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. Much stronger than gunpowder.")
- 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)
- local organic = elem.allocate("MOD", "ORGM")
- local biogas = elem.allocate("MOD", "BIOG")
- local biofuel = elem.allocate("MOD", "BFUL")
- elem.element(organic, elem.element(elem.DEFAULT_PT_DUST))
- elem.property(organic, "Name", "ORGM")
- elem.property(organic, "Description", "Organic matter, decomposes into biogas at high temperatures.")
- elem.property(organic, "Color", 0x333300)
- elem.property(organic, "Flammable", 20)
- elem.property(organic, "Weight", 80)
- elem.property(organic, "MenuSection", elem.SC_POWDER)
- elem.element(biogas, elem.element(elem.DEFAULT_PT_BOYL))
- elem.property(biogas, "Name", "BIOG")
- elem.property(biogas, "Description", "Biogas, made from organic matter.")
- elem.property(biogas, "Temperature", 573.15)
- elem.property(biogas, "Color", 0x669900)
- elem.property(biogas, "Diffusion", 0.5)
- elem.property(biogas, "Flammable", 80)
- elem.property(biogas, "LowTemperature", 473.15)
- elem.property(biogas, "LowTemperatureTransition", biofuel)
- elem.element(biofuel, elem.element(elem.DEFAULT_PT_DESL))
- elem.property(biofuel, "Name", "BFUL")
- elem.property(biofuel, "Description", "Biofuel, liquefied and more flammable version of biogas.")
- elem.property(biofuel, "Color", 0x264D00)
- elem.property(biofuel, "Flammable", 20)
- elem.property(biofuel, "Explosive", 1)
- elem.property(biofuel, "HighTemperature", 473.15)
- elem.property(biofuel, "HighTemperatureTransition", biogas)
- local function orgmUpdate(i, x, y, s, nt)
- if sim.partProperty(i, "temp") >= 1000 then
- if sim.pressure(x/4, y/4) >= 1 then
- if math.random(1, 200) == 1 then
- sim.partChangeType(i, biogas)
- end
- else
- if math.random(1, 1000) == 1 then
- sim.partChangeType(i, biogas)
- end
- end
- end
- end
- elem.property(organic, "Update", orgmUpdate)
- local bramble = elem.allocate("MOD", "BCRS")
- elem.element(bramble, elem.element(elem.DEFAULT_PT_WOOD))
- elem.property(bramble, "Name", "BCRS")
- elem.property(bramble, "MenuSection", elem.SC_SPECIAL)
- elem.property(bramble, "Description", "Bramblecrush, grows into solid things.")
- elem.property(bramble, "Color", 0x145214)
- elem.property(bramble, "HighTemperature", 395.15)
- elem.property(bramble, "HighTemperatureTransition", organic)
- local function bcrsUpdate(i, x, y, s, nt)
- 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")
- local rx = sim.partProperty(r, "x")
- local ry = sim.partProperty(r, "y")
- if (bit.band(elem.property(rtype, "Properties"), elem.PROP_DEADLY) ~= 0 or bit.band(elem.property(rtype, "Properties"), elem.PROP_RADIOACTIVE) ~= 0) and math.random(1, 5) == 1 then
- sim.partChangeType(i, organic)
- elseif rtype == elem.DEFAULT_PT_GLAS or rtype == elem.DEFAULT_PT_QRTZ then
- if math.random(1, 5) == 1 then
- sim.partKill(r)
- if math.random(1, 5) > 2 then
- local new = sim.partCreate(-1, rx, ry, bramble)
- end
- end
- elseif bit.band(elem.property(rtype, "Properties"), elem.TYPE_SOLID) ~= 0 and elem.property(rtype, "Hardness") ~= 0 and rtype ~= bramble then
- if math.random(1, 5) == 1 then
- sim.partKill(r)
- if math.random(1, 5) > 2 then
- local new = sim.partCreate(-1, rx, ry, bramble)
- end
- end
- end
- end
- end
- elem.property(bramble, "Update", bcrsUpdate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement