From a878ccee3082a7d5d6cdaa50d505e946b3b7af92 Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Sat, 4 Jul 2015 09:34:03 -0400 Subject: [PATCH 1/3] Pools Hotspots --- code/LINDA/LINDA_fire.dm | 10 +++++----- code/LINDA/LINDA_turf_tile.dm | 2 +- code/game/machinery/doors/door.dm | 5 ----- code/game/objects/explosion.dm | 2 +- code/modules/projectiles/projectile/bullets.dm | 2 +- code/modules/reagents/Chemistry-Reagents.dm | 12 ++++++------ code/modules/reagents/newchem/drugs.dm | 2 +- code/modules/reagents/newchem/pyro.dm | 16 ++++++++-------- 8 files changed, 23 insertions(+), 28 deletions(-) diff --git a/code/LINDA/LINDA_fire.dm b/code/LINDA/LINDA_fire.dm index bdfa2971881..43ef1e80054 100644 --- a/code/LINDA/LINDA_fire.dm +++ b/code/LINDA/LINDA_fire.dm @@ -30,7 +30,7 @@ if(air_contents.oxygen < 0.5 || air_contents.toxins < 0.5) return 0 - active_hotspot = new(src) + active_hotspot = PoolOrNew(/obj/effect/hotspot, src) active_hotspot.temperature = exposed_temperature active_hotspot.volume = exposed_volume @@ -152,18 +152,18 @@ // Garbage collect itself by nulling reference to it /obj/effect/hotspot/proc/Kill() - air_master.hotspots -= src - DestroyTurf() - qdel(src) + PlaceInPool(src) /obj/effect/hotspot/Destroy() + air_master.hotspots -= src + DestroyTurf() set_light(0) if(istype(loc, /turf/simulated)) var/turf/simulated/T = loc if(T.active_hotspot == src) T.active_hotspot = null loc = null - return ..() + return QDEL_HINT_PUTINPOOL /obj/effect/hotspot/proc/DestroyTurf() diff --git a/code/LINDA/LINDA_turf_tile.dm b/code/LINDA/LINDA_turf_tile.dm index eb43d2d5bca..ef834dbb1b2 100644 --- a/code/LINDA/LINDA_turf_tile.dm +++ b/code/LINDA/LINDA_turf_tile.dm @@ -66,7 +66,7 @@ turf/simulated/New() turf/simulated/Del() if(active_hotspot) - qdel(active_hotspot) + active_hotspot.Kill() ..() turf/simulated/assume_air(datum/gas_mixture/giver) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 6702399aad3..c62976ec171 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -262,11 +262,6 @@ operating = 0 air_update_turf(1) update_freelok_sight() - - //I shall not add a check every x ticks if a door has closed over some fire. - var/obj/effect/hotspot/fire = locate() in loc - if(fire) - qdel(fire) return /obj/machinery/door/proc/crush() diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index 60cbc8daafd..f6167259e0b 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -124,7 +124,7 @@ var/atom/movable/AM = atom_movable if(AM) AM.ex_act(dist) if(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density) - new/obj/effect/hotspot(T) //Mostly for ambience! + PoolOrNew(/obj/effect/hotspot, T) //Mostly for ambience! if(dist > 0) T.ex_act(dist) diff --git a/code/modules/projectiles/projectile/bullets.dm b/code/modules/projectiles/projectile/bullets.dm index 11fb7facc5f..63e1d384a4d 100644 --- a/code/modules/projectiles/projectile/bullets.dm +++ b/code/modules/projectiles/projectile/bullets.dm @@ -104,7 +104,7 @@ /obj/item/projectile/bullet/incendiary/shell/Move() ..() var/turf/location = get_turf(src) - new/obj/effect/hotspot(location) + PoolOrNew(/obj/effect/hotspot, location) location.hotspot_expose(700, 50, 1) /obj/item/projectile/bullet/incendiary/shell/dragonsbreath diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index ef6d0f4437e..2a530bab243 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -270,25 +270,25 @@ datum for(var/mob/living/carbon/slime/M in T) M.apply_water() - var/hotspot = (locate(/obj/effect/hotspot) in T) + var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) - qdel(hotspot) + hotspot.Kill() return reaction_obj(var/obj/O, var/volume) src = null var/turf/T = get_turf(O) - var/hotspot = (locate(/obj/effect/hotspot) in T) + var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) - qdel(hotspot) + hotspot.Kill() if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/monkeycube)) var/obj/item/weapon/reagent_containers/food/snacks/monkeycube/cube = O if(!cube.wrapped) @@ -1860,13 +1860,13 @@ datum if(T.wet_overlay) T.overlays -= T.wet_overlay T.wet_overlay = null - var/hotspot = (locate(/obj/effect/hotspot) in T) + var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) - qdel(hotspot) + hotspot.Kill() enzyme name = "Denatured Enzyme" diff --git a/code/modules/reagents/newchem/drugs.dm b/code/modules/reagents/newchem/drugs.dm index 82d945c5403..3ace84f1a5c 100644 --- a/code/modules/reagents/newchem/drugs.dm +++ b/code/modules/reagents/newchem/drugs.dm @@ -90,7 +90,7 @@ /datum/chemical_reaction/crank/on_reaction(var/datum/reagents/holder, var/created_volume) var/turf/T = get_turf(holder.my_atom) for(var/turf/turf in range(1,T)) - new /obj/effect/hotspot(turf) + PoolOrNew(/obj/effect/hotspot, turf) explosion(T,0,0,2) return diff --git a/code/modules/reagents/newchem/pyro.dm b/code/modules/reagents/newchem/pyro.dm index 4dbb2c9ee82..2296a7b17ad 100644 --- a/code/modules/reagents/newchem/pyro.dm +++ b/code/modules/reagents/newchem/pyro.dm @@ -46,7 +46,7 @@ /datum/chemical_reaction/clf3/on_reaction(var/datum/reagents/holder, var/created_volume) var/turf/T = get_turf(holder.my_atom) for(var/turf/turf in range(1,T)) - new /obj/effect/hotspot(turf) + PoolOrNew(/obj/effect/hotspot, turf) return /datum/reagent/clf3/reaction_turf(var/turf/simulated/T, var/volume) @@ -59,13 +59,13 @@ if(prob(volume/10)) F.make_plating() if(istype(F, /turf/simulated/floor/)) - new /obj/effect/hotspot(F) + PoolOrNew(/obj/effect/hotspot, F) if(istype(T, /turf/simulated/wall/)) var/turf/simulated/wall/W = T if(prob(volume/10)) W.ChangeTurf(/turf/simulated/floor) if(istype(T, /turf/simulated/shuttle/)) - new /obj/effect/hotspot(T) + PoolOrNew(/obj/effect/hotspot, T) return /datum/reagent/clf3/reaction_mob(var/mob/living/M, var/method=TOUCH, var/volume) @@ -428,7 +428,7 @@ datum/reagent/blackpowder/reaction_turf(var/turf/T, var/volume) //oh shit return var/turf/simulated/T = get_turf(holder.my_atom) for(var/turf/simulated/turf in range(created_volume/10,T)) - new /obj/effect/hotspot(turf) + PoolOrNew(/obj/effect/hotspot, turf) return /datum/reagent/phlogiston/on_mob_life(var/mob/living/M as mob) @@ -574,25 +574,25 @@ datum/reagent/firefighting_foam/reaction_turf(var/turf/simulated/T, var/volume) src = null if(!istype(T, /turf/space)) new /obj/effect/decal/cleanable/flour/foam(T) //foam mess; clears up quickly. - var/hotspot = (locate(/obj/effect/hotspot) in T) + var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-(CT*1000),lowertemp.temperature / CT) ,0) lowertemp.react() T.assume_air(lowertemp) - qdel(hotspot) + hotspot.Kill() return datum/reagent/firefighting_foam/reaction_obj(var/obj/O, var/volume) src = null var/turf/T = get_turf(O) - var/hotspot = (locate(/obj/effect/hotspot) in T) + var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) - del(hotspot) + hotspot.Kill() return /datum/chemical_reaction/clf3_firefighting From ab28186d131650baecad91fe6b38e01b10eafa92 Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Sat, 4 Jul 2015 19:27:43 -0400 Subject: [PATCH 2/3] Kill is Kill --- code/LINDA/LINDA_fire.dm | 9 +++------ code/LINDA/LINDA_turf_tile.dm | 2 +- code/game/objects/items/weapons/tanks/watertank.dm | 2 +- code/modules/reagents/Chemistry-Reagents.dm | 12 ++++++------ code/modules/reagents/newchem/pyro.dm | 8 ++++---- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/code/LINDA/LINDA_fire.dm b/code/LINDA/LINDA_fire.dm index 43ef1e80054..e8b368d64fc 100644 --- a/code/LINDA/LINDA_fire.dm +++ b/code/LINDA/LINDA_fire.dm @@ -98,18 +98,18 @@ var/turf/simulated/location = loc if(!istype(location)) - Kill() + qdel(src) return if(location.excited_group) location.excited_group.reset_cooldowns() if((temperature < FIRE_MINIMUM_TEMPERATURE_TO_EXIST) || (volume <= 1)) - Kill() + qdel(src) return if(!(location.air) || location.air.toxins < 0.5 || location.air.oxygen < 0.5) - Kill() + qdel(src) return perform_exposure() @@ -151,9 +151,6 @@ // Garbage collect itself by nulling reference to it -/obj/effect/hotspot/proc/Kill() - PlaceInPool(src) - /obj/effect/hotspot/Destroy() air_master.hotspots -= src DestroyTurf() diff --git a/code/LINDA/LINDA_turf_tile.dm b/code/LINDA/LINDA_turf_tile.dm index ef834dbb1b2..eb43d2d5bca 100644 --- a/code/LINDA/LINDA_turf_tile.dm +++ b/code/LINDA/LINDA_turf_tile.dm @@ -66,7 +66,7 @@ turf/simulated/New() turf/simulated/Del() if(active_hotspot) - active_hotspot.Kill() + qdel(active_hotspot) ..() turf/simulated/assume_air(datum/gas_mixture/giver) diff --git a/code/game/objects/items/weapons/tanks/watertank.dm b/code/game/objects/items/weapons/tanks/watertank.dm index ff76e6259d3..7dd5365e20a 100644 --- a/code/game/objects/items/weapons/tanks/watertank.dm +++ b/code/game/objects/items/weapons/tanks/watertank.dm @@ -357,7 +357,7 @@ G.temperature = 2 T.air_update_turf() for(var/obj/effect/hotspot/H in T) - H.Kill() + qdel(H) if(G.toxins) G.nitrogen += (G.toxins) G.toxins = 0 diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index 2a530bab243..ef6d0f4437e 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -270,25 +270,25 @@ datum for(var/mob/living/carbon/slime/M in T) M.apply_water() - var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) + var/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) - hotspot.Kill() + qdel(hotspot) return reaction_obj(var/obj/O, var/volume) src = null var/turf/T = get_turf(O) - var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) + var/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) - hotspot.Kill() + qdel(hotspot) if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/monkeycube)) var/obj/item/weapon/reagent_containers/food/snacks/monkeycube/cube = O if(!cube.wrapped) @@ -1860,13 +1860,13 @@ datum if(T.wet_overlay) T.overlays -= T.wet_overlay T.wet_overlay = null - var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) + var/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) - hotspot.Kill() + qdel(hotspot) enzyme name = "Denatured Enzyme" diff --git a/code/modules/reagents/newchem/pyro.dm b/code/modules/reagents/newchem/pyro.dm index 2296a7b17ad..c1a9b11e8f6 100644 --- a/code/modules/reagents/newchem/pyro.dm +++ b/code/modules/reagents/newchem/pyro.dm @@ -574,25 +574,25 @@ datum/reagent/firefighting_foam/reaction_turf(var/turf/simulated/T, var/volume) src = null if(!istype(T, /turf/space)) new /obj/effect/decal/cleanable/flour/foam(T) //foam mess; clears up quickly. - var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) + var/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-(CT*1000),lowertemp.temperature / CT) ,0) lowertemp.react() T.assume_air(lowertemp) - hotspot.Kill() + qdel(hotspot) return datum/reagent/firefighting_foam/reaction_obj(var/obj/O, var/volume) src = null var/turf/T = get_turf(O) - var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) + var/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot && !istype(T, /turf/space)) var/datum/gas_mixture/lowertemp = T.remove_air( T:air:total_moles() ) lowertemp.temperature = max( min(lowertemp.temperature-2000,lowertemp.temperature / 2) ,0) lowertemp.react() T.assume_air(lowertemp) - hotspot.Kill() + qdel(hotspot) return /datum/chemical_reaction/clf3_firefighting From a25e0528024fbca8b32a8c6d25e63e75016baa9c Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Sat, 4 Jul 2015 22:56:28 -0400 Subject: [PATCH 3/3] parents --- code/LINDA/LINDA_fire.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/LINDA/LINDA_fire.dm b/code/LINDA/LINDA_fire.dm index e8b368d64fc..adb59f7f0fe 100644 --- a/code/LINDA/LINDA_fire.dm +++ b/code/LINDA/LINDA_fire.dm @@ -159,7 +159,7 @@ var/turf/simulated/T = loc if(T.active_hotspot == src) T.active_hotspot = null - loc = null + ..() return QDEL_HINT_PUTINPOOL /obj/effect/hotspot/proc/DestroyTurf()