mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 21:12:24 +01:00
Lag War Day 4: Under Pressure, High Voltage (#21878)
Replace /datum/gas_mixture/proc/return_pressure with XGM_PRESSURE(xgm) macro. Having such a relatively simple statement contributing proc overhead to procs called millions of times is ridiculous Rename /datum/gas_mixture/proc/zburn to react, deleting the old react which was just an alias for it. Free proc overhead Turn check_combustibility into a macro CHECK_COMBUSTIBLE(is_cmb, xgm). also rewrite it slightly so that it only needs to do one pass. Its a bit nasty so I apologize for that, but speeeeed. Delete most powernet and obj/machinery/power procs for handling power, replacing them with macros. The fact that we were unironically calling a draw_power() on APCs to call draw_power() on their terminals to call draw_power() on their powernet every single process tick was insane. Turn `between` into a macro alias for clamp() since the param order is different turn `Percent` into a macro AS_PCT Rewrite significant chunks of update_canmove so its not quite as horrifying of a proc and hopefully doesn't eat the entire mob subsystem every movement now
This commit is contained in:
@@ -36,10 +36,10 @@
|
||||
affected_mobs |= user
|
||||
for(var/area/AffectedArea in affected_areas)
|
||||
AffectedArea.power_light = 0
|
||||
AffectedArea.power_change()
|
||||
SEND_SIGNAL(AffectedArea, COMSIG_AREA_POWER_CHANGE)
|
||||
spawn(rand(25,50))
|
||||
AffectedArea.power_light = 1
|
||||
AffectedArea.power_change()
|
||||
SEND_SIGNAL(AffectedArea, COMSIG_AREA_POWER_CHANGE)
|
||||
|
||||
sleep(100)
|
||||
for(var/mob/M in affected_mobs)
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
var/t = SPAN_NOTICE("Coordinates: [T.x],[T.y],[T.z]\n")
|
||||
t += SPAN_WARNING("Temperature: [env.temperature]\n")
|
||||
t += SPAN_WARNING("Pressure: [env.return_pressure()]kPa\n")
|
||||
t += SPAN_WARNING("Pressure: [XGM_PRESSURE(env)]kPa\n")
|
||||
for(var/g in env.gas)
|
||||
t += SPAN_NOTICE("[g]: [env.gas[g]] / [env.gas[g] * R_IDEAL_GAS_EQUATION * env.temperature / env.volume]kPa\n")
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@
|
||||
var/source_volume = source.volume * source.group_multiplier
|
||||
var/sink_volume = sink.volume * sink.group_multiplier
|
||||
|
||||
var/source_pressure = source.return_pressure()
|
||||
var/sink_pressure = sink.return_pressure()
|
||||
var/source_pressure = XGM_PRESSURE(source)
|
||||
var/sink_pressure = XGM_PRESSURE(sink)
|
||||
|
||||
return (source_pressure - sink_pressure)/(R_IDEAL_GAS_EQUATION * (source.temperature/source_volume + sink.temperature/sink_volume))
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
/obj/machinery/atmospherics/binary/circulator/proc/return_transfer_air()
|
||||
var/datum/gas_mixture/removed
|
||||
if(anchored && !(stat&BROKEN) && network1)
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
var/input_starting_pressure = XGM_PRESSURE(air1)
|
||||
var/output_starting_pressure = XGM_PRESSURE(air2)
|
||||
last_pressure_delta = max(input_starting_pressure - output_starting_pressure - 5, 0)
|
||||
|
||||
//only circulate air if there is a pressure difference (plus 5kPa kinetic, 10kPa static friction)
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
last_power_draw = 0
|
||||
//TODO Add overlay with F-P-R letter to display current state
|
||||
if (phase == "filling")//filling tank
|
||||
var/pressure_delta = target_pressure - inner_tank.return_pressure()
|
||||
var/pressure_delta = target_pressure - XGM_PRESSURE(inner_tank)
|
||||
if (pressure_delta > 0.01 && air1.temperature > 0)
|
||||
var/transfer_moles = calculate_transfer_moles(air1, inner_tank, pressure_delta)
|
||||
power_draw = pump_gas(src, air1, inner_tank, transfer_moles, power_rating*power_setting) * intake_power_efficiency
|
||||
@@ -112,7 +112,7 @@
|
||||
use_power_oneoff(power_draw)
|
||||
if(network1)
|
||||
network1.update = 1
|
||||
if (air1.return_pressure() < 0.1 * ONE_ATMOSPHERE || inner_tank.return_pressure() >= target_pressure * 0.95)//if pipe is good as empty or tank is full
|
||||
if (XGM_PRESSURE(air1) < 0.1 * ONE_ATMOSPHERE || XGM_PRESSURE(inner_tank) >= target_pressure * 0.95)//if pipe is good as empty or tank is full
|
||||
phase = "processing"
|
||||
|
||||
if (phase == "processing")//processing CO2 in tank
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
if (phase == "releasing")//releasing processed gas mix
|
||||
power_draw = -1
|
||||
var/pressure_delta = target_pressure - air2.return_pressure()
|
||||
var/pressure_delta = target_pressure - XGM_PRESSURE(air2)
|
||||
if (pressure_delta > 0.01 && inner_tank.temperature > 0)
|
||||
var/transfer_moles = calculate_transfer_moles(inner_tank, air2, pressure_delta, (network2)? network2.volume : 0)
|
||||
power_draw = pump_gas(src, inner_tank, air2, transfer_moles, power_rating*power_setting)
|
||||
@@ -148,7 +148,7 @@
|
||||
network2.update = 1
|
||||
else//can't push outside harder than target pressure. Device is not intended to be used as a pump after all
|
||||
phase = "filling"
|
||||
if (inner_tank.return_pressure() <= 0.1)
|
||||
if (XGM_PRESSURE(inner_tank) <= 0.1)
|
||||
phase = "filling"
|
||||
|
||||
/obj/machinery/atmospherics/binary/oxyregenerator/update_icon()
|
||||
@@ -162,9 +162,9 @@
|
||||
data["on"] = use_power ? 1 : 0
|
||||
data["powerSetting"] = power_setting
|
||||
data["gasProcessed"] = last_flow_rate
|
||||
data["air1Pressure"] = round(air1.return_pressure())
|
||||
data["air2Pressure"] = round(air2.return_pressure())
|
||||
data["tankPressure"] = round(inner_tank.return_pressure())
|
||||
data["air1Pressure"] = round(XGM_PRESSURE(air1))
|
||||
data["air2Pressure"] = round(XGM_PRESSURE(air2))
|
||||
data["tankPressure"] = round(XGM_PRESSURE(inner_tank))
|
||||
data["targetPressure"] = round(target_pressure)
|
||||
data["phase"] = phase
|
||||
if (inner_tank.total_moles > 0)
|
||||
|
||||
@@ -116,8 +116,8 @@
|
||||
if(!unlocked)
|
||||
return 0
|
||||
|
||||
var/output_starting_pressure = air2.return_pressure()
|
||||
var/input_starting_pressure = air1.return_pressure()
|
||||
var/output_starting_pressure = XGM_PRESSURE(air2)
|
||||
var/input_starting_pressure = XGM_PRESSURE(air1)
|
||||
|
||||
var/pressure_delta
|
||||
switch (regulate_mode)
|
||||
@@ -203,11 +203,8 @@
|
||||
unlocked = !unlocked
|
||||
|
||||
if("set_target_pressure" in signal.data)
|
||||
target_pressure = between(
|
||||
0,
|
||||
text2num(signal.data["set_target_pressure"]),
|
||||
max_pressure_setting
|
||||
)
|
||||
var/set_pressure = text2num(signal.data["set_target_pressure"])
|
||||
target_pressure = between(0, set_pressure, max_pressure_setting)
|
||||
|
||||
if("set_regulate_mode" in signal.data)
|
||||
regulate_mode = text2num(signal.data["set_regulate_mode"])
|
||||
@@ -335,7 +332,7 @@
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
if (!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > PRESSURE_EXERTED)
|
||||
if ((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
@@ -121,7 +121,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
broadcast_status_next_process = FALSE
|
||||
|
||||
var/power_draw = -1
|
||||
var/pressure_delta = target_pressure - air2.return_pressure()
|
||||
var/pressure_delta = target_pressure - XGM_PRESSURE(air2)
|
||||
|
||||
if(pressure_delta > 0.01 && air1.temperature > 0)
|
||||
//Figure out how much gas to transfer to meet the target pressure.
|
||||
@@ -282,7 +282,7 @@ Thus, the two variables affect pump operation are set in New():
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
if (!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > PRESSURE_EXERTED && !istype(attacking_item, /obj/item/pipewrench))
|
||||
if ((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED && !istype(attacking_item, /obj/item/pipewrench))
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench this [src], it's too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
@@ -88,10 +88,10 @@
|
||||
|
||||
var/int_pressure = 0
|
||||
for(var/datum/omni_port/P in ports)
|
||||
int_pressure += P.air.return_pressure()
|
||||
int_pressure += XGM_PRESSURE(P.air)
|
||||
if(!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_pressure - env_air.return_pressure()) > PRESSURE_EXERTED)
|
||||
if ((int_pressure - XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
if(!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > PRESSURE_EXERTED)
|
||||
if ((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
@@ -355,7 +355,7 @@
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
if(!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > PRESSURE_EXERTED)
|
||||
if ((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, "<span class='warnng'>You cannot unwrench \the [src], it too exerted due to internal pressure.</span>")
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
var/list/data = list()
|
||||
|
||||
data["on"] = !!use_power
|
||||
data["gasPressure"] = round(air_contents.return_pressure())
|
||||
data["gasPressure"] = round(XGM_PRESSURE(air_contents))
|
||||
data["gasTemperature"] = round(air_contents.temperature)
|
||||
data["minGasTemperature"] = 0
|
||||
data["maxGasTemperature"] = round(T20C+500)
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
if(!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if((int_air.return_pressure() - env_air.return_pressure()) > PRESSURE_EXERTED)
|
||||
if((XGM_PRESSURE(int_air) - XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
var/list/data = list()
|
||||
|
||||
data["on"] = !!use_power
|
||||
data["gasPressure"] = round(air_contents.return_pressure())
|
||||
data["gasPressure"] = round(XGM_PRESSURE(air_contents))
|
||||
data["gasTemperature"] = round(air_contents.temperature)
|
||||
data["minGasTemperature"] = 0
|
||||
data["maxGasTemperature"] = round(T20C + 600)
|
||||
|
||||
@@ -260,18 +260,18 @@
|
||||
|
||||
/obj/machinery/atmospherics/unary/vent_pump/proc/get_pressure_delta(datum/gas_mixture/environment)
|
||||
var/pressure_delta = DEFAULT_PRESSURE_DELTA
|
||||
var/environment_pressure = environment.return_pressure()
|
||||
var/environment_pressure = XGM_PRESSURE(environment)
|
||||
|
||||
if(pump_direction) //internal -> external
|
||||
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
|
||||
pressure_delta = min(pressure_delta, external_pressure_bound - environment_pressure) //increasing the pressure here
|
||||
if(pressure_checks & PRESSURE_CHECK_INTERNAL)
|
||||
pressure_delta = min(pressure_delta, air_contents.return_pressure() - internal_pressure_bound) //decreasing the pressure here
|
||||
pressure_delta = min(pressure_delta, XGM_PRESSURE(air_contents) - internal_pressure_bound) //decreasing the pressure here
|
||||
else //external -> internal
|
||||
if(pressure_checks & PRESSURE_CHECK_EXTERNAL)
|
||||
pressure_delta = min(pressure_delta, environment_pressure - external_pressure_bound) //decreasing the pressure here
|
||||
if(pressure_checks & PRESSURE_CHECK_INTERNAL)
|
||||
pressure_delta = min(pressure_delta, internal_pressure_bound - air_contents.return_pressure()) //increasing the pressure here
|
||||
pressure_delta = min(pressure_delta, internal_pressure_bound - XGM_PRESSURE(air_contents)) //increasing the pressure here
|
||||
|
||||
return pressure_delta
|
||||
|
||||
@@ -349,37 +349,23 @@
|
||||
if (signal.data["set_internal_pressure"] == "default")
|
||||
internal_pressure_bound = internal_pressure_bound_default
|
||||
else
|
||||
internal_pressure_bound = between(
|
||||
0,
|
||||
text2num(signal.data["set_internal_pressure"]),
|
||||
MAX_VENT_PRESSURE
|
||||
)
|
||||
var/set_pressure = text2num(signal.data["set_internal_pressure"])
|
||||
internal_pressure_bound = between(0, set_pressure, MAX_VENT_PRESSURE)
|
||||
|
||||
if(signal.data["set_external_pressure"] != null)
|
||||
if (signal.data["set_external_pressure"] == "default")
|
||||
external_pressure_bound = external_pressure_bound_default
|
||||
else
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
text2num(signal.data["set_external_pressure"]),
|
||||
MAX_VENT_PRESSURE
|
||||
)
|
||||
var/set_pressure = text2num(signal.data["set_external_pressure"])
|
||||
external_pressure_bound = between(0, set_pressure, MAX_VENT_PRESSURE)
|
||||
|
||||
if(signal.data["adjust_internal_pressure"] != null)
|
||||
internal_pressure_bound = between(
|
||||
0,
|
||||
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
|
||||
MAX_VENT_PRESSURE
|
||||
)
|
||||
var/set_pressure = internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"])
|
||||
internal_pressure_bound = between(0, set_pressure, MAX_VENT_PRESSURE)
|
||||
|
||||
if(signal.data["adjust_external_pressure"] != null)
|
||||
|
||||
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
|
||||
MAX_VENT_PRESSURE
|
||||
)
|
||||
var/set_pressure = external_pressure_bound + text2num(signal.data["adjust_external_pressure"])
|
||||
external_pressure_bound = between(0, set_pressure, MAX_VENT_PRESSURE)
|
||||
|
||||
if(signal.data["init"] != null)
|
||||
name = signal.data["init"]
|
||||
@@ -452,7 +438,7 @@
|
||||
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()) > PRESSURE_EXERTED)
|
||||
if((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
if(!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > PRESSURE_EXERTED)
|
||||
if ((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
@@ -327,7 +327,7 @@
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
if (!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > PRESSURE_EXERTED)
|
||||
if ((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
/datum/pipeline/process()//This use to be called called from the pipe networks
|
||||
//Check to see if pressure is within acceptable limits
|
||||
var/pressure = air.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(air)
|
||||
if(pressure > alert_pressure)
|
||||
for(var/obj/machinery/atmospherics/pipe/member in members)
|
||||
if(!member.check_pressure(pressure))
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
var/datum/gas_mixture/int_air = return_air()
|
||||
if(!loc) return FALSE
|
||||
var/datum/gas_mixture/env_air = loc.return_air()
|
||||
if ((int_air.return_pressure()-env_air.return_pressure()) > PRESSURE_EXERTED)
|
||||
if ((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
if(!istype(attacking_item, /obj/item/pipewrench))
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
@@ -236,7 +236,7 @@
|
||||
if(!loc) return
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
var/pressure_difference = pressure - environment.return_pressure()
|
||||
var/pressure_difference = pressure - XGM_PRESSURE(environment)
|
||||
|
||||
if(pressure_difference > maximum_pressure)
|
||||
burst()
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
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()) > PRESSURE_EXERTED)
|
||||
if((XGM_PRESSURE(int_air)-XGM_PRESSURE(env_air)) > PRESSURE_EXERTED)
|
||||
to_chat(user, SPAN_WARNING("You cannot unwrench \the [src], it is too exerted due to internal pressure."))
|
||||
add_fingerprint(user)
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
return FALSE
|
||||
if(!istype(O))
|
||||
return FALSE
|
||||
if(O.air_contents.return_pressure() >= 500)
|
||||
if(XGM_PRESSURE(O.air_contents) >= 500)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@
|
||||
if(target_mob != user)
|
||||
to_chat(user, SPAN_NOTICE("You inject [target_mob] with [chems_to_use] unit\s of [charge.display_name]."))
|
||||
|
||||
if(!target_mob.is_physically_disabled())
|
||||
if(!target_mob.incapacitated(INCAPACITATION_DISABLED))
|
||||
to_chat(target_mob, SPAN_NOTICE("<b>You feel a rushing in your veins as [chems_to_use] unit\s of [charge.display_name] [chems_to_use == 1 ? "is" : "are"] injected.</b>"))
|
||||
target_mob.reagents.add_reagent(charge.product_type, chems_to_use)
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
part_list += "\a [I]"
|
||||
. += "\The [src] has [english_list(part_list)] installed."
|
||||
if(tank && distance <= 1)
|
||||
. += SPAN_NOTICE("The wrist-mounted pressure gauge reads [max(round(tank.air_contents.return_pressure()),0)] kPa remaining in \the [tank].")
|
||||
. += SPAN_NOTICE("The wrist-mounted pressure gauge reads [max(round(XGM_PRESSURE(tank.air_contents)),0)] kPa remaining in \the [tank].")
|
||||
if (cooler && distance <= 1)
|
||||
. += SPAN_NOTICE("The mounted cooler's battery charge reads [round(cooler.cell.percent())]%")
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@
|
||||
|
||||
if(T)
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/pressure = (environment)? environment.return_pressure() : 0
|
||||
var/pressure = SAFE_XGM_PRESSURE(environment)
|
||||
if(ispath(installed_barrel.projectile_type, /obj/projectile/kinetic))
|
||||
var/obj/projectile/kinetic/shot_projectile = new installed_barrel.projectile_type(get_turf(src))
|
||||
shot_projectile.damage = damage_increase
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
/obj/projectile/kinetic/proc/do_damage(var/turf/T, var/living_damage = 1, var/mineral_damage = 1)
|
||||
if(!istype(T)) return
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
living_damage *= max(1 - (environment.return_pressure() / 100) * 0.75, 0)
|
||||
living_damage *= max(1 - (XGM_PRESSURE(environment) / 100) * 0.75, 0)
|
||||
new /obj/effect/overlay/temp/kinetic_blast(T)
|
||||
for(var/mob/living/L in T)
|
||||
L.take_overall_damage(min(living_damage, 50))
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
cockpit.equalize(T.return_air())
|
||||
changed = TRUE
|
||||
else if(air_supply)
|
||||
var/env_pressure = cockpit.return_pressure()
|
||||
var/env_pressure = XGM_PRESSURE(cockpit)
|
||||
var/pressure_delta = air_supply.release_pressure - env_pressure
|
||||
if((air_supply.air_contents.temperature > 0) && (pressure_delta > 0))
|
||||
var/transfer_moles = calculate_transfer_moles(air_supply.air_contents, cockpit, pressure_delta)
|
||||
|
||||
@@ -322,7 +322,7 @@
|
||||
health_change += missing_gas * HYDRO_SPEED_MULTIPLIER
|
||||
|
||||
// Process it.
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(environment)
|
||||
if(pressure < GET_SEED_TRAIT(src, TRAIT_LOWKPA_TOLERANCE)|| pressure > GET_SEED_TRAIT(src, TRAIT_HIGHKPA_TOLERANCE))
|
||||
health_change += rand(1,3) * HYDRO_SPEED_MULTIPLIER
|
||||
|
||||
|
||||
@@ -201,15 +201,16 @@
|
||||
if(should_act) // We're gonna give or take from the net.
|
||||
if(drawing)
|
||||
var/to_transfer = min(throughput, (assembly.battery.maxcharge - assembly.battery.charge) / CELLRATE) // So we don't need to draw 10kW if the cell needs much less.
|
||||
var/amount = IO.draw_power(to_transfer)
|
||||
var/amount = POWER_DRAW(IO, to_transfer)
|
||||
DRAW_POWER(IO, amount)
|
||||
assembly.give_power(amount)
|
||||
else
|
||||
var/amount = assembly.draw_power(throughput)
|
||||
IO.add_avail(amount)
|
||||
ADD_TO_POWERNET(IO, amount)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, IO.avail())
|
||||
set_pin_data(IC_OUTPUT, 2, IO.surplus())
|
||||
set_pin_data(IC_OUTPUT, 3, -IO.surplus()-IO.avail()) // we don't have a viewload() proc on machines and i'm lazy
|
||||
set_pin_data(IC_OUTPUT, 1, POWER_AVAIL(IO))
|
||||
set_pin_data(IC_OUTPUT, 2, POWER_SURPLUS(IO))
|
||||
set_pin_data(IC_OUTPUT, 3, POWER_LOAD(IO))
|
||||
|
||||
// Internal power machine for interacting with the powernet.
|
||||
// It needs a bit of special code since base /machinery/power assumes loc will be a tile.
|
||||
|
||||
@@ -629,7 +629,7 @@
|
||||
return
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(environment)
|
||||
var/total_moles = environment.total_moles
|
||||
|
||||
if (total_moles)
|
||||
@@ -707,7 +707,7 @@
|
||||
return
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(environment)
|
||||
var/total_moles = environment.total_moles
|
||||
|
||||
if (total_moles)
|
||||
|
||||
@@ -1069,7 +1069,7 @@ GLOBAL_LIST_INIT_TYPED(total_extraction_beacons, /obj/structure/extraction_point
|
||||
if(!istype(proj_turf))
|
||||
return
|
||||
var/datum/gas_mixture/environment = proj_turf.return_air()
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(environment)
|
||||
if(pressure < 50)
|
||||
name = "strong resonance field"
|
||||
resonance_damage = 60
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(environment)
|
||||
var/total_moles = environment.total_moles
|
||||
|
||||
to_chat(src, SPAN_NOTICE("<B>Results:</B>"))
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
if(T && !vacuum_proof) //Ghosts can hear even in vacuum.
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/pressure = (environment)? environment.return_pressure() : 0
|
||||
var/pressure = SAFE_XGM_PRESSURE(environment)
|
||||
var/distance_to_speaker = get_dist(speaker, src)
|
||||
if(pressure < SOUND_MINIMUM_PRESSURE && distance_to_speaker > 1)
|
||||
// Yeah, this isn't quite realistic to be able to see if someone is talking through, say, an opaque mask, but for gameplay purposes it should help indicate that you're not bugged.
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
//Handle possble chem smoke effect
|
||||
/mob/living/carbon/proc/handle_chemical_smoke(var/datum/gas_mixture/environment)
|
||||
if(species && environment.return_pressure() < species.breath_pressure/5)
|
||||
if(species && XGM_PRESSURE(environment) < species.breath_pressure/5)
|
||||
return //pressure is too low to even breathe in.
|
||||
if(wear_mask && (wear_mask.item_flags & ITEM_FLAG_BLOCK_GAS_SMOKE_EFFECT))
|
||||
return
|
||||
|
||||
@@ -416,11 +416,6 @@
|
||||
usr.sleeping = 20 // Short nap.
|
||||
usr.eye_blurry = 20
|
||||
|
||||
/mob/living/carbon/sleeps_horizontal()
|
||||
if(species && species.sleeps_upright)
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/verb/toggle_indefinite_sleep()
|
||||
set name = "Toggle Indefinite Sleep"
|
||||
set category = "IC"
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
qdel(internal)
|
||||
else
|
||||
. += "Internal Atmosphere Info: [internal.name]"
|
||||
. += "Tank Pressure: [internal.air_contents.return_pressure()]"
|
||||
. += "Tank Pressure: [XGM_PRESSURE(internal.air_contents)]"
|
||||
. += "Distribution Pressure: [internal.distribute_pressure]"
|
||||
|
||||
var/obj/item/organ/internal/machine/power_core/IC = internal_organs_by_name[BP_CELL]
|
||||
@@ -1905,15 +1905,15 @@
|
||||
eyeobj.remove_visual(src)
|
||||
|
||||
|
||||
/mob/living/carbon/human/can_stand_overridden()
|
||||
/mob/living/carbon/human/proc/can_stand_overridden()
|
||||
if(wearing_rig && wearing_rig.ai_can_move_suit(check_for_ai = 1))
|
||||
// Actually missing a leg will screw you up. Everything else can be compensated for.
|
||||
for(var/limbcheck in list(BP_L_LEG,BP_R_LEG))
|
||||
var/obj/item/organ/affecting = get_organ(limbcheck)
|
||||
if(!affecting)
|
||||
return 0
|
||||
return 1
|
||||
return 0
|
||||
return FALSE
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/mob/living/carbon/human/proc/can_drink(var/obj/item/I)
|
||||
if(should_have_organ(BP_REACTOR))
|
||||
@@ -2307,7 +2307,7 @@
|
||||
look_up_open_space(get_turf(src))
|
||||
|
||||
/mob/living/proc/look_up_open_space(var/turf/T)
|
||||
if(client && !is_physically_disabled())
|
||||
if(client && !MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED))
|
||||
if(z_eye)
|
||||
reset_view(null)
|
||||
QDEL_NULL(z_eye)
|
||||
@@ -2330,7 +2330,7 @@
|
||||
look_down_open_space(get_turf(src))
|
||||
|
||||
/mob/living/proc/look_down_open_space(var/turf/T)
|
||||
if(client && !is_physically_disabled())
|
||||
if(client && !MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED))
|
||||
if(z_eye)
|
||||
reset_view(null)
|
||||
QDEL_NULL(z_eye)
|
||||
|
||||
@@ -13,7 +13,7 @@ emp_act
|
||||
if(species_check)
|
||||
return species_check
|
||||
|
||||
if(!is_physically_disabled())
|
||||
if(!MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED))
|
||||
var/deflection_chance = check_martial_deflection_chance()
|
||||
if(prob(deflection_chance))
|
||||
visible_message(SPAN_WARNING("\The [src] deftly dodges \the [hitting_projectile]!"), SPAN_NOTICE("You deftly dodge \the [hitting_projectile]!"))
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
I.take_damage(rand(3,5))
|
||||
|
||||
//Moving makes open wounds get infected much faster
|
||||
for(var/datum/wound/W in E.wounds)
|
||||
for(var/datum/wound/W as anything in E.wounds)
|
||||
if (W.infection_check())
|
||||
W.germ_level += 1
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
|
||||
if(breath)
|
||||
//exposure to extreme pressures can rupture lungs
|
||||
var/check_pressure = breath.return_pressure()
|
||||
var/check_pressure = XGM_PRESSURE(breath)
|
||||
if(check_pressure < ONE_ATMOSPHERE / 5 || check_pressure > ONE_ATMOSPHERE * 5)
|
||||
if(!is_lung_ruptured() && prob(5))
|
||||
rupture_lung()
|
||||
@@ -313,7 +313,7 @@
|
||||
species.handle_environment_special(src)
|
||||
|
||||
//Moved pressure calculations here for use in skip-processing check.
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(environment)
|
||||
var/adjusted_pressure = calculate_affecting_pressure(pressure)
|
||||
|
||||
if (consume_nutrition_from_air)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
visible_message(SPAN_WARNING("\The [user] is taking a look at \the [src]'s air tank."))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
var/obj/item/tank/T = internal
|
||||
to_chat(user, SPAN_NOTICE("\The [T] has [T.air_contents.return_pressure()] kPA left."))
|
||||
to_chat(user, SPAN_NOTICE("\The [T] has [XGM_PRESSURE(T.air_contents)] kPA left."))
|
||||
to_chat(user, SPAN_NOTICE("The [T] is set to release [T.distribute_pressure] kPA."))
|
||||
return TRUE
|
||||
if("pockets")
|
||||
|
||||
@@ -320,7 +320,7 @@ var/list/channel_to_radio_key = new
|
||||
if(!speaking || !(speaking.flags & PRESSUREPROOF))
|
||||
//make sure the air can transmit speech - speaker's side
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/pressure = (environment)? environment.return_pressure() : 0
|
||||
var/pressure = SAFE_XGM_PRESSURE(environment)
|
||||
if(pressure < SOUND_MINIMUM_PRESSURE)
|
||||
message_range = 1
|
||||
|
||||
|
||||
@@ -557,7 +557,7 @@
|
||||
|
||||
if(jetpack)
|
||||
. += "Internal Atmosphere Info: [jetpack.name]"
|
||||
. += "Tank Pressure: [jetpack.air_contents.return_pressure()]"
|
||||
. += "Tank Pressure: [XGM_PRESSURE(jetpack.air_contents)]"
|
||||
. += "Lights: [lights_on ? "ON" : "OFF"]"
|
||||
if(module)
|
||||
for(var/datum/matter_synth/ms in module.synths)
|
||||
|
||||
@@ -347,7 +347,7 @@
|
||||
if(istype(loc,/turf))
|
||||
var/turf/T = loc
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
if (environment.return_pressure() <= 80)
|
||||
if (XGM_PRESSURE(environment) <= 80)
|
||||
bearmode = BEARMODE_SPACE
|
||||
|
||||
if (bearmode != former)
|
||||
|
||||
+50
-87
@@ -1,7 +1,3 @@
|
||||
#define UNBUCKLED 0
|
||||
#define PARTIALLY_BUCKLED 1
|
||||
#define FULLY_BUCKLED 2
|
||||
|
||||
/mob/Destroy()//This makes sure that mobs with clients/keys are not just deleted from the game.
|
||||
MOB_STOP_THINKING(src)
|
||||
// Tell any mobs touching us that they're not pulling us anymore.
|
||||
@@ -323,12 +319,6 @@
|
||||
return UNBUCKLED
|
||||
return restrained() ? FULLY_BUCKLED : PARTIALLY_BUCKLED
|
||||
|
||||
/mob/proc/is_physically_disabled()
|
||||
return MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED)
|
||||
|
||||
/mob/proc/cannot_stand()
|
||||
return MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN)
|
||||
|
||||
// Inside this file, you should use MOB_IS_INCAPACITATED for performance reasons
|
||||
/mob/proc/incapacitated(var/incapacitation_flags = INCAPACITATION_DEFAULT)
|
||||
|
||||
@@ -828,9 +818,6 @@
|
||||
/mob/proc/is_active()
|
||||
return (0 >= usr.stat)
|
||||
|
||||
/mob/proc/is_dead()
|
||||
return stat == DEAD
|
||||
|
||||
/mob/proc/is_mechanical()
|
||||
return FALSE
|
||||
|
||||
@@ -861,61 +848,60 @@
|
||||
if(transforming) return 0
|
||||
return 1
|
||||
|
||||
/// Not sure what to call this. Used to check if humans are wearing an AI-controlled exosuit and hence don't need to fall over yet.
|
||||
/mob/proc/can_stand_overridden()
|
||||
return 0
|
||||
|
||||
/// Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it.
|
||||
/mob/proc/update_canmove()
|
||||
if(in_neck_grab())
|
||||
lying = FALSE
|
||||
for(var/obj/item/grab/G in grabbed_by)
|
||||
if(G.force_down)
|
||||
lying = TRUE
|
||||
break
|
||||
else if(!resting && cannot_stand() && can_stand_overridden())
|
||||
lying = FALSE
|
||||
lying_is_intentional = FALSE
|
||||
canmove = TRUE
|
||||
else
|
||||
if(istype(buckled_to, /obj/vehicle))
|
||||
var/obj/vehicle/V = buckled_to
|
||||
if(is_physically_disabled())
|
||||
lying = TRUE
|
||||
lying_is_intentional = FALSE
|
||||
canmove = FALSE
|
||||
pixel_y = V.mob_offset_y - 5
|
||||
else
|
||||
if(buckled_to.buckle_lying != -1) lying = buckled_to.buckle_lying
|
||||
lying_is_intentional = FALSE
|
||||
canmove = TRUE
|
||||
pixel_y = V.mob_offset_y
|
||||
else if(buckled_to)
|
||||
anchored = TRUE
|
||||
canmove = FALSE
|
||||
if(isobj(buckled_to))
|
||||
if(buckled_to.buckle_lying != -1)
|
||||
lying = buckled_to.buckle_lying
|
||||
lying_is_intentional = FALSE
|
||||
if(buckled_to.buckle_movable)
|
||||
anchored = FALSE
|
||||
canmove = TRUE
|
||||
else if(captured)
|
||||
anchored = TRUE
|
||||
var/found_grab = FALSE
|
||||
for(var/obj/item/grab/G as anything in grabbed_by)
|
||||
if(G.wielded || G.state >= GRAB_AGGRESSIVE)
|
||||
canmove = FALSE
|
||||
lying = G.wielded || (G.state >= GRAB_NECK && G.force_down)
|
||||
found_grab = TRUE
|
||||
break
|
||||
var/mob/living/carbon/human/H = astype(src)
|
||||
if(!found_grab)
|
||||
if(!resting && MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && H?.can_stand_overridden())
|
||||
lying = FALSE
|
||||
else if(m_intent == M_LAY && !incapacitated())
|
||||
lying = TRUE
|
||||
lying_is_intentional = TRUE
|
||||
lying_is_intentional = FALSE
|
||||
canmove = TRUE
|
||||
else if(sleeping)
|
||||
lying = resting || is_dead() || (MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && sleeps_horizontal()) // Vaurca, IPCs and Diona sleep standing up, unless they were already lying down
|
||||
lying_is_intentional = FALSE
|
||||
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
|
||||
else
|
||||
lying = resting || is_dead() || MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && !recently_slept
|
||||
lying_is_intentional = FALSE
|
||||
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
|
||||
if(buckled_to)
|
||||
if(istype(buckled_to, /obj/vehicle))
|
||||
var/obj/vehicle/V = buckled_to
|
||||
if(MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED))
|
||||
lying = TRUE
|
||||
lying_is_intentional = FALSE
|
||||
canmove = FALSE
|
||||
pixel_y = V.mob_offset_y - 5
|
||||
else
|
||||
if(buckled_to.buckle_lying != -1) lying = buckled_to.buckle_lying
|
||||
lying_is_intentional = FALSE
|
||||
canmove = TRUE
|
||||
pixel_y = V.mob_offset_y
|
||||
else
|
||||
anchored = TRUE
|
||||
canmove = FALSE
|
||||
if(buckled_to.buckle_lying != -1)
|
||||
lying = buckled_to.buckle_lying
|
||||
lying_is_intentional = FALSE
|
||||
if(buckled_to.buckle_movable)
|
||||
anchored = FALSE
|
||||
canmove = TRUE
|
||||
else if(captured)
|
||||
anchored = TRUE
|
||||
canmove = FALSE
|
||||
lying = FALSE
|
||||
else if(m_intent == M_LAY && !MOB_IS_INCAPACITATED(INCAPACITATION_DEFAULT))
|
||||
lying = TRUE
|
||||
lying_is_intentional = TRUE
|
||||
canmove = TRUE
|
||||
else if(sleeping)
|
||||
lying = resting || (stat == DEAD) || (MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && !(H?.species?.sleeps_upright)) // Vaurca, IPCs and Diona sleep standing up, unless they were already lying down
|
||||
lying_is_intentional = FALSE
|
||||
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
|
||||
else
|
||||
lying = resting || (stat == DEAD) || MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && !recently_slept
|
||||
lying_is_intentional = FALSE
|
||||
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
|
||||
|
||||
if(lying)
|
||||
ADD_TRAIT(src, TRAIT_UNDENSE, TRAIT_SOURCE_LYING_DOWN)
|
||||
@@ -925,30 +911,11 @@
|
||||
else
|
||||
REMOVE_TRAIT(src, TRAIT_UNDENSE, TRAIT_SOURCE_LYING_DOWN)
|
||||
|
||||
for(var/obj/item/grab/G in grabbed_by)
|
||||
if(G.wielded)
|
||||
canmove = FALSE
|
||||
lying = TRUE
|
||||
break
|
||||
if(G.state >= GRAB_AGGRESSIVE)
|
||||
canmove = 0
|
||||
break
|
||||
|
||||
//Temporarily moved here from the various life() procs
|
||||
//I'm fixing stuff incrementally so this will likely find a better home.
|
||||
//It just makes sense for now. ~Carn
|
||||
if( update_icon ) //forces a full overlay update
|
||||
update_icon = 0
|
||||
regenerate_icons()
|
||||
else if( lying != lying_prev )
|
||||
if( lying != lying_prev )
|
||||
update_icon()
|
||||
|
||||
return canmove
|
||||
|
||||
|
||||
/mob/proc/sleeps_horizontal()
|
||||
return TRUE
|
||||
|
||||
/mob/proc/facedir(var/ndir, var/force_change = FALSE)
|
||||
if(!canface() || (client && client.moving))
|
||||
return 0
|
||||
@@ -1121,7 +1088,7 @@
|
||||
break
|
||||
if(affected)
|
||||
affected.implants -= implant
|
||||
for(var/datum/wound/wound in affected.wounds)
|
||||
for(var/datum/wound/wound as anything in affected.wounds)
|
||||
LAZYREMOVE(wound.embedded_objects, implant)
|
||||
if(!surgical_removal)
|
||||
shock_stage += 20
|
||||
@@ -1592,7 +1559,3 @@
|
||||
var/atom/movable/screen/plane_master/lighting/exterior_lighting = hud_used.plane_masters["[EXTERIOR_LIGHTING_PLANE]"]
|
||||
if (exterior_lighting)
|
||||
exterior_lighting.alpha = min(GLOB.minimum_exterior_lighting_alpha, lighting_alpha)
|
||||
|
||||
#undef UNBUCKLED
|
||||
#undef PARTIALLY_BUCKLED
|
||||
#undef FULLY_BUCKLED
|
||||
|
||||
@@ -1296,6 +1296,8 @@ GLOBAL_LIST_INIT(organ_rel_size, list(
|
||||
M.client.eye = M.client.mob
|
||||
M.client.perspective = MOB_PERSPECTIVE
|
||||
|
||||
|
||||
|
||||
/mob/proc/in_neck_grab()
|
||||
for(var/thing in grabbed_by)
|
||||
var/obj/item/grab/G = thing
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
return 1
|
||||
|
||||
/mob/living/silicon/robot/can_ztravel(var/direction)
|
||||
if(incapacitated() || is_dead())
|
||||
if(incapacitated() || (stat == DEAD))
|
||||
return FALSE
|
||||
|
||||
if(Allow_Spacemove()) //Checks for active jetpack
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
if(!loc) return FALSE
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
var/pressure_difference = pressure - environment.return_pressure()
|
||||
var/pressure_difference = pressure - XGM_PRESSURE(environment)
|
||||
|
||||
if(pressure_difference > maximum_pressure)
|
||||
burst()
|
||||
|
||||
@@ -27,14 +27,15 @@
|
||||
min_broken_damage = 10
|
||||
|
||||
/obj/item/organ/internal/Destroy()
|
||||
if(owner)
|
||||
if(owner && owner.internal_organs)
|
||||
owner.internal_organs.Remove(src)
|
||||
owner.internal_organs_by_name[organ_tag] = null
|
||||
owner.internal_organs_by_name -= organ_tag
|
||||
while(null in owner.internal_organs)
|
||||
owner.internal_organs -= null
|
||||
var/obj/item/organ/external/E = owner.organs_by_name[parent_organ]
|
||||
if(istype(E)) E.internal_organs -= src
|
||||
if(parent_organ in owner.organs_by_name)
|
||||
var/obj/item/organ/external/E = astype(owner.organs_by_name[parent_organ])
|
||||
E?.internal_organs -= src
|
||||
return ..()
|
||||
|
||||
/// Sets the internal organ as belonging to the targeted external organ, and matches the target's species/robotness. Also updates all organ lists belonging to the owner.
|
||||
|
||||
@@ -247,7 +247,7 @@
|
||||
var/list/do_spray = list()
|
||||
for(var/obj/item/organ/external/temp in owner.bad_external_organs)
|
||||
if((temp.status & ORGAN_BLEEDING) && !BP_IS_ROBOTIC(temp))
|
||||
for(var/datum/wound/W in temp.wounds)
|
||||
for(var/datum/wound/W as anything in temp.wounds)
|
||||
if(W.bleeding())
|
||||
open_wound = TRUE
|
||||
if(temp.applied_pressure)
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
temperature_change *= 0.5
|
||||
|
||||
// Check if there is somehow no air, or if we are in an ambient without enough air to properly cool us.
|
||||
if((!ambient || (ambient && owner.calculate_affecting_pressure(ambient.return_pressure()) < owner.species.warning_low_pressure)))
|
||||
if((!ambient || (ambient && owner.calculate_affecting_pressure(XGM_PRESSURE(ambient)) < owner.species.warning_low_pressure)))
|
||||
if(!spaceproof)
|
||||
temperature_change *= 0
|
||||
else
|
||||
|
||||
@@ -248,9 +248,8 @@
|
||||
cached_markings = null
|
||||
mob_icon = null
|
||||
|
||||
for(var/datum/wound/wound in wounds)
|
||||
qdel(wound)
|
||||
|
||||
if(wounds)
|
||||
QDEL_NULL_LIST(wounds)
|
||||
QDEL_LIST(children)
|
||||
QDEL_LIST(internal_organs)
|
||||
QDEL_LIST(implants)
|
||||
@@ -605,7 +604,7 @@
|
||||
return
|
||||
|
||||
//Heal damage on the individual wounds
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
if(brute == 0 && burn == 0)
|
||||
break
|
||||
|
||||
@@ -695,7 +694,7 @@ This function completely restores a damaged organ to perfect condition.
|
||||
if((type == INJURY_TYPE_CUT || type == INJURY_TYPE_BRUISE) && damage >= 5)
|
||||
//we need to make sure that the wound we are going to worsen is compatible with the type of damage...
|
||||
var/list/compatible_wounds = list()
|
||||
for (var/datum/wound/W in wounds)
|
||||
for (var/datum/wound/W as anything in wounds)
|
||||
if (W.can_worsen(type, damage))
|
||||
compatible_wounds += W
|
||||
|
||||
@@ -730,14 +729,17 @@ This function completely restores a damaged organ to perfect condition.
|
||||
for(var/datum/wound/other in wounds)
|
||||
if(other.can_merge(W))
|
||||
other.merge_wound(W)
|
||||
W = null // to signify that the wound was added
|
||||
W = other
|
||||
break
|
||||
LAZYADD(wounds, W)
|
||||
|
||||
if(bandage_level)
|
||||
owner.visible_message(SPAN_WARNING("The bandages on [owner.name]'s [name] gets [is_burn_type_damage ? "burnt" : "ripped"] off!"), SPAN_WARNING("The bandages on your [name] gets [is_burn_type_damage ? "burnt" : "ripped"] off!"))
|
||||
bandage_level = BANDAGE_LEVEL_NONE
|
||||
owner.update_bandages()
|
||||
if(!QDELETED(W))
|
||||
if(!LAZYISIN(wounds, W))
|
||||
LAZYADD(wounds, W)
|
||||
|
||||
if(bandage_level)
|
||||
owner.visible_message(SPAN_WARNING("The bandages on [owner.name]'s [name] gets [is_burn_type_damage ? "burnt" : "ripped"] off!"), SPAN_WARNING("The bandages on your [name] gets [is_burn_type_damage ? "burnt" : "ripped"] off!"))
|
||||
bandage_level = BANDAGE_LEVEL_NONE
|
||||
owner.update_bandages()
|
||||
return W
|
||||
|
||||
/****************************************************
|
||||
@@ -888,24 +890,21 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
var/antibiotics = 0
|
||||
if(CE_ANTIBIOTIC in owner.chem_effects)
|
||||
antibiotics = owner.chem_effects[CE_ANTIBIOTIC]
|
||||
for(var/datum/wound/W in wounds)
|
||||
var/increased_own_germs = FALSE
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
//Open wounds can become infected
|
||||
if (owner.germ_level > W.germ_level && W.infection_check())
|
||||
W.germ_level++
|
||||
|
||||
if(antibiotics < 5)
|
||||
for(var/datum/wound/W in wounds)
|
||||
//Infected wounds raise the organ's germ level
|
||||
if (W.germ_level > germ_level && W.infection_check())
|
||||
if(!increased_own_germs && antibiotics < 5 && W.germ_level > germ_level)
|
||||
germ_level++
|
||||
break //limit increase to a maximum of one per second
|
||||
increased_own_germs = TRUE // limit increase to 1/tick
|
||||
|
||||
/obj/item/organ/external/proc/get_infect_target(var/list/infect_candidates = list())
|
||||
var/obj/item/organ/temp_target
|
||||
shuffle(infect_candidates) //Slightly randomizes since if all germ levels are zero, it'll always be the first pick of the list
|
||||
|
||||
//figure out which organs we can spread germs to
|
||||
for (var/obj/item/organ/I in infect_candidates)
|
||||
for (var/obj/item/organ/I as anything in infect_candidates)
|
||||
if(I.germ_level < min(germ_level, INFECTION_LEVEL_TWO)) //Only choose organs that have less germs than us AND are below level two
|
||||
//The below will always be the organ with the highest germ level. It picks a temp_target first then cycles through to find which, if any, has more germs.
|
||||
if(!temp_target || I.germ_level > temp_target.germ_level)
|
||||
@@ -977,11 +976,12 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
|
||||
//Updating wounds. Handles wound natural I had some free spachealing, internal bleedings and infections
|
||||
/obj/item/organ/external/proc/update_wounds()
|
||||
if(status & (ORGAN_ROBOT|ORGAN_ADV_ROBOT|ORGAN_PLANT))
|
||||
return //Robotic limbs don't heal or get worse. Diona limbs heal using their own mechanic
|
||||
|
||||
if((status & ORGAN_ROBOT) || (status & ORGAN_ADV_ROBOT) || (status & ORGAN_PLANT)) //Robotic limbs don't heal or get worse. Diona limbs heal using their own mechanic
|
||||
return
|
||||
var/updatehud
|
||||
for(var/datum/wound/W in wounds)
|
||||
var/num_total_wounds = LAZYLEN(wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
// wounds can disappear after 10 minutes at the earliest
|
||||
if(W.damage <= 0 && W.created + (10 MINUTES) <= world.time)
|
||||
qdel(W)
|
||||
@@ -995,22 +995,20 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
var/heal_amt = 0
|
||||
|
||||
// if damage >= 50 AFTER treatment then it's probably too severe to heal within the timeframe of a round.
|
||||
if (W.can_autoheal() && W.wound_damage() && brute_ratio < 50 && burn_ratio < 50)
|
||||
if (updatehud && brute_ratio < 50 && burn_ratio < 50 && W.can_autoheal())
|
||||
heal_amt += 0.5
|
||||
|
||||
//we only update wounds once in [wound_update_accuracy] ticks so have to emulate realtime
|
||||
heal_amt = heal_amt * wound_update_accuracy
|
||||
heal_amt *= wound_update_accuracy
|
||||
//configurable regen speed woo, no-regen hardcore or instaheal hugbox, choose your destiny
|
||||
heal_amt = heal_amt * GLOB.config.organ_regeneration_multiplier
|
||||
heal_amt *= GLOB.config.organ_regeneration_multiplier
|
||||
// amount of healing is spread over all the wounds
|
||||
heal_amt = heal_amt / (LAZYLEN(wounds) + 1)
|
||||
heal_amt /= ((number_wounds / num_total_wounds) + 1)
|
||||
// making it look prettier on scanners
|
||||
heal_amt = round(heal_amt,0.1)
|
||||
var/dam_type = DAMAGE_BRUTE
|
||||
if (W.damage_type == INJURY_TYPE_BURN)
|
||||
dam_type = DAMAGE_BURN
|
||||
heal_amt = round(heal_amt, 0.1)
|
||||
var/dam_type = W.damage_type == INJURY_TYPE_BURN ? DAMAGE_BURN : DAMAGE_BRUTE
|
||||
|
||||
if(owner.can_autoheal(dam_type) && (heal_amt > 0))
|
||||
if((heal_amt > 0) && owner.can_autoheal(dam_type))
|
||||
W.heal_damage(heal_amt)
|
||||
|
||||
// Salving also helps against infection
|
||||
@@ -1037,12 +1035,11 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
status &= ~ORGAN_BLEEDING
|
||||
var/clamped = 0
|
||||
|
||||
var/mob/living/carbon/human/H
|
||||
if(istype(owner,/mob/living/carbon/human))
|
||||
H = owner
|
||||
var/mob/living/carbon/human/H = astype(owner)
|
||||
var/can_bleed = !BP_IS_ROBOTIC(src) && (H && !(H.species.flags & NO_BLOOD))
|
||||
|
||||
//update damage counts
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
|
||||
if(W.damage <= 0)
|
||||
qdel(W)
|
||||
@@ -1055,7 +1052,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
if(W.damage_type == INJURY_TYPE_CUT)
|
||||
cut_dam += W.damage
|
||||
|
||||
if(!(status & ORGAN_ROBOT) && W.bleeding() && (H && !(H.species.flags & NO_BLOOD)))
|
||||
if(can_bleed && W.bleeding())
|
||||
W.handle_bleeding(H, src)
|
||||
|
||||
clamped |= W.clamped
|
||||
@@ -1063,18 +1060,18 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
number_wounds += W.amount
|
||||
|
||||
//things tend to bleed if they are CUT OPEN
|
||||
if (open && !clamped && (H && !(H.species.flags & NO_BLOOD) && !(status & ORGAN_ROBOT)))
|
||||
if (open && !clamped && can_bleed)
|
||||
status |= ORGAN_BLEEDING
|
||||
|
||||
if (istype(tendon))
|
||||
if (tendon)
|
||||
tendon.update_damage(cut_dam - min_broken_damage)
|
||||
|
||||
update_damage_ratios()
|
||||
|
||||
/obj/item/organ/external/proc/update_damage_ratios()
|
||||
var/limb_loss_threshold = max_damage * 2
|
||||
brute_ratio = Percent(brute_dam, limb_loss_threshold)
|
||||
burn_ratio = Percent(burn_dam, limb_loss_threshold)
|
||||
brute_ratio = AS_PCT(brute_dam, limb_loss_threshold)
|
||||
burn_ratio = AS_PCT(burn_dam, limb_loss_threshold)
|
||||
|
||||
// new damage icon system
|
||||
// returns just the brute/burn damage code
|
||||
@@ -1231,21 +1228,21 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
|
||||
// checks if all wounds on the organ are bandaged
|
||||
/obj/item/organ/external/proc/is_bandaged()
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
if(!W.bandaged)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
// checks if all wounds on the organ are salved
|
||||
/obj/item/organ/external/proc/is_salved()
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
if(!W.salved)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
// checks if all wounds on the organ are disinfected
|
||||
/obj/item/organ/external/proc/is_disinfected()
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
if(!W.disinfected)
|
||||
return 0
|
||||
return 1
|
||||
@@ -1253,21 +1250,21 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
/obj/item/organ/external/proc/bandage()
|
||||
var/rval = 0
|
||||
status &= ~ORGAN_BLEEDING
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
rval |= !W.bandaged
|
||||
W.bandage()
|
||||
return rval
|
||||
|
||||
/obj/item/organ/external/proc/salve()
|
||||
var/rval = 0
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
rval |= !W.salved
|
||||
W.salve()
|
||||
return rval
|
||||
|
||||
/obj/item/organ/external/proc/disinfect()
|
||||
var/rval = 0
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
rval |= !W.disinfected
|
||||
W.disinfect()
|
||||
W.germ_level = 0
|
||||
@@ -1276,7 +1273,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
/obj/item/organ/external/proc/clamp_organ()
|
||||
var/rval = 0
|
||||
src.status &= ~ORGAN_BLEEDING
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
rval |= !W.clamped
|
||||
W.clamped = 1
|
||||
return rval
|
||||
@@ -1396,7 +1393,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
return max(brute_dam + burn_dam - perma_injury, perma_injury) //could use max_damage?
|
||||
|
||||
/obj/item/organ/external/proc/has_infected_wound()
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
if(W.germ_level > INFECTION_LEVEL_ONE)
|
||||
return 1
|
||||
return 0
|
||||
@@ -1443,7 +1440,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
SPAN_DANGER("\The [W] sticks in your wound!"))
|
||||
|
||||
if(supplied_wound)
|
||||
for(var/datum/wound/wound in wounds)
|
||||
for(var/datum/wound/wound as anything in wounds)
|
||||
if ((wound.damage_type == INJURY_TYPE_CUT || wound.damage_type == INJURY_TYPE_PIERCE) && wound.damage >= W.w_class * 5)
|
||||
supplied_wound = wound
|
||||
break
|
||||
@@ -1570,7 +1567,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
wound_descriptors["an open incision"] = 1
|
||||
else if (open)
|
||||
wound_descriptors["an incision"] = 1
|
||||
for(var/datum/wound/W in wounds)
|
||||
for(var/datum/wound/W as anything in wounds)
|
||||
var/this_wound_desc = W.desc
|
||||
if(W.damage_type == DAMAGE_BURN && W.salved)
|
||||
this_wound_desc = "salved [this_wound_desc]"
|
||||
|
||||
@@ -375,7 +375,7 @@
|
||||
if ((istype(attacking_item, /obj/item/analyzer)) && get_dist(user, src) <= 1)
|
||||
user.visible_message(SPAN_WARNING("[user] has used [attacking_item] on [icon2html(icon, viewers(get_turf(user)))] [src]."))
|
||||
|
||||
var/pressure = air_contents.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(air_contents)
|
||||
manipulated_by = user.real_name //This person is aware of the contents of the tank.
|
||||
var/total_moles = air_contents.total_moles
|
||||
|
||||
@@ -409,7 +409,7 @@
|
||||
|
||||
// this is the data which will be sent to the ui
|
||||
var/data[0]
|
||||
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
|
||||
data["tankPressure"] = round(SAFE_XGM_PRESSURE(air_contents))
|
||||
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
|
||||
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
|
||||
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
|
||||
@@ -513,7 +513,7 @@
|
||||
if(!air_contents)
|
||||
return null
|
||||
|
||||
var/tank_pressure = air_contents.return_pressure()
|
||||
var/tank_pressure = XGM_PRESSURE(air_contents)
|
||||
if((tank_pressure < distribute_pressure) && prob(5))
|
||||
to_chat(owner, SPAN_WARNING("There is a buzzing in your [parent_organ]."))
|
||||
|
||||
@@ -534,7 +534,7 @@
|
||||
if(!air_contents)
|
||||
return 0
|
||||
|
||||
var/pressure = air_contents.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(air_contents)
|
||||
if(pressure > TANK_FRAGMENT_PRESSURE)
|
||||
if(!istype(src.loc,/obj/item/transfer_valve))
|
||||
message_admins("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast].")
|
||||
@@ -545,7 +545,7 @@
|
||||
air_contents.react()
|
||||
air_contents.react()
|
||||
|
||||
pressure = air_contents.return_pressure()
|
||||
pressure = XGM_PRESSURE(air_contents)
|
||||
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
|
||||
|
||||
explosion(
|
||||
|
||||
@@ -104,16 +104,14 @@
|
||||
if(LAZYLEN(embedded_objects))
|
||||
return FALSE
|
||||
|
||||
return (wound_damage() <= autoheal_cutoff) ? TRUE : is_treated()
|
||||
return ((src.damage / src.amount) <= autoheal_cutoff) ? TRUE : is_treated()
|
||||
|
||||
/// Checks whether the wound has been appropriately treated
|
||||
/datum/wound/proc/is_treated()
|
||||
if(!LAZYLEN(embedded_objects))
|
||||
switch(damage_type)
|
||||
if(INJURY_TYPE_BRUISE, INJURY_TYPE_CUT, INJURY_TYPE_PIERCE)
|
||||
return bandaged
|
||||
if(INJURY_TYPE_BURN)
|
||||
return salved
|
||||
if(LAZYLEN(embedded_objects))
|
||||
return FALSE
|
||||
|
||||
return damage_type == INJURY_TYPE_BURN ? salved : bandaged
|
||||
|
||||
/// Checks whether other other can be merged into src.
|
||||
/datum/wound/proc/can_merge(datum/wound/other)
|
||||
@@ -144,7 +142,7 @@
|
||||
/datum/wound/proc/infection_check()
|
||||
if (damage < 10) //small cuts, tiny bruises, and moderate burns shouldn't be infectable.
|
||||
return FALSE
|
||||
if (is_treated() && damage < 25) //anything less than a flesh wound (or equivalent) isn't infectable if treated properly
|
||||
if (damage < 25 && is_treated()) //anything less than a flesh wound (or equivalent) isn't infectable if treated properly
|
||||
return FALSE
|
||||
if (disinfected)
|
||||
germ_level = 0 //reset this, just in case
|
||||
@@ -186,7 +184,7 @@
|
||||
amount -= healed_damage
|
||||
src.damage -= healed_damage
|
||||
|
||||
while(src.wound_damage() < damage_list[current_stage] && current_stage < length(src.desc_list))
|
||||
while((src.damage / src.amount) < damage_list[current_stage] && current_stage < length(src.desc_list))
|
||||
current_stage++
|
||||
desc = desc_list[current_stage]
|
||||
src.min_damage = damage_list[current_stage]
|
||||
@@ -226,14 +224,14 @@
|
||||
return TRUE
|
||||
|
||||
/datum/wound/proc/bleeding()
|
||||
for(var/obj/item/thing in embedded_objects)
|
||||
for(var/obj/item/thing as anything in embedded_objects)
|
||||
if(thing.w_class > WEIGHT_CLASS_SMALL)
|
||||
return FALSE
|
||||
|
||||
if (bandaged||clamped)
|
||||
return FALSE
|
||||
|
||||
return ((bleed_timer > 0 || wound_damage() > bleed_threshold) && current_stage <= max_bleeding_stage)
|
||||
return ((bleed_timer > 0 || (src.damage / src.amount) > bleed_threshold) && current_stage <= max_bleeding_stage)
|
||||
|
||||
/// Called in organ_external.dm update_damages, this will update the limb's status to bleeding, and lowers the bleed_timer if applicable
|
||||
/datum/wound/proc/handle_bleeding(var/mob/victim, var/obj/item/organ/external/limb)
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
var/obj/item/organ/external/E = A
|
||||
if(BP_IS_ROBOTIC(E))
|
||||
continue
|
||||
for(var/datum/wound/W in E.wounds)
|
||||
for(var/datum/wound/W as anything in E.wounds)
|
||||
if(W.germ_level < INFECTION_LEVEL_ONE)
|
||||
W.germ_level = INFECTION_LEVEL_ONE
|
||||
W.germ_level += rand(10, 50)
|
||||
|
||||
@@ -328,8 +328,8 @@
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/proc/adapt_seed(var/datum/seed/S)
|
||||
SET_SEED_TRAIT_BOUNDED(S, TRAIT_IDEAL_HEAT, atmosphere.temperature + rand(-5,5), 800, 70, null)
|
||||
SET_SEED_TRAIT_BOUNDED(S, TRAIT_HEAT_TOLERANCE, GET_SEED_TRAIT(S, TRAIT_HEAT_TOLERANCE) + rand(-5,5), 800, 70, null)
|
||||
SET_SEED_TRAIT_BOUNDED(S, TRAIT_LOWKPA_TOLERANCE, atmosphere.return_pressure() + rand(-5,-50), 80, 0, null)
|
||||
SET_SEED_TRAIT_BOUNDED(S, TRAIT_HIGHKPA_TOLERANCE, atmosphere.return_pressure() + rand(5,50), 500, 110, null)
|
||||
SET_SEED_TRAIT_BOUNDED(S, TRAIT_LOWKPA_TOLERANCE, XGM_PRESSURE(atmosphere) + rand(-5,-50), 80, 0, null)
|
||||
SET_SEED_TRAIT_BOUNDED(S, TRAIT_HIGHKPA_TOLERANCE, XGM_PRESSURE(atmosphere) + rand(5,50), 500, 110, null)
|
||||
SET_SEED_TRAIT(S, TRAIT_SPREAD, 0)
|
||||
if(S.exude_gasses)
|
||||
S.exude_gasses -= badgas
|
||||
@@ -508,7 +508,7 @@
|
||||
gases += gas_data.name[g]
|
||||
extra_data += "<b>Atmosphere composition:</b> [english_list(gases)]"
|
||||
var/inaccuracy = rand(8,12)/10
|
||||
extra_data += "<b>Atmosphere pressure:</b> [atmosphere.return_pressure()*inaccuracy] kPa, <b>temperature:</b> [atmosphere.temperature*inaccuracy] K"
|
||||
extra_data += "<b>Atmosphere pressure:</b> [XGM_PRESSURE(atmosphere)*inaccuracy] kPa, <b>temperature:</b> [atmosphere.temperature*inaccuracy] K"
|
||||
|
||||
if(seeds.len)
|
||||
extra_data += "<br>Unrecognized xenoflora detected."
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
water.SetTransform(rotation = rand(0, 360))
|
||||
skybox_image.overlays += water
|
||||
|
||||
if (atmosphere && atmosphere.return_pressure() > SOUND_MINIMUM_PRESSURE)
|
||||
if (SAFE_XGM_PRESSURE(atmosphere) > SOUND_MINIMUM_PRESSURE)
|
||||
|
||||
var/atmo_color = get_atmosphere_color()
|
||||
if (!atmo_color)
|
||||
|
||||
@@ -462,7 +462,7 @@
|
||||
var/turf/T=get_turf(src)
|
||||
if(istype(T))
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
if(environment && environment.return_pressure() > MINIMUM_PRESSURE_DIFFERENCE_TO_SUSPEND)
|
||||
if(SAFE_XGM_PRESSURE(environment) > MINIMUM_PRESSURE_DIFFERENCE_TO_SUSPEND)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
|
||||
.+= "Propellant total mass: [round(air_contents.get_mass(),0.01)] kg."
|
||||
.+= "Propellant used per burn: [round(air_contents.get_mass() * volume_per_burn * thrust_limit / air_contents.volume,0.01)] kg."
|
||||
.+= "Propellant pressure: [round(air_contents.return_pressure()/1000,0.1)] MPa."
|
||||
.+= "Propellant pressure: [round(XGM_PRESSURE(air_contents)/1000,0.1)] MPa."
|
||||
. = jointext(.,"<br>")
|
||||
|
||||
/obj/machinery/atmospherics/unary/engine/power_change()
|
||||
@@ -241,10 +241,12 @@
|
||||
T = get_step(T, exhaust_dir)
|
||||
if(T)
|
||||
T.assume_air(removed)
|
||||
new/obj/effect/engine_exhaust(T, dir, air_contents.check_combustibility() && air_contents.temperature >= PHORON_MINIMUM_BURN_TEMPERATURE)
|
||||
var/is_cmb = 0
|
||||
CHECK_COMBUSTIBLE(is_cmb, air_contents)
|
||||
new/obj/effect/engine_exhaust(T, dir, is_cmb && air_contents.temperature >= PHORON_MINIMUM_BURN_TEMPERATURE)
|
||||
|
||||
/obj/machinery/atmospherics/unary/engine/proc/calculate_thrust(datum/gas_mixture/propellant, used_part = 1)
|
||||
return round(sqrt(propellant.get_mass() * used_part * sqrt(air_contents.return_pressure()/200)),0.1)
|
||||
return round(sqrt(propellant.get_mass() * used_part * sqrt(XGM_PRESSURE(air_contents)/200)),0.1)
|
||||
|
||||
//Exhaust effect
|
||||
/obj/effect/engine_exhaust
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
check_core_stability()
|
||||
|
||||
add_avail(stored_power)
|
||||
ADD_TO_POWERNET(src, stored_power)
|
||||
|
||||
power_cycle++
|
||||
if(power_cycle >= power_cycle_delay)
|
||||
|
||||
+140
-135
@@ -39,11 +39,23 @@
|
||||
#define CHARGING_ON 1
|
||||
#define CHARGING_FULL 2
|
||||
|
||||
//channel settings
|
||||
#define CHANNEL_OFF 0
|
||||
#define CHANNEL_OFF_AUTO 1
|
||||
#define CHANNEL_ON 2
|
||||
#define CHANNEL_ON_AUTO 3
|
||||
// APC channel status:
|
||||
/// The APCs power channel is off.
|
||||
#define CHANNEL_OFF 0
|
||||
/// The APCs power channel is on.
|
||||
#define CHANNEL_ON BITFLAG(0)
|
||||
/// The APCs power channel is being controlled automatically.
|
||||
#define CHANNEL_AUTO BITFLAG(1)
|
||||
/// The APCs power channel is automatically on.
|
||||
#define CHANNEL_AUTO_ON (CHANNEL_ON | CHANNEL_AUTO)
|
||||
|
||||
// APC autoset enums:
|
||||
/// The APC turns automated and manual power channels off.
|
||||
#define AUTOSET_FORCE_OFF 0
|
||||
/// The APC turns automated power channels off.
|
||||
#define AUTOSET_OFF 2
|
||||
/// The APC turns automated power channels on.
|
||||
#define AUTOSET_ON 1
|
||||
|
||||
//channel types
|
||||
#define CHANNEL_EQUIPMENT 0
|
||||
@@ -60,6 +72,28 @@
|
||||
#define AUTOFLAG_ENVIRON_ON 1
|
||||
#define AUTOFLAG_ENVIRON_LIGHTS_ON 2
|
||||
#define AUTOFLAG_ALL_ON 3
|
||||
/**
|
||||
* Returns the new status value for an APC channel.
|
||||
*
|
||||
* Arguments:
|
||||
* - val: The current status of the power channel.
|
||||
* - [APC_CHANNEL_OFF]: The APCs channel has been manually set to off. This channel will not automatically change.
|
||||
* - [APC_CHANNEL_AUTO_OFF]: The APCs channel is running on automatic and is currently off. Can be automatically set to [APC_CHANNEL_AUTO_ON].
|
||||
* - [APC_CHANNEL_ON]: The APCs channel has been manually set to on. This will be automatically changed only if the APC runs completely out of power or is disabled.
|
||||
* - [APC_CHANNEL_AUTO_ON]: The APCs channel is running on automatic and is currently on. Can be automatically set to [APC_CHANNEL_AUTO_OFF].
|
||||
* - on: An enum dictating how to change the channel's status.
|
||||
* - [AUTOSET_FORCE_OFF]: The APC forces the channel to turn off. This includes manually set channels.
|
||||
* - [AUTOSET_ON]: The APC allows automatic channels to turn back on.
|
||||
* - [AUTOSET_OFF]: The APC turns automatic channels off.
|
||||
*/
|
||||
|
||||
#define autoset(val, on) (((val & CHANNEL_AUTO) || on == AUTOSET_FORCE_OFF) ? ((val & ~CHANNEL_ON) | on == AUTOSET_ON) : val)
|
||||
|
||||
#define APC_DELTA_POWER (((src.lastused_charging * 2) - src.lastused_total) * CELLRATE)
|
||||
#define APC_GOAL(dp) (dp < 0) ? (cell.charge) : (cell.maxcharge - cell.charge)
|
||||
#define APC_UPDATE_TIME(dp, goal) (world.time + (dp ? ((goal / abs(dp)) * (world.time - src.last_time)) : 0))
|
||||
#define APC_CHARGE_MODE(dp) (dp < 0 ? CHARGE_MODE_DISCHARGE : dp > 0 ? CHARGE_MODE_CHARGE : CHARGE_MODE_STABLE)
|
||||
|
||||
|
||||
// the Area Power Controller (APC), formerly Power Distribution Unit (PDU)
|
||||
// one per area, needs wire conection to power network through a terminal
|
||||
@@ -93,9 +127,9 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
var/shorted = FALSE
|
||||
/// Determines if the light level is set to dimmed or not
|
||||
var/night_mode = FALSE
|
||||
var/lighting = CHANNEL_ON_AUTO
|
||||
var/equipment = CHANNEL_ON_AUTO
|
||||
var/environ = CHANNEL_ON_AUTO
|
||||
var/lighting = CHANNEL_AUTO_ON
|
||||
var/equipment = CHANNEL_AUTO_ON
|
||||
var/environ = CHANNEL_AUTO_ON
|
||||
var/infected = FALSE
|
||||
var/operating = TRUE
|
||||
var/charging = CHARGING_OFF
|
||||
@@ -188,7 +222,7 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
area.power_light = 0
|
||||
area.power_equip = 0
|
||||
area.power_environ = 0
|
||||
area.power_change()
|
||||
SEND_SIGNAL(area, COMSIG_AREA_POWER_CHANGE)
|
||||
QDEL_NULL(wires)
|
||||
QDEL_NULL(terminal)
|
||||
if(cell)
|
||||
@@ -442,21 +476,21 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
|
||||
if (equipment == CHANNEL_OFF)
|
||||
update_overlay |= APC_UPOVERLAY_EQUIPMENT0
|
||||
else if(equipment == CHANNEL_OFF_AUTO)
|
||||
else if(equipment == CHANNEL_AUTO)
|
||||
update_overlay |= APC_UPOVERLAY_EQUIPMENT1
|
||||
else if(equipment == CHANNEL_ON)
|
||||
update_overlay |= APC_UPOVERLAY_EQUIPMENT2
|
||||
|
||||
if(lighting == CHANNEL_OFF)
|
||||
update_overlay |= APC_UPOVERLAY_LIGHTING0
|
||||
else if(lighting == CHANNEL_OFF_AUTO)
|
||||
else if(lighting == CHANNEL_AUTO)
|
||||
update_overlay |= APC_UPOVERLAY_LIGHTING1
|
||||
else if(lighting == CHANNEL_ON)
|
||||
update_overlay |= APC_UPOVERLAY_LIGHTING2
|
||||
|
||||
if(environ == CHANNEL_OFF)
|
||||
update_overlay |= APC_UPOVERLAY_ENVIRON0
|
||||
else if(environ == CHANNEL_OFF_AUTO)
|
||||
else if(environ == CHANNEL_AUTO)
|
||||
update_overlay |= APC_UPOVERLAY_ENVIRON1
|
||||
else if(environ == CHANNEL_ON)
|
||||
update_overlay |= APC_UPOVERLAY_ENVIRON2
|
||||
@@ -943,17 +977,25 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/power/apc/proc/update()
|
||||
if(operating && !shorted && !failure_timer)
|
||||
area.power_light = (lighting > 1)
|
||||
area.power_equip = (equipment > 1)
|
||||
area.power_environ = (environ > 1)
|
||||
var/old_lt = area.power_light
|
||||
var/old_eq = area.power_equip
|
||||
var/old_ev = area.power_environ
|
||||
|
||||
else
|
||||
var/any_power = old_lt || old_eq || old_ev
|
||||
|
||||
if(operating && !shorted && !failure_timer)
|
||||
area.power_light = lighting & CHANNEL_ON
|
||||
area.power_equip = equipment & CHANNEL_ON
|
||||
area.power_environ = environ & CHANNEL_ON
|
||||
|
||||
else if(any_power)
|
||||
area.power_light = FALSE
|
||||
area.power_equip = FALSE
|
||||
area.power_environ = FALSE
|
||||
playsound(src.loc, 'sound/machines/terminal/terminal_off.ogg', 50, FALSE)
|
||||
area.power_change()
|
||||
|
||||
if(old_lt != area.power_light || old_eq != area.power_equip || old_ev != area.power_environ)
|
||||
SEND_SIGNAL(area, COMSIG_AREA_POWER_CHANGE)
|
||||
|
||||
/obj/machinery/power/apc/proc/isWireCut(var/wireIndex)
|
||||
return wires.is_cut(wireIndex)
|
||||
@@ -1087,11 +1129,12 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
var/val = text2num(params["set"])
|
||||
switch(params["chan"])
|
||||
if("Equipment")
|
||||
equipment = setsubsystem(val)
|
||||
equipment = val
|
||||
if("Lighting")
|
||||
lighting = setsubsystem(val)
|
||||
lighting = val
|
||||
if("Environment")
|
||||
environ = setsubsystem(val)
|
||||
environ = val
|
||||
autoflag = AUTOFLAG_OFF
|
||||
intent_message(BUTTON_FLICK, 5)
|
||||
playsound(src, 'sound/machines/terminal/terminal_select.ogg', 18, TRUE)
|
||||
update_icon()
|
||||
@@ -1137,39 +1180,25 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
visible_message(SPAN_DANGER("The [name] suddenly lets out a blast of smoke and some sparks!"), \
|
||||
SPAN_DANGER("You hear sizzling electronics."))
|
||||
|
||||
|
||||
/obj/machinery/power/apc/surplus()
|
||||
return terminal?.surplus()
|
||||
|
||||
/obj/machinery/power/apc/proc/last_surplus()
|
||||
return terminal?.powernet?.last_surplus()
|
||||
|
||||
//Returns 1 if the APC should attempt to charge
|
||||
/obj/machinery/power/apc/proc/attempt_charging()
|
||||
return (chargemode && charging == CHARGING_ON && operating)
|
||||
|
||||
/obj/machinery/power/apc/draw_power(var/amount)
|
||||
return terminal?.powernet?.draw_power(amount)
|
||||
|
||||
/obj/machinery/power/apc/avail()
|
||||
return terminal?.avail()
|
||||
|
||||
/obj/machinery/power/apc/process(seconds_per_tick)
|
||||
if(stat & (BROKEN|MAINT))
|
||||
return
|
||||
if(!area.requires_power)
|
||||
return
|
||||
if(failure_timer)
|
||||
update()
|
||||
queue_icon_update()
|
||||
if(failure_timer > 0)
|
||||
failure_timer--
|
||||
force_update = TRUE
|
||||
if(!(update_state & UPDATE_BLUESCREEN))
|
||||
update()
|
||||
SSicon_update.add_to_queue(src)
|
||||
return
|
||||
|
||||
lastused_light = area.usage(AREA_USAGE_LIGHT)
|
||||
lastused_equip = area.usage(AREA_USAGE_EQUIP)
|
||||
lastused_environ = area.usage(AREA_USAGE_ENVIRON)
|
||||
area.clear_usage()
|
||||
lastused_light = LIGHT_USAGE(area)
|
||||
lastused_equip = EQUIP_USAGE(area)
|
||||
lastused_environ = ENVIRON_USAGE(area)
|
||||
CLEAR_USAGE(area)
|
||||
|
||||
lastused_total = lastused_light + lastused_equip + lastused_environ
|
||||
|
||||
@@ -1179,9 +1208,9 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
var/last_en = environ
|
||||
var/last_ch = charging
|
||||
|
||||
var/excess = surplus()
|
||||
var/excess = POWER_SURPLUS(src.terminal)
|
||||
|
||||
if(!avail())
|
||||
if(POWER_AVAIL(src.terminal) <= 0)
|
||||
main_status = 0
|
||||
else if(excess < 0)
|
||||
main_status = 1
|
||||
@@ -1189,27 +1218,33 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
main_status = 2
|
||||
|
||||
if(cell && !shorted)
|
||||
update_time()
|
||||
var/delta_power = APC_DELTA_POWER
|
||||
var/goal = APC_GOAL(delta_power)
|
||||
time = APC_UPDATE_TIME(delta_power, goal)
|
||||
last_time = world.time
|
||||
charge_mode = APC_CHARGE_MODE(delta_power)
|
||||
// draw power from cell as before to power the area
|
||||
cellused = min(cell.charge, (CELLRATE * lastused_total)) // clamp deduction to a max, amount left in cell
|
||||
cell.use(cellused)
|
||||
var/draw = 0
|
||||
if(excess > lastused_total) // if power excess recharge the cell
|
||||
// by the same amount just used
|
||||
draw = draw_power(cellused/CELLRATE) // draw the power needed to charge this cell
|
||||
draw = TERMINAL_POWER_DRAW(cellused/CELLRATE) // draw the power needed to charge this cell
|
||||
TERMINAL_DRAW_POWER(draw)
|
||||
cell.give(draw * CELLRATE)
|
||||
else // no excess, and not enough per-apc
|
||||
if((cell.charge/CELLRATE + excess) >= lastused_total) // can we draw enough from cell+grid to cover last usage?
|
||||
draw = draw_power(excess)
|
||||
draw = TERMINAL_POWER_DRAW(excess)
|
||||
TERMINAL_DRAW_POWER(draw)
|
||||
cell.charge = min(cell.maxcharge, cell.charge + CELLRATE * draw) //recharge with what we can
|
||||
charging = CHARGING_OFF
|
||||
else // not enough power available to run the last tick!
|
||||
charging = CHARGING_OFF
|
||||
chargecount = 0
|
||||
// This turns everything off in the case that there is still a charge left on the battery, just not enough to run the room.
|
||||
equipment = autoset(equipment, CHANNEL_OFF)
|
||||
lighting = autoset(lighting, CHANNEL_OFF)
|
||||
environ = autoset(environ, CHANNEL_OFF)
|
||||
equipment = autoset(equipment, AUTOSET_FORCE_OFF)
|
||||
lighting = autoset(lighting, AUTOSET_FORCE_OFF)
|
||||
environ = autoset(environ, AUTOSET_FORCE_OFF)
|
||||
autoflag = AUTOFLAG_OFF
|
||||
|
||||
// Set channels depending on how much charge we have left
|
||||
@@ -1217,12 +1252,13 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
|
||||
// now trickle-charge the cell
|
||||
lastused_charging = 0 // Clear the variable for new use.
|
||||
if(attempt_charging())
|
||||
if((chargemode && charging == CHARGING_ON && operating))
|
||||
if(excess > 0) // check to make sure we have enough to charge
|
||||
// Max charge is capped to % per second constant
|
||||
var/ch = min(excess*CELLRATE, cell.maxcharge*chargelevel)
|
||||
|
||||
ch = draw_power(ch/CELLRATE) // Removes the power we're taking from the grid
|
||||
ch = TERMINAL_POWER_DRAW(ch/CELLRATE) // Removes the power we're taking from the grid
|
||||
TERMINAL_DRAW_POWER(ch)
|
||||
cell.give(ch*CELLRATE) // actually recharge the cell
|
||||
lastused_charging = ch + draw
|
||||
lastused_total += ch + draw // Sensors need this to stop reporting APC charging as "Other" load
|
||||
@@ -1254,19 +1290,19 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
else // no cell, switch everything off
|
||||
charging = CHARGING_OFF
|
||||
chargecount = 0
|
||||
equipment = autoset(equipment, CHANNEL_OFF)
|
||||
lighting = autoset(lighting, CHANNEL_OFF)
|
||||
environ = autoset(environ, CHANNEL_OFF)
|
||||
equipment = autoset(equipment, AUTOSET_FORCE_OFF)
|
||||
lighting = autoset(lighting, AUTOSET_FORCE_OFF)
|
||||
environ = autoset(environ, AUTOSET_FORCE_OFF)
|
||||
GLOB.power_alarm.triggerAlarm(loc, src)
|
||||
autoflag = AUTOFLAG_OFF
|
||||
|
||||
// update icon & area power if anything changed
|
||||
if(last_lt != lighting || last_eq != equipment || last_en != environ || force_update)
|
||||
force_update = FALSE
|
||||
queue_icon_update()
|
||||
SSicon_update.add_to_queue(src)
|
||||
update()
|
||||
else if (last_ch != charging)
|
||||
queue_icon_update()
|
||||
SSicon_update.add_to_queue(src)
|
||||
|
||||
/obj/machinery/power/apc/proc/update_channels()
|
||||
// Allow the APC to operate as normal if the cell can charge
|
||||
@@ -1275,51 +1311,38 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
else if(longtermpower > -10)
|
||||
longtermpower -= 2
|
||||
|
||||
if((cell.percent() > 30) || longtermpower > 0) // Put most likely at the top so we don't check it last, effeciency 101
|
||||
if(autoflag != AUTOFLAG_ALL_ON)
|
||||
equipment = autoset(equipment, CHANNEL_OFF_AUTO)
|
||||
lighting = autoset(lighting, CHANNEL_OFF_AUTO)
|
||||
environ = autoset(environ, CHANNEL_OFF_AUTO)
|
||||
autoflag = AUTOFLAG_ALL_ON
|
||||
GLOB.power_alarm.clearAlarm(loc, src)
|
||||
else if((cell.percent() <= 30) && (cell.percent() > 15) && longtermpower < 0) // <30%, turn off equipment
|
||||
if(autoflag != AUTOFLAG_ENVIRON_LIGHTS_ON)
|
||||
equipment = autoset(equipment, CHANNEL_ON)
|
||||
lighting = autoset(lighting, CHANNEL_OFF_AUTO)
|
||||
environ = autoset(environ, CHANNEL_OFF_AUTO)
|
||||
GLOB.power_alarm.triggerAlarm(loc, src)
|
||||
autoflag = AUTOFLAG_ENVIRON_LIGHTS_ON
|
||||
else if(cell.percent() <= 15) // <15%, turn off lighting & equipment
|
||||
if((autoflag > AUTOFLAG_ENVIRON_ON && longtermpower < 0) || (autoflag > AUTOFLAG_ENVIRON_ON && longtermpower >= 0))
|
||||
equipment = autoset(equipment, CHANNEL_ON)
|
||||
lighting = autoset(lighting, CHANNEL_ON)
|
||||
environ = autoset(environ, CHANNEL_OFF_AUTO)
|
||||
GLOB.power_alarm.triggerAlarm(loc, src)
|
||||
autoflag = AUTOFLAG_ENVIRON_ON
|
||||
var/cell_charge = cell.maxcharge && ((cell.charge / cell.maxcharge) * 100.0)
|
||||
|
||||
if((cell_charge > 30 || longtermpower > 0))
|
||||
if(autoflag == AUTOFLAG_ALL_ON)
|
||||
return
|
||||
equipment = autoset(equipment, AUTOSET_ON)
|
||||
lighting = autoset(lighting, AUTOSET_ON)
|
||||
environ = autoset(environ, AUTOSET_ON)
|
||||
autoflag = AUTOFLAG_ALL_ON
|
||||
GLOB.power_alarm.clearAlarm(loc, src)
|
||||
else if(cell_charge > 15) // <30%, turn off equipment
|
||||
if(autoflag == AUTOFLAG_ENVIRON_LIGHTS_ON)
|
||||
return
|
||||
equipment = autoset(equipment, AUTOSET_OFF)
|
||||
lighting = autoset(lighting, AUTOSET_ON)
|
||||
environ = autoset(environ, AUTOSET_ON)
|
||||
GLOB.power_alarm.triggerAlarm(loc, src)
|
||||
autoflag = AUTOFLAG_ENVIRON_LIGHTS_ON
|
||||
else if(cell_charge <= 15) // <15%, turn off lighting & equipment
|
||||
if(autoflag == AUTOFLAG_ENVIRON_ON)
|
||||
return
|
||||
equipment = autoset(equipment, AUTOSET_OFF)
|
||||
lighting = autoset(lighting, AUTOSET_OFF)
|
||||
environ = autoset(environ, AUTOSET_ON)
|
||||
GLOB.power_alarm.triggerAlarm(loc, src)
|
||||
autoflag = AUTOFLAG_ENVIRON_ON
|
||||
else // zero charge, turn all off
|
||||
if(autoflag != AUTOFLAG_OFF)
|
||||
equipment = autoset(equipment, CHANNEL_OFF)
|
||||
lighting = autoset(lighting, CHANNEL_OFF)
|
||||
environ = autoset(environ, CHANNEL_OFF)
|
||||
GLOB.power_alarm.triggerAlarm(loc, src)
|
||||
autoflag = AUTOFLAG_OFF
|
||||
|
||||
/obj/machinery/power/apc/proc/autoset(var/val, var/on)
|
||||
if(on == CHANNEL_EQUIPMENT)
|
||||
if(val == CHANNEL_ON)
|
||||
return CHANNEL_OFF
|
||||
else if(val == CHANNEL_ON_AUTO)
|
||||
return CHANNEL_OFF_AUTO
|
||||
|
||||
else if(on == CHANNEL_LIGHTING)
|
||||
if(val == CHANNEL_OFF_AUTO)
|
||||
return CHANNEL_ON_AUTO
|
||||
|
||||
else if(on == CHANNEL_ENVIRONMENT)
|
||||
if(val == CHANNEL_ON_AUTO)
|
||||
return CHANNEL_OFF_AUTO
|
||||
|
||||
return val
|
||||
equipment = autoset(equipment, AUTOSET_FORCE_OFF)
|
||||
lighting = autoset(lighting, AUTOSET_FORCE_OFF)
|
||||
environ = autoset(environ, AUTOSET_FORCE_OFF)
|
||||
GLOB.power_alarm.triggerAlarm(loc, src)
|
||||
autoflag = AUTOFLAG_OFF
|
||||
|
||||
// damage and destruction acts
|
||||
/obj/machinery/power/apc/emp_act(severity)
|
||||
@@ -1328,9 +1351,9 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
if(cell)
|
||||
cell.emp_act(severity)
|
||||
|
||||
lighting = CHANNEL_OFF
|
||||
equipment = CHANNEL_OFF
|
||||
environ = CHANNEL_OFF
|
||||
lighting = 0
|
||||
equipment = 0
|
||||
environ = 0
|
||||
update()
|
||||
update_icon()
|
||||
|
||||
@@ -1339,7 +1362,7 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
/obj/machinery/power/apc/proc/post_emp_act()
|
||||
update_channels()
|
||||
update()
|
||||
queue_icon_update()
|
||||
SSicon_update.add_to_queue(src)
|
||||
|
||||
/obj/machinery/power/apc/ex_act(severity)
|
||||
switch(severity)
|
||||
@@ -1381,7 +1404,7 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
stat |= BROKEN
|
||||
operating = 0
|
||||
failure_timer = 0
|
||||
queue_icon_update()
|
||||
SSicon_update.add_to_queue(src)
|
||||
update()
|
||||
|
||||
// overload the lights in this APC area
|
||||
@@ -1425,14 +1448,6 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
night_mode = !night_mode
|
||||
intent_message(BUTTON_FLICK, 5)
|
||||
|
||||
/obj/machinery/power/apc/proc/setsubsystem(val)
|
||||
if(cell && cell.charge > 0)
|
||||
return (val == CHANNEL_OFF_AUTO) ? CHANNEL_OFF : val
|
||||
else if(val == CHANNEL_ON_AUTO)
|
||||
return CHANNEL_OFF_AUTO
|
||||
else
|
||||
return CHANNEL_OFF
|
||||
|
||||
// Malfunction: Transfers APC under AI's control
|
||||
/obj/machinery/power/apc/proc/ai_hack(var/mob/living/silicon/ai/A = null)
|
||||
if(!A || !A.hacked_apcs || hacker || aidisabled || A.stat == DEAD)
|
||||
@@ -1443,21 +1458,6 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/apc/proc/update_time()
|
||||
|
||||
var/delta_power = (lastused_charging * 2) - lastused_total
|
||||
delta_power *= CELLRATE
|
||||
|
||||
var/goal = (delta_power < 0) ? (cell.charge) : (cell.maxcharge - cell.charge)
|
||||
time = world.time + (delta_power ? ((goal / abs(delta_power)) * (world.time - last_time)) : 0)
|
||||
// If it is negative - we are discharging
|
||||
if(delta_power < 0)
|
||||
charge_mode = CHARGE_MODE_DISCHARGE
|
||||
else if(delta_power > 0)
|
||||
charge_mode = CHARGE_MODE_CHARGE
|
||||
else
|
||||
charge_mode = CHARGE_MODE_STABLE
|
||||
last_time = world.time
|
||||
|
||||
/obj/machinery/power/apc/proc/manage_emergency(var/new_security_level)
|
||||
for(var/obj/machinery/M in area)
|
||||
@@ -1618,9 +1618,9 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
// Construction site APC, starts turned off
|
||||
/obj/machinery/power/apc/high/inactive
|
||||
cell_type = /obj/item/cell/high
|
||||
lighting = CHANNEL_OFF
|
||||
equipment = CHANNEL_OFF
|
||||
environ = CHANNEL_OFF
|
||||
lighting = 0
|
||||
equipment = 0
|
||||
environ = 0
|
||||
locked = FALSE
|
||||
coverlocked = FALSE
|
||||
start_charge = 100
|
||||
@@ -1733,9 +1733,9 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
#undef CHARGING_ON
|
||||
#undef CHARGING_FULL
|
||||
#undef CHANNEL_OFF
|
||||
#undef CHANNEL_OFF_AUTO
|
||||
#undef CHANNEL_AUTO
|
||||
#undef CHANNEL_ON
|
||||
#undef CHANNEL_ON_AUTO
|
||||
#undef CHANNEL_AUTO_ON
|
||||
#undef CHANNEL_EQUIPMENT
|
||||
#undef CHANNEL_LIGHTING
|
||||
#undef CHANNEL_ENVIRONMENT
|
||||
@@ -1746,3 +1746,8 @@ ABSTRACT_TYPE(/obj/machinery/power/apc)
|
||||
#undef AUTOFLAG_ENVIRON_ON
|
||||
#undef AUTOFLAG_ENVIRON_LIGHTS_ON
|
||||
#undef AUTOFLAG_ALL_ON
|
||||
#undef autoset
|
||||
#undef APC_DELTA_POWER
|
||||
#undef APC_GOAL
|
||||
#undef APC_UPDATE_TIME
|
||||
#undef APC_CHARGE_MODE
|
||||
|
||||
@@ -156,7 +156,8 @@
|
||||
if(terminal)
|
||||
if(input_attempt)
|
||||
var/target_load = min((capacity-charge)/SMESRATE, input_level) // charge at set rate, limited to spare capacity
|
||||
var/actual_load = draw_power(target_load) // add the load to the terminal side network
|
||||
var/actual_load = POWER_DRAW(src, target_load) // add the load to the terminal side network
|
||||
DRAW_POWER(src, actual_load)
|
||||
charge += actual_load * SMESRATE // increase the charge
|
||||
|
||||
if (actual_load >= target_load) // did the powernet have enough power available for us?
|
||||
@@ -167,7 +168,7 @@
|
||||
if(output_attempt) // if outputting
|
||||
output_used = min( charge/SMESRATE, output_level) //limit output to that stored
|
||||
charge -= output_used*SMESRATE // reduce the storage (may be recovered in /restore() if excessive)
|
||||
add_avail(output_used) // add output to powernet (smes side)
|
||||
ADD_TO_POWERNET(src, output_used) // add output to powernet (smes side)
|
||||
if(charge < 0.0001)
|
||||
outputting(0) // stop output if charge falls to zero
|
||||
|
||||
|
||||
@@ -62,10 +62,9 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
if(drain_check)
|
||||
return TRUE
|
||||
|
||||
var/datum/powernet/PN = powernet
|
||||
if(!PN) return FALSE
|
||||
. = POWERNET_POWER_DRAW(powernet, amount)
|
||||
|
||||
return PN.draw_power(amount)
|
||||
DRAW_FROM_POWERNET(powernet, .)
|
||||
|
||||
/obj/structure/cable/yellow
|
||||
color = COLOR_YELLOW
|
||||
@@ -563,7 +562,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
to_chat(user, SPAN_NOTICE("You don't have enough coils for this!"))
|
||||
return
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
for(var/datum/wound/W in affecting.wounds)
|
||||
for(var/datum/wound/W as anything in affecting.wounds)
|
||||
if(W.bandaged)
|
||||
continue
|
||||
if(W.current_stage <= W.max_bleeding_stage)
|
||||
|
||||
@@ -226,7 +226,7 @@ GLOBAL_LIST_INIT_TYPED(rad_collectors, /obj/machinery/power/rad_collector, list(
|
||||
if(loaded_tank && active)
|
||||
var/power_produced = 0
|
||||
power_produced = min(100*loaded_tank.air_contents.gas[GAS_PHORON]*pulse_strength*pulse_coeff,max_power)
|
||||
add_avail(power_produced)
|
||||
ADD_TO_POWERNET(src, power_produced)
|
||||
last_power_new = power_produced
|
||||
return
|
||||
return
|
||||
|
||||
@@ -73,7 +73,8 @@
|
||||
toggle_active()
|
||||
return
|
||||
|
||||
var/actual_load = draw_power(active_power_usage)
|
||||
var/actual_load = POWER_DRAW(src, active_power_usage)
|
||||
DRAW_POWER(src, active_power_usage)
|
||||
if(actual_load < active_power_usage)
|
||||
toggle_active()
|
||||
return
|
||||
|
||||
@@ -26,4 +26,4 @@
|
||||
powernet_connection_failed = 1
|
||||
spawn(150) // Error! Check again in 15 seconds.
|
||||
powernet_connection_failed = 0
|
||||
add_avail(power_generation_rate)
|
||||
ADD_TO_POWERNET(src, power_generation_rate)
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
for(var/i = 1 to LAZYLEN(fusion_cores))
|
||||
var/list/core = list()
|
||||
var/obj/machinery/power/fusion_core/C = fusion_cores[i]
|
||||
var/power_available = C.avail()
|
||||
var/power_available = POWER_AVAIL(C)
|
||||
var/power_usage = C.active_power_usage
|
||||
var/power_generated = C.owned_field?.output_avg
|
||||
|
||||
|
||||
@@ -141,6 +141,6 @@
|
||||
connect_to_network()
|
||||
if(stat & BROKEN)
|
||||
return FALSE
|
||||
if(idle_power_usage > avail())
|
||||
if(idle_power_usage > POWER_AVAIL(src))
|
||||
return FALSE
|
||||
. = TRUE
|
||||
|
||||
@@ -221,7 +221,7 @@
|
||||
output_archive_2 = output_archive_1
|
||||
output_archive_1 = power_output
|
||||
output_avg = ((output_archive_1 + output_archive_2 + output_archive_3 + output_archive_4 + output_archive_5 ) / 5)
|
||||
owned_core.add_avail(power_output)
|
||||
ADD_TO_POWERNET(owned_core, power_output)
|
||||
|
||||
// Roundstart update
|
||||
if(field_strength < 20)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
return E
|
||||
|
||||
/obj/machinery/power/emitter/gyrotron/update_icon()
|
||||
if (active && powernet && avail(active_power_usage))
|
||||
if (active && powernet && POWER_AVAIL(src))
|
||||
icon_state = "emitter-on"
|
||||
else
|
||||
icon_state = "emitter-off"
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
if(genlev != lastgenlev)
|
||||
lastgenlev = genlev
|
||||
update_icon()
|
||||
add_avail(effective_gen)
|
||||
ADD_TO_POWERNET(src, effective_gen)
|
||||
|
||||
/obj/machinery/power/generator/attack_ai(mob/user)
|
||||
if(!ai_can_interact(user))
|
||||
@@ -210,9 +210,9 @@
|
||||
data["primaryDir"] = vertical ? "top" : "left"
|
||||
data["primaryOutput"] = last_circ1_gen/1000
|
||||
data["primaryFlowCapacity"] = circ1.volume_capacity_used*100
|
||||
data["primaryInletPressure"] = circ1.air1.return_pressure()
|
||||
data["primaryInletPressure"] = XGM_PRESSURE(circ1.air1)
|
||||
data["primaryInletTemperature"] = circ1.air1.temperature
|
||||
data["primaryOutletPressure"] = circ1.air2.return_pressure()
|
||||
data["primaryOutletPressure"] = XGM_PRESSURE(circ1.air2)
|
||||
data["primaryOutletTemperature"] = circ1.air2.temperature
|
||||
|
||||
if(circ2)
|
||||
@@ -220,9 +220,9 @@
|
||||
data["secondaryDir"] = vertical ? "bottom" : "right"
|
||||
data["secondaryOutput"] = last_circ2_gen/1000
|
||||
data["secondaryFlowCapacity"] = circ2.volume_capacity_used*100
|
||||
data["secondaryInletPressure"] = circ2.air1.return_pressure()
|
||||
data["secondaryInletPressure"] = XGM_PRESSURE(circ2.air1)
|
||||
data["secondaryInletTemperature"] = circ2.air1.temperature
|
||||
data["secondaryOutletPressure"] = circ2.air2.return_pressure()
|
||||
data["secondaryOutletPressure"] = XGM_PRESSURE(circ2.air2)
|
||||
data["secondaryOutletTemperature"] = circ2.air2.temperature
|
||||
|
||||
if(circ1 && circ2)
|
||||
|
||||
@@ -53,8 +53,7 @@
|
||||
/obj/machinery/power/portgen/process()
|
||||
if(active && HasFuel() && !IsBroken() && anchored)
|
||||
set_light(2, 1, l_color = portgen_lightcolour)
|
||||
if(powernet)
|
||||
add_avail(power_gen * power_output)
|
||||
ADD_TO_POWERNET(src, power_gen * power_output)
|
||||
UseFuel()
|
||||
else
|
||||
set_light(0)
|
||||
@@ -215,7 +214,7 @@
|
||||
if(!loc) return
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
if (environment)
|
||||
var/ratio = min(environment.return_pressure()/ONE_ATMOSPHERE, 1)
|
||||
var/ratio = min(XGM_PRESSURE(environment)/ONE_ATMOSPHERE, 1)
|
||||
var/ambient = environment.temperature - T20C
|
||||
lower_limit += ambient*ratio
|
||||
upper_limit += ambient*ratio
|
||||
@@ -247,7 +246,7 @@
|
||||
if(T)
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
if (environment)
|
||||
var/ratio = min(environment.return_pressure()/ONE_ATMOSPHERE, 1)
|
||||
var/ratio = min(XGM_PRESSURE(environment)/ONE_ATMOSPHERE, 1)
|
||||
var/ambient = environment.temperature - T20C
|
||||
cooling_temperature += ambient*ratio
|
||||
|
||||
|
||||
@@ -24,39 +24,6 @@
|
||||
///////////////////////////////
|
||||
// General procedures
|
||||
//////////////////////////////
|
||||
|
||||
// common helper procs for all power machines
|
||||
/obj/machinery/power/drain_power(var/drain_check, var/surge, var/amount = 0)
|
||||
if(drain_check)
|
||||
return 1
|
||||
|
||||
if(powernet && powernet.avail)
|
||||
powernet.trigger_warning()
|
||||
return powernet.draw_power(amount)
|
||||
|
||||
/obj/machinery/power/proc/add_avail(var/amount)
|
||||
if(powernet)
|
||||
powernet.newavail += amount
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/power/proc/draw_power(var/amount)
|
||||
if(powernet)
|
||||
return powernet.draw_power(amount)
|
||||
return 0
|
||||
|
||||
/obj/machinery/power/proc/surplus()
|
||||
if(powernet)
|
||||
return powernet.avail-powernet.load
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/machinery/power/proc/avail()
|
||||
if(powernet)
|
||||
return powernet.avail
|
||||
else
|
||||
return 0
|
||||
|
||||
// Proc: power_wattage_readable()
|
||||
// Parameters: 1 (amount - Power in Watts to be converted to W, kW or MW)
|
||||
// Description: Helper proc that converts reading in Watts to kW or MW (returns string version of amount parameter)
|
||||
@@ -370,7 +337,8 @@
|
||||
source_area.use_power_oneoff(drained_energy/CELLRATE)
|
||||
else if (istype(power_source,/datum/powernet))
|
||||
var/drained_power = drained_energy/CELLRATE
|
||||
drained_power = PN.draw_power(drained_power)
|
||||
drained_power = POWERNET_POWER_DRAW(PN, drained_power)
|
||||
DRAW_FROM_POWERNET(PN, drained_power)
|
||||
else if (istype(power_source, /obj/item/cell))
|
||||
cell.use(drained_energy)
|
||||
return drained_energy
|
||||
|
||||
@@ -39,11 +39,6 @@
|
||||
/datum/powernet/proc/last_surplus()
|
||||
return max(avail - load, 0)
|
||||
|
||||
/datum/powernet/proc/draw_power(var/amount)
|
||||
var/draw = between(0, amount, avail - load)
|
||||
load += draw
|
||||
return draw
|
||||
|
||||
/datum/powernet/proc/is_empty()
|
||||
return !cables.len && !nodes.len
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/power/radial_floodlight/process()
|
||||
var/actual_load = draw_power(active_power_usage)
|
||||
var/actual_load = POWER_DRAW(src, active_power_usage)
|
||||
DRAW_POWER(src, active_power_usage)
|
||||
if(!on || !anchored || (stat & BROKEN) || !powernet || actual_load < active_power_usage)
|
||||
STOP_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF)
|
||||
update_use_power(POWER_USE_OFF)
|
||||
@@ -56,7 +57,7 @@
|
||||
if(!powernet)
|
||||
to_chat(user, SPAN_WARNING("\The [src] isn't connected to a power network."))
|
||||
return
|
||||
if(avail() < active_power_usage)
|
||||
if(POWER_AVAIL(src) < active_power_usage)
|
||||
to_chat(user, SPAN_WARNING("\The [src]'s power network doesn't have enough power."))
|
||||
return
|
||||
toggle_active()
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
/obj/machinery/power/rtg/process()
|
||||
..()
|
||||
add_avail(power_gen)
|
||||
ADD_TO_POWERNET(src, power_gen)
|
||||
if(panel_open && irradiate)
|
||||
for (var/mob/living/L in range(2, src))
|
||||
L.apply_damage(10, DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED) // Weak but noticeable.
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
/obj/machinery/power/emitter/update_icon()
|
||||
ClearOverlays()
|
||||
if(active && powernet && avail(active_power_usage))
|
||||
if(active && powernet && POWER_AVAIL(src))
|
||||
AddOverlays(emissive_appearance(icon, "[icon_state]_lights"))
|
||||
AddOverlays("[icon_state]_lights")
|
||||
|
||||
@@ -149,7 +149,8 @@
|
||||
update_icon()
|
||||
return
|
||||
if(((last_shot + fire_delay) <= world.time) && active)
|
||||
var/actual_load = draw_power(active_power_usage)
|
||||
var/actual_load = POWER_DRAW(src, active_power_usage)
|
||||
DRAW_POWER(src, actual_load)
|
||||
if(actual_load >= active_power_usage) //does the laser have enough power to shoot?
|
||||
if(!powered)
|
||||
powered = TRUE
|
||||
|
||||
@@ -175,13 +175,6 @@
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/power/smes/add_avail(var/amount)
|
||||
if(..(amount))
|
||||
powernet.smes_newavail += amount
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/power/smes/disconnect_terminal()
|
||||
if(terminal)
|
||||
terminal.master = null
|
||||
@@ -236,7 +229,8 @@
|
||||
var/inputted_power = target_load * (percentage/100)
|
||||
inputted_power = between(0, inputted_power, target_load)
|
||||
if(terminal && terminal.powernet)
|
||||
inputted_power = terminal.powernet.draw_power(inputted_power)
|
||||
inputted_power = TERMINAL_POWER_DRAW(inputted_power)
|
||||
TERMINAL_DRAW_POWER(inputted_power)
|
||||
charge += inputted_power * SMESRATE
|
||||
input_taken = inputted_power
|
||||
if(percentage == 100)
|
||||
@@ -295,7 +289,7 @@
|
||||
if(output_attempt && (!output_pulsed && !output_cut) && powernet && charge)
|
||||
output_used = min( charge/SMESRATE, output_level) //limit output to that stored
|
||||
charge -= output_used*SMESRATE // reduce the storage (may be recovered in /restore() if excessive)
|
||||
add_avail(output_used) // add output to powernet (smes side)
|
||||
SMES_ADD_TO_POWERNET(src, output_used) // add output to powernet (smes side)
|
||||
outputting = 2
|
||||
else if(!powernet || !charge)
|
||||
outputting = 1
|
||||
@@ -358,12 +352,6 @@
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/power/smes/draw_power(var/amount)
|
||||
if(terminal && terminal.powernet)
|
||||
return terminal.powernet.draw_power(amount)
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/power/smes/attack_ai(mob/user)
|
||||
if(!ai_can_interact(user))
|
||||
return
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
if(obscured) //get no light from the sun, so don't generate power
|
||||
return
|
||||
var/sgen = SOLARGENRATE * sunfrac
|
||||
add_avail(sgen)
|
||||
ADD_TO_POWERNET(src, sgen)
|
||||
control.gen += sgen
|
||||
else //if we're no longer on the same powernet, remove from control computer
|
||||
unset_control()
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
//don't lose arc power when it's not connected to anything
|
||||
//please place tesla coils all around the station to maximize effectiveness
|
||||
var/power_produced = powernet ? power / power_loss : power
|
||||
add_avail(power_produced*input_power_multiplier)
|
||||
ADD_TO_POWERNET(src, power_produced*input_power_multiplier)
|
||||
flick("coilhit", src)
|
||||
playsound(src.loc, 'sound/magic/LightningShock.ogg', 100, 1, extrarange = 5)
|
||||
tesla_zap(src, 5, power_produced)
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
rpm = max(0, rpm - (rpm*rpm)/(COMPFRICTION*efficiency))
|
||||
|
||||
if(!(stat & NOPOWER))
|
||||
draw_power(2800)
|
||||
DRAW_POWER(src, 2800)
|
||||
if(rpm < 1000)
|
||||
rpmtarget = 1000
|
||||
else
|
||||
@@ -272,7 +272,7 @@
|
||||
else
|
||||
lastgen = ((compressor.rpm / TURBPOWER) ** TURBCURVESHAPE) * TURBPOWER * productivity * POWER_CURVE_MOD
|
||||
|
||||
add_avail(lastgen)
|
||||
ADD_TO_POWERNET(src, lastgen)
|
||||
|
||||
var/newrpm = (compressor.gas_contained.temperature * compressor.gas_contained.total_moles) / 4
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
return
|
||||
. += "The valve is dialed to <b>[pressure_setting]%</b>."
|
||||
if(tank)
|
||||
. += "The tank dial reads <b>[tank.air_contents.return_pressure()] kPa</b>."
|
||||
. += "The tank dial reads <b>[XGM_PRESSURE(tank.air_contents)] kPa</b>."
|
||||
else
|
||||
. += "Nothing is attached to the tank valve!"
|
||||
|
||||
@@ -101,9 +101,9 @@
|
||||
if(T)
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
if(environment)
|
||||
environment_pressure = environment.return_pressure()
|
||||
environment_pressure = XGM_PRESSURE(environment)
|
||||
|
||||
fire_pressure = (tank.air_contents.return_pressure() - environment_pressure)*pressure_setting/100
|
||||
fire_pressure = (XGM_PRESSURE(tank.air_contents) - environment_pressure)*pressure_setting/100
|
||||
if(fire_pressure < 10)
|
||||
to_chat(user, "There isn't enough gas in the tank to fire [src].")
|
||||
return null
|
||||
|
||||
@@ -402,7 +402,7 @@
|
||||
data["mode"] = mode
|
||||
data["uses_air"] = uses_air
|
||||
data["panel_open"] = panel_open
|
||||
data["pressure"] = CLAMP01(air_contents.return_pressure() / (SEND_PRESSURE))
|
||||
data["pressure"] = CLAMP01(XGM_PRESSURE(air_contents) / (SEND_PRESSURE))
|
||||
return data
|
||||
|
||||
/obj/machinery/disposal/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
@@ -507,13 +507,13 @@
|
||||
update()
|
||||
|
||||
// Validate whether we're pressurized or not.
|
||||
if(mode == MODE_PRESSURIZING && air_contents.return_pressure() >= SEND_PRESSURE)
|
||||
if(mode == MODE_PRESSURIZING && XGM_PRESSURE(air_contents) >= SEND_PRESSURE)
|
||||
mode = MODE_READY
|
||||
update()
|
||||
return
|
||||
|
||||
// If you turn this into a bare 'else' statement it just tries to pressurize infinitely and I don't know why.
|
||||
else if(mode == MODE_PRESSURIZING && air_contents.return_pressure() < SEND_PRESSURE)
|
||||
else if(mode == MODE_PRESSURIZING && XGM_PRESSURE(air_contents) < SEND_PRESSURE)
|
||||
src.pressurize()
|
||||
update()
|
||||
return
|
||||
@@ -541,7 +541,7 @@
|
||||
if (power_draw > 0)
|
||||
use_power_oneoff(power_draw)
|
||||
// If we've reached the target pressure, we're ready to flush
|
||||
if(air_contents.return_pressure() >= SEND_PRESSURE)
|
||||
if(XGM_PRESSURE(air_contents) >= SEND_PRESSURE)
|
||||
mode = MODE_READY
|
||||
|
||||
/**
|
||||
|
||||
@@ -123,7 +123,8 @@
|
||||
|
||||
if (PN)
|
||||
var/power_draw = between(0, max_charge - stored_charge, charge_rate) //what we are trying to draw
|
||||
power_draw = PN.draw_power(power_draw) //what we actually get
|
||||
power_draw = POWERNET_POWER_DRAW(PN, power_draw) //what we actually get
|
||||
DRAW_FROM_POWERNET(PN, power_draw)
|
||||
stored_charge += power_draw
|
||||
|
||||
time_since_fail++
|
||||
|
||||
@@ -85,7 +85,8 @@
|
||||
return FALSE
|
||||
|
||||
var/shieldload = between(500, max_stored_power - storedpower, (power_draw*seconds_per_tick)) //what we try to draw
|
||||
shieldload = PN.draw_power(shieldload) //what we actually get
|
||||
shieldload = POWERNET_POWER_DRAW(PN, shieldload) //what we actually get
|
||||
DRAW_FROM_POWERNET(PN, shieldload)
|
||||
storedpower += shieldload
|
||||
|
||||
//If we're still in the red, then there must not be enough available power to cover our load.
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
user.visible_message(SPAN_NOTICE("\The [user] rests a hand on \the [target]'s [E.name]."))
|
||||
to_chat(target, SPAN_NOTICE("A healing warmth suffuses you."))
|
||||
|
||||
for(var/datum/wound/W in E.wounds)
|
||||
for(var/datum/wound/W as anything in E.wounds)
|
||||
if(W.bleeding())
|
||||
to_chat(user, SPAN_NOTICE("You knit together severed veins and broken flesh, stemming the bleeding."))
|
||||
W.bleed_timer = 0
|
||||
|
||||
@@ -385,7 +385,7 @@
|
||||
if(loc && !istype(loc, /turf/space))
|
||||
env = src.loc.return_air()
|
||||
data["ambient_temp"] = round(env?.temperature)
|
||||
data["ambient_pressure"] = round(env?.return_pressure())
|
||||
data["ambient_pressure"] = round(SAFE_XGM_PRESSURE(env))
|
||||
data["detonating"] = grav_pulling
|
||||
return data
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ GLOBAL_LIST_INIT(can_enter_vent_with, list(
|
||||
if(BODYTEMP_HEAT_DAMAGE_LIMIT to INFINITY)
|
||||
to_chat(src, SPAN_DANGER("You feel a searing heat coming from the vent!"))
|
||||
|
||||
switch(vent_found.air_contents.return_pressure())
|
||||
switch(XGM_PRESSURE(vent_found.air_contents))
|
||||
if(0 to HAZARD_LOW_PRESSURE)
|
||||
to_chat(src, SPAN_DANGER("You feel a rushing draw pulling you into the vent!"))
|
||||
if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/obj/abstract/weather_system/proc/get_movement_delay(var/datum/gas_mixture/env, var/travel_dir)
|
||||
|
||||
// It's quiet. Too quiet.
|
||||
if(!wind_direction || !base_wind_delay || !travel_dir || !env || env.return_pressure() < MIN_WIND_PRESSURE)
|
||||
if(!wind_direction || !base_wind_delay || !travel_dir || !env || XGM_PRESSURE(env) < MIN_WIND_PRESSURE)
|
||||
return 0
|
||||
|
||||
// May the wind be always at your back!
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
var/turf/T = get_turf(M)
|
||||
if(istype(T))
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
if(environment && environment.return_pressure() >= MIN_WIND_PRESSURE) // Arbitrary low pressure bound.
|
||||
if(SAFE_XGM_PRESSURE(environment) >= MIN_WIND_PRESSURE) // Arbitrary low pressure bound.
|
||||
var/absolute_strength = abs(wind_strength)
|
||||
if(absolute_strength <= 0.5 || !wind_direction)
|
||||
to_chat(M, SPAN_NOTICE("The wind is calm."))
|
||||
|
||||
@@ -216,14 +216,6 @@
|
||||
else
|
||||
total_moles += gas[g]
|
||||
|
||||
|
||||
///Returns the pressure of the gas mix. Only accurate if there have been no gas modifications since update_values() has been called.
|
||||
/datum/gas_mixture/proc/return_pressure()
|
||||
if(volume)
|
||||
return total_moles * R_IDEAL_GAS_EQUATION * temperature / volume
|
||||
return 0
|
||||
|
||||
|
||||
///Removes moles from the gas mixture and returns a gas_mixture containing the removed air.
|
||||
/datum/gas_mixture/proc/remove(amount)
|
||||
amount = min(amount, total_moles * group_multiplier) //Can not take more air than the gas mixture has!
|
||||
@@ -332,7 +324,7 @@
|
||||
return 0
|
||||
marked[g] = 1
|
||||
|
||||
if(abs(return_pressure() - sample.return_pressure()) > MINIMUM_PRESSURE_DIFFERENCE_TO_SUSPEND)
|
||||
if(abs(XGM_PRESSURE(src) - XGM_PRESSURE(sample)) > MINIMUM_PRESSURE_DIFFERENCE_TO_SUSPEND)
|
||||
return 0
|
||||
|
||||
for(var/g in sample.gas)
|
||||
@@ -350,11 +342,6 @@
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
/datum/gas_mixture/proc/react()
|
||||
zburn(null, force_burn=0, no_check=0) //could probably just call zburn() here with no args but I like being explicit.
|
||||
|
||||
|
||||
//Rechecks the gas_mixture and adjusts the graphic list if needed.
|
||||
//Two lists can be passed by reference if you need know specifically which graphics were added and removed.
|
||||
/datum/gas_mixture/proc/check_tile_graphic(list/graphic_add = null, list/graphic_remove = null)
|
||||
@@ -381,8 +368,10 @@
|
||||
else if (heat_overlay in graphic)
|
||||
LAZYADD(graphic_remove, heat_overlay)
|
||||
|
||||
var/pressure = XGM_PRESSURE(src)
|
||||
|
||||
var/cold_overlay = get_tile_overlay(GAS_COLD)
|
||||
if(temperature <= FOGGING_TEMPERATURE && (return_pressure() >= (ONE_ATMOSPHERE / 4)))
|
||||
if(temperature <= FOGGING_TEMPERATURE && (pressure >= (ONE_ATMOSPHERE / 4)))
|
||||
if(!(cold_overlay in graphic))
|
||||
LAZYADD(graphic_add, cold_overlay)
|
||||
else if (cold_overlay in graphic)
|
||||
@@ -396,7 +385,7 @@
|
||||
graphic -= graphic_remove
|
||||
. = 1
|
||||
if(length(graphic))
|
||||
var/pressure_mod = clamp(return_pressure() / ONE_ATMOSPHERE, 0, 2)
|
||||
var/pressure_mod = clamp(pressure / ONE_ATMOSPHERE, 0, 2)
|
||||
for(var/obj/gas_overlay/O in graphic)
|
||||
if(istype(O, /obj/gas_overlay/heat)) //Heat based
|
||||
var/new_alpha = clamp(max(125, 255 * ((temperature - CARBON_LIFEFORM_FIRE_RESISTANCE) / CARBON_LIFEFORM_FIRE_RESISTANCE * 4)), 125, 255)
|
||||
|
||||
Reference in New Issue
Block a user