mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Merge pull request #602 from Fox-McCloud/Recursive-Explosions
Removes Recursive Explosions
This commit is contained in:
@@ -22,11 +22,6 @@ proc/trange(var/Dist=0,var/turf/Center=null)//alternative to range (ONLY process
|
||||
proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, adminlog = 1)
|
||||
src = null //so we don't abort once src is deleted
|
||||
spawn(0)
|
||||
if(config.use_recursive_explosions)
|
||||
var/power = devastation_range * 2 + heavy_impact_range + light_impact_range //The ranges add up, ie light 14 includes both heavy 7 and devestation 3. So this calculation means devestation counts for 4, heavy for 2 and light for 1 power, giving us a cap of 27 power.
|
||||
explosion_rec(epicenter, power)
|
||||
return
|
||||
|
||||
var/start = world.timeofday
|
||||
epicenter = get_turf(epicenter)
|
||||
if(!epicenter) return
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
/client/proc/kaboom()
|
||||
|
||||
set category = "Debug"
|
||||
|
||||
var/power = input(src, "power?", "power?") as num
|
||||
var/turf/T = get_turf(src.mob)
|
||||
explosion_rec(T, power)
|
||||
|
||||
/obj
|
||||
var/explosion_resistance
|
||||
|
||||
|
||||
|
||||
var/list/explosion_turfs = list()
|
||||
|
||||
var/explosion_in_progress = 0
|
||||
|
||||
|
||||
proc/explosion_rec(turf/epicenter, power)
|
||||
|
||||
var/loopbreak = 0
|
||||
while(explosion_in_progress)
|
||||
if(loopbreak >= 15) return
|
||||
sleep(10)
|
||||
loopbreak++
|
||||
|
||||
if(power <= 0) return
|
||||
epicenter = get_turf(epicenter)
|
||||
if(!epicenter) return
|
||||
|
||||
message_admins("Explosion with size ([power]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z])")
|
||||
log_game("Explosion with size ([power]) in area [epicenter.loc.name] ")
|
||||
|
||||
playsound(epicenter, 'sound/effects/explosionfar.ogg', 100, 1, round(power*2,1) )
|
||||
playsound(epicenter, "explosion", 100, 1, round(power,1) )
|
||||
|
||||
explosion_in_progress = 1
|
||||
explosion_turfs = list()
|
||||
|
||||
explosion_turfs[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, direction)
|
||||
|
||||
//This step applies the ex_act effects for the explosion, as planned in the previous step.
|
||||
for(var/turf/T in explosion_turfs)
|
||||
if(explosion_turfs[T] <= 0) continue
|
||||
if(!T) continue
|
||||
|
||||
//Wow severity looks confusing to calculate... Fret not, I didn't leave you with any additional instructions or help. (just kidding, see the line under the calculation)
|
||||
var/severity = 4 - round(max(min( 3, ((explosion_turfs[T] - T.explosion_resistance) / (max(3,(power/3)))) ) ,1), 1) //sanity effective power on tile divided by either 3 or one third the total explosion power
|
||||
// One third because there are three power levels and I
|
||||
// want each one to take up a third of the crater
|
||||
var/x = T.x
|
||||
var/y = T.y
|
||||
var/z = T.z
|
||||
T.ex_act(severity)
|
||||
if(!T)
|
||||
T = locate(x,y,z)
|
||||
for(var/atom/A in T)
|
||||
A.ex_act(severity)
|
||||
|
||||
explosion_in_progress = 0
|
||||
|
||||
/turf
|
||||
var/explosion_resistance
|
||||
|
||||
/turf/space
|
||||
explosion_resistance = 10
|
||||
|
||||
/turf/simulated/floor
|
||||
explosion_resistance = 1
|
||||
|
||||
/turf/unsimulated/floor
|
||||
explosion_resistance = 1
|
||||
|
||||
/turf/simulated/mineral
|
||||
explosion_resistance = 2
|
||||
|
||||
turf/unsimulated/mineral
|
||||
explosion_resistance = 2
|
||||
|
||||
/turf/simulated/shuttle/floor
|
||||
explosion_resistance = 1
|
||||
|
||||
/turf/simulated/shuttle/floor4
|
||||
explosion_resistance = 1
|
||||
|
||||
/turf/simulated/shuttle/plating
|
||||
explosion_resistance = 1
|
||||
|
||||
/turf/simulated/shuttle/wall
|
||||
explosion_resistance = 5
|
||||
|
||||
/turf/simulated/wall
|
||||
explosion_resistance = 5
|
||||
|
||||
/turf/simulated/wall/r_wall
|
||||
explosion_resistance = 15
|
||||
|
||||
//Code-wise, a safe value for power is something up to ~25 or ~30.. This does quite a bit of damage to the station.
|
||||
//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)
|
||||
*/
|
||||
|
||||
if(explosion_turfs[src] >= power)
|
||||
return //The turf already sustained and spread a power greated than what we are dealing with. No point spreading again.
|
||||
explosion_turfs[src] = 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(spread_power)
|
||||
*/
|
||||
|
||||
/turf/unsimulated/explosion_spread(power)
|
||||
return //So it doesn't get to the parent proc, which simulates explosions
|
||||
@@ -8,7 +8,6 @@
|
||||
flags = CONDUCT
|
||||
pressure_resistance = 5*ONE_ATMOSPHERE
|
||||
layer = 2.9
|
||||
explosion_resistance = 5
|
||||
var/health = 10
|
||||
var/destroyed = 0
|
||||
|
||||
|
||||
@@ -465,7 +465,6 @@ var/global/wcColored
|
||||
glasstype = /obj/item/stack/sheet/plasmaglass
|
||||
reinf = 1
|
||||
health = 160
|
||||
explosion_resistance = 4
|
||||
|
||||
|
||||
/obj/structure/window/plasmareinforced/New(Loc,re=0)
|
||||
@@ -485,7 +484,6 @@ var/global/wcColored
|
||||
reinf = 1
|
||||
basestate = "rwindow"
|
||||
health = 40
|
||||
explosion_resistance = 1
|
||||
|
||||
/obj/structure/window/reinforced/tinted
|
||||
name = "tinted window"
|
||||
|
||||
Reference in New Issue
Block a user