1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Merge pull request #876 from plague006/fix/entity_placement_restriction

Fix logic in entity_placement_restriction
This commit is contained in:
Matthew 2019-03-16 15:27:24 -04:00 committed by GitHub
commit a437324592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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