function main_menu turn_campfire for 65535 do local obj level object_b

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
function main_menu:turn_campfire()
for i = 1, 65535 do
local obj = level.object_by_id(i)
if (obj ~= nil) then
local campfire = obj:get_campfire()
if (campfire ~= nil and db.actor:position():distance_to(obj:position()) < 3) then
if (not campfire:is_on() ) then
campfire:turn_on()
else
campfire:turn_off()
end
end
end
end
end