Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domino of Explosions: Explosion on a Dwayne-Class #3387

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
9 changes: 5 additions & 4 deletions code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@

//TANKS
/// temperature in kelvins at which a tank will start to melt
#define TANK_MELT_TEMPERATURE 1000000
#define TANK_MELT_TEMPERATURE 800 + T0C
/// Tank starts leaking
#define TANK_LEAK_PRESSURE (30.*ONE_ATMOSPHERE)
#define TANK_LEAK_PRESSURE (10 * ONE_ATMOSPHERE + 5)
/// Tank spills all contents into atmosphere
#define TANK_RUPTURE_PRESSURE (35.*ONE_ATMOSPHERE)
#define TANK_RUPTURE_PRESSURE (11 * ONE_ATMOSPHERE)
/// Boom 3x3 base explosion
#define TANK_FRAGMENT_PRESSURE (40.*ONE_ATMOSPHERE)
#define TANK_FRAGMENT_PRESSURE (12.*ONE_ATMOSPHERE)
/// +1 for each SCALE kPa aboe threshold
#define TANK_FRAGMENT_SCALE (6.*ONE_ATMOSPHERE)
#define TANK_MAX_RELEASE_PRESSURE (ONE_ATMOSPHERE*3)
Expand Down Expand Up @@ -337,6 +337,7 @@
#define GAS_HYDROGEN "h2"
#define GAS_CHLORINE "cl2"
#define GAS_HYDROGEN_CHLORIDE "hcl"
#define GAS_CO "co"

#define GAS_FLAG_DANGEROUS (1<<0)
#define GAS_FLAG_BREATH_PROC (1<<1)
Expand Down
12 changes: 6 additions & 6 deletions code/__DEFINES/species.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Pressure limits.
/// This determins at what pressure the ultra-high pressure red icon is displayed. (This one is set as a constant)
#define HAZARD_HIGH_PRESSURE 550
#define HAZARD_HIGH_PRESSURE 303
/// This determins when the orange pressure icon is displayed (it is 0.7 * HAZARD_HIGH_PRESSURE)
#define WARNING_HIGH_PRESSURE 325
#define WARNING_HIGH_PRESSURE 202
/// This is when the gray low pressure icon is displayed. (it is 2.5 * HAZARD_LOW_PRESSURE)
#define WARNING_LOW_PRESSURE 50
#define WARNING_LOW_PRESSURE 60
/// This is when the black ultra-low pressure icon is displayed. (This one is set as a constant)
#define HAZARD_LOW_PRESSURE 20
#define HAZARD_LOW_PRESSURE 40
Comment on lines +3 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably update the comments here because they will be inaccurate with the current numbers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep


/// This is used in handle_temperature_damage() for humans, and in reagents that affect body temperature. Temperature damage is multiplied by this amount.
#define TEMPERATURE_DAMAGE_COEFFICIENT 1.5
Expand All @@ -28,11 +28,11 @@
/// The body temperature limit the human body can take before it starts taking damage from heat.
/// This also affects how fast the body normalises it's temperature when hot.
/// 340k is about 66c, and rather high for a human.
#define HUMAN_BODYTEMP_HEAT_DAMAGE_LIMIT (HUMAN_BODYTEMP_NORMAL + 30)
#define HUMAN_BODYTEMP_HEAT_DAMAGE_LIMIT (HUMAN_BODYTEMP_NORMAL + 20)
/// The body temperature limit the human body can take before it starts taking damage from cold.
/// This also affects how fast the body normalises it's temperature when cold.
/// 270k is about -3c, that is below freezing and would hurt over time.
#define HUMAN_BODYTEMP_COLD_DAMAGE_LIMIT (HUMAN_BODYTEMP_NORMAL - 40)
#define HUMAN_BODYTEMP_COLD_DAMAGE_LIMIT (HUMAN_BODYTEMP_NORMAL - 30)
Comment on lines 30 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the comments here too, new numbers are 57 c/ 330 k and 7 c/ 280 k

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty



//VOX DEFINES
Expand Down
43 changes: 43 additions & 0 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1542,3 +1542,46 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
if(dir & WEST)
return WEST
return 0

/proc/filled_turfs(atom/center, radius = 3, type = "circle", include_edge = TRUE)
var/turf/center_turf = get_turf(center)
if(radius < 0 || !center)
return
if(radius == 0)
return list(center_turf)

var/list/directions
switch(type)
if("square")
directions = GLOB.alldirs
if("circle")
directions = GLOB.cardinals

var/list/results = list(center_turf)
var/list/turfs_to_check = list()
turfs_to_check += center_turf
for(var/i = radius; i > 0; i--)
for(var/X in turfs_to_check)
var/turf/T = X
for(var/direction in directions)
var/turf/AdjT = get_step(T, direction)
if(!AdjT)
continue
if (AdjT in results) // Ignore existing turfs
continue
if(AdjT.density)
if(include_edge)
results += AdjT
continue

turfs_to_check += AdjT
results += AdjT
return results

/proc/flame_radius(turf/epicenter, radius = 1, power = 5, fire_color = "red")
if(!isturf(epicenter))
CRASH("flame_radius used without a valid turf parameter")
radius = clamp(radius, 1, 50) //Sanitize inputs

for(var/turf/turf_to_flame as anything in filled_turfs(epicenter, radius, "circle"))
turf_to_flame.IgniteTurf(power, fire_color)
2 changes: 2 additions & 0 deletions code/controllers/subsystem/explosions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ SUBSYSTEM_DEF(explosions)

if(flame_dist && prob(40) && !isspaceturf(T) && !T.density)
flameturf += T
if(flame_range)
flame_radius(epicenter, flame_range, flame_range*2)

//--- THROW ITEMS AROUND ---
var/throw_dir = get_dir(epicenter,T)
Expand Down
6 changes: 3 additions & 3 deletions code/datums/components/pellet_cloud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
var/mob/living/shooter

/datum/component/pellet_cloud/Initialize(projectile_type=/obj/item/shrapnel, magnitude=5)
if(!isammocasing(parent) && !isgrenade(parent) && !islandmine(parent) && !issupplypod(parent))
return COMPONENT_INCOMPATIBLE
Comment on lines -49 to -50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please at least check that its an atom or obj


if(magnitude < 1)
stack_trace("Invalid magnitude [magnitude] < 1 on pellet_cloud, parent: [parent]")
Expand All @@ -57,7 +55,7 @@

if(isammocasing(parent))
num_pellets = magnitude
else if(isgrenade(parent) || islandmine(parent) || issupplypod(parent))
else
radius = magnitude

/datum/component/pellet_cloud/Destroy(force, silent)
Expand All @@ -78,6 +76,8 @@
RegisterSignal(parent, COMSIG_MINE_TRIGGERED, PROC_REF(create_blast_pellets))
else if(issupplypod(parent))
RegisterSignal(parent, COMSIG_SUPPLYPOD_LANDED, PROC_REF(create_blast_pellets))
else
RegisterSignal(parent, COMSIG_SUPPLYPOD_LANDED, PROC_REF(create_blast_pellets))
rye-rice marked this conversation as resolved.
Show resolved Hide resolved

/datum/component/pellet_cloud/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_PELLET_CLOUD_INIT, COMSIG_GRENADE_PRIME, COMSIG_GRENADE_ARMED, COMSIG_MOVABLE_MOVED, COMSIG_MINE_TRIGGERED, COMSIG_ITEM_DROPPED))
Expand Down
23 changes: 23 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,29 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
if(isturf(location))
location.hotspot_expose(flame_heat, 5)

if(!prob(1))
return

for(var/dir in GLOB.cardinals)
var/ruined_round = FALSE
var/turf/test_turf = get_step(location, dir)
for(var/obj/to_test as obj in test_turf.contents)
if(istype(to_test, /obj/structure/reagent_dispensers/fueltank))
visible_message("<span class='userdanger'>A single ember from [src] drops gently onto [to_test]. Uh oh.</span>")
to_test.fire_act()
ruined_round = TRUE
break
if(istype(to_test, /obj/machinery/atmospherics/components/unary/tank))
visible_message("<span class='userdanger'>A flash fire forms around [src]!</span>")
location.IgniteTurf(flame_heat/20)
new /obj/effect/hotspot(location)
ruined_round = TRUE
break
if(ruined_round)
break



/obj/item/proc/ignition_effect(atom/A, mob/user)
if(get_temperature())
. = "<span class='notice'>[user] lights [A] with [src].</span>"
Expand Down
10 changes: 9 additions & 1 deletion code/game/objects/items/extinguisher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,15 @@
var/turf/my_target = particles[W]
if(!W)
continue
step_towards(W,my_target)
var/turf/tomove = get_step_towards(W,my_target)
var/movedir = get_dir(W, tomove)
if(!W.CanPassThrough(tomove, movedir))
if(isopenturf(tomove))
W.forceMove(tomove)
particles -= W
else
W.Move(tomove)

if(!W.reagents)
continue
W.reagents.expose(get_turf(W))
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/shrapnel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
armour_penetration = -35
dismemberment = 10
shrapnel_type = /obj/item/shrapnel/hot
ricochets_max = 10
ricochet_incidence_leeway = 0
damage_type = BURN

/obj/projectile/bullet/shrapnel/hot/on_hit(atom/target, blocked = FALSE)
Expand Down
66 changes: 42 additions & 24 deletions code/game/objects/items/tanks/tanks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BACK
hitsound = 'sound/weapons/smash.ogg'
resistance_flags = FIRE_PROOF // its metal, but the gas inside isnt nessarily fireproof...
pressure_resistance = ONE_ATMOSPHERE * 5
force = 5
throwforce = 10
Expand All @@ -16,7 +17,6 @@
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 10, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 30)
var/datum/gas_mixture/air_contents = null
var/distribute_pressure = ONE_ATMOSPHERE
var/integrity = 3
var/volume = 70

supports_variations = VOX_VARIATION
Expand Down Expand Up @@ -219,8 +219,33 @@
/obj/item/tank/process()
//Allow for reactions
air_contents.react()
var/turf/open/current_turf = get_turf(src)
if(current_turf)
temperature_expose(current_turf.air, current_turf.air.return_temperature(), current_turf.air.return_pressure())
check_status()

/obj/item/tank/fire_act(exposed_temperature, exposed_volume)
. = ..()
var/tank_temperature = air_contents.return_temperature()
tank_temperature = ((tank_temperature * 4) + exposed_temperature)/5 //slowly equalize with the air, since this is over an active fire, we heat up faster
air_contents.set_temperature(tank_temperature)
if(exposed_temperature > TANK_MELT_TEMPERATURE)
take_damage(max((exposed_temperature - TANK_MELT_TEMPERATURE), 0), BURN, 0)
if(exposed_volume > TANK_RUPTURE_PRESSURE) // implosion
take_damage(max((exposed_volume - TANK_RUPTURE_PRESSURE), 0), BURN, 0)


/obj/item/tank/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's easy for a tank to end up overheating on lava planets & there's no fast way to un-overheat a tank as far as I'm aware

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this mechanic, temperature_expose only procs on fires

Before I removed it putting the tank back in your ship would cool it ambiently

if(!isturf(loc)) //so people dont freeze to death by cold air during eva
return ..()
var/tank_temperature = air_contents.return_temperature()
tank_temperature = ((tank_temperature * 6) + exposed_temperature)/7 //slowly equalize with the air
air_contents.set_temperature(tank_temperature)
if(exposed_temperature > TANK_MELT_TEMPERATURE)
take_damage(max((exposed_temperature - TANK_MELT_TEMPERATURE), 0), BURN, 0)
if(exposed_volume > TANK_RUPTURE_PRESSURE) // implosion
take_damage(max((exposed_volume - TANK_RUPTURE_PRESSURE), 0), BURN, 0)

/obj/item/tank/proc/check_status()
//Handle exploding, leaking, and rupturing of the tank

Expand All @@ -232,40 +257,33 @@

if(pressure > TANK_FRAGMENT_PRESSURE)
if(!istype(src.loc, /obj/item/transfer_valve))
message_admins("[src] ruptured explosively at [ADMIN_VERBOSEJMP(src)], last touched by [get_mob_by_key(fingerprintslast)]!")
log_admin("[src] ruptured explosively at [ADMIN_VERBOSEJMP(src)], last touched by [get_mob_by_key(fingerprintslast)]!")
log_bomber(get_mob_by_key(fingerprintslast), "was last key to touch", src, "which ruptured explosively")
//Give the gas a chance to build up more pressure through reacting
air_contents.react(src)
pressure = air_contents.return_pressure()
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
var/range = (pressure-TANK_RUPTURE_PRESSURE)/TANK_FRAGMENT_SCALE
var/turf/epicenter = get_turf(loc)


explosion(epicenter, round(range*0.25), round(range*0.5), round(range), round(range*1.5))

AddComponent(/datum/component/pellet_cloud, /obj/projectile/bullet/shrapnel/hot, round(range))
if(istype(src.loc, /obj/item/transfer_valve))
qdel(src.loc)
else
qdel(src)
return obj_destruction()

else if(pressure > TANK_RUPTURE_PRESSURE || temperature > TANK_MELT_TEMPERATURE)
if(integrity <= 0)
var/turf/T = get_turf(src)
if(!T)
return
T.assume_air(air_contents)
playsound(src.loc, 'sound/effects/spray.ogg', 10, TRUE, -3)
qdel(src)
else
integrity--

else if(pressure > TANK_LEAK_PRESSURE)
if(integrity <= 0)
var/turf/T = get_turf(src)
if(!T)
return
var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(0.25)
T.assume_air(leaked_gas)
else
integrity--
take_damage(max((pressure - TANK_RUPTURE_PRESSURE), 0), BRUTE, 0)
take_damage(max((temperature - TANK_MELT_TEMPERATURE), 0), BRUTE, 0)

/obj/item/tank/obj_destruction(damage_flag)
var/turf/T = get_turf(src)
if(!T)
return ..()
T.assume_air(air_contents)
playsound(src.loc, 'sound/effects/spray.ogg', 100, TRUE, -3)
return ..()

else if(integrity < 3)
integrity++
2 changes: 1 addition & 1 deletion code/modules/atmospherics/auxgm/breathing_classes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
gases = list(
GAS_O2 = 1,
GAS_PLUOXIUM = 8,
GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant
GAS_CO2 = -0.2, // CO2 isn't actually toxic, just an asphyxiant
)
products = list(
GAS_CO2 = 1,
Expand Down
13 changes: 12 additions & 1 deletion code/modules/atmospherics/auxgm/gas_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
)
)

/datum/gas/carbon_monoxide
id = GAS_CO
specific_heat = 30
name = "Carbon Monoxide"
breath_results = GAS_CO

flags = GAS_FLAG_DANGEROUS

fusion_power = 0
enthalpy = -110500

/datum/gas/carbon_dioxide //what the fuck is this?
id = GAS_CO2
specific_heat = 30
Expand Down Expand Up @@ -161,7 +172,7 @@
specific_heat = 10
name = "Hydrogen"
flags = GAS_FLAG_DANGEROUS
moles_visible = MOLES_GAS_VISIBLE
//moles_visible = MOLES_GAS_VISIBLE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain why

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain why

image

color = "#ffe"
fusion_power = 0
fire_products = list(GAS_H2O = 1)
Expand Down
1 change: 1 addition & 0 deletions code/modules/atmospherics/gasmixtures/auxgm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA

/datum/gas
var/id = ""
/// heat capacity? thats the only explanation on what this var is
var/specific_heat = 0
var/name = ""
var/gas_overlay = "generic" //icon_state in icons/effects/atmospherics.dmi
Expand Down
13 changes: 8 additions & 5 deletions code/modules/atmospherics/machinery/airalarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@
var/datum/radio_frequency/radio_connection

//anything outright hazardous (flammable, toxic, generally Weird)
var/list/filter_basic = list(GAS_CO2, GAS_PLASMA, GAS_NITROUS, GAS_BZ, GAS_TRITIUM, GAS_NITRYL, GAS_FREON, GAS_HYDROGEN, GAS_CHLORINE, GAS_HYDROGEN_CHLORIDE)
var/list/filter_basic = list(GAS_CO2, GAS_PLASMA, GAS_NITROUS, GAS_BZ, GAS_TRITIUM, GAS_NITRYL, GAS_FREON, GAS_HYDROGEN, GAS_CHLORINE, GAS_HYDROGEN_CHLORIDE, GAS_CO)
//anything that isn't o2 or n2.
var/list/filter_extra = list(GAS_CO2, GAS_PLASMA, GAS_NITROUS, GAS_BZ, GAS_TRITIUM, GAS_NITRYL, GAS_FREON, GAS_HYDROGEN, GAS_CHLORINE, GAS_HYDROGEN_CHLORIDE, GAS_H2O, GAS_HYPERNOB, GAS_STIMULUM, GAS_PLUOXIUM)
var/list/filter_extra = list(GAS_CO2, GAS_PLASMA, GAS_NITROUS, GAS_BZ, GAS_TRITIUM, GAS_NITRYL, GAS_FREON, GAS_HYDROGEN, GAS_CHLORINE, GAS_HYDROGEN_CHLORIDE, GAS_H2O, GAS_HYPERNOB, GAS_STIMULUM, GAS_PLUOXIUM, GAS_CO)

var/list/TLV = list( // Breathable air.
"pressure" = new/datum/tlv(HAZARD_LOW_PRESSURE, WARNING_LOW_PRESSURE, WARNING_HIGH_PRESSURE, HAZARD_HIGH_PRESSURE), // kPa. Values are min2, min1, max1, max2
Expand All @@ -129,7 +129,8 @@
GAS_FREON = new/datum/tlv/dangerous,
GAS_HYDROGEN = new/datum/tlv/dangerous,
GAS_CHLORINE = new/datum/tlv/dangerous,
GAS_HYDROGEN_CHLORIDE = new/datum/tlv/dangerous
GAS_HYDROGEN_CHLORIDE = new/datum/tlv/dangerous,
GAS_CO = new/datum/tlv(-1, -1, 0.002, 2)
)

/obj/machinery/airalarm/server // No checks here.
Expand All @@ -151,7 +152,8 @@
GAS_FREON = new/datum/tlv/no_checks,
GAS_HYDROGEN = new/datum/tlv/no_checks,
GAS_CHLORINE = new/datum/tlv/dangerous,
GAS_HYDROGEN_CHLORIDE = new/datum/tlv/dangerous
GAS_HYDROGEN_CHLORIDE = new/datum/tlv/dangerous,
GAS_CO = new/datum/tlv(-1, -1, 5, 10)
)
heating_manage = FALSE

Expand All @@ -174,7 +176,8 @@
GAS_FREON = new/datum/tlv/dangerous,
GAS_HYDROGEN = new/datum/tlv/dangerous,
GAS_CHLORINE = new/datum/tlv/dangerous,
GAS_HYDROGEN_CHLORIDE = new/datum/tlv/dangerous
GAS_HYDROGEN_CHLORIDE = new/datum/tlv/dangerous,
GAS_CO = new/datum/tlv(-1, -1, 5, 10)
)
heating_manage = FALSE

Expand Down
Loading
Loading