SHOW:
|
|
- or go back to the newest paste.
| 1 | -- reaction(i, x, y, nt, radius, percentage, element A, element B, element C) | |
| 2 | ||
| 3 | local function reaction(i,x,y,nt,r,p,a,b,c) | |
| 4 | local chance = math.random(1,1/(p/100)) == 1 | |
| 5 | local dx = math.random(-r,r) | |
| 6 | local dy = math.random(-r,r) | |
| 7 | if nt > 0 and chance and tpt.get_property("type", x+dx, y+dy) == a then
| |
| 8 | tpt.set_property("type", b, i)
| |
| 9 | tpt.set_property("type", c, x+dx, y+dy)
| |
| 10 | end | |
| 11 | end | |
| 12 | ||
| 13 | -- velocity(i, initial velocity, number of directions) | |
| 14 | ||
| 15 | local function velocity(i,v,n) | |
| 16 | if tpt.get_property("vx", i) == 0 and tpt.get_property("vy", i) == 0 then
| |
| 17 | local angle = math.random(1,n)*(2*math.pi/n) | |
| 18 | tpt.set_property("vx", v*math.cos(angle), i)
| |
| 19 | tpt.set_property("vy", v*math.sin(angle), i)
| |
| 20 | end | |
| 21 | end | |
| 22 | ||
| 23 | -- NULL element | |
| 24 | ||
| 25 | local null = elements.allocate("ELEMENT", "NULL")
| |
| 26 | elements.element(null, elements.element(elements.DEFAULT_PT_PHOT)) | |
| 27 | elements.property(null, "Name", "NULL") | |
| 28 | elements.property(null, "Description", "NULL, displaces DMND.") | |
| 29 | elements.property(null, "Colour", 0xFF2020) | |
| 30 | - | elements.property(null, "Diffusion", 0) |
| 30 | + | |
| 31 | - | elements.property(null, "HotAir", 0) |
| 31 | + | |
| 32 | - | elements.property(null, "AirDrag", 0) |
| 32 | + | |
| 33 | - | elements.property(null, "AirLoss", 0) |
| 33 | + | |
| 34 | reaction(i, x, y, nt, 2, 50, elements.DEFAULT_PT_DMND, elements.DEFAULT_PT_DMND, elements.ELEMENT_PT_NULL) | |
| 35 | end | |
| 36 | ||
| 37 | elements.property(null, "Update", nullUpdate) |