mirror of
https://github.com/goonstation/goonstation-2016.git
synced 2026-08-25 06:56:22 +01:00
Initial Commit
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////
|
||||
//// SMOKE SYSTEMS
|
||||
// direct can be optinally added when set_up, to make the smoke always travel in one direction
|
||||
// in case you wanted a vent to always smoke north for example
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/datum/effects/system/bad_smoke_spread
|
||||
var/number = 3
|
||||
var/cardinals = 0
|
||||
var/turf/location
|
||||
var/atom/holder
|
||||
var/total_smoke = 0 // To stop it being spammed and lagging!
|
||||
var/direction
|
||||
var/color = null
|
||||
|
||||
/datum/effects/system/bad_smoke_spread/proc/set_up(n = 5, c = 0, loca, direct, color)
|
||||
if(n > 20)
|
||||
n = 20
|
||||
number = n
|
||||
cardinals = c
|
||||
src.color = color
|
||||
if(istype(loca, /turf/))
|
||||
location = loca
|
||||
else
|
||||
location = get_turf(loca)
|
||||
if(direct)
|
||||
direction = direct
|
||||
|
||||
|
||||
/datum/effects/system/bad_smoke_spread/proc/attach(atom/atom)
|
||||
holder = atom
|
||||
|
||||
/datum/effects/system/bad_smoke_spread/proc/start()
|
||||
var/i = 0
|
||||
for(i=0, i<src.number, i++)
|
||||
if(src.total_smoke > 20)
|
||||
return
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effects/bad_smoke/smoke = unpool(/obj/effects/bad_smoke)
|
||||
smoke.color = color
|
||||
smoke.set_loc(src.location)
|
||||
src.total_smoke++
|
||||
var/direction = src.direction
|
||||
if(!direction)
|
||||
if(src.cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
for(var/j=0, j<pick(0,1,1,1,2,2,2,3), j++)
|
||||
sleep(10)
|
||||
step(smoke,direction)
|
||||
spawn(150+rand(10,30))
|
||||
if (smoke)
|
||||
pool(smoke)
|
||||
src.total_smoke--
|
||||
@@ -0,0 +1,68 @@
|
||||
/datum/effects/system/foam_spread
|
||||
var/amount = 5 // the size of the foam spread.
|
||||
var/turf/location
|
||||
var/list/carried_reagents // the IDs of reagents present when the foam was mixed
|
||||
var/metal = 0 // 0=foam, 1=metalfoam, 2=ironfoam,
|
||||
var/temperature = T0C
|
||||
var/list/banned_reagents = list("smokepowder", "thalmerite", "fluorosurfactant", "stimulants", "salt")
|
||||
|
||||
/datum/effects/system/foam_spread/proc/set_up(amt=5, loca, var/datum/reagents/carry = null, var/metalfoam = 0)
|
||||
if (!carry)
|
||||
return
|
||||
amount = round(amt/5, 1)
|
||||
amount = min(amount, 7) // FUCK infinifoam holy shit
|
||||
if(istype(loca, /turf/))
|
||||
location = loca
|
||||
else
|
||||
location = get_turf(loca)
|
||||
|
||||
carried_reagents = list()
|
||||
metal = metalfoam
|
||||
temperature = carry.total_temperature
|
||||
|
||||
// bit of a hack here. Foam carries along any reagent also present in the glass it is mixed
|
||||
// with (defaults to water if none is present). Rather than actually transfer the reagents,
|
||||
// this makes a list of the reagent ids and spawns 1 unit of that reagent when the foam disolves.
|
||||
|
||||
if(carry && !metal)
|
||||
for(var/reagent_id in carry.reagent_list)
|
||||
var/datum/reagent/current_reagent = carry.reagent_list[reagent_id]
|
||||
carried_reagents[reagent_id] = current_reagent.volume
|
||||
|
||||
/datum/effects/system/foam_spread/proc/start()
|
||||
spawn(0)
|
||||
var/obj/effects/foam/F = locate() in location
|
||||
if(F)
|
||||
DEBUG("Located [F] in [location]")
|
||||
F.amount += amount
|
||||
F.amount = min(F.amount, 27)
|
||||
return
|
||||
|
||||
F = unpool(/obj/effects/foam)
|
||||
F.set_up(src.location, metal)
|
||||
F.amount = amount
|
||||
|
||||
if(!metal) // don't carry other chemicals if a metal foam
|
||||
F.create_reagents(15)
|
||||
|
||||
if(carried_reagents)
|
||||
for(var/id in carried_reagents)
|
||||
//Limit reagents in foam to 3 so the nerds can't bomb eveyrthing all day
|
||||
if (banned_reagents.Find("[id]"))
|
||||
continue
|
||||
var/datum/reagent/reagent_volume = carried_reagents[id]
|
||||
F.reagents.add_reagent(id,min(reagent_volume,3), null, temperature)
|
||||
F.overlays.len = 0
|
||||
F.icon_state = "foam"
|
||||
F.foamcolor = F.reagents.get_master_color()
|
||||
var/icon/I = new /icon('icons/effects/effects.dmi',"foam_overlay")
|
||||
I.Blend(F.foamcolor, ICON_ADD)
|
||||
F.overlays += I
|
||||
else
|
||||
F.reagents.add_reagent("cleaner", 1)
|
||||
F.overlays.len = 0
|
||||
F.icon_state = "foam"
|
||||
F.foamcolor = F.reagents.get_master_color()
|
||||
var/icon/I = new /icon('icons/effects/effects.dmi',"foam_overlay")
|
||||
I.Blend(F.foamcolor, ICON_ADD)
|
||||
F.overlays += I
|
||||
@@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////
|
||||
//// SMOKE SYSTEMS
|
||||
// direct can be optinally added when set_up, to make the smoke always travel in one direction
|
||||
// in case you wanted a vent to always smoke north for example
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/datum/effects/system/harmless_smoke_spread
|
||||
var/number = 3
|
||||
var/cardinals = 0
|
||||
var/turf/location
|
||||
var/atom/holder
|
||||
var/total_smoke = 0 // To stop it being spammed and lagging!
|
||||
var/direction
|
||||
|
||||
/datum/effects/system/harmless_smoke_spread/proc/set_up(n = 5, c = 0, loca, direct)
|
||||
if(n > 10)
|
||||
n = 10
|
||||
number = n
|
||||
cardinals = c
|
||||
if(istype(loca, /turf/))
|
||||
location = loca
|
||||
else
|
||||
location = get_turf(loca)
|
||||
if(direct)
|
||||
direction = direct
|
||||
|
||||
|
||||
/datum/effects/system/harmless_smoke_spread/proc/attach(atom/atom)
|
||||
holder = atom
|
||||
|
||||
/datum/effects/system/harmless_smoke_spread/proc/start()
|
||||
var/i = 0
|
||||
for(i=0, i<src.number, i++)
|
||||
if(src.total_smoke > 20)
|
||||
return
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effects/harmless_smoke/smoke = unpool(/obj/effects/harmless_smoke)
|
||||
smoke.set_loc(src.location)
|
||||
src.total_smoke++
|
||||
var/direction = src.direction
|
||||
if(!direction)
|
||||
if(src.cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
for(var/j=0, j<pick(0,1,1,1,2,2,2,3), j++)
|
||||
sleep(10)
|
||||
step(smoke,direction)
|
||||
spawn(75+rand(10,30))
|
||||
if (smoke)
|
||||
pool(smoke)
|
||||
src.total_smoke--
|
||||
@@ -0,0 +1,50 @@
|
||||
/datum/effects/system/ion_trail_follow
|
||||
var/atom/holder
|
||||
var/turf/oldposition
|
||||
var/processing = 1
|
||||
var/on = 1
|
||||
var/offset = 0
|
||||
var/istate = "ion_fade"
|
||||
|
||||
/datum/effects/system/ion_trail_follow/proc/set_up(atom/atom, pixel_offset = 0, state = 0)
|
||||
holder = atom
|
||||
oldposition = get_turf(atom)
|
||||
if (pixel_offset)
|
||||
offset = pixel_offset
|
||||
if (state)
|
||||
istate = state
|
||||
|
||||
/datum/effects/system/ion_trail_follow/proc/start()
|
||||
if(!src.on)
|
||||
src.on = 1
|
||||
src.processing = 1
|
||||
if(src.processing)
|
||||
src.processing = 0
|
||||
spawn(0)
|
||||
var/turf/T = get_turf(src.holder)
|
||||
if(T != src.oldposition)
|
||||
if(istype(T, /turf/space) || (istype(holder, /obj/machinery/vehicle) && (istype(T, /turf/simulated) && T:allows_vehicles)) )
|
||||
if (istext(istate) && istate != "blank")
|
||||
var/obj/effects/ion_trails/I = unpool(/obj/effects/ion_trails)
|
||||
I.set_loc(src.oldposition)
|
||||
src.oldposition = T
|
||||
I.dir = src.holder.dir
|
||||
flick(istate, I)
|
||||
I.icon_state = "blank"
|
||||
I.pixel_x = offset
|
||||
I.pixel_y = offset
|
||||
spawn( 20 )
|
||||
if (I && !I.disposed) pool(I)
|
||||
spawn(2)
|
||||
if(src.on)
|
||||
src.processing = 1
|
||||
src.start()
|
||||
else
|
||||
spawn(2)
|
||||
if(src.on)
|
||||
src.processing = 1
|
||||
src.start()
|
||||
|
||||
/datum/effects/system/ion_trail_follow/proc/stop()
|
||||
src.processing = 0
|
||||
src.on = 0
|
||||
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////
|
||||
//// SMOKE SYSTEMS
|
||||
// direct can be optinally added when set_up, to make the smoke always travel in one direction
|
||||
// in case you wanted a vent to always smoke north for example
|
||||
/////////////////////////////////////////////
|
||||
/datum/effects/system/mustard_gas_spread
|
||||
var/number = 3
|
||||
var/cardinals = 0
|
||||
var/turf/location
|
||||
var/atom/holder
|
||||
var/total_smoke = 0 // To stop it being spammed and lagging!
|
||||
var/direction
|
||||
|
||||
/datum/effects/system/mustard_gas_spread/proc/set_up(n = 5, c = 0, loca, direct)
|
||||
if(n > 20)
|
||||
n = 20
|
||||
number = n
|
||||
cardinals = c
|
||||
if(istype(loca, /turf/))
|
||||
location = loca
|
||||
else
|
||||
location = get_turf(loca)
|
||||
if(direct)
|
||||
direction = direct
|
||||
|
||||
/datum/effects/system/mustard_gas_spread/proc/attach(atom/atom)
|
||||
holder = atom
|
||||
|
||||
/datum/effects/system/mustard_gas_spread/proc/start()
|
||||
var/i = 0
|
||||
for(i=0, i<src.number, i++)
|
||||
if(src.total_smoke > 20)
|
||||
return
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effects/mustard_gas/smoke = new /obj/effects/mustard_gas(src.location)
|
||||
src.total_smoke++
|
||||
var/direction = src.direction
|
||||
if(!direction)
|
||||
if(src.cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
for(i=0, i<pick(0,1,1,1,2,2,2,3), i++)
|
||||
sleep(10)
|
||||
step(smoke,direction)
|
||||
spawn(100)
|
||||
qdel(smoke)
|
||||
src.total_smoke--
|
||||
@@ -0,0 +1,105 @@
|
||||
/datum/effects/system/spark_spread
|
||||
var/number = 3
|
||||
var/cardinals = 0
|
||||
var/turf/location
|
||||
var/atom/holder
|
||||
var/total_sparks = 0 // To stop it being spammed and lagging!
|
||||
var/list/livesparks = new
|
||||
|
||||
///datum/effects/system/spark_spread/Del()
|
||||
//pool(src)
|
||||
//no no no no no stop doing this what the fuck man aaaaaaaa -singh
|
||||
|
||||
/datum/effects/system/spark_spread/pooled()
|
||||
number = initial(number)
|
||||
cardinals = initial(cardinals)
|
||||
location = null
|
||||
holder = null
|
||||
total_sparks = initial(total_sparks)
|
||||
if(livesparks)
|
||||
livesparks.len = 0
|
||||
livesparks = new
|
||||
|
||||
/datum/effects/system/spark_spread/proc/set_up(n = 3, c = 0, loca)
|
||||
if(n > 10)
|
||||
n = 10
|
||||
number = n
|
||||
cardinals = c
|
||||
if(istype(loca, /turf/))
|
||||
location = loca
|
||||
else
|
||||
location = get_turf(loca)
|
||||
|
||||
/datum/effects/system/spark_spread/proc/attach(atom/atom)
|
||||
holder = atom
|
||||
|
||||
/datum/effects/system/spark_spread/proc/detach()
|
||||
holder = null
|
||||
|
||||
/datum/effects/system/spark_spread/proc/update()
|
||||
if(!livesparks.len && !holder)
|
||||
pool(src)
|
||||
return
|
||||
var/do_hotspot
|
||||
for(var/obj/effects/sparks/sparks in livesparks)
|
||||
do_hotspot = 0
|
||||
// get direction
|
||||
var/direction = livesparks[sparks] >> 4
|
||||
// get distance
|
||||
var/distance = livesparks[sparks] & 15
|
||||
if(distance)
|
||||
// Only do hotspot for tiles that dont already have sparks on them
|
||||
if(!locate(/obj/effects/sparks in get_step(sparks, direction)))
|
||||
do_hotspot = 1
|
||||
|
||||
// Move the sparks
|
||||
step(sparks, direction)
|
||||
distance--
|
||||
|
||||
if(do_hotspot)
|
||||
var/turf/T = get_turf(sparks)
|
||||
if(istype(T, /turf))
|
||||
T.hotspot_expose(1000, 100)
|
||||
|
||||
livesparks[sparks] = direction << 4 | distance
|
||||
else
|
||||
// Kill the spark in 20 ticks
|
||||
spawn(20)
|
||||
if (sparks)
|
||||
livesparks -= sparks
|
||||
pool(sparks)
|
||||
|
||||
if(livesparks.len)
|
||||
spawn(5)
|
||||
update()
|
||||
|
||||
/datum/effects/system/spark_spread/proc/start()
|
||||
if(istype(holder, /atom/movable))
|
||||
location = get_turf(holder)
|
||||
spawn(0)
|
||||
if(istype(src.location, /turf))
|
||||
src.location.hotspot_expose(1000, 100)
|
||||
// Create sparks
|
||||
for(var/i = 0, i < src.number, i++)
|
||||
if(src.total_sparks > 20)
|
||||
break;
|
||||
|
||||
// Check spawn limits
|
||||
if(!limiter.canISpawn(/obj/effects/sparks))
|
||||
continue
|
||||
// Create sparks
|
||||
var/obj/effects/sparks/sparks = unpool(/obj/effects/sparks)
|
||||
sparks.set_loc(src.location)
|
||||
src.total_sparks++
|
||||
|
||||
// Set direction and distance to travel
|
||||
var/direction
|
||||
if(src.cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
var/distance = rand(1,3)
|
||||
// Store direction and distance to travel as the high quad and low quad of the low byte
|
||||
livesparks[sparks] = direction << 4 | distance
|
||||
spawn(5)
|
||||
update()
|
||||
@@ -0,0 +1,64 @@
|
||||
/////////////////////////////////////////////
|
||||
// GENERIC STEAM SPREAD SYSTEM
|
||||
|
||||
//Usage: set_up(number of bits of steam, use North/South/East/West only, spawn location)
|
||||
// The attach(atom/atom) proc is optional, and can be called to attach the effect
|
||||
// to something, like a smoking beaker, so then you can just call start() and the steam
|
||||
// will always spawn at the items location, even if it's moved.
|
||||
|
||||
/* Example:
|
||||
var/datum/effects/system/steam_spread/steam = new /datum/effects/system/steam_spread() -- creates new system
|
||||
steam.set_up(5, 0, mob.loc) -- sets up variables
|
||||
OPTIONAL: steam.attach(mob)
|
||||
steam.start() -- spawns the effect
|
||||
*/
|
||||
/////////////////////////////////////////////
|
||||
|
||||
|
||||
/datum/effects/system/steam_spread
|
||||
var/number = 3
|
||||
var/cardinals = 0
|
||||
var/turf/location
|
||||
var/atom/holder
|
||||
|
||||
/datum/effects/system/steam_spread/pooled()
|
||||
..()
|
||||
number = initial(number)
|
||||
cardinals = initial(cardinals)
|
||||
location = null
|
||||
holder = null
|
||||
|
||||
/datum/effects/system/steam_spread/proc/set_up(n = 3, c = 0, turf/loc)
|
||||
if(n > 10)
|
||||
n = 10
|
||||
number = n
|
||||
cardinals = c
|
||||
location = loc
|
||||
|
||||
/*
|
||||
/datum/effects/system/steam_spread/Del()
|
||||
pool(src)
|
||||
*/
|
||||
|
||||
/datum/effects/system/steam_spread/proc/attach(atom/atom)
|
||||
holder = atom
|
||||
|
||||
/datum/effects/system/steam_spread/proc/start()
|
||||
for(var/i=0, i<src.number, i++)
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effects/steam/steam = unpool(/obj/effects/steam)
|
||||
steam.set_loc(src.location)
|
||||
var/direction
|
||||
if(src.cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
for(var/j=0, j<pick(1,2,3), j++)
|
||||
sleep(5)
|
||||
step(steam,direction)
|
||||
spawn(20)
|
||||
if (steam)
|
||||
pool(steam)
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//////// Attach a steam trail to an object (eg. a reacting beaker) that will follow it
|
||||
// even if it's carried of thrown.
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/datum/effects/system/steam_trail_follow
|
||||
var/atom/holder
|
||||
var/turf/oldposition
|
||||
var/processing = 1
|
||||
var/on = 1
|
||||
var/number
|
||||
|
||||
/datum/effects/system/steam_trail_follow/proc/set_up(atom/atom)
|
||||
holder = atom
|
||||
oldposition = get_turf(atom)
|
||||
|
||||
/datum/effects/system/steam_trail_follow/proc/start()
|
||||
if(!src.on)
|
||||
src.on = 1
|
||||
src.processing = 1
|
||||
if(src.processing)
|
||||
src.processing = 0
|
||||
spawn(0)
|
||||
if(src.number < 3)
|
||||
var/obj/effects/steam/I = unpool(/obj/effects/steam)
|
||||
I.set_loc(src.oldposition)
|
||||
src.number++
|
||||
src.oldposition = get_turf(holder)
|
||||
I.dir = src.holder.dir
|
||||
spawn(10)
|
||||
if (I && !I.disposed) pool(I)
|
||||
src.number--
|
||||
spawn(2)
|
||||
if(src.on)
|
||||
src.processing = 1
|
||||
src.start()
|
||||
else
|
||||
spawn(2)
|
||||
if(src.on)
|
||||
src.processing = 1
|
||||
src.start()
|
||||
|
||||
/datum/effects/system/steam_trail_follow/proc/stop()
|
||||
src.processing = 0
|
||||
src.on = 0
|
||||
Reference in New Issue
Block a user