mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
fix a couple of errors, dont give polied players shields, dont let player arrows pop in and out of existance, fix poly players maybe not having movement after unpoly'ing
This commit is contained in:
parent
c9bfc20f10
commit
204b282fdd
5 changed files with 29 additions and 8 deletions
|
@ -369,6 +369,9 @@ function player_fns.serialize_position(player_data)
|
|||
local x, y = EntityGetTransform(entity)
|
||||
local character_data = EntityGetFirstComponentIncludingDisabled(entity, "CharacterDataComponent")
|
||||
local character_platforming_comp = EntityGetFirstComponentIncludingDisabled(entity, "CharacterPlatformingComponent")
|
||||
if character_data == nil or character_platforming_comp == nil then
|
||||
return
|
||||
end
|
||||
local vel_x, vel_y = ComponentGetValue2(character_data, "mVelocity")
|
||||
|
||||
local c = CharacterPos{
|
||||
|
|
|
@ -4,6 +4,8 @@ local gui = GuiCreate()
|
|||
|
||||
local module = {}
|
||||
|
||||
local last_coords = {}
|
||||
|
||||
-- "Borrowed" from MK VIII QF 2-puntaa NAVAL-ASE in Noita discord server.
|
||||
-- https://discord.com/channels/453998283174576133/632303734877192192/1178002118368559175
|
||||
local function world2gui( x, y )
|
||||
|
@ -26,6 +28,9 @@ local function is_suitable_target(entity)
|
|||
end
|
||||
|
||||
function module.on_world_update()
|
||||
if EntityHasTag(ctx.my_player.entity, "polymorphed") then
|
||||
return
|
||||
end
|
||||
GuiStartFrame(gui)
|
||||
|
||||
GuiZSet(gui, 10)
|
||||
|
@ -40,14 +45,16 @@ function module.on_world_update()
|
|||
|
||||
local gui_id = 2
|
||||
|
||||
for _, player_data in pairs(ctx.players) do
|
||||
if player_data.peer_id == ctx.my_id and is_suitable_target(player_data.entity) then
|
||||
goto continue
|
||||
end
|
||||
|
||||
for peer_id, player_data in pairs(ctx.players) do
|
||||
local px, py = EntityGetTransform(player_data.entity)
|
||||
if px == nil then
|
||||
return
|
||||
if last_coords[peer_id] == nil then
|
||||
return
|
||||
else
|
||||
px, py = last_coords[peer_id]
|
||||
end
|
||||
else
|
||||
last_coords[peer_id] = px, py
|
||||
end
|
||||
local player_dir_x = px - ccx
|
||||
local player_dir_y = py - ccy
|
||||
|
@ -98,7 +105,7 @@ function module.on_world_update()
|
|||
if player_data.status and not player_data.status.is_alive then
|
||||
is_notplayer = true
|
||||
end
|
||||
if not is_notplayer and EntityHasTag(player_data.entity,"polymorphed_player") then
|
||||
if not is_notplayer and EntityGetIsAlive(player_data.entity) and EntityHasTag(player_data.entity, "polymorphed_player") then
|
||||
goto continue
|
||||
end
|
||||
local x, y = world2gui(ccx+player_dir_x, ccy+player_dir_y)
|
||||
|
|
|
@ -15,12 +15,16 @@ local function entity_changed()
|
|||
ctx.my_player.currently_polymorphed = currently_polymorphed
|
||||
if currently_polymorphed then
|
||||
local damage_model = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
|
||||
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true)
|
||||
if damage_model ~= nil then
|
||||
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", true)
|
||||
end
|
||||
|
||||
rpc.change_entity({data = np.SerializeEntity(ctx.my_player.entity)})
|
||||
else
|
||||
rpc.change_entity(nil)
|
||||
wandfinder.set_wands_after_poly()
|
||||
local controls = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent")
|
||||
ComponentSetValue2(controls, "enabled", true)
|
||||
end
|
||||
ctx.hook.on_local_player_polymorphed(currently_polymorphed)
|
||||
end
|
||||
|
|
|
@ -66,6 +66,10 @@ local function is_acceptable_help_target(spectating_over)
|
|||
if player_data.status == nil or not player_data.status.is_alive then
|
||||
return false
|
||||
end
|
||||
-- No helping polied players
|
||||
if EntityHasTag(player_data.entity, "polymorphed") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
|
|
@ -305,6 +305,9 @@ local function on_world_post_update_inner()
|
|||
GlobalsSetValue("ew_wand_fired", "0")
|
||||
if times_wand_fired > 0 then
|
||||
local inventory_component = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "Inventory2Component")
|
||||
if inventory_component == nil then
|
||||
return
|
||||
end
|
||||
local last_switch = ComponentGetValue2(inventory_component, "mLastItemSwitchFrame")
|
||||
local switched_now = last_switch == GameGetFrameNum()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue