From eb5fcba6c507772259449b8167b1e9acbfbae4ac Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Tue, 12 Jan 2016 18:46:10 -0500 Subject: [PATCH] Explosion Overhaul --- code/game/objects/explosion.dm | 30 +++++++++++++++------ code/game/objects/structures/fullwindow.dm | 1 + code/game/objects/structures/grille.dm | 1 + code/game/turfs/simulated.dm | 4 ++- code/game/turfs/simulated/floor.dm | 10 +++++-- code/game/turfs/space/space.dm | 3 +++ code/game/turfs/turf.dm | 4 +++ html/changelogs/explosion-tweak-mccloud.yml | 7 +++++ 8 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 html/changelogs/explosion-tweak-mccloud.yml diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index a8ce807be8a..a20094a44f1 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -35,7 +35,7 @@ if(!epicenter) return var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range) - var/list/cached_exp_block = new + var/list/cached_exp_block = list() if(adminlog) message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range], [flame_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z]) (JMP)") @@ -84,10 +84,10 @@ var/y0 = epicenter.y var/z0 = epicenter.z + var/list/affected_turfs = trange(max_range, epicenter) + if(config.reactionary_explosions) - // Cache the explosion block rating of every turf in the explosion area so - // exploded turfs don't leave the explosion lopsided - for(var/turf/T in trange(max_range, epicenter)) + for(var/turf/T in affected_turfs) // we cache the explosion block rating of every turf in the explosion area cached_exp_block[T] = 0 if(T.density && T.explosion_block) cached_exp_block[T] += T.explosion_block @@ -96,7 +96,7 @@ if(D.density && D.explosion_block) cached_exp_block[T] += D.explosion_block - for(var/turf/T in trange(max_range, epicenter)) + for(var/turf/T in affected_turfs) var/dist = cheap_hypotenuse(T.x, T.y, x0, y0) @@ -123,9 +123,23 @@ if(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density) new /obj/effect/hotspot(T) //Mostly for ambience! if(dist > 0) - for(var/atom_movable in T.contents) //bypass type checking since only atom/movable can be contained by turfs anyway - var/atom/movable/AM = atom_movable - if(AM && AM.simulated) AM.ex_act(dist) + if(istype(T, /turf/simulated)) + var/turf/simulated/S = T + var/affecting_level + if(dist == 1) + affecting_level = 1 + else + affecting_level = S.is_shielded() ? 2 : (S.intact ? 2 : 1) + for(var/atom_movable in S.contents) //bypass type checking since only atom/movable can be contained by turfs anyway + var/atom/movable/AM = atom_movable + if(AM && AM.simulated) + if(AM.level >= affecting_level) + AM.ex_act(dist) + else + for(var/atom_movable in T.contents) //bypass type checking since only atom/movable can be contained by turfs anyway + var/atom/movable/AM = atom_movable + if(AM && AM.simulated) + AM.ex_act(dist) T.ex_act(dist) //--- THROW ITEMS AROUND --- diff --git a/code/game/objects/structures/fullwindow.dm b/code/game/objects/structures/fullwindow.dm index 71c6e56616d..fda64fcb740 100644 --- a/code/game/objects/structures/fullwindow.dm +++ b/code/game/objects/structures/fullwindow.dm @@ -1,6 +1,7 @@ /obj/structure/window/full sheets = 2 dir=SOUTHWEST + level = 3 /obj/structure/window/full/CheckExit(atom/movable/O as mob|obj, target as turf) return 1 diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 23072239bcd..0b2ca129317 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -10,6 +10,7 @@ layer = 2.9 var/health = 10 var/destroyed = 0 + level = 3 /obj/structure/grille/fence/ diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index 44650579eaa..f3fd7b38dd1 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -167,4 +167,6 @@ /turf/simulated/ChangeTurf(var/path) . = ..() - smooth_icon_neighbors(src) \ No newline at end of file + smooth_icon_neighbors(src) + +/turf/simulated/proc/is_shielded() \ No newline at end of file diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index b28f2674c52..3a147050e13 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -64,7 +64,8 @@ var/list/wood_icons = list("wood","wood-broken") // return ..() /turf/simulated/floor/ex_act(severity) - //set src in oview(1) + if(is_shielded()) + return switch(severity) if(1.0) src.ChangeTurf(/turf/space) @@ -100,6 +101,11 @@ var/list/wood_icons = list("wood","wood-broken") 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/is_shielded() + for(var/obj/structure/A in contents) + if(A.level == 3) + return 1 + /turf/simulated/floor/blob_act() return @@ -217,4 +223,4 @@ var/list/wood_icons = list("wood","wood-broken") ChangeTurf(/turf/simulated/floor/engine/cult) /turf/simulated/floor/can_have_cabling() - return !burnt & !broken + return !burnt && !broken diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index c64c14644f8..ca73867902f 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -198,3 +198,6 @@ /turf/space/singularity_act() return + +/turf/space/can_have_cabling() + return 0 \ No newline at end of file diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 37b40525275..af12a95a3e7 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -170,6 +170,10 @@ W.levelupdate() W.CalculateAdjacentTurfs() + + if(!can_have_cabling()) + for(var/obj/structure/cable/C in contents) + qdel(C) return W //////Assimilate Air////// diff --git a/html/changelogs/explosion-tweak-mccloud.yml b/html/changelogs/explosion-tweak-mccloud.yml new file mode 100644 index 00000000000..7587fa8ce32 --- /dev/null +++ b/html/changelogs/explosion-tweak-mccloud.yml @@ -0,0 +1,7 @@ + +author: Fox McCloud + +delete-after: True + +changes: + - tweak: "Explosions will no longer destroy things underneath turfs until the turf is exposed." \ No newline at end of file