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

@@ -1,9 +1,14 @@
var/global/list/processing_turfs = list() var/global/list/turf/processing_turfs = list()
/datum/controller/process/turf/setup() /datum/controller/process/turf/setup()
name = "turf" name = "turf"
schedule_interval = 20 // every 2 seconds schedule_interval = 30 // every 3 seconds
/datum/controller/process/turf/doWork() /datum/controller/process/turf/doWork()
for(var/turf/unsimulated/wall/supermatter/SM in processing_turfs) for(var/turf/T in processing_turfs)
SM.process() 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) processing_turfs.Remove(src)
..() ..()
/turf/unsimulated/wall/supermatter/proc/process() /turf/unsimulated/wall/supermatter/process()
// Only check infrequently. // Only check infrequently.
if(next_check>world.time) return if(next_check>world.time) return

View File

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

View File

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