mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-27 22:17:32 +01:00
Merge pull request #1353 from Fox-McCloud/explosion-rework
Explosion Rework
This commit is contained in:
@@ -208,8 +208,8 @@
|
||||
new /obj/structure/alien/weeds(T, linked_node)
|
||||
|
||||
|
||||
/obj/structure/alien/weeds/ex_act(severity, target)
|
||||
del(src)
|
||||
/obj/structure/alien/weeds/ex_act(severity)
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/structure/alien/weeds/attackby(obj/item/I, mob/user, params)
|
||||
|
||||
@@ -1102,11 +1102,11 @@ steam.start() -- spawns the effect
|
||||
qdel(src)
|
||||
|
||||
blob_act()
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
bullet_act()
|
||||
if(metal==1 || prob(50))
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
attack_hand(var/mob/user)
|
||||
if ((HULK in user.mutations) || (prob(75 - metal*25)))
|
||||
@@ -1115,7 +1115,7 @@ steam.start() -- spawns the effect
|
||||
if ((O.client && !( O.blinded )))
|
||||
O << "\red [user] smashes through the foamed metal."
|
||||
|
||||
del(src)
|
||||
qdel(src)
|
||||
else
|
||||
user << "\blue You hit the metal foam but bounce off it."
|
||||
return
|
||||
@@ -1129,8 +1129,8 @@ steam.start() -- spawns the effect
|
||||
for(var/mob/O in viewers(src))
|
||||
if (O.client)
|
||||
O << "\red [G.assailant] smashes [G.affecting] through the foamed metal wall."
|
||||
del(I)
|
||||
del(src)
|
||||
qdel(I)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
if(prob(I.force*20 - metal*25))
|
||||
@@ -1138,7 +1138,7 @@ steam.start() -- spawns the effect
|
||||
for(var/mob/O in oviewers(user))
|
||||
if ((O.client && !( O.blinded )))
|
||||
O << "\red [user] smashes through the foamed metal."
|
||||
del(src)
|
||||
qdel(src)
|
||||
else
|
||||
user << "\blue You hit the metal foam to no effect."
|
||||
|
||||
|
||||
@@ -156,15 +156,15 @@
|
||||
/obj/effect/supermatter_crystal/ex_act(severity)
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
del(src)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
if (prob(50))
|
||||
del(src)
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
if (prob(5))
|
||||
del(src)
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
return
|
||||
@@ -176,4 +176,4 @@
|
||||
|
||||
/obj/effect/supermatter_crystal/proc/CheckEndurance()
|
||||
if(endurance <= 0)
|
||||
del(src)
|
||||
qdel(src)
|
||||
@@ -6,7 +6,7 @@
|
||||
if(dx>=dy) return dx + (0.5*dy) //The longest side add half the shortest side approximates the hypotenuse
|
||||
else return dy + (0.5*dx)
|
||||
|
||||
proc/trange(var/Dist=0,var/turf/Center=null)//alternative to range (ONLY processes turfs and thus less intensive)
|
||||
/proc/trange(var/Dist=0,var/turf/Center=null)//alternative to range (ONLY processes turfs and thus less intensive)
|
||||
if(Center==null) return
|
||||
|
||||
//var/x1=((Center.x-Dist)<1 ? 1 : Center.x-Dist)
|
||||
@@ -19,42 +19,60 @@ proc/trange(var/Dist=0,var/turf/Center=null)//alternative to range (ONLY process
|
||||
return block(x1y1,x2y2)
|
||||
|
||||
|
||||
proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, adminlog = 1)
|
||||
/proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1, ignorecap = 0, flame_range = 0 ,silent = 0)
|
||||
src = null //so we don't abort once src is deleted
|
||||
epicenter = get_turf(epicenter)
|
||||
|
||||
// Archive the uncapped explosion for the doppler array
|
||||
var/orig_dev_range = devastation_range
|
||||
var/orig_heavy_range = heavy_impact_range
|
||||
var/orig_light_range = light_impact_range
|
||||
|
||||
if(!ignorecap)
|
||||
// Clamp all values to MAX_EXPLOSION_RANGE
|
||||
devastation_range = min (MAX_EX_DEVESTATION_RANGE, devastation_range)
|
||||
heavy_impact_range = min (MAX_EX_HEAVY_RANGE, heavy_impact_range)
|
||||
light_impact_range = min (MAX_EX_LIGHT_RANGE, light_impact_range)
|
||||
flash_range = min (MAX_EX_FLASH_RANGE, flash_range)
|
||||
flame_range = min (MAX_EX_FLAME_RANGE, flame_range)
|
||||
|
||||
spawn(0)
|
||||
var/start = world.timeofday
|
||||
epicenter = get_turf(epicenter)
|
||||
if(!epicenter) return
|
||||
|
||||
var/max_range = max(devastation_range, heavy_impact_range, light_impact_range)
|
||||
var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range)
|
||||
|
||||
// Play sounds; since playsound uses range() for each use, we'll try doing it through the player list.
|
||||
// Playsound_local will also have an extra bonus of panning the sound, depending on the source. So stereo users will hear the direction of the explosion
|
||||
for(var/mob/M in player_list)
|
||||
// Double check for client
|
||||
if(M && M.client)
|
||||
var/turf/M_turf = get_turf(M)
|
||||
if(M_turf && M_turf.z == epicenter.z)
|
||||
var/dist = get_dist(M_turf, epicenter)
|
||||
// If inside the blast radius + world.view - 2
|
||||
if(dist <= round(max_range + world.view - 2, 1))
|
||||
M.playsound_local(epicenter, "explosion", 100, 1)
|
||||
// You hear a far explosion if you're outside the blast radius (*5) Small bombs shouldn't be heard all over the station.
|
||||
else if(dist <= round(max_range * 10, 1))
|
||||
var/far_volume = Clamp(max_range * 10, 30, 60) // Volume is based on explosion size and dist
|
||||
far_volume += (dist > max_range * 2 ? 0 : 40) // add 40 volume if the mob is pretty close to the explosion
|
||||
M.playsound_local(epicenter, 'sound/effects/explosionfar.ogg', far_volume, 1)
|
||||
|
||||
|
||||
var/close = range(world.view+round(devastation_range,1), epicenter)
|
||||
// to all distanced mobs play a different sound
|
||||
for(var/mob/M in world) if(M.z == epicenter.z) if(!(M in close))
|
||||
// check if the mob can hear
|
||||
if(M.ear_deaf <= 0 || !M.ear_deaf) if(!istype(M.loc,/turf/space))
|
||||
M << 'sound/effects/explosionfar.ogg'
|
||||
if(adminlog)
|
||||
msg_admin_attack("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_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>)")
|
||||
log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ")
|
||||
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>)")
|
||||
log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range], [flame_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z])")
|
||||
|
||||
// Play sounds; we want sounds to be different depending on distance so we will manually do it ourselves.
|
||||
// Stereo users will also hear the direction of the explosion!
|
||||
|
||||
// Calculate far explosion sound range. Only allow the sound effect for heavy/devastating explosions.
|
||||
// 3/7/14 will calculate to 80 + 35
|
||||
|
||||
var/far_dist = 0
|
||||
far_dist += heavy_impact_range * 5
|
||||
far_dist += devastation_range * 20
|
||||
|
||||
if(!silent)
|
||||
var/frequency = get_rand_frequency()
|
||||
for(var/mob/M in player_list)
|
||||
// Double check for client
|
||||
if(M && M.client)
|
||||
var/turf/M_turf = get_turf(M)
|
||||
if(M_turf && M_turf.z == epicenter.z)
|
||||
var/dist = get_dist(M_turf, epicenter)
|
||||
// If inside the blast radius + world.view - 2
|
||||
if(dist <= round(max_range + world.view - 2, 1))
|
||||
M.playsound_local(epicenter, get_sfx("explosion"), 100, 1, frequency, falloff = 5) // get_sfx() is so that everyone gets the same sound
|
||||
// You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
|
||||
else if(dist <= far_dist)
|
||||
var/far_volume = Clamp(far_dist, 30, 50) // Volume is based on explosion size and dist
|
||||
far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion
|
||||
M.playsound_local(epicenter, 'sound/effects/explosionfar.ogg', far_volume, 1, frequency, falloff = 5)
|
||||
|
||||
|
||||
//Pause the lighting updates for a bit
|
||||
var/datum/controller/process/lighting = processScheduler.getProcess("lighting")
|
||||
@@ -74,7 +92,8 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
|
||||
var/z0 = epicenter.z
|
||||
|
||||
for(var/turf/T in trange(max_range, epicenter))
|
||||
var/dist = sqrt((T.x - x0)**2 + (T.y - y0)**2)
|
||||
|
||||
var/dist = cheap_pythag(T.x - x0,T.y - y0)
|
||||
|
||||
if(config.reactionary_explosions)
|
||||
var/turf/Trajectory = T
|
||||
@@ -87,19 +106,25 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
|
||||
if(D.density && D.explosion_block)
|
||||
dist += D.explosion_block
|
||||
|
||||
var/flame_dist = 0
|
||||
var/throw_dist = dist
|
||||
|
||||
if(dist < flame_range)
|
||||
flame_dist = 1
|
||||
|
||||
if(dist < devastation_range) dist = 1
|
||||
else if(dist < heavy_impact_range) dist = 2
|
||||
else if(dist < light_impact_range) dist = 3
|
||||
else dist = 0
|
||||
else dist = 0
|
||||
|
||||
//------- 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(AM) AM.ex_act(dist)
|
||||
if(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density)
|
||||
new/obj/effect/hotspot(T) //Mostly for ambience!
|
||||
if(dist > 0)
|
||||
T.ex_act(dist)
|
||||
|
||||
@@ -122,7 +147,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
|
||||
for(var/i,i<=doppler_arrays.len,i++)
|
||||
var/obj/machinery/doppler_array/Array = doppler_arrays[i]
|
||||
if(Array)
|
||||
Array.sense_explosion(x0,y0,z0,devastation_range,heavy_impact_range,light_impact_range,took)
|
||||
Array.sense_explosion(x0,y0,z0,devastation_range,heavy_impact_range,light_impact_range,took,orig_dev_range,orig_heavy_range,orig_light_range)
|
||||
|
||||
sleep(8)
|
||||
|
||||
@@ -136,7 +161,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
|
||||
|
||||
|
||||
|
||||
proc/secondaryexplosion(turf/epicenter, range)
|
||||
/proc/secondaryexplosion(turf/epicenter, range)
|
||||
for(var/turf/tile in trange(range, epicenter))
|
||||
tile.ex_act(2)
|
||||
|
||||
@@ -145,8 +170,10 @@ proc/secondaryexplosion(turf/epicenter, range)
|
||||
set category = "Debug"
|
||||
|
||||
var/newmode = alert("Use reactionary explosions?","Check Bomb Impact", "Yes", "No")
|
||||
var/turf/epicenter = get_turf(mob)
|
||||
if(!epicenter)
|
||||
return
|
||||
|
||||
var/turf/epicenter = get_turf(usr)
|
||||
var/dev = 0
|
||||
var/heavy = 0
|
||||
var/light = 0
|
||||
|
||||
@@ -1293,14 +1293,14 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
|
||||
if (ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.show_message("\red Your [src] explodes!", 1)
|
||||
M.show_message("<span class='danger'>Your [src] explodes!</span>", 1)
|
||||
|
||||
if(T)
|
||||
T.hotspot_expose(700,125)
|
||||
|
||||
explosion(T, -1, -1, 2, 3)
|
||||
JFLOG("Exploded")
|
||||
del(src)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/device/pda/Destroy()
|
||||
|
||||
@@ -134,6 +134,6 @@
|
||||
if(1.0)
|
||||
del(src)
|
||||
if(2.0)
|
||||
if(prob(50)) del(src)
|
||||
if(prob(50)) qdel(src)
|
||||
if(3.0)
|
||||
if(prob(25)) del(src)
|
||||
if(prob(25)) qdel(src)
|
||||
|
||||
@@ -317,4 +317,4 @@
|
||||
if(pai)
|
||||
pai.ex_act(severity)
|
||||
else
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
return
|
||||
|
||||
/obj/item/weapon/a_gift/ex_act()
|
||||
del(src)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/effect/spresent/relaymove(mob/user as mob)
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
/obj/item/weapon/grenade/iedcasing/prime() //Blowing that can up
|
||||
update_mob()
|
||||
explosion(src.loc,0,0,2,2) //explosion(src.loc,-1,-1,-1, flame_range = range)
|
||||
explosion(src.loc,-1,-1,-1, flame_range = range) // no explosive damage, only a large fireball.
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/grenade/iedcasing/examine(mob/user)
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
|
||||
/obj/item/weapon/grenade/syndieminibomb/prime()
|
||||
update_mob()
|
||||
explosion(src.loc,1,2,4)
|
||||
del(src)
|
||||
explosion(src.loc,1,2,4,flame_range = 2)
|
||||
qdel(src)
|
||||
@@ -248,13 +248,15 @@
|
||||
air_contents.react()
|
||||
pressure = air_contents.return_pressure()
|
||||
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
|
||||
range = min(range, MAX_EXPLOSION_RANGE) // was 8 - - - Changed to a configurable define -- TLE
|
||||
var/turf/epicenter = get_turf(loc)
|
||||
|
||||
//world << "\blue Exploding Pressure: [pressure] kPa, intensity: [range]"
|
||||
|
||||
explosion(epicenter, round(range*0.25), round(range*0.5), round(range), round(range*1.5))
|
||||
del(src)
|
||||
if(istype(src.loc,/obj/item/device/transfer_valve))
|
||||
qdel(src.loc)
|
||||
else
|
||||
qdel(src)
|
||||
|
||||
else if(pressure > TANK_RUPTURE_PRESSURE)
|
||||
//world << "\blue[x],[y] tank is rupturing: [pressure] kPa, integrity [integrity]"
|
||||
@@ -264,7 +266,7 @@
|
||||
return
|
||||
T.assume_air(air_contents)
|
||||
playsound(src.loc, 'sound/effects/spray.ogg', 10, 1, -3)
|
||||
del(src)
|
||||
qdel(src)
|
||||
else
|
||||
integrity--
|
||||
|
||||
|
||||
@@ -181,13 +181,13 @@
|
||||
switch(severity)
|
||||
if(1.0)
|
||||
for(var/obj/O in src.contents)
|
||||
del(O)
|
||||
qdel(O)
|
||||
qdel(src)
|
||||
return
|
||||
if(2.0)
|
||||
for(var/obj/O in src.contents)
|
||||
if(prob(50))
|
||||
del(O)
|
||||
qdel(O)
|
||||
qdel(src)
|
||||
return
|
||||
if(3.0)
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
getFromPool(/obj/item/weapon/shard, loc)
|
||||
if (occupant)
|
||||
dump()
|
||||
del(src)
|
||||
qdel(src)
|
||||
if (2)
|
||||
if (prob(50))
|
||||
src.health -= 15
|
||||
|
||||
Reference in New Issue
Block a user