Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SWRM = elements.allocate("SSCCSSCC", "SWRM")
- elements.element(elements.SSCCSSCC_PT_SWRM, elements.element(elements.DEFAULT_PT_DMND))
- elements.property(elements.SSCCSSCC_PT_SWRM, "Name", "SWRM")
- elements.property(elements.SSCCSSCC_PT_SWRM, "Description", "Soap worm")
- elements.property(elements.SSCCSSCC_PT_SWRM, "MenuSection", 11)
- local function swrm(i,x,y,s,n)
- sim.partKill(i)
- end
- tpt.element_func(swrm,elements.SSCCSSCC_PT_SWRM)
- n=0
- soap={}
- function makesoap()
- function keyHandler(keyString, key, modifier, event)
- if key==279 then
- n=0
- tpt.set_pause(0)
- end
- function mouseHandler(mousex, mousey, button, event)
- local x2=tpt.mousex
- local y2=tpt.mousey
- local x, y = sim.adjustCoords(x2, y2)
- if (button==1) and (tpt.get_property("type", x, y)==0) and (tpt.selectedl=="SSCCSSCC_PT_SWRM") then
- n=n+1
- tpt.create(x, y, "SOAP")
- soap[n]=sim.partID(x, y)
- if n==1 then
- tpt.set_property("ctype","STNE",soap[n])
- tpt.set_property("life","100000",soap[n])
- end
- if n>1 then
- tpt.set_property("life","100000",soap[n])
- tpt.set_property("ctype","GUN",soap[n])
- tpt.set_property("tmp",soap[n-1],soap[n])
- tpt.set_property("tmp2",'0',soap[n])
- tpt.set_property("tmp2",soap[n],soap[n-1])
- end
- end
- end
- tpt.register_mouseclick(mouseHandler)
- end
- tpt.register_keypress(keyHandler)
- end
- tpt.register_step(makesoap)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement