1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-03 14:53:01 +02:00

Fix logic in entity_placement_restriction. Closes #875

This commit is contained in:
Matthew Heguy 2019-03-16 14:35:09 -04:00
parent 15648bd66e
commit 13c93425a7

View File

@ -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
@ -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()