From f40dcf358e8d351219568b05293b3bff5e21394f Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Sat, 21 Jul 2012 10:31:50 +0000 Subject: [PATCH] Committing this in-case anybody is willing to speed-test it against the current one. It's an explosion proc that uses locate to locate only turfs and then ex_acts them. As opposed to grabing every atom in a square around the epicenter and then selecting which ones to ex_act this version also supports sticking a sleep() in there to help stop the server getting too backlogged. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4134 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/objects/explosion2.dm | 115 ++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 code/game/objects/explosion2.dm diff --git a/code/game/objects/explosion2.dm b/code/game/objects/explosion2.dm new file mode 100644 index 00000000000..5f6ee6a678f --- /dev/null +++ b/code/game/objects/explosion2.dm @@ -0,0 +1,115 @@ +//TODO: Flash range does nothing currently + +proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1) + spawn(0) + var/start = world.timeofday + epicenter = get_turf(epicenter) + if(!epicenter) return + + if(adminlog) + message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") + log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ") + + playsound(epicenter, 'explosionfar.ogg', 100, 1, round(devastation_range*2,1) ) + playsound(epicenter, "explosion", 100, 1, round(devastation_range,1) ) + + tension_master.explosion() + + if(defer_powernet_rebuild != 2) + defer_powernet_rebuild = 1 + + if(heavy_impact_range > 1) + var/datum/effect/system/explosion/E = new/datum/effect/system/explosion() + E.set_up(epicenter) + E.start() + + var/x = epicenter.x + var/y = epicenter.y + var/z = epicenter.z + + var/counter = 0 + + if(devastation_range > 0) + counter += explosion_turf(x,y,z,1) + else + devastation_range = 0 + if(heavy_impact_range > 0) + counter += explosion_turf(x,y,z,2) + else + heavy_impact_range = 0 + if(light_impact_range > 0) + counter += explosion_turf(x,y,z,3) + else + return + + //Diamond 'splosions (looks more round than square version) + for(var/i=0, i