mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Heart mage effect sync
This commit is contained in:
parent
8bf9e69969
commit
319b651cc3
6 changed files with 91 additions and 2 deletions
2
noita-proxy/Cargo.lock
generated
2
noita-proxy/Cargo.lock
generated
|
@ -1931,7 +1931,7 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
|||
|
||||
[[package]]
|
||||
name = "noita-proxy"
|
||||
version = "0.13.1"
|
||||
version = "0.13.2"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"bitcode",
|
||||
|
|
|
@ -4,7 +4,7 @@ members = ["tangled"]
|
|||
[package]
|
||||
name = "noita-proxy"
|
||||
description = "Noita Entangled Worlds companion app."
|
||||
version = "0.13.1"
|
||||
version = "0.13.2"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
40
quant.ew/files/src/system/damage/append/hearty_effect.xml
Normal file
40
quant.ew/files/src/system/damage/append/hearty_effect.xml
Normal file
|
@ -0,0 +1,40 @@
|
|||
<Entity>
|
||||
<InheritTransformComponent
|
||||
_enabled="1" >
|
||||
</InheritTransformComponent>
|
||||
|
||||
<LuaComponent
|
||||
script_source_file="mods/quant.ew/files/src/system/damage/append/hearty_start.lua"
|
||||
execute_every_n_frame="4"
|
||||
remove_after_executed="1"
|
||||
>
|
||||
</LuaComponent>
|
||||
|
||||
<LuaComponent
|
||||
script_source_file="mods/quant.ew/files/src/system/damage/append/hearty_end.lua"
|
||||
execute_every_n_frame="-1"
|
||||
execute_on_removed="1"
|
||||
>
|
||||
</LuaComponent>
|
||||
|
||||
<VariableStorageComponent
|
||||
name="effect_hearty"
|
||||
value_float="0.0"
|
||||
>
|
||||
</VariableStorageComponent>
|
||||
|
||||
<LifetimeComponent
|
||||
lifetime="1200"
|
||||
>
|
||||
</LifetimeComponent>
|
||||
|
||||
<UIIconComponent
|
||||
name="$status_hearty"
|
||||
description="$statusdesc_hearty"
|
||||
icon_sprite_file="data/ui_gfx/status_indicators/hearty.png"
|
||||
is_perk="0"
|
||||
display_above_head="0"
|
||||
display_in_hud="1"
|
||||
>
|
||||
</UIIconComponent>
|
||||
</Entity>
|
8
quant.ew/files/src/system/damage/append/hearty_end.lua
Normal file
8
quant.ew/files/src/system/damage/append/hearty_end.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local entity_id = GetUpdatedEntityID()
|
||||
local player_id = EntityGetRootEntity( entity_id )
|
||||
|
||||
if player_id ~= 0 and EntityHasTag( player_id, "player_unit" ) then
|
||||
CrossCall("ew_ds_effect_hearty", false)
|
||||
else
|
||||
dofile("scripts/status_effects/hearty_end.lua")
|
||||
end
|
8
quant.ew/files/src/system/damage/append/hearty_start.lua
Normal file
8
quant.ew/files/src/system/damage/append/hearty_start.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local entity_id = GetUpdatedEntityID()
|
||||
local player_id = EntityGetRootEntity( entity_id )
|
||||
|
||||
if player_id ~= 0 and EntityHasTag( player_id, "player_unit" ) then
|
||||
CrossCall("ew_ds_effect_hearty", true)
|
||||
else
|
||||
dofile("scripts/status_effects/hearty_start.lua")
|
||||
end
|
|
@ -16,6 +16,9 @@ module.recent_message = "unknown"
|
|||
module.last_damage_message = "unknown"
|
||||
|
||||
ModLuaFileAppend("data/scripts/game_helpers.lua", "mods/quant.ew/files/src/system/damage/append/game_helpers.lua")
|
||||
-- ModLuaFileAppend("data/scripts/status_effects/hearty_start.lua", "mods/quant.ew/files/src/system/damage/append/hearty_start.lua")
|
||||
-- ModLuaFileAppend("data/scripts/status_effects/hearty_end.lua", "mods/quant.ew/files/src/system/damage/append/hearty_end.lua")
|
||||
ModTextFileSetContent("data/entities/misc/effect_hearty.xml", ModTextFileGetContent("mods/quant.ew/files/src/system/damage/append/hearty_effect.xml"))
|
||||
|
||||
local function damage_received(damage, message, entity_id, add_healing_effect)
|
||||
local was_my_player = entity_id == nil or ctx.my_player.entity == entity_id
|
||||
|
@ -176,4 +179,34 @@ function rpc.healing_effect()
|
|||
EntityAddChild( entity_id, entity_fx )
|
||||
end
|
||||
|
||||
rpc.opts_reliable()
|
||||
rpc.opts_everywhere()
|
||||
function rpc.effect_hearty(applied)
|
||||
if not ctx.is_host then
|
||||
return
|
||||
end
|
||||
local hearty_applied_count = tonumber(GlobalsGetValue("ew_effect_hearty", "0"))
|
||||
if applied then
|
||||
-- The effect was added
|
||||
if module.max_health() <= 0.4 then
|
||||
return
|
||||
end
|
||||
|
||||
module.set_health(math.max(module.health() * 0.5, 0.04))
|
||||
module.set_max_health(module.max_health() * 0.5)
|
||||
hearty_applied_count = hearty_applied_count + 1
|
||||
else
|
||||
-- The effect was removed
|
||||
if hearty_applied_count <= 0 then
|
||||
return
|
||||
end
|
||||
module.set_max_health(module.max_health() * 2)
|
||||
module.set_health(module.health() * 2)
|
||||
hearty_applied_count = hearty_applied_count - 1
|
||||
end
|
||||
GlobalsSetValue("ew_effect_hearty", tostring(hearty_applied_count))
|
||||
end
|
||||
|
||||
np.CrossCallAdd("ew_ds_effect_hearty", rpc.effect_hearty)
|
||||
|
||||
return module
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue