Adds turf processing.

Currently only used by walls. Radioactive walls now irradiate nearby mobs.
This commit is contained in:
PsiOmega
2015-05-16 10:27:47 +02:00
parent 8dcb2ba3ea
commit 163aab3753
5 changed files with 26 additions and 30 deletions

View File

@@ -59,4 +59,4 @@
/datum/controller/process/machinery/getStatName()
return ..()+"([machines.len])"
return ..()+"([machines.len])"

View File

@@ -1,9 +1,14 @@
var/global/list/processing_turfs = list()
var/global/list/turf/processing_turfs = list()
/datum/controller/process/turf/setup()
name = "turf"
schedule_interval = 20 // every 2 seconds
schedule_interval = 30 // every 3 seconds
/datum/controller/process/turf/doWork()
for(var/turf/unsimulated/wall/supermatter/SM in processing_turfs)
SM.process()
for(var/turf/T in processing_turfs)
if(T.process() == PROCESS_KILL)
processing_turfs.Remove(T)
scheck()
/datum/controller/process/turf/getStatName()
return ..()+"([processing_turfs.len])"

View File

@@ -23,7 +23,7 @@
processing_turfs.Remove(src)
..()
/turf/unsimulated/wall/supermatter/proc/process()
/turf/unsimulated/wall/supermatter/process()
// Only check infrequently.
if(next_check>world.time) return

View File

@@ -15,7 +15,6 @@ var/list/global/wall_cache = list()
var/damage_overlay
var/global/damage_overlays[8]
var/active
var/last_event
var/can_open = 0
var/material/material
var/material/reinf_material
@@ -33,10 +32,13 @@ var/list/global/wall_cache = list()
if(!isnull(rmaterialtype))
reinf_material = name_to_material[rmaterialtype]
update_material()
processing_turfs |= src
/turf/simulated/wall/process()
// Calling parent will kill processing
radiate()
/turf/simulated/wall/bullet_act(var/obj/item/projectile/Proj)
radiate()
if(istype(Proj,/obj/item/projectile/beam))
ignite(2500)
else if(istype(Proj,/obj/item/projectile/ion))
@@ -236,20 +238,11 @@ var/list/global/wall_cache = list()
return 0
/turf/simulated/wall/proc/radiate()
var/material/M = name_to_material[material]
if(!istype(M) || !M.radioactivity)
if(!material.radioactivity)
return
if(!active)
if(world.time > last_event+15)
active = 1
for(var/mob/living/L in range(3,src))
L.apply_effect(M.radioactivity,IRRADIATE,0)
for(var/turf/simulated/wall/T in range(3,src))
T.radiate()
last_event = world.time
active = null
return
for(var/mob/living/L in range(3,src))
L.apply_effect(material.radioactivity,IRRADIATE,0)
return
/turf/simulated/wall/proc/burn(temperature)
@@ -266,19 +259,14 @@ var/list/global/wall_cache = list()
D.ignite(temperature/4)
/turf/simulated/wall/proc/ignite(var/exposed_temperature)
var/material/M = name_to_material[material]
if(!istype(M) || !isnull(M.ignition_point))
if(isnull(material.ignition_point))
return
if(exposed_temperature > M.ignition_point)//If the temperature of the object is over 300, then ignite
if(exposed_temperature > material.ignition_point)//If the temperature of the object is over 300, then ignite
burn(exposed_temperature)
return
..()
/turf/simulated/wall/Bumped(AM as mob|obj)
radiate()
..()
/turf/simulated/wall/Destroy()
processing_turfs -= src
dismantle_wall(null,null,1)
..()
..()

View File

@@ -378,3 +378,6 @@
if(!LinkBlocked(src, t) && !TurfBlockedNonWindow(t))
L.Add(t)
return L
/turf/proc/process()
return PROCESS_KILL