[MIRROR] Fixes some runtimes [IDB IGNORE] (#10322)

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-03-06 23:22:26 +01:00
committed by GitHub
co-authored by Cameron Lennox Kashargul
parent 831b0eadab
commit 53764daffa
13 changed files with 88 additions and 57 deletions
+32 -7
View File
@@ -132,7 +132,7 @@ Pipelines + Other Objects -> Pipe network
return null
/obj/machinery/atmospherics/proc/build_network()
/obj/machinery/atmospherics/proc/build_network(var/new_attachment)
// Called to build a network from this node
return null
@@ -158,11 +158,14 @@ Pipelines + Other Objects -> Pipe network
return null
/obj/machinery/atmospherics/proc/can_unwrench()
/* //Old version. We now handle unwrenching in the machinery itself.
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
return 0
return 1
return FALSE
*/
return TRUE
// Deconstruct into a pipe item.
/obj/machinery/atmospherics/proc/deconstruct()
@@ -191,13 +194,17 @@ Pipelines + Other Objects -> Pipe network
atmos_init()
if(QDELETED(src))
return // TODO - Eventually should get rid of the need for this.
build_network()
var/list/nodes = get_neighbor_nodes_for_init()
for(var/obj/machinery/atmospherics/A in nodes)
A.atmos_init()
A.build_network()
// TODO - Should we do src.build_network() before or after the nodes?
// We've historically done before, but /tg does after. TODO research if there is a difference.
A.build_network(TRUE)
build_network()
// There was a coder comment her from 7 years ago asking 'tg does it this way, should we?' and the answer was yes.
// By building the network BEFORE our nodes build their network, two things happened:
// 1. The network was built and none of the pipes got their temporary air vaiables, resulting in the pipes having no air in them
// 2. The previous network was nulled but never deleted, resulting in a memory leak.
// So now, we build our network AFTER the nodes build their network AND we delete the previous network.
// This sets our piping layer. Hopefully its cool.
/obj/machinery/atmospherics/proc/setPipingLayer(new_layer)
@@ -232,3 +239,21 @@ Pipelines + Other Objects -> Pipe network
// pixel_x = PIPE_PIXEL_OFFSET_X(piping_layer)
// pixel_y = PIPE_PIXEL_OFFSET_Y(piping_layer)
// layer = initial(layer) + PIPE_LAYER_OFFSET(piping_layer)
/obj/machinery/atmospherics/proc/unsafe_pressure_release(mob/user, pressures = null)
if(!user)
return
if(!pressures)
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
pressures = int_air.return_pressure() - env_air.return_pressure()
user.visible_message(span_danger("[user] is sent flying by pressure!"),span_userdanger("The pressure sends you flying!"))
// if get_dir(src, user) is not 0, target is the edge_target_turf on that dir
// otherwise, edge_target_turf uses a random cardinal direction
// range is pressures / 250
// speed is pressures / 1250
if(user.buckled)
user.buckled.unbuckle_mob(user, TRUE)
user.throw_at(get_edge_target_turf(user, get_dir(src, user) || pick(GLOB.cardinal)), pressures / 250, pressures / 1250)
+20 -3
View File
@@ -79,9 +79,11 @@
return parent.air
/obj/machinery/atmospherics/pipe/build_network()
/obj/machinery/atmospherics/pipe/build_network(new_attachment)
if(QDELETED(src))
return
if(new_attachment)
QDEL_NULL(parent)
if(!parent)
parent = new /datum/pipeline()
parent.build_pipeline(src)
@@ -137,13 +139,28 @@
to_chat(user, span_warning("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
add_fingerprint(user)
return 1
//potential yeet
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
var/unsafe_wrenching = FALSE
var/internal_pressure = int_air.return_pressure()-env_air.return_pressure()
if (internal_pressure > 2*ONE_ATMOSPHERE)
to_chat(user, span_warning("As you begin unwrenching \the [src] a gush of air blows in your face... maybe you should reconsider?"))
unsafe_wrenching = TRUE //here we go
else
to_chat(user, span_notice("You begin to unfasten \the [src]..."))
playsound(src, W.usesound, 50, 1)
to_chat(user, span_notice("You begin to unfasten \the [src]..."))
if (do_after(user, 10 * W.toolspeed))
user.visible_message( \
span_infoplain(span_bold("\The [user]") + " unfastens \the [src]."), \
span_notice("You have unfastened \the [src]."), \
"You hear a ratchet.")
span_hear("You hear a ratchet."))
if(unsafe_wrenching)
unsafe_pressure_release(user, internal_pressure)
deconstruct()
/obj/machinery/atmospherics/pipe/proc/change_color(var/new_color)
+10 -4
View File
@@ -16,7 +16,7 @@
/proc/atmosanalyzer_scan(var/atom/target, var/datum/gas_mixture/mixture, var/mob/user)
var/list/results = list()
if (mixture && mixture.total_moles > 0)
if(mixture && mixture.total_moles > 0)
var/pressure = mixture.return_pressure()
var/total_moles = mixture.total_moles
results += span_notice("Pressure: [round(pressure,0.1)] kPa")
@@ -42,10 +42,16 @@
return atmosanalyzer_scan(src, src.air_contents, user)
/obj/machinery/atmospherics/pipe/atmosanalyze(var/mob/user)
return atmosanalyzer_scan(src, src.parent.air, user)
if(parent && parent.air) //Sometimes we may have a pipe that has no parent. This seems to happen if you add a pipe onto a pipeline, causing it to delete the parent for every pipe on that pipeline...Yeah. It's complicated and a bug.
return atmosanalyzer_scan(src, src.parent.air, user)
// This one is strange. The connector is not guaranteed to have a network (if you placed it down by itself)
// 'gases' is also a list. But the atmos analyzer wants you to give it a gas mixture.
// The 'gases' list holds ONE gas mixture.
/obj/machinery/atmospherics/portables_connector/atmosanalyze(var/mob/user)
return atmosanalyzer_scan(src, src.network.gases, user)
if(network && network.gases)
var/list/datum/gas_mixture/analyzed_gas = network.gases[1]
return atmosanalyzer_scan(src, analyzed_gas, user)
/obj/machinery/atmospherics/unary/atmosanalyze(var/mob/user)
return atmosanalyzer_scan(src, src.air_contents, user)
@@ -67,7 +73,7 @@
/obj/machinery/meter/atmosanalyze(var/mob/user)
var/datum/gas_mixture/mixture = null
if(src.target)
if(target && target.parent)
mixture = src.target.parent.air
return atmosanalyzer_scan(src, mixture, user)
+2
View File
@@ -84,6 +84,8 @@
var/list/RGB2 = ReadRGB(rgb2)
// add missing alpha if needed
if(!RGB1 || !RGB2) //Don't blend if we don't two! No use blending what we don't have!
return
if(RGB1.len < RGB2.len) RGB1 += 255
else if(RGB2.len < RGB1.len) RGB2 += 255
var/usealpha = RGB1.len > 3
+2 -1
View File
@@ -49,7 +49,8 @@
continue
if(istype(DD.vars[V],/list))
var/list/L = D.vars[V]
DD.vars[V] = L.Copy()
if(L)
DD.vars[V] = L.Copy()
else
DD.vars[V] = D.vars[V]
+8 -5
View File
@@ -104,11 +104,14 @@
spread_power -= O.explosion_resistance
var/turf/T = get_step(src, direction)
T.explosion_spread(spread_power, direction, explosion_turfs)
T = get_step(src, turn(direction,90))
T.explosion_spread(spread_power, turn(direction,90), explosion_turfs)
T = get_step(src, turn(direction,-90))
T.explosion_spread(spread_power, turn(direction,-90), explosion_turfs)
if(T)
T.explosion_spread(spread_power, direction, explosion_turfs)
T = get_step(src, turn(direction,90))
if(T)
T.explosion_spread(spread_power, turn(direction,90), explosion_turfs)
T = get_step(src, turn(direction,-90))
if(T)
T.explosion_spread(spread_power, turn(direction,-90), explosion_turfs)
/turf/unsimulated/explosion_spread(power)
return //So it doesn't get to the parent proc, which simulates explosions
@@ -14,8 +14,7 @@
/obj/item/healthanalyzer/proc/guide(var/mob/living/carbon/human/M, mob/living/user)
/* CHOMPedit remove: Anyone can get this info. *
/* Enable this if you want non-medical users to be blocked from the guide. Kind of pointless, since the only ones that would really NEED the guide are non-medical users.
var/obj/item/card/id/ourid = user?.GetIdCard()
if(!ourid)
return
@@ -29,8 +28,7 @@
return
if(!ishuman(M))
return
* CHOMPedit end. */
*/
var/dat = ""
@@ -85,7 +83,7 @@
if(infection)
dat += span_bold("Infection") + " - Administer Spaceacillin. If severe, use Corophizine or overdose on Spaceacillin and monitor until well.<br>"
if(M.getBrainLoss() >= 1)
dat += span_bold("Traumatic Brain Injury") + " - Commence brain repair surgery Administer Alkysine or universal organ-repair chemicals such as Peridaxon.<br>"
dat += span_bold("Traumatic Brain Injury") + " - Commence brain repair surgery, administer Alkysine or universal organ-repair chemicals such as Peridaxon.<br>"
if(M.radiation || M.accumulated_rads)
dat += span_bold("Radiation Exposure") + " - Administer Hyronalin or Arithrazine. Monitor for genetic damage.<br>"
if(organ)
@@ -102,7 +100,7 @@
dat += span_bold("Genetic Damage") + " - Utilize cryogenic pod with appropriate chemicals (i.e. Cryoxadone) and below 70 K, or give Rezadone.<br>"
if(bone)
dat += span_bold("Bone fracture") + " - Splint damaged area. Treat with bone repair surgery or Osteodaxon after treating brute damage.<br>"
if(M.viruses.len)
if(M.viruses && M.viruses.len)
for(var/datum/disease/D in M.GetViruses())
if(D.visibility_flags & HIDDEN_SCANNER)
continue
@@ -134,7 +134,6 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
pref.species = SPECIES_HUMAN
pref.s_tone = sanitize_integer(pref.s_tone, -185, 34, initial(pref.s_tone))
pref.h_style = sanitize_inlist(pref.h_style, hair_styles_list, initial(pref.h_style))
pref.grad_style = sanitize_inlist(pref.grad_style, GLOB.hair_gradients, initial(pref.grad_style))
pref.f_style = sanitize_inlist(pref.f_style, facial_hair_styles_list, initial(pref.f_style))
pref.grad_style = sanitize_inlist(pref.grad_style, GLOB.hair_gradients, initial(pref.grad_style))
pref.b_type = sanitize_text(pref.b_type, initial(pref.b_type))
@@ -168,7 +167,6 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
character.f_style = pref.f_style
character.s_tone = pref.s_tone
character.h_style = pref.h_style
character.grad_style= pref.grad_style
character.f_style = pref.f_style
character.grad_style= pref.grad_style
character.b_type = pref.b_type
@@ -199,7 +197,6 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
character.set_gender(pref.biological_gender)
// Destroy/cyborgize organs and limbs.
character.synthetic = pref.species == "Protean" ? all_robolimbs["protean"] : null //Clear the existing var. (unless protean, then switch it to the normal protean limb)
var/list/organs_to_edit = list()
for (var/name in list(BP_TORSO, BP_HEAD, BP_GROIN, BP_L_ARM, BP_R_ARM, BP_L_HAND, BP_R_HAND, BP_L_LEG, BP_R_LEG, BP_L_FOOT, BP_R_FOOT))
@@ -611,14 +608,6 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
pref.h_style = new_h_style
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["grad_style"])
var/list/valid_gradients = GLOB.hair_gradients
var/new_grad_style = tgui_input_list(user, "Choose a color pattern for your hair:", "Character Preference", pref.grad_style, valid_gradients)
if(new_grad_style && CanUseTopic(user))
pref.grad_style = new_grad_style
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["grad_style"])
var/list/valid_gradients = GLOB.hair_gradients
+1 -1
View File
@@ -68,7 +68,7 @@
/obj/item/deck/attack_hand(mob/user as mob)
var/mob/living/carbon/human/H = user
if(istype(src.loc, /obj/item/storage) || src == H.r_store || src == H.l_store || src.loc == user) // so objects can be removed from storage containers or pockets. also added a catch-all, so if it's in the mob you'll pick it up.
if(ishuman(H) && (istype(src.loc, /obj/item/storage) || src == H.r_store || src == H.l_store || src.loc == user)) // so objects can be removed from storage containers or pockets. also added a catch-all, so if it's in the mob you'll pick it up. Human only, however!
..()
else // but if they're not, or are in your hands, you can still draw cards.
draw_card()
@@ -199,10 +199,10 @@
humanform.species.update_misc_tabs(src)
/mob/living/simple_mob/protean_blob/updatehealth()
if(!humanform)
CRASH("A protean blob does not have a humanform! src = [src] ckey = [ckey]")
if(humanform.nano_dead_check(src))
return
if(!humanform)
return ..()
//Set the max
maxHealth = humanform.getMaxHealth()*2 //HUMANS, and their 'double health', bleh.
@@ -326,6 +326,8 @@
/mob/living/simple_mob/protean_blob/Life()
. = ..()
if(!humanform)
CRASH("A protean_blob calling Life() has no humanform! Src = [src] ckey = [ckey]")
if(!humanform.nano_dead_check(src))
if(. && istype(refactory) && humanform)
if(!healing && (human_brute || human_burn) && refactory.get_stored_material(MAT_STEEL) >= 100)
@@ -670,6 +672,8 @@
return ..()
/mob/living/simple_mob/protean_blob/handle_mutations_and_radiation()
if(!humanform)
CRASH("A protean blob does not have a humanform! src = [src] ckey = [ckey]")
humanform.handle_mutations_and_radiation()
/mob/living/simple_mob/protean_blob/update_icon()
@@ -155,6 +155,8 @@
// Update T.
T = get_step(src, get_dir(src, destination))
if(!T) //There is no turf in that direction.
return FALSE //Hit a non-existant turf.
if(T.check_density(ignore_mobs = TRUE))
to_chat(src, span_critical("You hit something really solid!"))
playsound(src, "punch", 75, 1)
@@ -192,6 +192,7 @@
client.prefs.dress_preview_mob(mannequin)
var/mob/observer/dead/observer = new(mannequin)
observer.moveToNullspace() //Let's not stay in our doomed mannequin
qdel(mannequin) //We're not used anymore, so goodbye!
spawning = 1
if(client.media)
@@ -43,20 +43,3 @@
if(unsafe_wrenching)
unsafe_pressure_release(user, internal_pressure)
deconstruct()
// Throws the user when they unwrench a pipe with a major difference between the internal and environmental pressure.
/obj/machinery/atmospherics/proc/unsafe_pressure_release(mob/user, pressures = null)
if(!user)
return
if(!pressures)
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
pressures = int_air.return_pressure() - env_air.return_pressure()
user.visible_message(span_danger("[user] is sent flying by pressure!"),span_userdanger("The pressure sends you flying!"))
// if get_dir(src, user) is not 0, target is the edge_target_turf on that dir
// otherwise, edge_target_turf uses a random cardinal direction
// range is pressures / 250
// speed is pressures / 1250
user.throw_at(get_edge_target_turf(user, get_dir(src, user) || pick(GLOB.cardinal)), pressures / 250, pressures / 1250)