- Committing the updated recursive explosion code. It now takes into account objects too.

The following objects affect explosions: (Doors only when closed)

Poddoor = 25
R-Wall = 25
Airlock = 15
Space = 10
Wall = 5
Window door = 5
Grille = 5
Plastic flaps = 5
Floor = 1

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4585 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2012-08-30 05:38:10 +00:00
parent 033c884e5f
commit e6197c2bae
7 changed files with 44 additions and 12 deletions

View File

@@ -1,9 +1,11 @@
/* - uncomment this to test it out!
/* - uncomment this to test it out! */
/mob/verb/kaboom()
var/power = input(src, "power?", "power?") as num
var/turf/T = get_turf(src)
explosion_rec(T, power)
*/
/obj
var/explosion_resistance
/datum/explosion_turf
var/turf/turf //The turf which will get ex_act called on it
@@ -58,7 +60,7 @@ proc/explosion_rec(turf/epicenter, power)
//This steap handles the gathering of turfs which will be ex_act() -ed in the next step. It also ensures each turf gets the maximum possible amount of power dealt to it.
for(var/direction in cardinal)
var/turf/T = get_step(epicenter, direction)
T.explosion_spread(power - epicenter.explosion_resistance)
T.explosion_spread(power - epicenter.explosion_resistance, direction)
//This step applies the ex_act effects for the explosion, as planned in the previous step.
for( var/datum/explosion_turf/ET in explosion_turfs )
@@ -111,18 +113,40 @@ proc/explosion_rec(turf/epicenter, power)
explosion_resistance = 25
//Code-wise, a safe value for power is something up to ~25 or ~30.. This does quite a bit of damage to the station.
/turf/proc/explosion_spread(power)
//direction is the direction that the spread took to come to this tile. So it is pointing in the main blast direction - meaning where this tile should spread most of it's force.
/turf/proc/explosion_spread(power, direction)
if(power <= 0)
return
/*
sleep(2)
new/obj/effect/debugging/marker(src)
*/
var/datum/explosion_turf/ET = get_explosion_turf(src)
if(ET.max_power >= power)
return //The turf already sustained and spread a power greated than what we are dealing with. No point spreading again.
ET.max_power = power
var/spread_power = power - src.explosion_resistance //This is the amount of power that will be spread to the tile in the direction of the blast
var/side_spread_power = power - 2 * src.explosion_resistance //This is the amount of power that will be spread to the side tiles
for(var/obj/O in src)
if(O.explosion_resistance)
spread_power -= O.explosion_resistance
side_spread_power -= O.explosion_resistance
var/turf/T = get_step(src, direction)
T.explosion_spread(spread_power, direction)
T = get_step(src, turn(direction,90))
T.explosion_spread(side_spread_power, turn(direction,90))
T = get_step(src, turn(direction,-90))
T.explosion_spread(side_spread_power, turn(direction,90))
/*
for(var/direction in cardinal)
var/turf/T = get_step(src, direction)
T.explosion_spread(power - src.explosion_resistance)
T.explosion_spread(spread_power)
*/
/turf/unsimulated/explosion_spread(power)
return //So it doesn't get to the parent proc, which simulates explosions