mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
add nil check, show differing game modes better~
This commit is contained in:
parent
dbe50e7b34
commit
43c9e1900c
5 changed files with 11 additions and 3 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -25,8 +25,12 @@ function rpc.player_update(input_data, pos_data, current_slot)
|
|||
end
|
||||
|
||||
function rpc.check_gamemode(gamemode)
|
||||
if gamemode ~= np.GetGameModeNr() then
|
||||
local mn = np.GetGameModeNr()
|
||||
local gm = np.GetGameModeName(mn)
|
||||
if gamemode ~= gm then
|
||||
GamePrint("Player: " .. ctx.rpc_player_data.name .. ", is on a different gamemode number then you")
|
||||
GamePrint("his game mode: ".. gamemode)
|
||||
GamePrint("your game mode: ".. gm)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -36,8 +40,9 @@ function module.on_world_update()
|
|||
local current_slot = player_fns.get_current_slot(ctx.my_player)
|
||||
if input_data ~= nil and pos_data ~= nil then
|
||||
rpc.player_update(input_data, pos_data, current_slot)
|
||||
if GameGetFrameNum() % 60 == 0 then
|
||||
rpc.check_gamemode(np.GetGameModeNr())
|
||||
if GameGetFrameNum() % 120 == 0 then
|
||||
local n = np.GetGameModeNr()
|
||||
rpc.check_gamemode(np.GetGameModeName(n))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -171,6 +171,9 @@ function module.on_world_update_client()
|
|||
end
|
||||
local x1, y1 = EntityGetTransform(host_playerdata.entity)
|
||||
local x2, y2 = EntityGetTransform(ctx.my_player.entity)
|
||||
if x1 == nil or x2 == nil then
|
||||
return
|
||||
end
|
||||
local dx = x1-x2
|
||||
local dy = y1-y2
|
||||
local dist_sq = dx*dx + dy*dy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue