From 1aca3fe7f2b8d846aa8e5c4ad0b64804563693bd Mon Sep 17 00:00:00 2001 From: Mloc-Argent Date: Mon, 23 Jun 2014 20:54:20 +0100 Subject: [PATCH] atmos: make fires more destructive Fires can now burn through walls, windows, and (with a high enough temperature) rwalls. New proc: adjacent_fire_act(). Called on turfs that a fire isn't able to spread to. (walls, floor surrounded by windows, etc.) Signed-off-by: Mloc-Argent --- code/ZAS/Fire.dm | 15 +++++++++++---- code/game/objects/structures/window.dm | 2 +- code/game/turfs/simulated/floor.dm | 15 +++++++++++++++ code/game/turfs/simulated/walls.dm | 8 ++++++++ code/game/turfs/simulated/walls_reinforced.dm | 1 + code/game/turfs/turf.dm | 3 +++ 6 files changed, 39 insertions(+), 5 deletions(-) diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm index 33161b8214e..2d181dc6009 100644 --- a/code/ZAS/Fire.dm +++ b/code/ZAS/Fire.dm @@ -63,9 +63,11 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) if(!istype(S)) del src + return if(!S.zone) del src + return var/datum/gas_mixture/air_contents = S.return_air() //get liquid fuels on the ground. @@ -87,6 +89,7 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) if(!air_contents.check_combustability(liquid)) //del src RemoveFire() + return //get a firelevel and set the icon firelevel = air_contents.calculate_firelevel(liquid) @@ -104,15 +107,16 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) //im not sure how to implement a version that works for every creature so for now monkeys are firesafe for(var/mob/living/carbon/human/M in loc) M.FireBurn(firelevel, air_contents.temperature, air_contents.return_pressure() ) //Burn the humans! + + loc.fire_act(air_contents, air_contents.temperature, air_contents.return_volume()) for(var/atom/A in loc) A.fire_act(air_contents, air_contents.temperature, air_contents.return_volume()) //spread for(var/direction in cardinal) - if(S.open_directions & direction) //Grab all valid bordering tiles + var/turf/simulated/enemy_tile = get_step(S, direction) - var/turf/simulated/enemy_tile = get_step(S, direction) - - if(istype(enemy_tile)) + if(istype(enemy_tile)) + if(S.open_directions & direction) //Grab all valid bordering tiles var/datum/gas_mixture/acs = enemy_tile.return_air() var/obj/effect/decal/cleanable/liquid_fuel/liq = locate() in enemy_tile if(!acs) continue @@ -128,6 +132,9 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) if( prob( 50 + 50 * (firelevel/vsc.fire_firelevel_multiplier) ) && S.CanPass(null, enemy_tile, 0,0) && enemy_tile.CanPass(null, S, 0,0)) new/obj/fire(enemy_tile,firelevel) + else + enemy_tile.adjacent_fire_act(loc, air_contents, air_contents.temperature, air_contents.return_volume()) + //seperate part of the present gas //this is done to prevent the fire burning all gases in a single pass var/datum/gas_mixture/flow = air_contents.remove_ratio(vsc.fire_consuption_rate) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 2c9b755f563..bc4d5fd25e8 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -324,7 +324,7 @@ //checks if this window is full-tile one /obj/structure/window/proc/is_fulltile() - if(dir in list(5,6,9,10)) + if(dir & (dir - 1)) return 1 return 0 diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 90aa2a4f02f..7af70b386e7 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -75,6 +75,21 @@ var/list/wood_icons = list("wood","wood-broken") src.hotspot_expose(1000,CELL_VOLUME) return +/turf/simulated/floor/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume) + if(!burnt && prob(5)) + burn_tile() + else if(prob(1) && !is_plating()) + make_plating() + burn_tile() + return + +/turf/simulated/floor/adjacent_fire_act(turf/simulated/floor/adj_turf, datum/gas_mixture/adj_air, adj_temp, adj_volume) + var/dir_to = get_dir(src, adj_turf) + + for(var/obj/structure/window/W in src) + if(W.dir == dir_to || W.is_fulltile()) //Same direction or diagonal (full tile) + W.fire_act(adj_air, adj_temp, adj_volume) + /turf/simulated/floor/blob_act() return diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 61bb4732a5a..d264f8375d9 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -11,6 +11,8 @@ var/damage_overlay var/global/damage_overlays[8] + var/max_temperature = 1800 //K, walls will take damage if they're next to a fire hotter than this + opacity = 1 density = 1 blocks_air = 1 @@ -97,6 +99,12 @@ return +/turf/simulated/wall/adjacent_fire_act(turf/simulated/floor/adj_turf, datum/gas_mixture/adj_air, adj_temp, adj_volume) + if(adj_temp > max_temperature) + take_damage(rand(10, 20) * (adj_temp / max_temperature)) + + return ..() + /turf/simulated/wall/proc/dismantle_wall(devastated=0, explode=0) if(istype(src,/turf/simulated/wall/r_wall)) if(!devastated) diff --git a/code/game/turfs/simulated/walls_reinforced.dm b/code/game/turfs/simulated/walls_reinforced.dm index b89c127a0e0..10c7a2cbceb 100644 --- a/code/game/turfs/simulated/walls_reinforced.dm +++ b/code/game/turfs/simulated/walls_reinforced.dm @@ -6,6 +6,7 @@ density = 1 damage_cap = 200 + max_temperature = 6000 walltype = "rwall" diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 9cbf30315af..f0d206ec710 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -149,6 +149,9 @@ return return +/turf/proc/adjacent_fire_act(turf/simulated/floor/source, temperature, volume) + return + /turf/proc/is_plating() return 0 /turf/proc/is_asteroid_floor()