This page is used for previewing and submitting scripts for use with the Script Manager
Available Scripts
(2) TPTMulti by LBPHacker
(3) set wifi v2 by jacob1
(4) Script Paste by jacob1
(5) Random Element by jacob1
(6) Magical Merge Master 3000 by nucular
(7) More Fuel Mod-heavy by jward212
(9) Breakpoints (BRPT) by boxmein
(10) Cockroaches! by boxmein
(11) Random tree by ssccsscc
(12) Element with random properties by ssccsscc
(15) Minimalistic Element Dehider by nucular
(16) FPS Gauge by mniip
(17) TPT Radio by jward212
(18) Print Debugger by FeynmanLogomaker
(19) Powered BHOL by jacob1
(20) Light and lamps by electronic_steve
(21) Extremely Durable TTAN by QuentinADay
(22) New Buttons by QuentinADay
(23) Pure Energy by QuentinADay
(25) RCA's HUD XV Update I by RCAProduction
(27) 123456787654 vols by mjpowder
(28) Singularity Bomb by QuentinADay
(29) ES wifi set by electronic_steve
(30) Lua Elements Pack by FeynmanLogomaker
(31) stkm gun by jward212
(32) space building materials by kjack1111
(34) Rust bomb by Damian97
(35) Simple command block by ssccsscc
(36) Everlasting Fusion by QuentinADay
(37) Screenshot Organiser by mecha-man
(38) Napalm mod by cccp3
(39) Rocket fuel mod v0.15 by cccp3
(41) Useful web links by jward212
(42) TPT Logic Gates Mod by iamdumb
(43) ESTools by electronic_steve
(44) Head Crabs-HL2 by jward212
(45) Procedural Save Generator by boxmein
(46) smooth colours for nametag by jward212
(47) ZAKPACK by zak03
(49) Performance Monitor by FeynmanLogomaker
(51) Texter by byzod
(52) Texter default fonts by byzod
(53) Schicko's Font Pack for Texter by Schicko
(54) Realistic Element Names by Atomic10
(55) TPT's Mod V.3 Update 1 by Amy
(56) Temporaryaccount-Decorator by Temporaryaccount
(57) random save loader by jward212
(58) Tmp gradient display by ssccsscc
(59) particle re-orderer by mniip
(60) Electric Glow by jacob1
(61) More Fuel Mod-lite by jward212
(63) Rythidium by janekbe04
(64) Simple FPS GUI by Sfsjunior
(65) Enhanced Element Dehider by ChargedCreeper
(66) Graph of average temp by ssccsscc
(67) Template save loader by jacob1
(68) Lua Text Generator by jBot-42
(70) Pixel's Freezer by Pixelguru26
(71) Thingy | Fusion For Ever by TheChosenEvilOne
(72) op explosions by zolly_bro
(73) Scar by DorkyBobster
(74) ScreenShotMod by lill74
(77) Useful Things by TheEvilChosenOne
(78) Alchemy Mod by _MrN_
(79) Nuke v2 by Fnaf65
(80) Compressor mod by TheChosenEvilOne
(81) Custom Render Mode Loader by jacob1
(82) Spacewars by JosephMA
(83) MOAR - Alpha 0.1 by TheChosenEvilOne
(86) Element Creator by cxi
(88) Soapworm by LBPHacker
(90) Pressure Bomb by God_Kra
(91) SMFB by wntjq69
(92) Potato by cxi
(93) Subatomic Pack (BDS) by TPT_PL
(94) Acidic Pack (BDS) by TPT_PL
(95) Starbound Building Materials by Sanpypr
(96) Factory problems by TPT_PL
(97) Gamma Ray-diation by Kostia4381
(98) Magic by livingfossil
(99) Cross-window Copy/Cut/Paste by LBPHacker
(100) Langton's Ant with variations by LBPHacker
(101) Remote particle creator/deleter by TPT_PL
(102) Force fields by electronic_steve
(103) Reinforced Concrete by 12Me21
(105) TPT_PL's Lua Mod by TPT_PL
(106) Nuke v4 by Fnaf65
(107) CHEMMOD V1 by KevAK
(108) Chemicals by Ligan
(109) VonDaniel's Template by VonDaniel
(110) The Inaccurate Radioactivity Toy Mod by TuDoR2007
(112) textmonsterPack by textmonster404
(113) Meteor by TheScienceKid
(114) Tgpm by TuDoR2007
(115) Civilizations by TPT_PL
(116) RAD-MOD 1.2.1B by Kev_AK
(117) MicroLua by RamiLego4Game
(118) Extra customizable HUD by djy0212
(119) Ingame brush editor by ssccsscc
(120) Window Maker by Paul_31415
(121) CHEM-MOD V1.2B by Kev_AK
(122) Rainbow PHOT by Mrprocom
(123) stronger stickmanv by yuval
(124) 3D Pressure Visualizer by mniip
(125) Arkadian Liquid by JanKaszanka
(126) Fuel by nukers473
(127) Immersive Radioactivity v2.1 by Potbelly
(128) ElementLaunchingTool by juh9870
(129) CHEM-MOD_v1.2.2b by KevAK
(130) Slingshot by Mrprocom
(131) Perlin Noise Generator by DoubleF
(132) Element Replace by TomW1605
(133) Flooder V2 by TheAwesomeMutant
(134) Link Sign GUI by QuanTech
(135) Element dehider by 4e616d65
(136) Subphoton ROM Builder by mad-cow
(137) Hardened Dust by Liftski
(138) Bio-Vir by TheAwesomeMutant
(140) Orbit Simulator by Mrprocom
(141) johnnyou's Font for Texter by johnnyou (49796346)
(142) auto_wifi by phisically
(143) Layering helper by ssccsscc
(144) Layering Helper Extended by LuaMaster
(145) TPT Remade by TuDoR2007
(146) All-seeing sampler by djy0212
(147) Layering helper remastered by ssccsscc
(148) Eraser by thepowdertoy12
(149) EXPLOSIONS by olix3001
(150) Simple rocket fuel mod by ArseniyPlotnikov2006
(151) Pure Fission by Fnaf65
(154) Graph by ssccsscc
(155) Little's Pack! by LittleProgramming
(156) Lead by LoftisGaming
(157) WIFI Tuner by ssccsscc
(158) Previous Brush by TomW1605
(159) HUD Auto-Hider by Tim
(161) Stack tool by thepowdertoy12
(162) Oil and plastic by ArseniyPlotnikov2006
(163) Colored Ember by DUC
(164) Timer by ssccsscc
(165) Bacteria Mod by TuDoR2007
(166) Noise filter by LBPHacker
(167) Future-proof element dehider by LBPHacker
(168) RadioactiveNuke by DreamingWarlord
(169) Only Hot Element by DreamingWarlord
(170) Philosopher's Stone by Godhydra
(171) Conic section generator by LBPHacker
(172) Interface API by ssccsscc
(173) Metals&Materials by Ferrous26
(174) tpt.all by LBPHacker
(175) The Visual Elements Pack by Goblin01, vvv331
(176) Layering Helper Reforged by PowderNotSolid
(177) SNOWified SING by LBPHacker
(178) FPS Chart by Goblin01
(179) TPT font writer by Goblin01
(180) Simple Ruler by PowderNotSolid
(181) Heat Modifier by DreamingWarlord
(182) TPT Remade II by TuDoR2007
(183) Gravity simulator by ArseniyPlotnikov2k6
(184) Unobtainium by christheboss894
(185) TPTMIDI noteblock in tpt by djy0212
(186) DreamingWarlord's Lua Tool by DreamingWarlord
(187) Elements Tooltip by Goblin01
(189) Explodium script by 0d15ea5ebe57c0debadc0ffee0ddf00d
(190) more powered force elements by 6nop6nop
(191) Yzaak1Scifire Modpack by Yzaak1Scifire
(194) Fluor and more modpack! by galaktor
(195) Hot Powder by lieve_blendi
(196) Star by TUANMINHVIETNAM
(197) Heat Powders by lieve_blendi
(200) Tangeriinium (thx 2 cxi 4 code) by LostEditor
(201) Freezer by lieve_blendi
(202) Powder Power! by TPTSortaGuy
(203) PowderPlus v1.4 by PowderPlus Team
(204) fire by ME
(205) Stacked Goo Animations by Maticzpl
(206) Stickman Control for Android Version by PhauloRiquelme
(207) Spark Removal Button by Xyz
(208) More HEAC's! by Maxhd1234
(209) Immersive Radioactivity v3.0 by Potbelly
(210) Subframe Chipmaker Script by Maticzpl
(211) Realistic Propellants by ArseniyPlotnikov2k6
(212) Mass Equals Gravity by Maticzpl
(213) PhiMod v1 by ArolaunTech
(214) PC Controls for Android by Cracker1000
(217) Single-pixel pipe configurator by LBPHacker
(218) Omega Death Laser Gun by Dogeoum
(219) Notifications by Maticzpl
(221) Powderizer by ArolaunTech
(222) ElemDehider 1.2 by Inventor70
(223) Unobtainum V2 by DoomKittyAttack
(224) Organics Mod v0.2B by PowderPlus Team
(225) Gravity distortion by Avolte55
(226) tmp Wifi by PhauloRiquelme
(227) Alchemagica Mod v1.0 by RebMiami
(228) Fan Elements Mod by RebMiami
(229) Impossibilities by ArolaunTech
(230) Realistic Explosives by ArseniyPlotnikov2k6
(231) libactivation by anamorphic
(232) Alloy Brushes by Maticzpl
(233) Gravity bender by pres
(234) Slow Tick by Pixel
(235) Paste ID by Maticzpl
(236) many things by jadenflp2
(237) Territect by Rebmiami
(238) Better Descriptions v1.0.5 by ashyboi2022
(239) LIGHTNING SPRK by GOLmaster10101
(240) Small Bombs by juh9870
(241) Save Shop by aaccbb
(242) Moving solids v1.3.0 Beta by ArolaunTech
(244) Alchemistry by rdococ
(245) ETRD-IM by aaccbb
(246) RadonX by Justadirtblock
(248) Water-X by deuterium_oxide
(250) Indestructible INSL by CheekyRand0m
(252) Console's Mod by Console/Compec
(255) Slow motion by LBPHacker
(256) Powered Repeller by Hythonia
(257) Zeta's Electric Tools. by Zetalasis
(258) Azure serum (AZSR) by ALumpOfPowderToy
(259) COLORFULSAND by xert
(260) Lightning Circle by defaultuser0
(261) Powder Future Tech by JonaHungary
(262) TPTGlowingSolids by DestinyDyson
(263) Volcano Bomb by I_am_the_NugsWorld
(264) Neon Lights by Rebmiami
(265) Radioactive Materials by xyz
(266) Eater mod by VIPERGAMEZ
(267) the biology mod by someone
(268) Atomic Physics by qe
(269) Pure Radiation by ronansb
(270) Fake Elements by That_PowderToy_Guy
(271) Tachyons and MISC by RamenNoods
(272) Exotic Particles by rdococ
(273) FPS Slider by aaccbb
(274) Enphosian's Radioactive mod pack by Enphosian
(275) TPTMulti v2.2.5 Beta by LBPHacker
(276) ROM Builder by QnpfvTPz
(277) acb's Idea Generator by aaccbb
(278) Bode's Grapher by Bodester
(279) Gradient Tool by Bodester
(280) Better FPS Slider by ngmoco
(281) MyWIFI by Bodester
(282) acb's Slow-Mo Script by aaccbb
(283) Fun n' Chemicals by 0xHenryMC
(284) Resistant coating by git4rker
(285) Nationwide script by Kit237
(286) weird alphabet.lua by alice_loona_ot12
(287) MT's font for texter by Kit237
(288) Compiler for the SCE computer by NoVIcE by NoVIcE
(289) Perlin Noise Map Generator by Kit236
(290) hell fire element by Hecker
(291) Power stuff by William
(292) Missile by BaCOn
(293) Wargame's things by Kit236
(294) Inert Gas by EwguhMicBewguhGuy
(295) Average Temperature Display by tptQuantification
(296) Radicons by stillthere
(297) ROCKET by stillthere
(298) NUUKE! by stillthere
(299) SubpixelScope by Rebmiami
(300) Unobtanium Element Pack by AlgoPowdo
(301) Magnets by TheSuperNova
(302) library007 2.0 3000 by 008cff
(303) Element tuner by TheSuperNova
(304) Somethings by TheSuperNova
(305) Realistic Water by yuht
(306) Futurism by TheSuperNova
(307) MMod by MeltedLawnFlamingo
(308) Wierd energy by mellowmonster12
(309) Time Reversing by crocodilea
(310) Weather System by Bigmann
(311) infinite framerate by kayra
(312) Diamondifier mod by Believer0914
(313) Radtech by ReallyJustDont
(314) TPT 'port' of #powder-moo game by creator_of_fail
(315) Fireshoas Stuff by Fireshoa
(316) TPTASM: Universal assembler for TPT computers by LBPHacker
(317) Ronansb's Elements by ronansb
(318) AeroStuff v1.1 by AerospaceFan
+ Submit new script!
Title:
Author:
Script:
-- TPT Lua Script - Content Mod
-- ReallyJustDont's Radiation and Technology Mod v1.0
-- 2025
local radon = elements.allocate("ARAD", "RDON")
local radium = elements.allocate("ARAD", "RDIM")
elements.element(radon, elements.element(elements.DEFAULT_PT_NBLE))
elements.property(radon, "Name", "RDON")
elements.property(radon, "Description", "Radon. Heavy, translucent gas. Absorbs protons, but may turn into radium or other heavy metals.")
elements.property(radon, "Color", 0x007766)
elements.property(radon, "MenuVisible", 1)
elements.property(radon, "MenuSection", elements.SC_NUCLEAR)
elements.property(radon, "Gravity", 0.02)
elements.property(radon, "Diffusion", 0.5)
elements.property(radon, "HotAir", 0)
elements.property(radon, "Properties", elements.TYPE_GAS + elements.PROP_PHOTPASS + elements.PROP_NEUTPASS + elements.PROP_DEADLY)
local function radonUpdate(i, x, y, s, nt)
local protons = 0
for part in sim.neighbors(x, y, 1, 1, elements.DEFAULT_PT_PROT) do
protons = protons + 1
if (math.random(1, 4) == 1) then
sim.partKill(part)
sim.partProperty(i, "life", sim.partProperty(i, "life") + 4)
end -- if
end -- for
if (protons == 0) and (math.random(1, 8) == 1) and (sim.partProperty(i, "life") > 0) then
sim.partProperty(i, "life", sim.partProperty(i, "life") - 1)
end -- if
if (sim.partProperty(i, "life") >= 20) then
sim.pressure(x / 4, y / 4, sim.pressure(x / 4, y / 4) + 0.2)
if (math.random(1, 2) == 1) then
if (math.random(1, 4) == 1) then
sim.partProperty(i, "type", elements.DEFAULT_PT_PLUT)
else
sim.partProperty(i, "type", elements.DEFAULT_PT_URAN)
end
else
sim.partProperty(i, "type", radium)
end
return -1
end -- if
end -- function
local function radonGraphics(i, colr, colg, colb)
local rMode = ren.DECO_FIRE + ren.FIRE_BLEND
if (sim.partProperty(i, "life") >= 2) then
rMode = rMode + ren.PMODE_FLARE
end
return 0, rMode, 150, colr, colg, colb, 150, colr / 2, colg / 2, colb / 2
end -- function
elements.property(radon, "Update", radonUpdate)
elements.property(radon, "Graphics", radonGraphics)
elements.element(radium, elements.element(elements.DEFAULT_PT_GOLD))
elements.property(radium, "Name", "RDIM")
elements.property(radium, "Description", "Radium. Solid, reactive, and sometimes emits hot neutrons. Decays under pressure, and can also melt.")
elements.property(radium, "Color", 0x00cc33)
elements.property(radium, "MenuVisible", 1)
elements.property(radium, "MenuSection", elements.SC_NUCLEAR)
elements.property(radium, "Hardness", 4)
elements.property(radium, "Properties", elements.TYPE_SOLID + elements.PROP_NEUTPASS + elements.PROP_RADIOACTIVE)
elements.property(radium, "HighTemperature", 700 + 273) -- 700 celsius converted to kelvin
elements.property(radium, "PhotonReflectWavelengths", 0x1fe00)
local function radiumUpdate(i, x, y, s, nt)
local water = 0
if (math.random(1, 4) == 1) then
for part in sim.neighbors(x, y, 1, 1) do
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_WATR) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_DSTW) then
water = water + 3
elseif (sim.partProperty(part, "type") == elements.DEFAULT_PT_CBNW) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_O2) then
water = water + 2
end
end
end -- if
if (math.random(1, 100) < water) or (sim.partProperty(i, "life") >= 100) then
for part in sim.neighbors(x, y, 2, 2, radium) do
sim.partProperty(part, "life", 100)
end
sim.partProperty(i, "life", 0)
sim.partProperty(i, "tmp", 50)
sim.partProperty(i, "type", elements.DEFAULT_PT_SING)
for count = 1, 8, 1 do
sim.partCreate(-2, math.random(x - 3, x + 3), math.random(y - 3, y + 3), elements.DEFAULT_PT_PLSM)
end
return -1
end
if (sim.pressure(x / 4, y / 4) >= 2) then
if (math.random(1, 100) < sim.pressure(x / 4, y / 4)) then
sim.partProperty(i, "life", sim.partProperty(i, "life") + 1)
end
end
local neutFactor = 6000
if (s >= 2) then -- if 2 or more empty spaces near this particle
neutFactor = 4500
end
if (sim.partProperty(i, "life") >= 50) or (sim.partProperty(i, "temp") >= (400 + 273)) then
neutFactor = neutFactor - 1000
end
if (math.random(1, neutFactor) == 1) then
local newPart = sim.partCreate(-3, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_NEUT)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", 400 + 273 + (sim.partProperty(i, "temp") / 5))
end
end
end
local function radiumGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT + ren.PMODE_GLOW
if (sim.partProperty(i, "temp") >= (400 + 273)) then -- start glowing at 400C
local tempDiff = (sim.partProperty(i, "temp") - 673) / 2
if (tempDiff > 150) then
tempDiff = 150
end
rRed = rRed + tempDiff
rGreen = rGreen - (tempDiff * 0.8)
end
if (sim.partProperty(i, "life") >= 0) and (sim.partProperty(i, "life") <= 200) then
rRed = rRed + (sim.partProperty(i, "life") / 4)
rBlue = rBlue + (sim.partProperty(i, "life") / 5)
if (sim.partProperty(i, "life") >= 50) then
rMode = rMode + ren.FIRE_ADD
end
else
rRed = rRed + 20
rBlue = rBlue + 20
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed / 2, rGreen / 2, rBlue / 2
end -- function
elements.property(radium, "Update", radiumUpdate)
elements.property(radium, "Graphics", radiumGraphics)
local tritium = elements.allocate("ARAD", "TRIT")
elements.element(tritium, elements.element(elements.DEFAULT_PT_GEL))
elements.property(tritium, "Name", "TRIT")
elements.property(tritium, "Description", "Liquid tritium. Specialized for fast proton reactions; reverts to DEUT when electrified.")
elements.property(tritium, "Color", 0x9966ff)
elements.property(tritium, "MenuVisible", 1)
elements.property(tritium, "MenuSection", elements.SC_NUCLEAR)
elements.property(tritium, "Gravity", 0.11)
elements.property(tritium, "Weight", 33)
elements.property(tritium, "HeatConduct", 190)
elements.property(tritium, "Properties", elements.TYPE_LIQUID + elements.PROP_SPARKSETTLE)
local function tritiumUpdate(i, x, y, s, nt)
if (nt >= 2) or (math.random(1, 100) == 1) then
local protVal = 0
local elecVal = 0
for part in sim.neighbors(x, y, 1, 1) do
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_PROT) then
protVal = protVal + 2
elseif (sim.partProperty(part, "type") == elements.DEFAULT_PT_ELEC) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_LIGH) then
elecVal = elecVal + 2
elseif (sim.partProperty(part, "type") == elements.DEFAULT_PT_SPRK) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_EMBR) then
elecVal = elecVal + 1
end
end
if (elecVal > protVal) then
if (math.random(1, 4) <= elecVal) then
sim.partProperty(i, "life", 30 + (2 * elecVal))
sim.partProperty(i, "ctype", 0)
sim.partProperty(i, "type", elements.DEFAULT_PT_DEUT)
return -1
end
end
if (protVal > elecVal) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_PROT)
if (math.random(1, 4) <= protVal) then
sim.partProperty(i, "life", sim.partProperty(i, "life") + 10)
local newPart = sim.partCreate(-3, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_PROT)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", 1200 + 273 + (sim.partProperty(i, "temp") * 0.8))
end
sim.pressure(x / 4, y / 4, sim.pressure(x / 4, y / 4) - 0.4)
end
if (sim.partProperty(i, "life") >= 60) then
sim.partKill(i)
return -1
end
end
end
if (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_PROT) and (sim.partProperty(i, "life") >= 1) then
sim.partProperty(i, "life", sim.partProperty(i, "life") - 1)
if (sim.partProperty(i, "life")) <= 1 then
sim.partProperty(i, "ctype", 0)
end
end
end
local function tritiumGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT + ren.PMODE_BLUR
if (math.random(1, 100) == 1) then
rMode = rMode + ren.PMODE_FLARE
rRed = rRed + 10
rGreen = rGreen + 8
rBlue = rBlue + 10
end
if (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_PROT) then
rRed = rRed + 30
rGreen = rGreen - 10
rBlue = rBlue - 10
if (math.random(1, 100) == 1) then
rMode = rMode + ren.PMODE_LFLARE
end
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed / 2, rGreen / 2, rBlue / 2
end -- function
elements.property(tritium, "Update", tritiumUpdate)
elements.property(tritium, "Graphics", tritiumGraphics)
local neutronium = elements.allocate("ARAD", "NTRM")
elements.element(neutronium, elements.element(elements.DEFAULT_PT_GOO))
elements.property(neutronium, "Name", "NTRM")
elements.property(neutronium, "Description", "Neutronium. Loses power over time, can be charged with neutrons. Vulnerable to pressure if unpowered.")
elements.property(neutronium, "Color", 0x0099ff)
elements.property(neutronium, "MenuVisible", 1)
elements.property(neutronium, "MenuSection", elements.SC_NUCLEAR)
elements.property(neutronium, "HeatConduct", 120)
elements.property(neutronium, "Hardness", 0)
elements.property(neutronium, "Loss", 0)
elements.property(neutronium, "Properties", elements.TYPE_SOLID + elements.PROP_SPARKSETTLE + elements.PROP_LIFE_DEC)
elements.property(neutronium, "PhotonReflectWavelengths", 0xff80)
local function neutroniumCreate(i, x, y, t, v)
sim.partProperty(i, "life", 3000)
end
local function neutroniumUpdate(i, x, y, s, nt)
if (nt >= 1) then
for part in sim.neighbors(x, y, 1, 1, elements.DEFAULT_PT_NEUT) do
local lifeAdd = 1200 + sim.partProperty(part, "life")
sim.partKill(part)
if (sim.partProperty(i, "life") <= 3000) then
lifeAdd = lifeAdd + 1800
end
sim.partProperty(i, "life", sim.partProperty(i, "life") + lifeAdd)
end
end
if (math.random(1, 4) == 1) then
for part in sim.neighbors(x, y, 1, 1, neutronium) do
if (sim.partProperty(part, "life") < (sim.partProperty(i, "life") - 10)) then
local lSum = sim.partProperty(i, "life") + sim.partProperty(part, "life")
if (sim.partProperty(i, "life") > (lSum * 0.6)) then
sim.partProperty(i, "life", lSum * 0.6)
sim.partProperty(part, "life", lSum * 0.5)
else
sim.partProperty(i, "life", sim.partProperty(i, "life") - 8)
sim.partProperty(part, "life", sim.partProperty(part, "life") + 8)
end
end
end
end
if (math.random(1, 20) == 1) and (sim.partProperty(i, "life") == 0) then
if (sim.pressure(x / 4, y / 4) >= 4) then
sim.partProperty(i, "life", 60)
sim.partProperty(i, "type", elements.DEFAULT_PT_BRAY)
return -1
end
end
end
local function neutroniumGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT
if (sim.partProperty(i, "life") > 0) then
rMode = rMode + ren.PMODE_GLOW
local lightAdd = sim.partProperty(i, "life") / 20
if (lightAdd >= 90) then
lightAdd = 90
end
rRed = rRed + lightAdd
rGreen = rGreen + lightAdd
if (sim.partProperty(i, "life") >= 3600) and (math.random(1, 60) == 1) then
rMode = rMode + ren.PMODE_FLARE
end
else
rBlue = rBlue - math.random(20, 40)
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed / 2, rGreen / 2, rBlue / 2
end
elements.property(neutronium, "Create", neutroniumCreate)
elements.property(neutronium, "Update", neutroniumUpdate)
elements.property(neutronium, "Graphics", neutroniumGraphics)
local actinium = elements.allocate("ARAD", "ACTN")
local curium = elements.allocate("ARAD", "CURI")
local zeroAlloy = elements.allocate("ARAD", "ZRAL")
elements.element(actinium, elements.element(elements.DEFAULT_PT_GOO))
elements.property(actinium, "Name", "ACTN")
elements.property(actinium, "Description", "Actinium. Solid, can oxidize. Absorbs protons and neutrons, but may turn into heavier metals. Decays under pressure.")
elements.property(actinium, "Color", 0x0066ff)
elements.property(actinium, "MenuVisible", 1)
elements.property(actinium, "MenuSection", elements.SC_NUCLEAR)
elements.property(actinium, "HeatConduct", 160)
elements.property(actinium, "Hardness", 4)
elements.property(actinium, "Loss", 0)
elements.property(actinium, "Properties", elements.TYPE_SOLID + elements.PROP_SPARKSETTLE + elements.PROP_NEUTPASS + elements.PROP_RADIOACTIVE + elements.PROP_LIFE_DEC)
elements.property(actinium, "PhotonReflectWavelengths", 0x1fff8)
local function actiniumUpdate(i, x, y, s, nt)
if (nt >= 2) then
local oxiFactor = 0
for part in sim.neighbors(x, y, 1, 1) do
local oxiPart = false
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_O2) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_CO2) then
oxiFactor = oxiFactor + 3
oxiPart = true
elseif (sim.partProperty(part, "type") == elements.DEFAULT_PT_FOG) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_WTRV) then
oxiFactor = oxiFactor + 2
oxiPart = true
elseif (sim.partProperty(part, "type") == elements.DEFAULT_PT_BOYL) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_GAS) then
oxiFactor = oxiFactor + 1
oxiPart = true
end
if (sim.partProperty(i, "ctype") ~= elements.DEFAULT_PT_O2) and (oxiFactor >= 3) and (math.random(1, 20) == 1) and (oxiPart) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_O2)
sim.partProperty(part, "type", elements.DEFAULT_PT_EMBR)
sim.partProperty(part, "life", math.random(90, 120))
end
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_PROT) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_NEUT) then
if (math.random(1, 4) == 1) then
sim.partKill(part)
sim.partProperty(i, "life", sim.partProperty(i, "life") + 20)
end
end
end
else
local partHere = sim.photons(x, y)
if (partHere ~= nil) and (math.random(1, 2) == 1) then
if (sim.partProperty(partHere, "type") == elements.DEFAULT_PT_PROT) or (sim.partProperty(partHere, "type") == elements.DEFAULT_PT_NEUT) then
sim.partKill(partHere)
sim.partProperty(i, "life", sim.partProperty(i, "life") + 20)
end
end
end
if (sim.partProperty(i, "life") >= 80) then
sim.pressure(x / 4, y / 4, sim.pressure(x / 4, y / 4) + 0.4)
sim.partProperty(i, "life", 0)
sim.partProperty(i, "temp", sim.partProperty(i, "temp") + 5)
sim.partProperty(i, "ctype", 0)
if (math.random(1, 2) == 1) then
if (math.random(1, 2) == 1) then
sim.partProperty(i, "type", elements.DEFAULT_PT_PLUT)
else
sim.partProperty(i, "type", elements.DEFAULT_PT_URAN)
end
else
sim.partProperty(i, "type", curium)
end
return -1
end
local pThreshold = 8
if (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_O2) then
pThreshold = 4
end
if (sim.pressure(x / 4, y / 4) >= pThreshold) and (math.random(1, 120) <= sim.pressure(x / 4, y / 4)) then
local newPart = sim.partCreate(-3, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_NEUT)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", 50 + sim.partProperty(i, "temp"))
end
sim.partProperty(i, "life", 0)
sim.partProperty(i, "ctype", 0)
if (math.random(1, 2) == 1) then
if (math.random(1, 2) == 1) then
sim.partProperty(i, "type", elements.DEFAULT_PT_STNE)
else
sim.partProperty(i, "type", elements.DEFAULT_PT_SAND)
end
else
sim.partProperty(i, "type", radon)
end
return -1
end
end
local function actiniumGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT + ren.PMODE_GLOW
if (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_O2) then
rRed = rRed + 50
rGreen = rGreen + 50
end
if (math.random(1, 60) < sim.partProperty(i, "life")) then
rRed = rRed + 20
rGreen = rGreen + 20
rMode = rMode + ren.PMODE_FLARE
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(actinium, "Update", actiniumUpdate)
elements.property(actinium, "Graphics", actiniumGraphics)
elements.element(curium, elements.element(elements.DEFAULT_PT_GOO))
elements.property(curium, "Name", "CURI")
elements.property(curium, "Description", "Curium. Solid, undergoes beta decay. Can be accelerated by electrons or low pressure.")
elements.property(curium, "Color", 0xff3366)
elements.property(curium, "MenuVisible", 1)
elements.property(curium, "MenuSection", elements.SC_NUCLEAR)
elements.property(curium, "HeatConduct", 160)
elements.property(curium, "Hardness", 6)
elements.property(curium, "Loss", 0)
elements.property(curium, "Properties", elements.TYPE_SOLID + elements.PROP_NEUTPASS + elements.PROP_RADIOACTIVE)
elements.property(curium, "PhotonReflectWavelengths", 0x3c00000f)
local function curiumUpdate(i, x, y, s, nt)
if (nt >= 2) then
local elecFactor = 1200
local isozFactor = 0
for part in sim.neighbors(x, y, 1, 1) do
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_ELEC) and (elecFactor >= 600) then
elecFactor = elecFactor - 120
end
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_ISOZ) then
isozFactor = isozFactor + 1
end
end
if (isozFactor >= 1) then
for part in sim.neighbors(x, y, 1, 1) do
if (sim.partProperty(part, "type") == curium) and (isozFactor >= 2) then
isozFactor = isozFactor - 1
sim.partProperty(part, "type", zeroAlloy)
end
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_ISOZ) then
sim.partKill(part)
end
end
sim.partProperty(i, "type", zeroAlloy)
return -1
end
if (sim.pressure(x / 4, y / 4) <= -2) then
elecFactor = elecFactor - 150
if (sim.pressure(x / 4, y / 4) <= -10) then
elecFactor = elecFactor - 150
end
end
if (math.random(1, elecFactor) == 1) then
local newPart = sim.partCreate(-2, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_ELEC)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", 300 + (sim.partProperty(i, "temp") * 0.9))
sim.partProperty(i, "life", sim.partProperty(i, "life") + 1)
end
end
if (sim.partProperty(i, "life") >= 6) then
sim.pressure(x / 4, y / 4, sim.pressure(x / 4, y / 4) - 0.4)
sim.partProperty(i, "life", 0)
sim.partProperty(i, "temp", sim.partProperty(i, "temp") + 5)
sim.partProperty(i, "ctype", 0)
if (math.random(1, 2) == 1) then
if (math.random(1, 2) == 1) then
sim.partProperty(i, "type", elements.DEFAULT_PT_URAN)
else
sim.partProperty(i, "type", radon)
end
else
sim.partProperty(i, "type", radium)
end
return -1
end
end
end
local function curiumGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT + ren.PMODE_GLOW
if (sim.partProperty(i, "life") >= 3) then
rGreen = rGreen + 50
rBlue = rBlue + 60
if (sim.partProperty(i, "life") >= 5) and (math.random(1, 2) == 1)then
rMode = rMode + ren.PMODE_LFLARE
end
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(curium, "Update", curiumUpdate)
elements.property(curium, "Graphics", curiumGraphics)
elements.element(zeroAlloy, elements.element(elements.DEFAULT_PT_TTAN))
elements.property(zeroAlloy, "Name", "ZRAL")
elements.property(zeroAlloy, "Description", "Zero Alloy. Created by infusing Curium with Isotope-Z. Cools itself and emits photons. Melts into ISOZ with extreme heat.")
elements.property(zeroAlloy, "Color", 0x3300ff)
elements.property(zeroAlloy, "MenuVisible", 1)
elements.property(zeroAlloy, "MenuSection", elements.SC_NUCLEAR)
elements.property(zeroAlloy, "Hardness", 2)
elements.property(zeroAlloy, "Properties", elements.TYPE_SOLID + elements.PROP_PHOTPASS + elements.PROP_RADIOACTIVE)
elements.property(zeroAlloy, "HighTemperature", 3333 + 273) -- 3,333 celsius converted to kelvin
elements.property(zeroAlloy, "HighTemperatureTransition", elements.DEFAULT_PT_ISOZ)
local function zeroAlloyUpdate(i, x, y, s, nt)
local photFactor = 3000
if (sim.pressure(x / 4, y / 4) <= -2) then
photFactor = 2700
if (sim.pressure(x / 4, y / 4) <= -4) then
photFactor = photFactor + (sim.pressure(x / 4, y / 4) * 2)
end
end
if (sim.partProperty(i, "temp") >= 273) then
photFactor = photFactor - (sim.partProperty(i, "temp") / 10)
end
if (math.random(1, photFactor) == 1) then
local newPart = sim.partCreate(-3, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_PHOT)
if (newPart >= 0) then
local newTemp = sim.partProperty(i, "temp") * 0.9
if (sim.partProperty(i, "temp") >= 173) then
newTemp = newTemp - 2
end
sim.partProperty(newPart, "temp", newTemp)
sim.partProperty(newPart, "vx", math.random(-3, 3))
sim.partProperty(newPart, "vy", math.random(-3, 3))
sim.partProperty(i, "life", 45)
end
elseif (sim.partProperty(i, "life") > 0) then
sim.partProperty(i, "life", sim.partProperty(i, "life") - 1)
end
end
local function zeroAlloyGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT + ren.PMODE_GLOW
if (sim.partProperty(i, "temp") >= (1333 + 273)) then
local tempDiff = sim.partProperty(i, "temp") - 1333 - 273
rRed = rRed + (tempDiff / 20) + 5
if (rRed > 150) then
rRed = 150
end
end
if (sim.partProperty(i, "life") >= 5) and (sim.partProperty(i, "life") <= 50) then
rRed = rRed + sim.partProperty(i, "life")
rGreen = rGreen + sim.partProperty(i, "life")
if (math.random(1, 60) <= sim.partProperty(i, "life")) then
rMode = rMode + ren.PMODE_FLARE
end
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed / 2, rGreen / 2, rBlue / 2
end
elements.property(zeroAlloy, "Update", zeroAlloyUpdate)
elements.property(zeroAlloy, "Graphics", zeroAlloyGraphics)
local oganesson = elements.allocate("ARAD", "OGAN")
elements.element(oganesson, elements.element(elements.DEFAULT_PT_STNE))
elements.property(oganesson, "Name", "OGAN")
elements.property(oganesson, "Description", "Oganesson. Very heavy particles that quickly decay and release energy. High destructive potential.")
elements.property(oganesson, "Color", 0x9999cc)
elements.property(oganesson, "MenuVisible", 1)
elements.property(oganesson, "MenuSection", elements.SC_NUCLEAR)
elements.property(oganesson, "Gravity", 0.5)
elements.property(oganesson, "Advection", 0.2)
elements.property(oganesson, "Temperature", 1273.15)
elements.property(oganesson, "Properties", elements.TYPE_PART + elements.PROP_NEUTPASS + elements.PROP_RADIOACTIVE)
elements.property(oganesson, "HighTemperature", sim.ITH)
elements.property(oganesson, "HighTemperatureTransition", sim.NT)
local function oganessonUpdate(i, x, y, s, nt)
if (nt >= 2) then
local lifeAdd = 0
if (math.random(1, 10) == 1) then
local newPart = sim.partCreate(-3, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_NEUT)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", sim.partProperty(i, "temp") + 200)
lifeAdd = lifeAdd + 4
end
elseif (math.random(1, 10) == 1) then
local newPart = sim.partCreate(-3, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_PROT)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", sim.partProperty(i, "temp") + 200)
lifeAdd = lifeAdd + 5
end
end
if (math.random(1, 15) == 1) then
local newPart = sim.partCreate(-2, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_PLSM)
if (newPart >= 0) then
sim.pressure(x / 4, y / 4, sim.pressure(x / 4, y / 4) + 1)
lifeAdd = lifeAdd + 2
end
end
if (math.random(1, 30) == 1) then
local newPart = sim.partCreate(-2, math.random(x - 1, x + 1), math.random(y - 1, y + 1), radon)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", sim.partProperty(i, "temp") + 100)
lifeAdd = lifeAdd + 10
end
end
sim.partProperty(i, "life", sim.partProperty(i, "life") + lifeAdd)
if (sim.partProperty(i, "life") >= 30) then
sim.pressure(x / 4, y / 4, sim.pressure(x / 4, y / 4) + 1)
sim.partProperty(i, "life", 0)
sim.partProperty(i, "temp", sim.partProperty(i, "temp") + 300)
sim.partProperty(i, "ctype", 0)
if (math.random(1, 2) == 1) then
if (math.random(1, 2) == 1) then
sim.partProperty(i, "type", elements.DEFAULT_PT_SING)
sim.partProperty(i, "tmp", 50)
else
sim.partProperty(i, "type", elements.DEFAULT_PT_PLUT)
end
else
sim.partProperty(i, "type", radium)
end
return -1
end
end
end
elements.property(oganesson, "Update", oganessonUpdate)
local radAmoeba = elements.allocate("ARAD", "RMOE")
elements.element(radAmoeba, elements.element(elements.DEFAULT_PT_GEL))
elements.property(radAmoeba, "Name", "RMOE")
elements.property(radAmoeba, "Description", "Radioactive Amoeba. Particles self-assign roles. Eats metal and radiation, dies when cold. Uses Newtonian gravity.")
elements.property(radAmoeba, "Color", 0x119900)
elements.property(radAmoeba, "MenuVisible", 1)
elements.property(radAmoeba, "MenuSection", elements.SC_NUCLEAR)
elements.property(radAmoeba, "Gravity", 0.11)
elements.property(radAmoeba, "Weight", 42)
elements.property(radAmoeba, "HeatConduct", 190)
elements.property(radAmoeba, "Properties", elements.TYPE_LIQUID + elements.PROP_RADIOACTIVE + elements.PROP_NEUTPASS)
local function radAmoebaUpdate(i, x, y, s, nt)
if (sim.partProperty(i, "ctype") == 0) and (math.random(1, 2) == 1) then -- self-assign role if it doesn't have one
local wallCount = 0
local nucleusCount = 0
local eaterCount = 0
local massCount = 0
for part in sim.neighbors(x, y, 3, 3, radAmoeba) do
if (sim.partProperty(part, "ctype") == elements.DEFAULT_PT_INSL) then
wallCount = wallCount + 1
elseif (sim.partProperty(part, "ctype") == radAmoeba) then
nucleusCount = nucleusCount + 1
elseif (sim.partProperty(part, "ctype") == radium) then
eaterCount = eaterCount + 1
elseif (sim.partProperty(part, "ctype") == elements.DEFAULT_PT_URAN) then
massCount = massCount + 1
end
end
if (nucleusCount == 0) and (math.random(1, 2) == 1) then
sim.partProperty(i, "ctype", radAmoeba)
elseif (wallCount <= 3) and (massCount <= 9) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_INSL)
elseif (eaterCount <= 1) and (massCount >= 3) then
sim.partProperty(i, "ctype", radium)
else
sim.partProperty(i, "ctype", elements.DEFAULT_PT_URAN)
end
elseif (sim.partProperty(i, "ctype") == radAmoeba) then -- nucleus
if (sim.pressure(x / 4, y / 4) >= -2) then
sim.pressure(x / 4, y / 4, sim.pressure(x / 4, y / 4) - 0.4)
end
sim.gravityMass(x / 4, y / 4, 0.1)
local wallCount = 0
local eaterCount = 0
local nucleusCount = 0
local xDist = 0
local yDist = 0
for part in sim.neighbors(x, y, 3, 3, radAmoeba) do
if (sim.partProperty(part, "x") > sim.partProperty(i, "x")) then
xDist = xDist + 1
end
if (sim.partProperty(part, "x") < sim.partProperty(i, "x")) then
xDist = xDist - 1
end
if (sim.partProperty(part, "y") > sim.partProperty(i, "y")) then
yDist = yDist + 1
end
if (sim.partProperty(part, "y") < sim.partProperty(i, "y")) then
yDist = yDist + 1
end
if (sim.partProperty(part, "ctype") == elements.DEFAULT_PT_INSL) then
wallCount = wallCount + 1
elseif (sim.partProperty(part, "ctype") == radium) then
eaterCount = eaterCount + 1
elseif (sim.partProperty(part, "ctype") == radAmoeba) then
nucleusCount = nucleusCount + 1
end
end
if (nucleusCount >= 2) then
if (math.random(1, 4) == 1) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_URAN)
elseif (math.random(1, 4) == 1) then
sim.partProperty(i, "ctype", radium)
end
end
if (xDist >= 3) and (sim.partProperty(i, "vx") <= 3) then
sim.partProperty(i, "vx", sim.partProperty(i, "vx") + 1)
end
if (xDist <= -3) and (sim.partProperty(i, "vx") >= -3) then
sim.partProperty(i, "vx", sim.partProperty(i, "vx") - 1)
end
if (yDist >= 3) and (sim.partProperty(i, "vy") <= 3) then
sim.partProperty(i, "vy", sim.partProperty(i, "vy") + 1)
end
if (yDist <= -3) and (sim.partProperty(i, "vy") >= -3) then
sim.partProperty(i, "vy", sim.partProperty(i, "vy") - 1)
end
elseif (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_INSL) then -- wall
if (math.abs(sim.partProperty(i, "vx")) >= 1) then
sim.partProperty(i, "vx", sim.partProperty(i, "vx") * 0.8)
end
if (math.abs(sim.partProperty(i, "vy")) >= 1) then
sim.partProperty(i, "vy", sim.partProperty(i, "vy") * 0.8)
end
local spaceCount = 0
local wallCount = 0
local otherCount = 0
for xOffset = -1, 1, 1 do
for yOffset = -1, 1, 1 do
local currX = x + xOffset
local currY = y + yOffset
local currPart = sim.pmap(currX, currY)
if (currPart == nil) then
spaceCount = spaceCount + 1
elseif (sim.partProperty(currPart, "type") ~= radAmoeba) then
spaceCount = spaceCount + 1
elseif (sim.partProperty(currPart, "ctype") == elements.DEFAULT_PT_INSL) then
wallCount = wallCount + 1
else
otherCount = otherCount + 1
end
end
end
if (wallCount >= 4) and (spaceCount <= 1) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_URAN)
elseif (spaceCount == 0) then
local wallTransfer = 1
local eaterCount = 0
for part in sim.neighbors(x, y, 1, 1, radAmoeba) do
if (sim.partProperty(part, "ctype") == elements.DEFAULT_PT_URAN) then
local spaceCount = 0
for xOffset = -1, 1, 1 do
for yOffset = -1, 1, 1 do
local currX = sim.partProperty(part, "x") + xOffset
local currY = sim.partProperty(part, "y") + yOffset
local currPart = sim.pmap(currX, currY)
if (currPart == nil) then
spaceCount = spaceCount + 1
elseif (sim.partProperty(currPart, "ctype") == radium) then
eaterCount = eaterCount + 1
end
end
end
if (spaceCount >= 2) and (wallTransfer == 1) then
sim.partProperty(part, "ctype", elements.DEFAULT_PT_INSL)
wallTransfer = 0
end
end
end
if (eaterCount >= 3) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_URAN)
else
sim.partProperty(i, "ctype", radium)
end
elseif (spaceCount >= 4) and (math.random(1, 300) == 1) then
local newPart = sim.partCreate(-3, math.random(x - 1, x + 1), math.random(y - 1, y + 1), elements.DEFAULT_PT_NEUT)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", 10 + sim.partProperty(i, "temp"))
end
sim.pressure(x / 4, y / 4, sim.pressure(x / 4, y / 4) + 0.5)
end
elseif (sim.partProperty(i, "ctype") == radium) then -- eater
if (math.random(1, 10) == 1) then -- only run eating behavior some of the time, to reduce lag and reduce chance of consumption of its own neutrons
local metals = {elements.DEFAULT_PT_IRON, elements.DEFAULT_PT_METL, elements.DEFAULT_PT_BMTL, elements.DEFAULT_PT_BRMT, elements.DEFAULT_PT_SLCN,
elements.DEFAULT_PT_BREC, elements.DEFAULT_PT_URAN, elements.DEFAULT_PT_PLUT, elements.DEFAULT_PT_POLO, radium, actinium, curium}
for part in sim.neighbors(x, y, 1, 1) do
local match = false
for k, v in pairs(metals) do
if (sim.partProperty(part, "type") == v) then
match = true
end
end
if not (match) then
if (bit.band(elements.property(sim.partProperty(part, "type"), "Properties"), elements.TYPE_ENERGY) > 0) then -- check if particle is energy
match = true
end
end
if (match) then
sim.partProperty(part, "ctype", 0)
sim.partProperty(part, "type", radAmoeba)
end
end
elseif (s >= 4) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_INSL)
end
elseif (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_URAN) then -- mass
if (s >= 3) then -- empty spaces nearby
sim.partProperty(i, "ctype", elements.DEFAULT_PT_INSL)
elseif (math.random(1, 120) == 1) then
sim.partProperty(i, "ctype", 0) -- auto-reassign if needed (e.g. regions with no nuclei)
end
end
local tempThreshold = 273 - 50 -- most particles will start to die at -50 C
if (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_INSL) then
tempThreshold = 273 - 75 -- walls are more resilient and can handle down to -75 C
end
if (sim.partProperty(i, "temp") <= tempThreshold) then
if (sim.partProperty(i, "temp") <= 5) or (math.random(1, sim.partProperty(i, "temp")) == 1) then
if (math.random(1, 2) == 1) then
sim.partProperty(i, "ctype", 0)
sim.partProperty(i, "temp", sim.partProperty(i, "temp") + 2)
if (math.random(1, 2) == 1) then
sim.partProperty(i, "type", elements.DEFAULT_PT_URAN)
else
sim.partProperty(i, "type", radon)
end
else
sim.partKill(i)
end
return -1
end
end
end
local function radAmoebaGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT
if (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_URAN) then -- mass
rRed = rRed + math.random(1, 50)
rGreen = rGreen + math.random(1, 50)
elseif (sim.partProperty(i, "ctype") == radium) then -- eater
rMode = rMode + ren.PMODE_GLOW
elseif (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_INSL) then -- wall
rMode = rMode + ren.PMODE_BLUR
if (math.random(1, 4) == 1) then
rMode = rMode + ren.PMODE_GLOW
end
rRed = 150
rGreen = rGreen + 50
rBlue = 130
elseif (sim.partProperty(i, "ctype") == radAmoeba) then -- nucleus
rRed = rGreen + 20
rMode = rMode + ren.PMODE_GLOW
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(radAmoeba, "Update", radAmoebaUpdate)
elements.property(radAmoeba, "Graphics", radAmoebaGraphics)
local lead = elements.allocate("ARAD", "LEAD")
elements.element(lead, elements.element(elements.DEFAULT_PT_TTAN))
elements.property(lead, "Name", "LEAD")
elements.property(lead, "Description", "Lead. Absorbs radiation efficiently, but heats up in the process. Low melting point. Can also oxidize.")
elements.property(lead, "Color", 0x6677cc)
elements.property(lead, "MenuVisible", 1)
elements.property(lead, "MenuSection", elements.SC_SOLIDS)
elements.property(lead, "HighTemperature", 273 + 327) -- 327 C, the melting point of lead
elements.property(lead, "HeatConduct", 200)
elements.property(lead, "Properties", elements.TYPE_SOLID + elements.PROP_CONDUCTS + elements.PROP_LIFE_DEC + elements.PROP_NEUTPASS)
elements.property(lead, "PhotonReflectWavelengths", 0x0)
local function leadUpdate(i, x, y, s, nt)
if (nt >= 2) then
local oxiFactor = 0
for part in sim.neighbors(x, y, 1, 1) do
local oxiPart = false
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_O2) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_CO2) then
oxiFactor = oxiFactor + 3
oxiPart = true
elseif (sim.partProperty(part, "type") == elements.DEFAULT_PT_FOG) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_WTRV) then
oxiFactor = oxiFactor + 2
oxiPart = true
elseif (sim.partProperty(part, "type") == elements.DEFAULT_PT_BOYL) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_GAS) then
oxiFactor = oxiFactor + 1
oxiPart = true
end
if (sim.partProperty(i, "tmp") < 1) and (oxiFactor >= 3) and (math.random(1, 4) == 1) and (oxiPart) then
sim.partProperty(i, "tmp", 1)
sim.partProperty(part, "type", elements.DEFAULT_PT_EMBR)
sim.partProperty(part, "life", math.random(90, 120))
end
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_PROT) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_NEUT) then
sim.partProperty(i, "temp", sim.partProperty(i, "temp") + (sim.partProperty(part, "temp") / 5) - 5)
sim.partKill(part)
end
end
else
local partHere = sim.photons(x, y)
if (partHere ~= nil) and (math.random(1, 2) == 1) then
if (sim.partProperty(partHere, "type") == elements.DEFAULT_PT_PROT) or (sim.partProperty(partHere, "type") == elements.DEFAULT_PT_NEUT) then
sim.partProperty(i, "temp", sim.partProperty(i, "temp") + (sim.partProperty(partHere, "temp") / 5) - 5)
sim.partKill(partHere)
end
end
if (sim.partProperty(i, "life") == 1) then
sim.partProperty(i, "temp", sim.partProperty(i, "temp") + 1)
end
end
end
local function leadGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT
if (sim.partProperty(i, "tmp") == 1) then
rRed = rRed / 2
rGreen = rGreen / 2
rBlue = (rBlue / 2) - 10
end
if (sim.partProperty(i, "temp") >= (273 + 227)) then
local tempDiff = sim.partProperty(i, "temp") - 273 - 227
rRed = rRed + tempDiff
rBlue = rBlue - tempDiff
if (rBlue < 10) then
rBlue = 10
end
if (tempDiff >= 50) and (math.random(1, 4) == 1) then
rMode = rMode + ren.FIRE_ADD
rBlue = (rBlue * 0.8)
end
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(lead, "Update", leadUpdate)
elements.property(lead, "Graphics", leadGraphics)
local chromium = elements.allocate("ARAD", "CHRM")
local liquidChromium = elements.allocate("ARAD", "LCHR")
local steel = elements.allocate("ARAD", "SSTL")
elements.element(chromium, elements.element(elements.DEFAULT_PT_TTAN))
elements.property(chromium, "Name", "CHRM")
elements.property(chromium, "Description", "Chromium. Shiny and conductive metal with a high melting point.")
elements.property(chromium, "Color", 0xddddee)
elements.property(chromium, "Hardness", 1)
elements.property(chromium, "MenuVisible", 1)
elements.property(chromium, "MenuSection", elements.SC_SOLIDS)
elements.property(chromium, "Properties", elements.TYPE_SOLID + elements.PROP_CONDUCTS + elements.PROP_LIFE_DEC)
elements.property(chromium, "HighTemperature", 1907 + 273)
elements.property(chromium, "HighTemperatureTransition", liquidChromium)
local function chromiumGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT
local partTemp = sim.partProperty(i, "temp")
if (partTemp >= (1407 + 273)) then
local tempDiff = partTemp - 1407 - 273
rRed = rRed + (tempDiff / 20)
if (rRed > 250) then
rRed = 250
end
rGreen = rGreen - (tempDiff / 10)
if (rGreen < 150) then
rGreen = 150
end
rBlue = rBlue - (tempDiff / 4) - 5
if (rBlue < 100) then
rBlue = 100
end
if (math.random(1, 4) == 1) then
rMode = rMode + ren.FIRE_ADD
end
end
local partLife = sim.partProperty(i, "life")
if (partLife >= 2) and (math.random(1, 6) <= partLife) then
rGreen = rGreen + 10
rBlue = rBlue + 10
rMode = rMode + ren.PMODE_FLARE
else
rGreen = rGreen + math.random(1, 10)
rBlue = rBlue + math.random(1, 10)
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(chromium, "Graphics", chromiumGraphics)
elements.element(liquidChromium, elements.element(elements.DEFAULT_PT_GEL))
elements.property(liquidChromium, "Name", "LCHR")
elements.property(liquidChromium, "Description", "Liquid chromium. Very hot. Can be combined with molten METL or IRON to make stainless steel.")
elements.property(liquidChromium, "Color", 0xffcc66)
elements.property(liquidChromium, "MenuVisible", 1)
elements.property(liquidChromium, "MenuSection", elements.SC_LIQUID)
elements.property(liquidChromium, "Properties", elements.TYPE_LIQUID + elements.PROP_DEADLY + elements.PROP_LIFE_DEC)
elements.property(liquidChromium, "Temperature", 2100 + 273.15)
elements.property(liquidChromium, "LowTemperature", 1906 + 273)
elements.property(liquidChromium, "LowTemperatureTransition", chromium)
local function liquidChromiumUpdate(i, x, y, s, nt)
if (nt >= 1) then
for part in sim.neighbors(x, y, 1, 1, elements.DEFAULT_PT_LAVA) do
if (sim.partProperty(part, "ctype") == elements.DEFAULT_PT_IRON) or (sim.partProperty(part, "ctype") == elements.DEFAULT_PT_METL) then
if (sim.partProperty(i, "ctype") ~= steel) then
sim.partProperty(i, "ctype", steel)
sim.partProperty(i, "life", 60)
sim.partKill(part)
end
end
end
end
if (sim.partProperty(i, "ctype") == steel) and (sim.partProperty(i, "life") == 0) then
sim.partProperty(i, "temp", sim.partProperty(i, "temp") + 5)
sim.partProperty(i, "type", elements.DEFAULT_PT_LAVA)
return -1
end
end
local function liquidChromiumGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT + ren.PMODE_BLUR
if (math.random(1, 120) <= sim.partProperty(i, "life")) then
rGreen = rGreen + 5
rBlue = rBlue + 5
rMode = rMode + ren.PMODE_LFLARE
elseif (math.random(1, 4) == 1) then
rGreen = rGreen + 6
rBlue = rBlue + 12
rMode = rMode + ren.FIRE_ADD
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(liquidChromium, "Update", liquidChromiumUpdate)
elements.property(liquidChromium, "Graphics", liquidChromiumGraphics)
elements.element(steel, elements.element(elements.DEFAULT_PT_TTAN))
elements.property(steel, "Name", "SSTL")
elements.property(steel, "Description", "Stainless steel. Highly durable metal, can even defend against VIRS.")
elements.property(steel, "Color", 0xcccccc)
elements.property(steel, "Hardness", 0)
elements.property(steel, "MenuVisible", 1)
elements.property(steel, "MenuSection", elements.SC_SOLIDS)
elements.property(steel, "Properties", elements.TYPE_SOLID + elements.PROP_CONDUCTS + elements.PROP_LIFE_DEC + elements.PROP_HOT_GLOW + elements.PROP_SPARKSETTLE)
elements.property(steel, "HighTemperature", 1550 + 273)
local function steelUpdate(i, x, y, s, nt)
if (nt >= 1) then
for part in sim.neighbors(x, y, 1, 1) do
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_VIRS) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_VRSS) or (sim.partProperty(part, "type") == elements.DEFAULT_PT_VRSG) then
sim.partProperty(part, "type", elements.DEFAULT_PT_EMBR)
sim.partProperty(part, "ctype", 0xee33ff)
sim.partProperty(part, "life", math.random(30, 120))
end
end
end
end
elements.property(steel, "Update", steelUpdate)
local nanite = elements.allocate("ARAD", "NBOT")
elements.element(nanite, elements.element(elements.DEFAULT_PT_GEL))
elements.property(nanite, "Name", "NBOT")
elements.property(nanite, "Description", "Nanobots. Can alter their behavior. Spark with PSCN to harden, NSCN to liquefy, or CHRM to assimilate.")
elements.property(nanite, "Color", 0x9999aa)
elements.property(nanite, "Weight", 46)
elements.property(nanite, "Gravity", 0.15)
elements.property(nanite, "MenuVisible", 1)
elements.property(nanite, "MenuSection", elements.SC_POWERED)
elements.property(nanite, "Properties", elements.TYPE_LIQUID + elements.PROP_LIFE_DEC)
local function naniteUpdate(i, x, y, s, nt)
if (sim.partProperty(i, "life") <= 0) then
for part in sim.neighbors(x, y, 1, 1) do
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_SPRK) and (sim.partProperty(part, "life") == 3) then
if (sim.partProperty(part, "ctype") == elements.DEFAULT_PT_PSCN) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_PSCN)
sim.partProperty(i, "life", 12)
elseif (sim.partProperty(part, "ctype") == elements.DEFAULT_PT_NSCN) then
sim.partProperty(i, "ctype", elements.DEFAULT_PT_NSCN)
sim.partProperty(i, "life", 12)
elseif (sim.partProperty(part, "ctype") == chromium) then
sim.partProperty(i, "ctype", chromium)
sim.partProperty(i, "life", 12)
end
elseif (sim.partProperty(part, "type") == nanite) and (sim.partProperty(part, "life") == 11)
and (sim.partProperty(i, "ctype") ~= sim.partProperty(part, "ctype")) then
sim.partProperty(i, "ctype", sim.partProperty(part, "ctype"))
sim.partProperty(i, "life", 12)
end
end
end
if (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_PSCN) or (nt == 0) then
sim.partProperty(i, "vx", 0)
sim.partProperty(i, "vy", 0)
elseif (sim.partProperty(i, "ctype") == chromium) and (sim.partProperty(i, "life") <= 4) and (math.random(1, 4) == 1) then
sim.partProperty(i, "type", chromium)
end
if (sim.partProperty(i, "tmp") <= 0) then
if (sim.partProperty(i, "ctype") == elements.DEFAULT_PT_PSCN) and (math.random(1, 240) == 1) then
sim.partProperty(i, "tmp", math.random(60, 90))
end
else
sim.partProperty(i, "tmp", sim.partProperty(i, "tmp") - 1)
end
end
local function naniteGraphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT
if (sim.partProperty(i, "life") >= 9) then
rRed = rRed + (sim.partProperty(i, "life") * 2)
rGreen = rGreen + (sim.partProperty(i, "life") * 2)
rBlue = rBlue + (sim.partProperty(i, "life") * 3)
if (math.random(1, 12) == 1) or (sim.partProperty(i, "life") == 12) then
rMode = rMode + ren.PMODE_FLARE
end
elseif (sim.partProperty(i, "tmp") >= 1) then
local lMod = sim.partProperty(i, "tmp")
if (lMod >= 90) then
lMod = 90
end
rRed = rRed + math.floor(lMod * 0.1) - 12
rGreen = rGreen + math.floor(lMod * 0.6) - 10
rBlue = rBlue + lMod - 8
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(nanite, "Update", naniteUpdate)
elements.property(nanite, "Graphics", naniteGraphics)
local forceField1 = elements.allocate("ARAD", "FP32")
elements.element(forceField1, elements.element(elements.DEFAULT_PT_FRME))
elements.property(forceField1, "Name", "FP32")
elements.property(forceField1, "Description", "Force Field Projector P32. Requires continuous power. Produces a circular light shield.")
elements.property(forceField1, "Color", 0x00ee99)
elements.property(forceField1, "MenuVisible", 1)
elements.property(forceField1, "MenuSection", elements.SC_POWERED)
elements.property(forceField1, "Properties", elements.TYPE_SOLID + elements.PROP_LIFE_DEC)
local function ff1Update(i, x, y, s, nt)
if (nt >= 1) then
for part in sim.neighbors(x, y, 1, 1) do
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_SPRK) and (sim.partProperty(part, "life") == 3) then
sim.partProperty(i, "life", 10)
end
end
end
if (sim.partProperty(i, "tmp") >= 360) then
sim.partProperty(i, "tmp", sim.partProperty(i, "tmp") - 358)
else
sim.partProperty(i, "tmp", sim.partProperty(i, "tmp") + 2)
end
local lRads = sim.partProperty(i, "tmp") * (3.142 / 180)
local xMod = math.floor(33 * math.sin(lRads))
local yMod = math.floor(33 * math.cos(lRads)) * -1 -- positive Y is down in TPT, so this needs to be inverted
local function shieldCreate(lp, nx, ny)
if (sim.photons(nx, ny) ~= nil) then
sim.partKill(sim.photons(nx, ny))
end
if (sim.pmap(nx, ny) ~= nil) and (sim.partProperty(sim.pmap(nx, ny), "type") == elements.DEFAULT_PT_BRAY) and (sim.partProperty(sim.pmap(nx, ny), "life") <= 30) then
sim.partKill(sim.pmap(nx, ny))
end
local newPart = sim.partCreate(-1, nx, ny, elements.DEFAULT_PT_BRAY)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", sim.partProperty(lp, "temp") - 2)
sim.partProperty(newPart, "life", 90)
sim.partProperty(newPart, "ctype", 0xff80)
end
end
if (sim.partProperty(i, "life") >= 1) then
shieldCreate(i, x + xMod, y + yMod)
shieldCreate(i, x - xMod, y - yMod)
local xMod = math.floor(34 * math.sin(lRads))
local yMod = math.floor(34 * math.cos(lRads)) * -1
shieldCreate(i, x + xMod, y + yMod)
shieldCreate(i, x - xMod, y - yMod)
end
end
local function ff1Graphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT
if (sim.partProperty(i, "life") >= 1) and (sim.partProperty(i, "life") <= 11) then
rRed = rRed + (sim.partProperty(i, "life") * 3)
rBlue = rBlue + (sim.partProperty(i, "life") * 3)
rMode = rMode + ren.PMODE_GLOW
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(forceField1, "Update", ff1Update)
elements.property(forceField1, "Graphics", ff1Graphics)
local forceField2 = elements.allocate("ARAD", "FP96")
elements.element(forceField2, elements.element(elements.DEFAULT_PT_FRME))
elements.property(forceField2, "Name", "FP96")
elements.property(forceField2, "Description", "Force Field Projector P96. Requires continuous power. Produces a larger circular shield.")
elements.property(forceField2, "Color", 0x0099ee)
elements.property(forceField2, "MenuVisible", 1)
elements.property(forceField2, "MenuSection", elements.SC_POWERED)
elements.property(forceField2, "Properties", elements.TYPE_SOLID + elements.PROP_LIFE_DEC)
local function ff2Update(i, x, y, s, nt)
if (nt >= 1) then
for part in sim.neighbors(x, y, 1, 1) do
if (sim.partProperty(part, "type") == elements.DEFAULT_PT_SPRK) and (sim.partProperty(part, "life") == 3) then
sim.partProperty(i, "life", 10)
end
end
end
if (sim.partProperty(i, "tmp") >= 360) then
sim.partProperty(i, "tmp", sim.partProperty(i, "tmp") - 359)
else
sim.partProperty(i, "tmp", sim.partProperty(i, "tmp") + 1)
end
local lRads = sim.partProperty(i, "tmp") * (3.142 / 180)
local xMod = math.floor(97 * math.sin(lRads))
local yMod = math.floor(97 * math.cos(lRads)) * -1 -- positive Y is down in TPT, so this needs to be inverted
local function shieldCreate(lp, nx, ny)
if (sim.photons(nx, ny) ~= nil) then
sim.partKill(sim.photons(nx, ny))
end
if (sim.pmap(nx, ny) ~= nil) and (sim.partProperty(sim.pmap(nx, ny), "type") == elements.DEFAULT_PT_BRAY) and (sim.partProperty(sim.pmap(nx, ny), "life") <= 30) then
sim.partKill(sim.pmap(nx, ny))
end
local newPart = sim.partCreate(-1, nx, ny, elements.DEFAULT_PT_BRAY)
if (newPart >= 0) then
sim.partProperty(newPart, "temp", sim.partProperty(lp, "temp") - 2)
sim.partProperty(newPart, "life", 120)
sim.partProperty(newPart, "ctype", 0x17ff)
end
end
if (sim.partProperty(i, "life") >= 1) then
for j = 97, 99 do
for k = 0, 2 do
xMod = math.floor(j * math.sin(lRads + (k * 2.094)))
yMod = math.floor(j * math.cos(lRads + (k * 2.094))) * -1
-- 2.094 = 2(pi)/3; creates points that form an equilateral triangle, hopefully
shieldCreate(i, x + xMod, y + yMod)
end
end
end
end
local function ff2Graphics(i, colr, colg, colb)
local rRed = colr
local rGreen = colg
local rBlue = colb
local rMode = ren.PMODE_FLAT
if (sim.partProperty(i, "life") >= 1) and (sim.partProperty(i, "life") <= 11) then
rRed = rRed + (sim.partProperty(i, "life") * 3)
rGreen = rGreen + (sim.partProperty(i, "life") * 3)
rMode = rMode + ren.PMODE_GLOW
end
return 0, rMode, 150, rRed, rGreen, rBlue, 50, rRed, rGreen, rBlue
end
elements.property(forceField2, "Update", ff2Update)
elements.property(forceField2, "Graphics", ff2Graphics)