Code: Select all
script.on_event(defines.events.on_built_entity, function(event)
local machine = event.created_entity
if machine.prototype.allowed_effects == true then
if beacons_count > 1 then
machine.active = false
end
end
end)
Code: Select all
script.on_event(defines.events.on_built_entity, function(event)
local machine = event.created_entity
if machine.prototype.allowed_effects == true then
if beacons_count > 1 then
machine.active = false
end
end
end)
Sorry, you're wrong! The condition doesn't result in an error because it's refers to an entity prototype!AlexTheNotsogreat wrote: Wed Sep 20, 2023 7:55 pmthe problem itself is the machine.prototype.allowed_effects conditional; since it refers to the entity prototype it doesnt result in an error,Code: Select all
if machine.prototype.allowed_effects == true then … end
Your base assumption is wrong:but it also seems to never be true regardless of whether or not a machine actually does accept module or beacon effects.
Code: Select all
type(machine.prototype.allowed_effects) == "boolean"
Code: Select all
game.print("machine.prototype.allowed_effects: "..serpent.block(machine.prototype.allowed_effects))
Code: Select all
table_size(machine.prototype.allowed_effects) > 0
Code: Select all
if next(machine.prototype.allowed_effects) then … end