mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 11:05:03 +01:00
Explosion fixes and profiling improvement
Fixes lopsided reactionary explosions and explosions calling ex_act(0) on stuff on non-exploded turfs. Also changes explosion profiling to use btime when available.
This commit is contained in:
@@ -31,10 +31,11 @@
|
||||
flame_range = min (MAX_EX_FLAME_RANGE, flame_range)
|
||||
|
||||
spawn(0)
|
||||
var/start = world.timeofday
|
||||
var/start = TimeOfHour
|
||||
if(!epicenter) return
|
||||
|
||||
var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range)
|
||||
var/list/cached_exp_block = new
|
||||
|
||||
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]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[epicenter.x];Y=[epicenter.y];Z=[epicenter.z]'>JMP</a>)")
|
||||
@@ -83,6 +84,18 @@
|
||||
var/y0 = epicenter.y
|
||||
var/z0 = epicenter.z
|
||||
|
||||
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))
|
||||
cached_exp_block[T] = 0
|
||||
if(T.density && T.explosion_block)
|
||||
cached_exp_block[T] += T.explosion_block
|
||||
|
||||
for(var/obj/machinery/door/D in T)
|
||||
if(D.density && D.explosion_block)
|
||||
cached_exp_block[T] += D.explosion_block
|
||||
|
||||
for(var/turf/T in trange(max_range, epicenter))
|
||||
|
||||
var/dist = cheap_hypotenuse(T.x, T.y, x0, y0)
|
||||
@@ -91,12 +104,7 @@
|
||||
var/turf/Trajectory = T
|
||||
while(Trajectory != epicenter)
|
||||
Trajectory = get_step_towards(Trajectory, epicenter)
|
||||
if(Trajectory.density && Trajectory.explosion_block)
|
||||
dist += Trajectory.explosion_block
|
||||
|
||||
for(var/obj/machinery/door/D in Trajectory)
|
||||
if(D.density && D.explosion_block)
|
||||
dist += D.explosion_block
|
||||
dist += cached_exp_block[Trajectory]
|
||||
|
||||
var/flame_dist = 0
|
||||
// var/throw_dist = max_range - dist
|
||||
@@ -112,12 +120,12 @@
|
||||
//------- TURF FIRES -------
|
||||
|
||||
if(T)
|
||||
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(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density)
|
||||
PoolOrNew(/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)
|
||||
T.ex_act(dist)
|
||||
|
||||
//--- THROW ITEMS AROUND ---
|
||||
@@ -133,7 +141,8 @@
|
||||
var/turf/throw_at = get_ranged_target_turf(I, throw_dir, throw_range)
|
||||
I.throw_at(throw_at, throw_range, 2, no_spin = 1) //Throw it at 2 speed, this is purely visual anyway; don't spin the thrown items, it's very costly.
|
||||
*/
|
||||
var/took = (world.timeofday-start)/10
|
||||
var/timeofhour = TimeOfHour
|
||||
var/took = round((start <= timeofhour) ? ((timeofhour-start)/10) : ((timeofhour-(start-36000))/10), 0.01)
|
||||
//You need to press the DebugGame verb to see these now....they were getting annoying and we've collected a fair bit of data. Just -test- changes to explosion code using this please so we can compare
|
||||
if(Debug2) world.log << "## DEBUG: Explosion([x0],[y0],[z0])(d[devastation_range],h[heavy_impact_range],l[light_impact_range]): Took [took] seconds."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user