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

PGFCSB/OSHA update: Various workplace hazards now are hazards #3387

Closed
wants to merge 26 commits into from
Closed
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
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 1000 + T0C
/// Tank starts leaking
#define TANK_LEAK_PRESSURE (30.*ONE_ATMOSPHERE)
#define TANK_LEAK_PRESSURE (20 * ONE_ATMOSPHERE + 5)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is higher than the rupture pressure so tanks probably won't leak (for long) they'll just pop

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 tank leaking from internal tanks, it didn't seem to even work as intended and during testing it was like... meh honestly

/// Tank spills all contents into atmosphere
#define TANK_RUPTURE_PRESSURE (35.*ONE_ATMOSPHERE)
#define TANK_RUPTURE_PRESSURE (20 * ONE_ATMOSPHERE)
Comment on lines +173 to +175
Copy link
Contributor

Choose a reason for hiding this comment

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

2023 kpa is less than the air pump, which fills to ~2533, so people trying to fill tanks with one can break them (source: experience). I'd think at the very least tanks should have warning labels for maximum pressure/temperature

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea

Probably on a examine()

/// Boom 3x3 base explosion
#define TANK_FRAGMENT_PRESSURE (40.*ONE_ATMOSPHERE)
#define TANK_FRAGMENT_PRESSURE (25.*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
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: 2 additions & 4 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
Member

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 @@ -76,7 +74,7 @@
RegisterSignal(parent, COMSIG_GRENADE_PRIME, PROC_REF(create_blast_pellets))
else if(islandmine(parent))
RegisterSignal(parent, COMSIG_MINE_TRIGGERED, PROC_REF(create_blast_pellets))
else if(issupplypod(parent))
else
RegisterSignal(parent, COMSIG_SUPPLYPOD_LANDED, PROC_REF(create_blast_pellets))

/datum/component/pellet_cloud/UnregisterFromParent()
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))
location.visible_message("<span class='userdanger'>A single ember from [src] drops gently onto [to_test]. Uh oh.</span>")
Copy link
Contributor

Choose a reason for hiding this comment

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

span macros

to_test.fire_act()
ruined_round = TRUE
break
if(istype(to_test, /obj/machinery/atmospherics/components/unary/tank))
location.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
9 changes: 8 additions & 1 deletion code/game/objects/items/extinguisher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,14 @@
var/turf/my_target = particles[W]
if(!W)
continue
step_towards(W,my_target)
var/turf/tomove = get_step_towards(W,my_target)
if(!step_towards(W, tomove))
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
72 changes: 47 additions & 25 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,37 @@
/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 += exposed_temperature/20 //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)/2, 0), BURN, 0)
if(exposed_volume > TANK_RUPTURE_PRESSURE) // implosion
take_damage(max((exposed_volume - TANK_RUPTURE_PRESSURE)/2, 0), BURN, 0)


/obj/item/tank/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
rye-rice marked this conversation as resolved.
Show resolved Hide resolved
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)/2, 0), BURN, 0)
if(exposed_volume > TANK_RUPTURE_PRESSURE) // implosion
take_damage(max((exposed_volume - TANK_RUPTURE_PRESSURE)/2, 0), BURN, 0)

/obj/item/tank/take_damage(damage_amount, damage_type, damage_flag, sound_effect, attack_dir, armour_penetration)
. = ..()
shake_animation(damage_amount, max(damage_amount/2, 2))

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

Expand All @@ -232,40 +261,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))
explosion(epicenter, round(range*0.1), 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
FalloutFalcon marked this conversation as resolved.
Show resolved Hide resolved
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/dangerous,
)

/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/dangerous
)
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/dangerous
)
heating_manage = FALSE

Expand Down
Loading
Loading