Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- reaction(i, x, y, nt, radius, percentage, element A, element B, element C)
- local function reaction(i,x,y,nt,r,p,a,b,c)
- local chance = math.random(1,1/(p/100)) == 1
- local dx = math.random(-r,r)
- local dy = math.random(-r,r)
- if nt > 0 and chance and tpt.get_property("type", x+dx, y+dy) == a then
- tpt.set_property("type", b, i)
- tpt.set_property("type", c, x+dx, y+dy)
- end
- end
- -- velocity(i, initial velocity, number of directions)
- local function velocity(i,v,n)
- if tpt.get_property("vx", i) == 0 and tpt.get_property("vy", i) == 0 then
- local angle = math.random(1,n)*(2*math.pi/n)
- tpt.set_property("vx", v*math.cos(angle), i)
- tpt.set_property("vy", v*math.sin(angle), i)
- end
- end
- -- NULL element
- local null = elements.allocate("ELEMENT", "NULL")
- elements.element(null, elements.element(elements.DEFAULT_PT_PHOT))
- elements.property(null, "Name", "NULL")
- elements.property(null, "Description", "NULL, displaces DMND.")
- elements.property(null, "Colour", 0xFF2020)
- elements.property(null, "HeatConduct", 0)
- local function nullUpdate(i,x,y,s,nt)
- velocity(i, 2, 6)
- reaction(i, x, y, nt, 2, 50, elements.DEFAULT_PT_DMND, elements.DEFAULT_PT_DMND, elements.ELEMENT_PT_NULL)
- end
- elements.property(null, "Update", nullUpdate)
Advertisement
Add Comment
Please, Sign In to add comment