Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sulfur = elem.allocate("BIGDIG", "SULF")
- local so2 = elem.allocate("BIGDIG", "SO2")
- local sulfurous = elem.allocate("BIGDIG", "H2SO3")
- local sulfacid = elem.allocate("BIGDIG", "H2SO4")
- elem.element(sulfur, elem.element(elem.DEFAULT_PT_SAND))
- elem.property(sulfur, "Name", "SULF")
- elem.property(sulfur, "Description", "Sulfur, heavy particles. Used in explosives, somewhat flammable in the basic form.")
- elem.property(sulfur, "Color", 0xCC9900)
- elem.property(sulfur, "Flammable", 10)
- elem.property(sulfur, "Hardness", 5)
- elem.property(sulfur, "Properties", elem.PROP_DEADLY)
- elem.property(sulfur, "HighTemperature", 273.15 + 118.9)
- local function sulfUpdate(i, x, y, s, nt)
- r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
- if r~= nil then
- temp = sim.partProperty(i, "temp")
- rtype = sim.partProperty(r, "type")
- if rtype == elem.DEFAULT_PT_OXYG and temp >= 365.15 then
- sim.partKill(i)
- sim.partProperty(r, "type", so2)
- elseif rtype == sulfacid and sim.partProperty(r, "tmp") == 1 then
- sim.partKill(i)
- sim.partProperty(r, "tmp", 0)
- end
- end
- end
- elem.property(sulfur, "Update", sulfUpdate)
- elem.element(so2, elem.element(elem.DEFAULT_PT_BOYL))
- elem.property(so2, "Name", "SO2")
- elem.property(so2, "Description", "Sulfur dioxide, toxic gas. Creates sulfurous acid with WTRV. Made from mixing hot sulphur and oxygen.")
- elem.property(so2, "Color", 0x996633)
- elem.property(so2, "Properties", elem.PROP_DEADLY+elem.TYPE_GAS)
- elem.property(so2, "Diffusion", 2)
- local function so2Update(i, x, y, s, nt)
- r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
- if r~= nil then
- if sim.partProperty(r, "type") == elem.DEFAULT_PT_WTRV then
- sim.partKill(r)
- sim.partProperty(i, "type", sulfurous)
- end
- end
- end
- elem.property(so2, "Update", so2Update)
- elem.element(sulfurous, elem.element(elem.DEFAULT_PT_SOAP))
- elem.property(sulfurous, "Name", "SOCD")
- elem.property(sulfurous, "Description", "Sulfurous acid (H2SO3). Corrodes some metals, makes SACD with OXYG. Decaus at high temperatures.")
- elem.property(sulfurous, "Weight", 32)
- elem.property(sulfurous, "Color", 0x334D00)
- elem.property(sulfurous, "Properties", elem.PROP_DEADLY+elem.TYPE_LIQUID)
- local function h2so3Update(i, x, y, s, nt)
- r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
- if r ~= nil then
- local rtype = sim.partProperty(r, "type")
- if rtype == elem.DEFAULT_PT_METL or (rtype == elem.DEFAULT_PT_BMTL and sim.partProperty(r, "tmp") ~= 1) or rtype == elem.DEFAULT_PT_IRON or rtype == elem.DEFAULT_PT_TUNG then
- sim.partChangeType(r, elem.DEFAULT_PT_BMTL)
- sim.partProperty(r, "tmp", 1)
- sim.partKill(i)
- return 1
- elseif rtype == elem.DEFAULT_PT_PLNT or rtype == elem.DEFAULT_PT_WOOD then
- sim.partKill(r)
- sim.partKill(i)
- return 1
- elseif rtype == elem.DEFAULT_PT_OXYG then
- sim.partChangeType(i, sulfacid)
- sim.partKill(r)
- elseif elem.property(rtype, "Flammable") ~= 0 then
- sim.partChangeType(r, elem.DEFAULT_PT_FIRE)
- sim.partKill(i)
- return 1
- end
- end
- if sim.partProperty(i, "temp") > 573.15 then
- sim.partChangeType(i, so2)
- sim.partCreate(-3, x, y, elem.DEFAULT_PT_WTRV)
- end
- end
- elem.property(sulfurous, "Update", h2so3Update)
- elem.element(sulfacid, elem.element(elem.DEFAULT_PT_SOAP))
- elem.property(sulfacid, "Name", "SACD")
- elem.property(sulfacid, "Description", "Sulfuric acid (H2SO4). Eats through most things, can be diluted with DSTW/WATR and concentrated with SULF.")
- elem.property(sulfacid, "Color", 0xCCCC00)
- elem.property(sulfacid, "Weight", 29)
- local function h2so4Update(i, x, y, s, nt)
- local tmp = sim.partProperty(i, "tmp")
- local r = sim.partID(x+math.random(-1,1),y+math.random(-1,1))
- if r ~= nil then
- local rtype = sim.partProperty(r, "type")
- if tmp ~= 1 then
- if rtype == elem.DEFAULT_PT_DSTW then
- sim.partKill(r)
- sim.partProperty(i, "tmp", 1)
- elseif rtype == elem.DEFAULT_PT_WATR then
- if math.random(1, 5) == 1 then
- sim.partProperty(i, "tmp", 1)
- end
- sim.partKill(r)
- else
- if rtype ~= sulfacid and elem.property(rtype, "Hardness") > 0 and rtype ~= sulfurous then
- sim.partKill(r)
- if math.random(1, 10) == 1 then
- sim.partKill(i)
- return 1
- end
- end
- end
- else
- if rtype == elem.DEFAULT_PT_BCOL then
- sim.partKill(i)
- sim.partProperty(r, "type", elem.DEFAULT_PT_BREL)
- end
- end
- end
- local r2 = sim.partID(x, y-1)
- if r2 ~= nil then
- if tmp ~= 1 and sim.partProperty(r2, "type") == sulfacid and sim.partProperty(r2, "tmp") == 1 then
- sim.partProperty(i, "tmp", 1)
- sim.partProperty(r2, "tmp", 0)
- end
- end
- end
- local function h2so4Graphics(i, colr, colg, colb)
- if sim.partProperty(i, "tmp") == 0 then
- r = 204
- g = 204
- b = 0
- else
- r = 153
- g = 255
- b = 51
- end;
- return 0, 0x00000001, 255, r, g, b, 0, 0, 0, 0
- end
- elem.property(sulfacid, "Update", h2so4Update)
- elem.property(sulfacid, "Graphics", h2so4Graphics)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement