File tree Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
# List of available hooks:
2
2
3
3
- ` ctx.hook.on_world_initialized() ` - called on OnWorldInitialized.
4
+ - ` ctx.hook.on_new_entity(ent) ` - called on new alive entity.
4
5
- ` ctx.hook.on_world_update() ` - called on OnWorldPreUpdate.
5
6
- ` ctx.hook.on_world_update_client() ` - called on OnWorldPreUpdate, but only on clients.
6
7
- ` ctx.hook.on_world_update_host() ` - called on OnWorldPreUpdate, but only on host.
11
12
- ` ctx.hook.on_draw_debug_window(imgui) `
12
13
- ` ctx.hook.on_local_player_polymorphed(currently_polymorphed) `
13
14
- ` ctx.hook.on_client_polymorphed(peer_id, player_data) `
14
- - ` ctx.hook.on_late_init() ` - called on OnModPostInit.
15
+ - ` ctx.hook.on_late_init() ` - called on OnModPostInit.
Original file line number Diff line number Diff line change 166
166
167
167
local exists
168
168
169
+ local new_ents = {}
170
+
169
171
function mod .on_new_entity (ent )
170
172
if ctx .is_host then
171
- update ( ent , 1 )
173
+ table.insert ( new_ents , ent )
172
174
end
173
175
end
174
176
@@ -226,6 +228,10 @@ function mod.on_world_pre_update()
226
228
count2 = count2 - update (ent , count2 )
227
229
end
228
230
end
231
+ for _ , ent in ipairs (new_ents ) do
232
+ update (ent , 1 )
233
+ end
234
+ new_ents = {}
229
235
if exists then
230
236
net .proxy_send (" flush_exp" , " " )
231
237
exists = nil
Original file line number Diff line number Diff line change @@ -146,4 +146,4 @@ function tele.on_world_update()
146
146
end
147
147
end
148
148
149
- return tele
149
+ return tele
Original file line number Diff line number Diff line change 677
677
function OnPlayerDied (player_entity )
678
678
ctx .hook .on_player_died (player_entity )
679
679
print (" player died" )
680
- end
680
+ end
You can’t perform that action at this time.
0 commit comments