mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
add health bar, remove spread max health function as it is deprecated... hopefully
This commit is contained in:
parent
cc8b8d0c6a
commit
28b7dd2a4b
6 changed files with 47 additions and 16 deletions
|
@ -410,9 +410,22 @@ function player_fns.spawn_player_for(peer_id, x, y, existing_playerdata)
|
||||||
end
|
end
|
||||||
GamePrint("Spawning player for "..peer_id)
|
GamePrint("Spawning player for "..peer_id)
|
||||||
local new = EntityLoad("mods/quant.ew/files/system/player/tmp/" .. peer_id .. "_base.xml", x, y)
|
local new = EntityLoad("mods/quant.ew/files/system/player/tmp/" .. peer_id .. "_base.xml", x, y)
|
||||||
|
|
||||||
|
if ctx.proxy_opt.game_mode == "shared_health" then
|
||||||
|
local player_components = EntityGetAllComponents(new)
|
||||||
|
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(new, comp, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if ctx.proxy_opt.friendly_fire then
|
if ctx.proxy_opt.friendly_fire then
|
||||||
GenomeSetHerdId(new, "player_pvp")
|
GenomeSetHerdId(new, "player_pvp")
|
||||||
end
|
end
|
||||||
|
|
||||||
local new_playerdata = existing_playerdata or player_fns.make_playerdata_for(new, peer_id)
|
local new_playerdata = existing_playerdata or player_fns.make_playerdata_for(new, peer_id)
|
||||||
new_playerdata.entity = new
|
new_playerdata.entity = new
|
||||||
-- util.tpcall(nickname.addLabel, new, new_playerdata.name, "data/fonts/font_pixel_white.xml", 1)
|
-- util.tpcall(nickname.addLabel, new, new_playerdata.name, "data/fonts/font_pixel_white.xml", 1)
|
||||||
|
@ -473,17 +486,6 @@ function player_fns.respawn_if_necessary()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function player_fns.spread_max_health()
|
|
||||||
if ctx.is_host then
|
|
||||||
local _, max_hp = util.get_ent_health(ctx.my_player.entity)
|
|
||||||
for peer_id, player_data in pairs(ctx.players) do
|
|
||||||
if peer_id ~= ctx.my_id then
|
|
||||||
util.set_ent_health(player_data.entity, {-1, max_hp})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function player_fns.is_inventory_open()
|
function player_fns.is_inventory_open()
|
||||||
local player_entity = ctx.players[ctx.my_id].entity
|
local player_entity = ctx.players[ctx.my_id].entity
|
||||||
local inventory_gui_comp = EntityGetFirstComponentIncludingDisabled(player_entity, "InventoryGuiComponent")
|
local inventory_gui_comp = EntityGetFirstComponentIncludingDisabled(player_entity, "InventoryGuiComponent")
|
||||||
|
|
BIN
quant.ew/files/resource/health_slider_back.png
Executable file
BIN
quant.ew/files/resource/health_slider_back.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
quant.ew/files/resource/health_slider_front.png
Executable file
BIN
quant.ew/files/resource/health_slider_front.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
|
@ -464,7 +464,7 @@
|
||||||
_enabled="0"
|
_enabled="0"
|
||||||
></SpriteComponent>
|
></SpriteComponent>
|
||||||
|
|
||||||
<SpriteComponent
|
<!-- <SpriteComponent
|
||||||
_tags="character,player_hat2_shadow"
|
_tags="character,player_hat2_shadow"
|
||||||
alpha="1"
|
alpha="1"
|
||||||
image_file="data/enemies_gfx/player_hat2_shadow.xml"
|
image_file="data/enemies_gfx/player_hat2_shadow.xml"
|
||||||
|
@ -475,7 +475,7 @@
|
||||||
z_index="0.58"
|
z_index="0.58"
|
||||||
_enabled="0"
|
_enabled="0"
|
||||||
></SpriteComponent>
|
></SpriteComponent>
|
||||||
|
-->
|
||||||
<LuaComponent
|
<LuaComponent
|
||||||
script_source_file="data/scripts/magic/amulet.lua"
|
script_source_file="data/scripts/magic/amulet.lua"
|
||||||
execute_on_added="1"
|
execute_on_added="1"
|
||||||
|
@ -619,4 +619,4 @@
|
||||||
<BossHealthBarComponent gui_max_distance_visible="1500" gui="1"/>
|
<BossHealthBarComponent gui_max_distance_visible="1500" gui="1"/>
|
||||||
|
|
||||||
<LuaComponent _tags="ew_remove_on_send" script_wand_fired = "mods/quant.ew/files/resource/cbs/count_times_wand_fired.lua"/>
|
<LuaComponent _tags="ew_remove_on_send" script_wand_fired = "mods/quant.ew/files/resource/cbs/count_times_wand_fired.lua"/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|
|
@ -576,6 +576,36 @@
|
||||||
value_string=""
|
value_string=""
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<Entity name="chunk_loader">
|
<Entity name="chunk_loader">
|
||||||
<Base file="mods/quant.ew/files/resource/entities/chunk_loader.xml">
|
<Base file="mods/quant.ew/files/resource/entities/chunk_loader.xml">
|
||||||
</Base>
|
</Base>
|
||||||
|
@ -600,4 +630,4 @@
|
||||||
></SpriteComponent>
|
></SpriteComponent>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="inventory_quick">
|
<Entity name="inventory_quick">
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|
|
@ -221,7 +221,6 @@ local function on_world_pre_update_inner()
|
||||||
|
|
||||||
if GameGetFrameNum() % 120 == 0 then
|
if GameGetFrameNum() % 120 == 0 then
|
||||||
player_fns.respawn_if_necessary()
|
player_fns.respawn_if_necessary()
|
||||||
player_fns.spread_max_health()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if ctx.events.new_player_just_connected or ctx.events.inventory_maybe_just_changed or (GameGetFrameNum() % 5 == 0 and inventory_helper.has_inventory_changed(ctx.my_player)) then
|
if ctx.events.new_player_just_connected or ctx.events.inventory_maybe_just_changed or (GameGetFrameNum() % 5 == 0 and inventory_helper.has_inventory_changed(ctx.my_player)) then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue