Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local awf = elements.allocate("OS", "AWF")
- elements.element(awf, elements.element(elem.DEFAULT_PT_WIFI))
- elements.property(awf, "Name", "AWF")
- elements.property(awf, "Description", "Atmospheric Wi-Fi. Designed for pressurized environments.")
- elements.property(awf, "Colour", 0x40A060)
- elements.property(awf, "HighPressure", 257)
- elements.property(awf, "HighPressureTransition", -1)
- local wireless = {}
- local CHANNELS = 201 --changing this would probably break it slightly
- for i = 1,CHANNELS do
- wireless[i] = {[0]=false, [1]=false}
- end
- function WIFI_update()
- for i = 1,CHANNELS do
- if wireless[i][1] then
- wireless[i] = {[0]=true, [1]=false}
- else
- wireless[i] = {[0]=false, [1]=false}
- end
- end
- end
- tpt.register_step(WIFI_update)
- function AWF_update(i, x, y, s, n)
- local tmp = math.floor((sim.partProperty(i, sim.FIELD_TEMP)+76.75)/50)
- if tmp > CHANNELS then
- tmp = CHANNELS
- elseif tmp < 1 then
- tmp = 1
- end
- sim.partProperty(i, sim.FIELD_TMP, tmp)
- for r in sim.neighbors(x, y, 1, 1) do
- local type = sim.partProperty(r, sim.FIELD_TYPE)
- if wireless[tmp][0] then
- if (type == elem.DEFAULT_PT_NSCN or type == elem.DEFAULT_PT_PSCN or type == elem.DEFAULT_PT_INWR) and sim.partProperty(r, sim.FIELD_LIFE) == 0 then
- sim.partProperty(r, sim.FIELD_CTYPE, type)
- sim.partChangeType(r, elem.DEFAULT_PT_SPRK)
- sim.partProperty(r, sim.FIELD_LIFE, 4)
- end
- elseif type == elem.DEFAULT_PT_SPRK and sim.partProperty(r, sim.FIELD_CTYPE) ~= elem.DEFAULT_PT_NSCN and sim.partProperty(r, sim.FIELD_LIFE) == 3 then
- wireless[tmp][1] = true
- end
- end
- end
- elements.property(awf, "Update", AWF_update)
- local function AWF_graphics(i, colr, colg, colb)
- local frequency = 0.031415
- local tmp = math.floor((sim.partProperty(i, sim.FIELD_TEMP)+76.75)/50)
- local colr = math.sin(frequency*tmp + 0) * 100 + 100
- local colg = math.sin(frequency*tmp + 2) * 100 + 100
- local colb = math.sin(frequency*tmp + 4) * 100 + 100
- return 0, ren.PMODE_FLAT + ren.EFFECT_DBGLINES, 255, colr, colg, colb, 0, 0, 0, 0
- end
- elements.property(awf, "Graphics", AWF_graphics)
Advertisement
Add Comment
Please, Sign In to add comment