Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#define EXPLOSION_FALLOFF_SHAPE_LINEAR 0
#define EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL 1
#define EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_HALF 2
#define EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_IN_PYLON 3
#define EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_HALF_IN_PYLON 4
#define EXPLOSION_MAX_POWER 5000

//area flags
Expand Down
40 changes: 23 additions & 17 deletions code/datums/autocells/explosion.dm
Original file line number Diff line number Diff line change
Expand Up @@ -194,28 +194,34 @@
if(new_power <= 0)
continue

var/new_falloff = power_falloff
// Handle our falloff function.
switch(falloff_shape)
if(EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL)
new_falloff += new_falloff * dir_falloff
if(EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_HALF)
new_falloff += (new_falloff*0.5) * dir_falloff

var/datum/automata_cell/explosion/E = propagate(dir)
if(E)
E.power = new_power
E.power_falloff = new_falloff
E.falloff_shape = falloff_shape
E.explosion_cause_data = explosion_cause_data
var/datum/automata_cell/explosion/new_cell = propagate(dir)
if(new_cell)
var/new_falloff = power_falloff
// Handle our falloff function.
switch(falloff_shape)
if(EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL)
new_falloff += new_falloff * dir_falloff
if(EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_HALF)
new_falloff += (new_falloff*0.5) * dir_falloff
if(EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_IN_PYLON)
if(new_cell.in_turf.get_pylon_protection_level() >= TURF_PROTECTION_OB)
new_falloff += new_falloff * dir_falloff
if(EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_HALF_IN_PYLON)
if(new_cell.in_turf.get_pylon_protection_level() >= TURF_PROTECTION_OB)
new_falloff += (new_falloff*0.5) * dir_falloff

new_cell.power = new_power
new_cell.power_falloff = new_falloff
new_cell.falloff_shape = falloff_shape
new_cell.explosion_cause_data = explosion_cause_data

// Set the direction the explosion is traveling in
E.direction = dir
new_cell.direction = dir
//Diagonal cells have a small delay when branching off the center. This helps the explosion look circular
if(!direction && (dir in GLOB.diagonals))
E.delay = 1
new_cell.delay = 1

setup_new_cell(E)
setup_new_cell(new_cell)

// We've done our duty, now die pls
qdel(src)
Expand Down
10 changes: 5 additions & 5 deletions code/modules/cm_marines/orbital_cannon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -477,27 +477,27 @@ GLOBAL_LIST_EMPTY(orbital_cannon_cancellation)
new /obj/effect/overlay/temp/ob_impact (target, warhead, 1.5)
sleep(10)
var/datum/cause_data/cause_data = create_cause_data(name, source_mob)
cell_explosion(target, clear_power, clear_falloff, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, cause_data) //break shit around
cell_explosion(target, clear_power, clear_falloff, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_IN_PYLON, null, cause_data) //break shit around
sleep(clear_delay)

// Explosion if turf is not a wall.
if(!target.density)
cell_explosion(target, standard_power, standard_falloff, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, cause_data)
cell_explosion(target, standard_power, standard_falloff, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_IN_PYLON, null, cause_data)
handle_ob_shake(target)
if(double_explosion_delay)
sleep(double_explosion_delay)
cell_explosion(target, standard_power, standard_falloff, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, cause_data)
cell_explosion(target, standard_power, standard_falloff, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_IN_PYLON, null, cause_data)
qdel(src)
return

// Checks turf around the target
for(var/turf/T in range(2, target))
if(!T.density)
cell_explosion(target, standard_power, standard_falloff, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, cause_data)
cell_explosion(target, standard_power, standard_falloff, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_IN_PYLON, null, cause_data)
handle_ob_shake(target)
if(double_explosion_delay)
sleep(double_explosion_delay)
cell_explosion(target, standard_power, standard_falloff, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, cause_data)
cell_explosion(target, standard_power, standard_falloff, EXPLOSION_FALLOFF_SHAPE_EXPONENTIAL_IN_PYLON, null, cause_data)
qdel(src)
return

Expand Down