disable most chained entitys for now, have notplayer use normal players hp bars, add nametag for notplayer

This commit is contained in:
bgkillas 2024-08-24 21:37:12 -04:00
parent c63c00d573
commit 4fbecb8bfe
3 changed files with 60 additions and 7 deletions

View file

@ -1,10 +1,12 @@
local module = {}
--TODO fix chained entities spawning repeatably on clients
--TODO fix minecart entity disapearing on spawn
module.phys_sync_allowed = {
-- Starting prop
["data/entities/props/physics_skateboard.xml"] = true,
["data/entities/props/physics_minecart.xml"] = true,
["data/entities/props/physics/minecart.xml"] = true,
-- ["data/entities/props/physics_minecart.xml"] = true,
-- ["data/entities/props/physics/minecart.xml"] = true,
["data/entities/props/physics_cart.xml"] = true,
@ -21,8 +23,8 @@ module.phys_sync_allowed = {
["data/entities/props/physics_barrel_oil.xml"] = true,
["data/entities/props/physics_barrel_radioactive.xml"] = true,
["data/entities/props/physics_seamine.xml"] = true,
["data/entities/props/suspended_tank_radioactive.xml"] = true,
["data/entities/props/suspended_tank_acid.xml"] = true,
-- ["data/entities/props/suspended_tank_radioactive.xml"] = true,
-- ["data/entities/props/suspended_tank_acid.xml"] = true,
["data/entities/props/physics_box_harmless.xml"] = true,
["data/entities/props/physics_tubelamp.xml"] = true,
@ -51,7 +53,7 @@ module.phys_sync_allowed = {
["data/entities/props/temple_statue_01.xml"] = true,
["data/entities/props/temple_statue_01_green.xml"] = true,
["data/entities/props/temple_statue_02.xml"] = true,
["data/entities/props/physics/temple_lantern.xml"] = true,
-- ["data/entities/props/physics/temple_lantern.xml"] = true,
-- ["data/entities/buildings/physics_worm_deflector_base.xml"] = true,
-- ["data/entities/buildings/physics_worm_deflector_crystal.xml"] = true,
-- ["data/entities/misc/greed_curse/greed_crystal.xml"] = true,

View file

@ -5,6 +5,7 @@ local util = dofile_once("mods/quant.ew/files/core/util.lua")
local inventory_helper = dofile_once("mods/quant.ew/files/core/inventory_helper.lua")
local np = require("noitapatcher")
local perk_fns = dofile_once("mods/quant.ew/files/core/perk_fns.lua")
local nickname = dofile_once("mods/quant.ew/files/system/nickname.lua")
local rpc = net.new_rpc_namespace()
@ -49,6 +50,26 @@ local function remove_inventory()
end
end
function rpc.add_nickname(id)
for _, data in pairs(ctx.players) do
if data.peer_id == id then
nickname.add_label(data.entity, data.name, "data/fonts/font_pixel_white.xml", 0.75)
end
end
end
function remove_healthbar_locally()
local player_components = EntityGetAllComponents(ctx.my_player.entity)
if player_components ~= nil then
for _, comp in ipairs(player_components) do
if ComponentHasTag(comp, "health_bar") or ComponentHasTag(comp, "health_bar_back") then
EntitySetComponentIsEnabled(ctx.my_player.entity, comp, false)
end
end
end
end
local function allow_notplayer_perk(perk_id)
local ignored_perks = {
GAMBLE = true,
@ -93,6 +114,8 @@ local function player_died()
EntityAddTag(iron, "kill_on_revive")
EntityAddComponent2(iron, "GameEffectComponent", {effect="IRON_STOMACH",frames=9999999})
EntityAddChild(ctx.my_player.entity, iron)
rpc.add_nickname(ctx.my_id)
remove_healthbar_locally()
end)
end

View file

@ -616,7 +616,35 @@
<InventoryGuiComponent/>
<BossHealthBarComponent gui_max_distance_visible="512" gui="1"/>
<SpriteComponent
_tags = "health_bar_back,ui,no_hitbox"
has_special_scale = "1"
image_file = "mods/quant.ew/files/resource/health_slider_back.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
alpha = "0.4"
z_index = "-9000"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<SpriteComponent
_tags= "health_bar,ui,no_hitbox"
has_special_scale= "1"
image_file = "mods/quant.ew/files/resource/health_slider_front.png"
offset_x = "5"
offset_y = "-11"
special_scale_y = "0.45"
z_index = "-9001"
never_ragdollify_on_death = "1"
>
</SpriteComponent>
<BossHealthBarComponent
gui="0"
in_world="1">
</BossHealthBarComponent>
<LuaComponent _tags="ew_remove_on_send" script_wand_fired = "mods/quant.ew/files/resource/cbs/count_times_wand_fired.lua"/>
@ -638,4 +666,4 @@
special_scale_y="0.5"
></SpriteComponent>
</Entity>
</Entity>
</Entity>