mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Scale player health by 25 instead of 100 past 4 players.
This commit is contained in:
parent
a580c7045d
commit
f1d38d56af
3 changed files with 6 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
|||
- `ctx.hook.on_world_update()`
|
||||
- `ctx.hook.on_world_update_client()`
|
||||
- `ctx.hook.on_world_update_host()`
|
||||
- `ctx.hook.on_new_player_seen(new_playerdata)` - called the first time player with this peer_id has entered the world
|
||||
- `ctx.hook.on_new_player_seen(new_playerdata, player_count)` - called the first time player with this peer_id has entered the world
|
||||
- `ctx.hook.on_local_player_spawn(my_player)`
|
||||
- `ctx.hook.on_client_spawned(peer_id, new_playerdata)`
|
||||
- `ctx.hook.on_should_send_updates()` - called either when we connect, or somebody else connects (and sends "welcome" message)
|
||||
|
|
|
@ -427,11 +427,11 @@ function player_fns.spawn_player_for(peer_id, x, y, existing_playerdata)
|
|||
local seen = GlobalsGetValue(global, "0")
|
||||
ctx.events.new_player_seen = seen ~= "1"
|
||||
if ctx.events.new_player_seen then
|
||||
ctx.hook.on_new_player_seen(new_playerdata)
|
||||
local count = tonumber(GlobalsGetValue("ew_player_count", "1")) + 1
|
||||
GlobalsSetValue("ew_player_count", tostring(count))
|
||||
GamePrint("Player count "..count)
|
||||
print("Player count "..count)
|
||||
ctx.hook.on_new_player_seen(new_playerdata, count)
|
||||
end
|
||||
GlobalsSetValue(global, "1")
|
||||
-- np.SetPlayerEntity(new, peer_id+1)
|
||||
|
|
|
@ -103,8 +103,11 @@ function module.on_world_update_host()
|
|||
end
|
||||
end
|
||||
|
||||
function module.on_new_player_seen(new_playerdata)
|
||||
function module.on_new_player_seen(new_playerdata, player_count)
|
||||
local hp = 4
|
||||
if player_count > 4 then
|
||||
hp = 1
|
||||
end
|
||||
module.set_max_health(module.max_health()+hp)
|
||||
module.set_health(module.health()+hp)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue