Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Adds mapping helper for virology / toxins cycling airlocks #505

Merged
merged 7 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
825 changes: 496 additions & 329 deletions _maps/map_files/LimaStation/LimaStation.dmm

Large diffs are not rendered by default.

534 changes: 248 additions & 286 deletions _maps/map_files/PubbyStation/PubbyStation.dmm

Large diffs are not rendered by default.

74 changes: 59 additions & 15 deletions code/game/machinery/airlock_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/// Forces the airlock to unbolt and open
/obj/machinery/door/airlock/proc/secure_open()
set waitfor = FALSE
locked = FALSE
update_appearance()

Expand All @@ -19,6 +20,8 @@

/// Forces the airlock to close and bolt
/obj/machinery/door/airlock/proc/secure_close()
set waitfor = FALSE

locked = FALSE
close(forced = TRUE)

Expand All @@ -36,13 +39,13 @@
icon_state = "airlock_sensor_off"
base_icon_state = "airlock_sensor"
name = "airlock sensor"
desc = "A small sensor that monitors the atmosphere in the airlock."
resistance_flags = FIRE_PROOF

power_channel = AREA_USAGE_ENVIRON

/// What controller are we linked to?
var/master_tag

var/on = TRUE
/// Whether the detective atmosphere is currently dangerous
var/alert = FALSE

/obj/machinery/airlock_sensor/incinerator_ordmix
Expand All @@ -58,7 +61,7 @@
master_tag = INCINERATOR_SYNDICATELAVA_AIRLOCK_CONTROLLER

/obj/machinery/airlock_sensor/update_icon_state()
if(!on)
if(!is_operational)
icon_state = "[base_icon_state]_off"
else
if(alert)
Expand All @@ -67,20 +70,61 @@
icon_state = "[base_icon_state]_standby"
return ..()

/obj/machinery/airlock_sensor/attack_hand(mob/user, list/modifiers)
/obj/machinery/airlock_sensor/Initialize(mapload)
. = ..()
SSair.start_processing_machine(src)

/obj/machinery/airlock_sensor/Destroy()
SSair.stop_processing_machine(src)
return..()

/obj/machinery/airlock_sensor/interact(mob/user, special_state)
. = ..()
if(.)
return

var/obj/machinery/airlock_controller/airlock_controller = GLOB.objects_by_id_tag[master_tag]
airlock_controller?.cycle()
airlock_controller?.try_cycle(user)
flick("[base_icon_state]_cycle", src)

flick("airlock_sensor_cycle", src)
/obj/machinery/airlock_sensor/process_atmos()
if(!is_operational)
return

/obj/machinery/airlock_sensor/process()
if(on)
var/datum/gas_mixture/air_sample = return_air()
var/pressure = round(air_sample.return_pressure(),0.1)
alert = (pressure < ONE_ATMOSPHERE*0.8)
monitor_atmos(return_air())

update_appearance()
/obj/machinery/airlock_sensor/proc/monitor_atmos(datum/gas_mixture/air_sample)
var/old_alert = alert
alert = isnull(air_sample) || (air_sample.return_pressure() < WARNING_LOW_PRESSURE) || (air_sample.return_temperature() < BODYTEMP_COLD_WARNING_3)
if(alert != old_alert)
update_appearance()

/obj/machinery/airlock_sensor/heater
name = "airlock sensor and regulator"
desc = "A small sensor with an integrated heater/cooler that monitors and regulates the atmosphere in an airlock system."

/// What temp do we trend to, does nothing if null
var/target_temperature

/obj/machinery/airlock_sensor/heater/monitor_atmos(datum/gas_mixture/air_sample)
. = ..()
if(!isturf(loc) || isnull(target_temperature) || isnull(air_sample))
return

var/curr_temperature = air_sample.return_temperature()
var/heat_capacity = air_sample.heat_capacity()
var/required_energy = min(abs(curr_temperature - target_temperature) * heat_capacity, 40000)

if(required_energy < 1)
return

var/delta_temperature = required_energy / heat_capacity
if(curr_temperature > target_temperature + 1)
delta_temperature *= -1
if(delta_temperature == 0)
return

var/turf/local_turf = loc
for (var/turf/open/turf in ((local_turf.atmos_adjacent_turfs || list()) + local_turf))
var/datum/gas_mixture/turf_gasmix = turf.return_air()
turf_gasmix.temperature += delta_temperature
air_update_turf(FALSE, FALSE)
use_power(required_energy * 0.01) // melbert todo - keep an eye on this with the nergy rework
27 changes: 10 additions & 17 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@
var/aiHacking = FALSE
/// Cyclelinking for airlocks that aren't on the same x or y coord as the target.
var/closeOtherId
var/obj/machinery/door/airlock/closeOther
var/list/obj/machinery/door/airlock/close_others = list()
var/list/obj/machinery/door/airlock/close_others
var/obj/item/electronics/airlock/electronics
COOLDOWN_DECLARE(shockCooldown)
/// Any papers pinned to the airlock
Expand Down Expand Up @@ -200,10 +199,8 @@
/obj/machinery/door/airlock/proc/update_other_id()
for(var/obj/machinery/door/airlock/Airlock as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/airlock))
if(Airlock.closeOtherId == closeOtherId && Airlock != src)
if(!(Airlock in close_others))
close_others += Airlock
if(!(src in Airlock.close_others))
Airlock.close_others += src
LAZYOR(close_others, Airlock)
LAZYOR(Airlock.close_others, src)

/obj/machinery/door/airlock/proc/cyclelinkairlock()
if (cyclelinkedairlock)
Expand Down Expand Up @@ -295,7 +292,7 @@
closeOtherId = null
for(var/obj/machinery/door/airlock/otherlock as anything in close_others)
otherlock.close_others -= src
close_others.Cut()
LAZYNULL(close_others)
if(id_tag)
for(var/obj/machinery/door_buttons/D as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door_buttons))
D.removeMe(src)
Expand Down Expand Up @@ -1209,16 +1206,12 @@
if(autoclose)
autoclose_in(normalspeed ? 8 SECONDS : 1.5 SECONDS)

if(closeOther != null && istype(closeOther, /obj/machinery/door/airlock))
addtimer(CALLBACK(closeOther, PROC_REF(close)), BYPASS_DOOR_CHECKS)

if(close_others)
for(var/obj/machinery/door/airlock/otherlock as anything in close_others)
if(!shuttledocked && !emergency && !otherlock.shuttledocked && !otherlock.emergency)
if(otherlock.operating)
otherlock.delayed_close_requested = TRUE
else
addtimer(CALLBACK(otherlock, PROC_REF(close)), BYPASS_DOOR_CHECKS)
for(var/obj/machinery/door/airlock/otherlock as anything in close_others)
if(!shuttledocked && !emergency && !otherlock.shuttledocked && !otherlock.emergency)
if(otherlock.operating)
otherlock.delayed_close_requested = TRUE
else
addtimer(CALLBACK(otherlock, PROC_REF(close)), BYPASS_DOOR_CHECKS)

if(cyclelinkedairlock)
if(!shuttledocked && !emergency && !cyclelinkedairlock.shuttledocked && !cyclelinkedairlock.emergency)
Expand Down
Loading
Loading