Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions map_gen/shared/entity_placement_restriction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,14 @@ local on_built_token =
-- Takes the keep_alive_callback function and runs it with the entity as an argument
-- If true is returned, we exit. If false, we destroy the entity.
local keep_alive_callback = primitives.keep_alive_callback
if not banned_entities[name] and keep_alive_callback and keep_alive_callback(entity) then

-- return in these cases:
-- not banned and no callback function
-- not banned and callback function and saved by callback
-- destroy in these cases:
-- all banned ents
-- not banned and callback function and not saved by callback
if not banned_entities[name] and (not keep_alive_callback or keep_alive_callback(entity)) then
return
end

Expand Down Expand Up @@ -196,7 +203,7 @@ end
-- @param keep_alive_callback <function>
function Public.set_keep_alive_callback(keep_alive_callback)
if type(keep_alive_callback) ~= 'function' then
error('Sending a non-funciton')
error('Sending a non-function')
end
primitives.keep_alive_callback = keep_alive_callback
check_event_status()
Expand Down