The Cycling 2.0, Airlocks can now be built in game to cycle and named (#61226)

You can now edit an airlock control board (both physically and through an RCD) to set the airlock name and what ID it cycles on
Airlocks now say what ID it cycles on when examined
when an airlock is made it takes its circuits set name and ID and updates the cycling
i redid how the cycle_id is updated on creation, so now when an airlock is made and grabbing airlocks with an identical ID to cycle it checks if the other airlocks with that ID needs a reference to the new airlock, and if so, it adds it, so you can add doors back to a cycle system if it breaks
NOTE: unfortunately the way linear airlocks, like the small 2 door airlocks to space, set their links, you cannot repair their cycle this way, you will have to deconstruct the remaining door and rebuild both to cycle again
This commit is contained in:
小月猫
2021-09-06 09:59:16 +01:00
committed by GitHub
parent e072a89d6b
commit 605a3a660c
5 changed files with 55 additions and 2 deletions
+8 -1
View File
@@ -214,7 +214,10 @@
/obj/machinery/door/airlock/proc/update_other_id()
for(var/obj/machinery/door/airlock/Airlock in GLOB.airlocks)
if(Airlock.closeOtherId == closeOtherId && Airlock != src)
close_others += Airlock
if(!(Airlock in close_others))
close_others += Airlock
if(!(src in Airlock.close_others))
Airlock.close_others += src
/obj/machinery/door/airlock/proc/cyclelinkairlock()
if (cyclelinkedairlock)
@@ -595,6 +598,10 @@
/obj/machinery/door/airlock/examine(mob/user)
. = ..()
if(closeOtherId)
. += span_warning("This airlock cycles on ID: [sanitize(closeOtherId)].")
else if(!closeOtherId)
. += span_warning("This airlock does not cycle.")
if(obj_flags & EMAGGED)
. += span_warning("Its access panel is smoking slightly.")
if(note)
@@ -7,6 +7,10 @@
var/one_access = 0
/// Unrestricted sides, or sides of the airlock that will open regardless of access
var/unres_sides = 0
///what name are we passing to the finished airlock
var/passed_name
///what string are we passing to the finished airlock as the cycle ID
var/passed_cycle_id
/// A holder of the electronics, in case of them working as an integrated part
var/holder
@@ -39,6 +43,8 @@
data["accesses"] = accesses
data["oneAccess"] = one_access
data["unres_direction"] = unres_sides
data["passedName"] = passed_name
data["passedCycleId"] = passed_cycle_id
return data
/obj/item/electronics/airlock/ui_act(action, params)
@@ -80,6 +86,14 @@
return
accesses -= SSid_access.get_region_access_list(list(region))
. = TRUE
if("passedName")
var/new_name = trim("[params["passedName"]]", 30)
passed_name = new_name
. = TRUE
if("passedCycleId")
var/new_cycle_id = trim(params["passedCycleId"], 30)
passed_cycle_id = new_cycle_id
. = TRUE
/obj/item/electronics/airlock/ui_host()
if(holder)
@@ -259,8 +259,13 @@
door.req_access = electronics.accesses
if(created_name)
door.name = created_name
else if(electronics.passed_name)
door.name = sanitize(electronics.passed_name)
else
door.name = base_name
if(electronics.passed_cycle_id)
door.closeOtherId = electronics.passed_cycle_id
door.update_other_id()
door.previous_airlock = previous_assembly
electronics.forceMove(door)
door.update_appearance()
+7
View File
@@ -298,12 +298,19 @@
new_airlock.electronics.accesses = the_rcd.airlock_electronics.accesses.Copy()
new_airlock.electronics.one_access = the_rcd.airlock_electronics.one_access
new_airlock.electronics.unres_sides = the_rcd.airlock_electronics.unres_sides
new_airlock.electronics.passed_name = the_rcd.airlock_electronics.passed_name
new_airlock.electronics.passed_cycle_id = the_rcd.airlock_electronics.passed_cycle_id
if(new_airlock.electronics.one_access)
new_airlock.req_one_access = new_airlock.electronics.accesses
else
new_airlock.req_access = new_airlock.electronics.accesses
if(new_airlock.electronics.unres_sides)
new_airlock.unres_sides = new_airlock.electronics.unres_sides
if(new_airlock.electronics.passed_name)
new_airlock.name = sanitize(new_airlock.electronics.passed_name)
if(new_airlock.electronics.passed_cycle_id)
new_airlock.closeOtherId = new_airlock.electronics.passed_cycle_id
new_airlock.update_other_id()
new_airlock.autoclose = TRUE
new_airlock.update_appearance()
return TRUE
@@ -1,5 +1,5 @@
import { useBackend, useLocalState } from '../backend';
import { Button, Flex, Grid, LabeledList, Section, Tabs } from '../components';
import { Button, Flex, Grid, Input, LabeledList, Section, Tabs } from '../components';
import { Window } from '../layouts';
import { sortBy } from 'common/collections';
@@ -8,6 +8,8 @@ export const AirlockElectronics = (props, context) => {
const {
oneAccess,
unres_direction,
passedName,
passedCycleId,
} = data;
const regions = data.regions || [];
const accesses = data.accesses || [];
@@ -56,6 +58,24 @@ export const AirlockElectronics = (props, context) => {
unres_direction: '8',
})} />
</LabeledList.Item>
<LabeledList.Item
label="Airlock Name">
<Input fluid
maxLength={30}
value={passedName}
onChange={(e, value) => act('passedName', {
passedName: value,
})} />
</LabeledList.Item>
<LabeledList.Item
label="Cycling Id">
<Input fluid
maxLength={30}
value={passedCycleId}
onChange={(e, value) => act('passedCycleId', {
passedCycleId: value,
})} />
</LabeledList.Item>
</LabeledList>
</Section>
<AirlockAccessList