mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
make so you dont get tethered if you are close to the hosts spectate, only tether to hosts position given from network
This commit is contained in:
parent
1a7d0bd9af
commit
1e3871c574
2 changed files with 10 additions and 2 deletions
|
@ -381,7 +381,9 @@ local player_fns = {
|
||||||
projectile_seed_chain = {}, -- TODO clean
|
projectile_seed_chain = {}, -- TODO clean
|
||||||
currently_polymorphed = false,
|
currently_polymorphed = false,
|
||||||
mouse_x = 0,
|
mouse_x = 0,
|
||||||
|
pos_x = 0,
|
||||||
mouse_y = 0,
|
mouse_y = 0,
|
||||||
|
pos_y = 0,
|
||||||
mutations = {ghost = false, luuki = false, rat = false, fungus = false, halo = 0}
|
mutations = {ghost = false, luuki = false, rat = false, fungus = false, halo = 0}
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
@ -401,6 +403,9 @@ function player_fns.serialize_position(player_data)
|
||||||
end
|
end
|
||||||
local vel_x, vel_y = ComponentGetValue2(character_data, "mVelocity")
|
local vel_x, vel_y = ComponentGetValue2(character_data, "mVelocity")
|
||||||
|
|
||||||
|
player_data.pos_x = x
|
||||||
|
player_data.pos_y = y
|
||||||
|
|
||||||
local c = CharacterPos{
|
local c = CharacterPos{
|
||||||
frames_in_air = ComponentGetValue2(character_platforming_comp, "mFramesInAirCounter"),
|
frames_in_air = ComponentGetValue2(character_platforming_comp, "mFramesInAirCounter"),
|
||||||
x = x,
|
x = x,
|
||||||
|
|
|
@ -219,7 +219,7 @@ function module.on_world_update()
|
||||||
if host_playerdata == nil or host_playerdata.entity == nil or not EntityGetIsAlive(host_playerdata.entity) then
|
if host_playerdata == nil or host_playerdata.entity == nil or not EntityGetIsAlive(host_playerdata.entity) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local x1, y1 = EntityGetTransform(host_playerdata.entity)
|
local x1, y1 = host_playerdata.pos_x, host_playerdata.pos_y
|
||||||
if x1 == nil or x2 == nil then
|
if x1 == nil or x2 == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -246,7 +246,10 @@ function module.on_world_update()
|
||||||
local dist_sq = dx*dx + dy*dy
|
local dist_sq = dx*dx + dy*dy
|
||||||
local not_actual_hm, not_hm = not_in_hm(x1, y1)
|
local not_actual_hm, not_hm = not_in_hm(x1, y1)
|
||||||
local _, i_not_in_hm = not_in_hm(x2, y2)
|
local _, i_not_in_hm = not_in_hm(x2, y2)
|
||||||
if x1 ~= nil and x2 ~= nil and (not_hm or (not not_actual_hm and y1 < y2)) and i_not_in_hm then
|
local host_mx, host_my = host_playerdata.mouse_x, host_playerdata.mouse_y
|
||||||
|
local dxm, dym = host_mx - x2, host_my - y2
|
||||||
|
if x1 ~= nil and x2 ~= nil and (not_hm or (not not_actual_hm and y1 < y2)) and i_not_in_hm
|
||||||
|
and dxm * dxm + dym * dym > tether_length * tether_length / 2 then
|
||||||
if no_tether then
|
if no_tether then
|
||||||
tether_enable(true, host_playerdata.entity)
|
tether_enable(true, host_playerdata.entity)
|
||||||
no_tether = false
|
no_tether = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue