This commit is contained in:
abbie 2022-03-27 17:59:05 +01:00
parent 1a622eb162
commit b74dca584f
No known key found for this signature in database
GPG key ID: 04DDE463F9200F87
4 changed files with 70 additions and 2 deletions

6
README
View file

@ -5,3 +5,9 @@ A mod for The Powder Toy using NACSL. It adds cool elements.
Elements Elements
------------ ------------
* BVIR - An unkillable, ever-spreadable virus. * BVIR - An unkillable, ever-spreadable virus.
* HYBT - An unmeltable battery (broken at the moment).
* FLSA - Flaming sand, spawns at 10,000 Kelvin.
Note
--------
This mod must be placed in "nacsl/viruslabs" to properly work.

View file

@ -3,4 +3,8 @@
<h2>Elements</h2> <h2>Elements</h2>
<ul> <ul>
<li>BVIR - An unkillable, ever-spreadable virus.</li> <li>BVIR - An unkillable, ever-spreadable virus.</li>
<li>HYBT - An unmeltable battery (broken at the moment).</li>
<li>FLSA - Flaming sand, spawns at 10,000 Kelvin.</li>
</ul> </ul>
<h2>Note</h2>
<p>This mod must be placed in "nacsl/viruslabs" to properly work.</p>

View file

@ -1,5 +1,5 @@
VirusLabs VirusLabs
0.0.1 0.0.2
threeoh6000 threeoh6000
Elements that are experimental and scary! VirusLabs brings the best in elemental technology! Elements that are experimental and scary! VirusLabs brings the best in elemental technology!
0.1.0 0.2.0

58
run.lua
View file

@ -1,3 +1,31 @@
local vanilla = false
if fs.exists("nacsl/viruslabs/labs.conf") then
local f = io.open("nacsl/viruslabs/labs.conf")
io.input(f)
local i = 0
for x in io.lines() do
if x == "true" and i == 0 then
vanilla = true
elseif x == "false" and i == 0 then
vanilla = false
end
end
io.close(f)
end
local function updatesettings()
local f = io.open("nacsl/viruslabs/labs.conf", "w")
io.output(f)
if vanilla then
vanilla = false
io.write("false")
else
vanilla = true
io.write("true")
end
io.close()
end
local bluevirus = elements.allocate("VIRUSLABS","BVIR") local bluevirus = elements.allocate("VIRUSLABS","BVIR")
elements.element(bluevirus, elements.element(elements.DEFAULT_PT_VIRS)) elements.element(bluevirus, elements.element(elements.DEFAULT_PT_VIRS))
elements.property(bluevirus, "Name", "BVIR") elements.property(bluevirus, "Name", "BVIR")
@ -18,4 +46,34 @@ local function bluevirusinfect(i,x,y,s,nt)
end end
elements.property(bluevirus, "Update", bluevirusinfect) elements.property(bluevirus, "Update", bluevirusinfect)
local superheat = elements.allocate("VIRUSLABS","FLSA")
elements.element(superheat, elements.element(elements.DEFAULT_PT_SAND))
elements.property(superheat, "Name", "FLSA")
elements.property(superheat, "Description", "Flaming sand, extremely hot.")
elements.property(superheat, "Temperature", 10000)
elements.property(superheat, "Colour", 0xBC544B)
elements.property(superheat, "Meltable", 0)
local superbattery = elements.allocate("VIRUSLABS","HYBT")
elements.element(superbattery, elements.element(elements.DEFAULT_PT_BTRY))
elements.property(superbattery, "Name", "HYBT")
elements.property(superbattery, "Description", "Hyper Battery, can't melt.")
elements.property(superbattery, "HighTemperature", ITL)
local function spark(i,x,y,s,nt)
for r in sim.neighbors(x,y,1,1) do
if sim.partProperty(r,"type") ~= elem.VIRUSLABS_PT_HYBT then
sim.partChangeType(r,DEFAULT_PT_SPRK)
end
end
end
elements.property(superbattery, "Update", spark)
local modmenu = Window:new(-1,-1,92,48)
local vanillabox = Checkbox:new(6,24,16,16,"Vanilla Mode")
local closebut = Button:new(77,0,15,15,"X")
vanillabox:checked(vanilla)
vanillabox:action(function(sender, checked) updatesettings() end)
closebut:action(function(sender) interface.closeWindow(modmenu) end)
modmenu:addComponent(closebut)
modmenu:addComponent(vanillabox)
nacsl.hook("viruslabs",modmenu)
print("VirusLabs activated!") print("VirusLabs activated!")