I'm trying to make condensation occur when an element around NONE/Empty/Air is cooled down enough. I've made the update function but it doesn't seem to work. Here's the script:
elements.property(elements.DEFAULT_PT_NONE, "Update", --*1
function(i,x,y) --1
for r in sim.neighbors(x,y,1,1) do --2
if sim.partProperty(r, "temp") < 100 then --3
if math.random(1,45000) == 1 then --4
sim.partCreate(-1, x+math.random(-2,2), y+math.random(-2,2), elements.DEFAULT_PT_WATR)
end --4
end --3
if sim.partProperty(r, "temp") < 200 then --5
if math.random(1,45000) == 1 then --6
sim.partCreate(-1, x+math.random(-2,2), y+math.random(-2,2), elements.DEFAULT_PT_LOXY)
end --6
end --5
end --2
end --1
) --*1