Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dynamite = elem.allocate("MOD", "DNMT")
- local blackpd = elem.allocate("MOD", "BPDR")
- local phosphor = elem.allocate("MOD", "PHOS")
- elem.element(dynamite, elem.element(tpt.element("c-4")))
- elem.property(dynamite, "Name", "DNMT")
- elem.property(dynamite, "Description", "Dynamite, very strong crushing explosive.")
- elem.property(dynamite, "Flammable", 0)
- elem.property(dynamite, "Explosive", 0)
- elem.property(dynamite, "Color", 0xFF6666)
- local function dnmtUpdate(i, x, y, s, nt)
- if s ~= 8 and nt ~= 0 then
- for r in sim.neighbors(x, y, 1, 1) do
- if sim.partProperty(r, "temp") > 673.15 or (sim.partProperty(r, "type") == elem.DEFAULT_PT_FIRE or sim.partProperty(r, "type") == elem.DEFAULT_PT_PLSM) then
- sim.partKill(i)
- sim.partCreate(-1, x, y, elem.DEFAULT_PT_FIRE)
- sim.pressure(x/4, y/4, sim.pressure(x/4, y/4)+1.2)
- return 1
- end
- end
- end
- if sim.partProperty(i, "temp") > 673.15 then
- sim.partKill(i)
- sim.partCreate(-1, x, y, elem.DEFAULT_PT_FIRE)
- sim.pressure(x/4, y/4, sim.pressure(x/4, y/4)+1.2)
- return 1
- end
- end
- elem.property(dynamite, "Update", dnmtUpdate)
- elem.element(blackpd, elem.element(tpt.element("gun")))
- elem.property(blackpd, "Name", "BPDR")
- elem.property(blackpd, "Description", "Black powder, explosive. Used in production of dynamite.")
- elem.property(blackpd, "Flammable", 0)
- elem.property(blackpd, "Explosive", 0)
- elem.property(blackpd, "Color", 0x555555)
- local function bpdrUpdate(i, x, y, s, nt)
- if s ~= 8 and nt ~= 0 then
- for r in sim.neighbors(x, y, 1, 1) do
- local rtype = sim.partProperty(r, "type")
- if sim.partProperty(r, "temp") > 673.15 or (rtype == elem.DEFAULT_PT_FIRE or rtype == elem.DEFAULT_PT_PLSM) then
- sim.partKill(i)
- if math.random(1, 15) ~= 1 then
- sim.partCreate(-1, x, y, elem.DEFAULT_PT_FIRE)
- else
- sim.partCreate(-1, x, y, elem.DEFAULT_PT_EMBR)
- end
- sim.pressure(x/4, y/4, sim.pressure(x/4, y/4)+0.5)
- return 1
- elseif rtype == elem.DEFAULT_PT_CLST then
- if math.random(0, 1) == 0 then
- sim.partChangeType(r, dynamite)
- else
- sim.partChangeType(i, dynamite)
- return 1
- end
- end
- end
- end
- if sim.partProperty(i, "temp") > 673.15 then
- sim.partKill(i)
- if math.random(1, 15) ~= 1 then
- sim.partCreate(-1, x, y, elem.DEFAULT_PT_FIRE)
- else
- sim.partCreate(-1, x, y, elem.DEFAULT_PT_EMBR)
- end
- sim.pressure(x/4, y/4, sim.pressure(x/4, y/4)+0.5)
- return 1
- end
- end
- elem.property(blackpd, "Update", bpdrUpdate)
- elem.element(phosphor, elem.element(elem.DEFAULT_PT_BCOL))
- elem.property(phosphor, "Name", "PHOS")
- elem.property(phosphor, "Description", "Phosphorus, glows for a short while when ignited.")
- elem.property(phosphor, "Color", 0x880000)
- elem.property(phosphor, "MenuSection", elem.SC_EXPLOSIVE)
- elem.property(phosphor, "Properties", elem.PROP_DEADLY+elem.PROP_LIFE_DEC)
- local function phosUpdate(i, x, y, s, nt)
- if sim.partProperty(i, "tmp") == 1 and sim.partProperty(i, "life") <= 0 then
- sim.partKill(i)
- sim.partCreate(-1, x, y, elem.DEFAULT_PT_FIRE)
- return 1
- end
- local r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
- if r ~= nil then
- local rtype = sim.partProperty(r, "type")
- if (rtype == elem.DEFAULT_PT_FIRE or rtype == elem.DEFAULT_PT_PLSM or (rtype == phosphor and sim.partProperty(r, "tmp") == 1)) and sim.partProperty(i, "tmp") ~= 1 then
- sim.partProperty(i, "tmp", 1)
- sim.partProperty(i, "life", 100)
- end
- end
- if sim.partProperty(i, "temp") >= 673.15 and sim.partProperty(i, "tmp") ~= 1 then
- sim.partProperty(i, "tmp", 1)
- sim.partProperty(i, "life", 100)
- end
- end
- local function phosGraphics(i, colr, colg, colb)
- if sim.partProperty(i, "tmp") == 1 then
- return 0, ren.PMODE_FLAT+ren.PMODE_FLARE+ren.FIRE_ADD, 125, 255, 125, 125, 125, 127, 63, 63
- end
- end
- elem.property(phosphor, "Update", phosUpdate)
- elem.property(phosphor, "Graphics", phosGraphics)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement