noita_entangled_worlds/quant.ew/files/system/proxy_info.lua

78 lines
1.7 KiB
Lua
Raw Permalink Normal View History

2024-06-21 19:06:40 +03:00
local module = {}
local ptt = 0
2024-06-21 20:18:01 +03:00
function module.on_world_update()
if GameGetFrameNum() % 4 ~= 2 then
2024-06-21 19:06:40 +03:00
return
end
2025-02-15 14:04:40 -05:00
local rebind = tonumber(ModSettingGet("quant.ew.rebind_ptt") or 42)
if ModSettingGet("quant.ew.ptt_toggle") then
if InputIsKeyJustDown(rebind) then
if ptt == 1 then
ptt = 0
else
ptt = 1
end
end
else
ptt = 0
if InputIsKeyDown(rebind) then
ptt = 1
end
2025-02-15 14:04:40 -05:00
end
local x, y = GameGetCameraPos()
2025-02-18 00:36:21 -05:00
local mx, my = EntityGetTransform(ctx.my_player.entity)
2025-03-01 10:23:20 -05:00
if mx == nil then
return
end
2025-02-18 09:53:21 -05:00
local dead = GameHasFlagRun("ew_flag_notplayer_active")
local polied = EntityHasTag(ctx.my_player.entity, "polymorphed_player")
local cess = EntityHasTag(ctx.my_player.entity, "polymorphed_cessation")
2025-02-18 09:56:19 -05:00
and (not ctx.proxy_opt.perma_death or not dead)
2025-02-18 09:53:21 -05:00
local a = 0
if dead then
a = 1
end
local b = 0
if polied then
b = 1
end
local c = 0
if cess then
c = 1
end
2025-03-11 16:00:32 -04:00
local is_dead = 0
if GameHasFlagRun("ew_flag_notplayer_active") then
is_dead = 1
end
local d = 0
if ctx.proxy_opt.no_notplayer or ctx.proxy_opt.perma_death then
d = 1
end
2025-02-18 00:36:21 -05:00
net.proxy_send(
"cam_pos",
2025-02-18 09:53:21 -05:00
math.floor(x)
.. " "
.. math.floor(y)
.. " "
.. math.floor(mx)
.. " "
.. math.floor(my)
.. " "
2025-03-11 16:00:32 -04:00
.. is_dead
.. " "
.. d
.. " "
2025-02-18 09:53:21 -05:00
.. ptt
.. " "
.. a
.. " "
.. b
.. " "
.. c
2025-02-18 00:36:21 -05:00
)
2024-06-21 19:06:40 +03:00
end
2025-01-02 00:49:28 -05:00
return module