mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
make so healing doesn't show as damage on peers side, dont double up player melee damage
This commit is contained in:
parent
8b84a05584
commit
f698f1356e
6 changed files with 32 additions and 16 deletions
|
@ -1,7 +1,17 @@
|
|||
function damage_about_to_be_received( damage, x, y, entity_thats_responsible, critical_hit_chance )
|
||||
if entity_thats_responsible ~= GameGetWorldStateEntity() then
|
||||
return 2^-128, 0
|
||||
end
|
||||
local dtypes = GetDamageDetails().damage_types
|
||||
if GameHasFlagRun("ew_flag_this_is_host") and dtypes == 1
|
||||
and entity_thats_responsible ~= GameGetWorldStateEntity() then
|
||||
return damage, 0
|
||||
end
|
||||
|
||||
return damage, 0
|
||||
if entity_thats_responsible ~= GameGetWorldStateEntity() then
|
||||
return 2^-128, 0
|
||||
end
|
||||
|
||||
if damage < 0 then
|
||||
return -2^-128, 0
|
||||
end
|
||||
|
||||
return damage, 0
|
||||
end
|
|
@ -1,8 +1,10 @@
|
|||
function damage_received(damage, message, entity_thats_responsible, is_fatal, projectile_thats_responsible)
|
||||
if entity_thats_responsible == GameGetWorldStateEntity() then
|
||||
if entity_thats_responsible == GameGetWorldStateEntity()
|
||||
or (projectile_thats_responsible ~= nil and projectile_thats_responsible ~= 0)
|
||||
or EntityHasTag(entity_thats_responsible, "ew_peer") then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- Change our health back
|
||||
local entity_id = GetUpdatedEntityID();
|
||||
|
||||
|
@ -12,4 +14,4 @@ function damage_received(damage, message, entity_thats_responsible, is_fatal, pr
|
|||
-- Damage the client
|
||||
CrossCall("ew_ds_client_damaged", EntityGetName(entity_id), damage, message)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -263,10 +263,9 @@ end
|
|||
|
||||
function module.on_client_spawned(peer_id, playerdata)
|
||||
playerdata.status = { is_alive = true }
|
||||
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
|
||||
if ctx.is_host then
|
||||
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_received = "mods/quant.ew/files/system/damage/cbs/send_damage_to_client.lua"})
|
||||
else
|
||||
EntityAddComponent2(playerdata.entity, "LuaComponent", {script_damage_about_to_be_received = "mods/quant.ew/files/resource/cbs/immortal.lua"})
|
||||
end
|
||||
local damage_model = EntityGetFirstComponentIncludingDisabled(playerdata.entity, "DamageModelComponent")
|
||||
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true)
|
||||
|
|
|
@ -786,8 +786,6 @@ local function choose_movement()
|
|||
end
|
||||
end
|
||||
local pdx, pdy = closest[2], closest[3]
|
||||
GamePrint(pdx)
|
||||
GamePrint(pdy)
|
||||
if math.abs(pdy) < 60 and math.abs(pdx) < 55 then
|
||||
if pdx < 0 then
|
||||
state.control_d = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue