mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
[MIRROR] Air Sensor are Craftable, Removed from RPD UI, Have New Linking System [MDB IGNORE] (#21964)
* Air Sensor are Craftable, Removed from RPD UI, Have New Linking System (#75869) ## About The Pull Request **1. Craftable & Removed from RPD UI** 1. Air sensor's are now craftable 2. You can turn them on/off with hand. Even though turning off the sensor will change it to a diffrent type[from `obj/machinery/air_sensor` -> `obj/item/air_sensor`] it's I/O port's are sill preserved when turning them on although you have to assign it a new name again which is usefull if you want to change the sensor's purpose in game. 3. They can now only be deconstructed by a welding tool and should be wrenched in place to turn them on. 4. Turned off air sensor's once unwrenched can be picked up like any regular item 5. Air sensor's are removed from the RPD UI because they don't go with pipes so it logically doesn't make sense to group them with pipe related device's Removed unused code in the process https://github.com/tgstation/tgstation/assets/110812394/3439a0f3-9c48-43ac-8f4b-98135435ec13 **2. New ID System** The problem with air sensor's is that each sensor is assigned a unique ID which is then stored in `GLOB.objects_by_id_tag` list. Each sensor name it's assigned based on the gas it's trying to sense(for naming only even though it can detect other gases) So if 2 sensor's having the same ID are made they will overwrite each other in this list leaving one sensor orphaned in the world which cannot be referenced because it's value was overwritten by a new sensor having the same ID in this list. The Solution? Rather than having all atmos computer's look up sensor's from this 1 global list make each computer keep track of all sensor's it's responsible for in it's own local list[which i called `connected_sensor's`] this way 2 sensor's can have randomly generated names in the global `GLOB.objects_by_id_tag` list but the computer will know what sensor to look up in this list based on the stored sensor ID's in the `connected_sensor's` list Basically what i am getting at is now you can make as many air sensor's as you wish but you will know have to connect that sensor to the computer using a multitool. Notice in the video how i made 2 sensor's called `Supermatter Chamber Sensor's`] and every time you try to connect an sensor which has the same name[`Supermatter Chamber Sensor's` in this case] they will ovewrite the old sensor in it's list as shown in the video https://github.com/tgstation/tgstation/assets/110812394/b5283c3b-c8a1-4b94-a6a8-8ba7a0007615 **Why it's good for the game**  I agree. Also air sensor's taking up a full Tab/Section in the RPD UI wasted a lot of UI space so that's removed now. Also making the air sensor's wrenchable and pickable item's was also requested in https://github.com/tgstation/tgstation/pull/72019#issuecomment-1355499873 so you relate them to device's like meter's Another huge issue was that the number of air sensor's you can make in the world was limited because each sensor in the world must have a unique ID but that's finally fixed now so yeah make as many sensor's as you want. ## Changelog 🆑 add: air sensor's are craftable refactor: air sensor's can now be turned off by hand and can only be deconstructed by a welding tool refactor: removed `Params()` proc qol: unwrenched air sensors can be picked up & recycled like regular item's del: air sensor are removed from the RPD UI qol: air sensor's are no longer restricted by their unique ID's which mean you can craft as many air sensors as you want. /🆑 --------- Co-authored-by: Time-Green <timkoster1@ hotmail.com> * Air Sensor are Craftable, Removed from RPD UI, Have New Linking System --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: Time-Green <timkoster1@ hotmail.com>
This commit is contained in:
co-authored by
Time-Green
SyncIt21
parent
42dbfeae69
commit
1beff3980c
@@ -29,6 +29,15 @@
|
||||
time = 2 SECONDS
|
||||
category = CAT_ATMOSPHERIC
|
||||
|
||||
/datum/crafting_recipe/air_sensor
|
||||
name = "Monitored Air Sensor"
|
||||
result = /obj/item/air_sensor
|
||||
reqs = list(
|
||||
/obj/item/analyzer = 1,
|
||||
/obj/item/stack/sheet/iron = 1,
|
||||
)
|
||||
blacklist = list(/obj/item/analyzer/ranged)
|
||||
|
||||
/datum/crafting_recipe/pipe/on_craft_completion(mob/user, atom/result)
|
||||
var/obj/item/pipe/crafted_pipe = result
|
||||
crafted_pipe.pipe_type = /obj/machinery/atmospherics/pipe/smart
|
||||
|
||||
@@ -32,13 +32,14 @@
|
||||
#define ATMOS_GAS_MONITOR_WASTE "waste"
|
||||
#define ATMOS_GAS_MONITOR_ENGINE "engine"
|
||||
|
||||
///maps a chamber id to its air sensor
|
||||
#define CHAMBER_SENSOR_FROM_ID(chamber_id) ((chamber_id) + "_sensor")
|
||||
///maps an air sensor's chamber id to its input valve[ i.e. outlet_injector] id
|
||||
#define CHAMBER_INPUT_FROM_ID(chamber_id) ((chamber_id) + "_in")
|
||||
///maps an air sensor's chamber id to its output valve[i.e. vent pump] id
|
||||
#define CHAMBER_OUTPUT_FROM_ID(chamber_id) ((chamber_id) + "_out")
|
||||
|
||||
///list of all air sensor's created round start
|
||||
GLOBAL_LIST_EMPTY(map_loaded_sensors)
|
||||
|
||||
// Human-readble names of these funny tags.
|
||||
GLOBAL_LIST_INIT(station_gas_chambers, list(
|
||||
ATMOS_GAS_MONITOR_O2 = "Oxygen Supply",
|
||||
|
||||
@@ -5,14 +5,26 @@
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "gsensor1"
|
||||
resistance_flags = FIRE_PROOF
|
||||
|
||||
power_channel = AREA_USAGE_ENVIRON
|
||||
active_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 1.5
|
||||
var/on = TRUE
|
||||
|
||||
/// The unique string that represents which atmos chamber to associate with.
|
||||
var/chamber_id
|
||||
/// The inlet[injector] controlled by this sensor
|
||||
var/inlet_id
|
||||
/// The outlet[vent pump] controlled by this sensor
|
||||
var/outlet_id
|
||||
|
||||
/obj/machinery/air_sensor/Initialize(mapload)
|
||||
id_tag = CHAMBER_SENSOR_FROM_ID(chamber_id)
|
||||
id_tag = assign_random_name()
|
||||
|
||||
//this global list of air sensors is available to all station monitering consoles round start and to new consoles made during the round
|
||||
if(mapload)
|
||||
GLOB.map_loaded_sensors[chamber_id] = id_tag
|
||||
inlet_id = CHAMBER_INPUT_FROM_ID(chamber_id)
|
||||
outlet_id = CHAMBER_OUTPUT_FROM_ID(chamber_id)
|
||||
|
||||
var/static/list/multitool_tips = list(
|
||||
TOOL_MULTITOOL = list(
|
||||
SCREENTIP_CONTEXT_LMB = "Link logged injectors/vents",
|
||||
@@ -27,21 +39,45 @@
|
||||
reset()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/air_sensor/return_air()
|
||||
if(!on)
|
||||
return
|
||||
. = ..()
|
||||
use_power(active_power_usage) //use power for analyzing gases
|
||||
|
||||
/obj/machinery/air_sensor/process()
|
||||
//update appearance according to power state
|
||||
if(machine_stat & NOPOWER)
|
||||
if(on)
|
||||
on = FALSE
|
||||
update_appearance()
|
||||
else if(!on)
|
||||
on = TRUE
|
||||
update_appearance()
|
||||
|
||||
/obj/machinery/air_sensor/examine(mob/user)
|
||||
. = ..()
|
||||
. += span_notice("Use multitool to link it to an injector/vent or reset it's ports")
|
||||
. += span_notice("Click with hand to turn it off.")
|
||||
|
||||
/obj/machinery/air_sensor/attack_hand(mob/living/user, list/modifiers)
|
||||
. = ..()
|
||||
|
||||
//switched off version of this air sensor but still anchored to the ground
|
||||
var/obj/item/air_sensor/sensor = new(drop_location(), inlet_id, outlet_id)
|
||||
sensor.set_anchored(TRUE)
|
||||
sensor.balloon_alert(user, "sensor turned off")
|
||||
|
||||
//delete self
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/air_sensor/update_icon_state()
|
||||
icon_state = "gsensor[on]"
|
||||
return ..()
|
||||
|
||||
/obj/machinery/air_sensor/proc/reset()
|
||||
var/input_id = CHAMBER_INPUT_FROM_ID(chamber_id)
|
||||
if(GLOB.objects_by_id_tag[input_id] != null)
|
||||
var/obj/machinery/atmospherics/components/unary/outlet_injector/injector = GLOB.objects_by_id_tag[input_id]
|
||||
injector.disconnect_chamber()
|
||||
|
||||
var/output_id = CHAMBER_OUTPUT_FROM_ID(chamber_id)
|
||||
if(GLOB.objects_by_id_tag[output_id] != null)
|
||||
var/obj/machinery/atmospherics/components/unary/vent_pump/pump = GLOB.objects_by_id_tag[output_id]
|
||||
pump.disconnect_chamber()
|
||||
|
||||
inlet_id = null
|
||||
outlet_id = null
|
||||
|
||||
///right click with multi tool to disconnect everything
|
||||
/obj/machinery/air_sensor/multitool_act_secondary(mob/living/user, obj/item/tool)
|
||||
@@ -50,16 +86,14 @@
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/air_sensor/multitool_act(mob/living/user, obj/item/multitool/multi_tool)
|
||||
.= ..()
|
||||
|
||||
if (!istype(multi_tool))
|
||||
return .
|
||||
. = ..()
|
||||
|
||||
if(istype(multi_tool.buffer, /obj/machinery/atmospherics/components/unary/outlet_injector))
|
||||
var/obj/machinery/atmospherics/components/unary/outlet_injector/input = multi_tool.buffer
|
||||
input.chamber_id = chamber_id
|
||||
GLOB.objects_by_id_tag[CHAMBER_INPUT_FROM_ID(chamber_id)] = input
|
||||
inlet_id = input.id_tag
|
||||
multi_tool.buffer = null
|
||||
balloon_alert(user, "connected to input")
|
||||
|
||||
else if(istype(multi_tool.buffer, /obj/machinery/atmospherics/components/unary/vent_pump))
|
||||
var/obj/machinery/atmospherics/components/unary/vent_pump/output = multi_tool.buffer
|
||||
//so its no longer controlled by air alarm
|
||||
@@ -69,11 +103,127 @@
|
||||
output.pressure_checks = ATMOS_INTERNAL_BOUND
|
||||
output.internal_pressure_bound = 4000
|
||||
output.external_pressure_bound = 0
|
||||
output.chamber_id = chamber_id
|
||||
GLOB.objects_by_id_tag[CHAMBER_OUTPUT_FROM_ID(chamber_id)] = output
|
||||
//finally assign it to this sensor
|
||||
outlet_id = output.id_tag
|
||||
multi_tool.buffer = null
|
||||
balloon_alert(user, "connected to output")
|
||||
|
||||
else
|
||||
multi_tool.buffer = src
|
||||
balloon_alert(user, "added to multitool buffer")
|
||||
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* A portable version of the /obj/machinery/air_sensor
|
||||
* Wrenching it & turning it on will convert it back to /obj/machinery/air_sensor
|
||||
* Unwelding /obj/machinery/air_sensor will turn it back to /obj/item/air_sensor
|
||||
* The logic is same as meters
|
||||
*/
|
||||
/obj/item/air_sensor
|
||||
name = "Air Sensor"
|
||||
desc = "A device designed to detect gases and their concentration in an area."
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "gsensor0"
|
||||
custom_materials = list(/datum/material/iron = SMALL_MATERIAL_AMOUNT, /datum/material/glass = SMALL_MATERIAL_AMOUNT)
|
||||
/// The injector linked with this sensor
|
||||
var/input_id
|
||||
/// The vent pump linked with this sensor
|
||||
var/output_id
|
||||
|
||||
/obj/item/air_sensor/Initialize(mapload, inlet, outlet)
|
||||
. = ..()
|
||||
register_context()
|
||||
input_id = inlet
|
||||
output_id = outlet
|
||||
|
||||
/obj/item/air_sensor/add_context(atom/source, list/context, obj/item/held_item, mob/user)
|
||||
if(isnull(held_item))
|
||||
return NONE
|
||||
|
||||
if(held_item.tool_behaviour == TOOL_WRENCH)
|
||||
context[SCREENTIP_CONTEXT_LMB] = anchored ? "Unwrench" : "Wrench"
|
||||
return CONTEXTUAL_SCREENTIP_SET
|
||||
|
||||
if(held_item.tool_behaviour == TOOL_WELDER && !anchored)
|
||||
context[SCREENTIP_CONTEXT_LMB] = "Dismantle"
|
||||
return CONTEXTUAL_SCREENTIP_SET
|
||||
|
||||
return NONE
|
||||
|
||||
/obj/item/air_sensor/examine(mob/user)
|
||||
. = ..()
|
||||
if(anchored)
|
||||
. += span_notice("It's [EXAMINE_HINT("wrenched")] in place")
|
||||
else
|
||||
. += span_notice("It should be [EXAMINE_HINT("wrenched")] in place to turn it on.")
|
||||
. += span_notice("It could be [EXAMINE_HINT("welded")] apart.")
|
||||
. += span_notice("Click with hand to turn it on.")
|
||||
|
||||
/obj/item/air_sensor/attack_hand(mob/user, list/modifiers)
|
||||
. = ..()
|
||||
if(!anchored)
|
||||
return
|
||||
|
||||
//List of air sensor's by name
|
||||
var/list/available_sensors = list()
|
||||
for(var/chamber_id in GLOB.station_gas_chambers)
|
||||
//don't let it conflict with existing distro & waste moniter meter's
|
||||
if(chamber_id == ATMOS_GAS_MONITOR_DISTRO)
|
||||
continue
|
||||
if(chamber_id == ATMOS_GAS_MONITOR_WASTE)
|
||||
continue
|
||||
available_sensors += GLOB.station_gas_chambers[chamber_id]
|
||||
|
||||
//make the choice
|
||||
var/chamber_name = tgui_input_list(user, "Select Sensor Purpose", "Select Sensor ID", available_sensors)
|
||||
if(isnull(chamber_name))
|
||||
return
|
||||
|
||||
//map chamber name back to id
|
||||
var/target_chamber
|
||||
for(var/chamber_id in GLOB.station_gas_chambers)
|
||||
if(GLOB.station_gas_chambers[chamber_id] != chamber_name)
|
||||
continue
|
||||
target_chamber = chamber_id
|
||||
break
|
||||
|
||||
//build the sensor from the subtypes of sensor's available
|
||||
var/static/list/chamber_subtypes = null
|
||||
if(isnull(chamber_subtypes))
|
||||
chamber_subtypes = subtypesof(/obj/machinery/air_sensor)
|
||||
for(var/obj/machinery/air_sensor/sensor as anything in chamber_subtypes)
|
||||
if(initial(sensor.chamber_id) != target_chamber)
|
||||
continue
|
||||
|
||||
//make real air sensor in it's place
|
||||
var/obj/machinery/air_sensor/new_sensor = new sensor(get_turf(src))
|
||||
new_sensor.inlet_id = input_id
|
||||
new_sensor.outlet_id = output_id
|
||||
new_sensor.balloon_alert(user, "sensor turned on")
|
||||
qdel(src)
|
||||
|
||||
break
|
||||
|
||||
/obj/item/air_sensor/wrench_act(mob/living/user, obj/item/tool)
|
||||
if(default_unfasten_wrench(user, tool) == SUCCESSFUL_UNFASTEN)
|
||||
return TOOL_ACT_TOOLTYPE_SUCCESS
|
||||
return
|
||||
|
||||
/obj/item/air_sensor/welder_act(mob/living/user, obj/item/tool)
|
||||
if(!tool.tool_start_check(user, amount = 1))
|
||||
return
|
||||
|
||||
loc.balloon_alert(user, "dismantling sensor")
|
||||
if(!tool.use_tool(src, user, 2 SECONDS, volume = 30, amount = 1))
|
||||
return
|
||||
loc.balloon_alert(user, "sensor dismanteled")
|
||||
|
||||
deconstruct(TRUE)
|
||||
return TOOL_ACT_TOOLTYPE_SUCCESS
|
||||
|
||||
/obj/item/air_sensor/deconstruct(disassembled)
|
||||
if(!(flags_1 & NODECONSTRUCT_1))
|
||||
new /obj/item/analyzer(loc)
|
||||
new /obj/item/stack/sheet/iron(loc, 1)
|
||||
return ..()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
circuit = /obj/item/circuitboard/computer/atmos_control
|
||||
light_color = LIGHT_COLOR_CYAN
|
||||
|
||||
/// Which sensors/input/outlets do we want to listen to.
|
||||
/// Which sensors do we want to listen to.
|
||||
/// Assoc of list[chamber_id] = readable_chamber_name
|
||||
var/list/atmos_chambers
|
||||
|
||||
@@ -19,12 +19,33 @@
|
||||
/// Whether we are allowed to reconnect.
|
||||
var/reconnecting = TRUE
|
||||
|
||||
/// Was this computer multitooled before. If so copy the list connected_sensors as it now mantain's it's own sensors independent of the map loaded one's
|
||||
var/was_multi_tooled = FALSE
|
||||
|
||||
/// list of all sensors[key is chamber id, value is id of air sensor linked to this chamber] monitered by this computer
|
||||
var/list/connected_sensors
|
||||
|
||||
/obj/machinery/computer/atmos_control/Initialize(mapload, obj/item/circuitboard/C)
|
||||
. = ..()
|
||||
|
||||
var/static/list/multitool_tips = list(
|
||||
TOOL_MULTITOOL = list(
|
||||
SCREENTIP_CONTEXT_LMB = "Link Sensor",
|
||||
)
|
||||
)
|
||||
AddElement(/datum/element/contextual_screentip_tools, multitool_tips)
|
||||
|
||||
//all newly constructed/round start computers by default have access to this list
|
||||
connected_sensors = GLOB.map_loaded_sensors
|
||||
|
||||
//special case for the station monitering console. We dont want to loose these chambers during reconnecting
|
||||
if(!control && !isnull(atmos_chambers))
|
||||
always_displayed_chambers = atmos_chambers.Copy()
|
||||
|
||||
/obj/machinery/computer/atmos_control/examine(mob/user)
|
||||
. = ..()
|
||||
. += span_notice("Use a multitool to link a air sensor to this computer")
|
||||
|
||||
/// Reconnect only works for station based chambers.
|
||||
/obj/machinery/computer/atmos_control/proc/reconnect(mob/user)
|
||||
if(!reconnecting)
|
||||
@@ -33,16 +54,25 @@
|
||||
// We only prompt the user with the sensors that are actually available.
|
||||
var/available_devices = list()
|
||||
|
||||
for (var/chamber_identifier in GLOB.station_gas_chambers)
|
||||
if (!(CHAMBER_INPUT_FROM_ID(chamber_identifier) in GLOB.objects_by_id_tag) && !(CHAMBER_OUTPUT_FROM_ID(chamber_identifier) in GLOB.objects_by_id_tag))
|
||||
for (var/chamber_identifier in connected_sensors)
|
||||
//this sensor was destroyed at the time of reconnecting
|
||||
var/obj/machinery/sensor = GLOB.objects_by_id_tag[connected_sensors[chamber_identifier]]
|
||||
if(QDELETED(sensor))
|
||||
continue
|
||||
|
||||
//non master computers don't have access to these station moniters. Only done to give master computer's special access to these chambers and make them feel special or something
|
||||
if(chamber_identifier == ATMOS_GAS_MONITOR_DISTRO)
|
||||
continue
|
||||
if(chamber_identifier == ATMOS_GAS_MONITOR_WASTE)
|
||||
continue
|
||||
|
||||
available_devices[GLOB.station_gas_chambers[chamber_identifier]] = chamber_identifier
|
||||
|
||||
// As long as we dont put any funny chars in the strings it should match.
|
||||
var/new_name = tgui_input_list(user, "Select the device set", "Reconnect", available_devices)
|
||||
if(isnull(new_name))
|
||||
return FALSE
|
||||
var/new_id = available_devices[new_name]
|
||||
|
||||
if(isnull(new_id))
|
||||
return FALSE
|
||||
|
||||
@@ -57,6 +87,22 @@
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/atmos_control/multitool_act(mob/living/user, obj/item/multitool/multi_tool)
|
||||
. = ..()
|
||||
|
||||
if(istype(multi_tool.buffer, /obj/machinery/air_sensor))
|
||||
var/obj/machinery/air_sensor/sensor = multi_tool.buffer
|
||||
//computers reference a global map loaded list of sensor's but as soon a user attempt's to edit it, make a copy of that list so other computers aren't affected
|
||||
if(!was_multi_tooled)
|
||||
connected_sensors = connected_sensors.Copy()
|
||||
was_multi_tooled = TRUE
|
||||
//register the sensor's unique ID with it's assositated chamber
|
||||
connected_sensors[sensor.chamber_id] = sensor.id_tag
|
||||
user.balloon_alert(user, "sensor connected to [src]")
|
||||
return TOOL_ACT_TOOLTYPE_SUCCESS
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/computer/atmos_control/ui_interact(mob/user, datum/tgui/ui)
|
||||
. = ..()
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
@@ -82,23 +128,26 @@
|
||||
chamber_info["id"] = chamber_id
|
||||
chamber_info["name"] = atmos_chambers[chamber_id]
|
||||
|
||||
var/obj/machinery/sensor = GLOB.objects_by_id_tag[CHAMBER_SENSOR_FROM_ID(chamber_id)]
|
||||
if (!isnull(sensor))
|
||||
var/obj/machinery/sensor = GLOB.objects_by_id_tag[connected_sensors[chamber_id]]
|
||||
if(!QDELETED(sensor))
|
||||
chamber_info["gasmix"] = gas_mixture_parser(sensor.return_air())
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/outlet_injector/monitored/input = GLOB.objects_by_id_tag[CHAMBER_INPUT_FROM_ID(chamber_id)]
|
||||
if (!isnull(input))
|
||||
chamber_info["input_info"] = list(
|
||||
"active" = input.on,
|
||||
"amount" = input.volume_rate,
|
||||
)
|
||||
if(istype(sensor, /obj/machinery/air_sensor)) //distro & waste loop are not air sensors and don't have these functions
|
||||
var/obj/machinery/air_sensor/air_sensor = sensor
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/vent_pump/output = GLOB.objects_by_id_tag[CHAMBER_OUTPUT_FROM_ID(chamber_id)]
|
||||
if (!isnull(output))
|
||||
chamber_info["output_info"] = list(
|
||||
"active" = output.on,
|
||||
"amount" = output.internal_pressure_bound,
|
||||
)
|
||||
var/obj/machinery/atmospherics/components/unary/outlet_injector/input = GLOB.objects_by_id_tag[air_sensor.inlet_id || ""]
|
||||
if (!QDELETED(input))
|
||||
chamber_info["input_info"] = list(
|
||||
"active" = input.on,
|
||||
"amount" = input.volume_rate,
|
||||
)
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/vent_pump/output = GLOB.objects_by_id_tag[air_sensor.outlet_id || ""]
|
||||
if (!QDELETED(output))
|
||||
chamber_info["output_info"] = list(
|
||||
"active" = output.on,
|
||||
"amount" = output.internal_pressure_bound,
|
||||
)
|
||||
|
||||
data["chambers"] += list(chamber_info)
|
||||
return data
|
||||
@@ -115,37 +164,66 @@
|
||||
if (!(chamber in atmos_chambers))
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/outlet_injector/monitored/input = GLOB.objects_by_id_tag[CHAMBER_INPUT_FROM_ID(chamber)]
|
||||
input?.on = !input.on
|
||||
var/obj/machinery/air_sensor/sensor = GLOB.objects_by_id_tag[connected_sensors[chamber]]
|
||||
if(QDELETED(sensor))
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/outlet_injector/input = GLOB.objects_by_id_tag[sensor.inlet_id || ""]
|
||||
if(QDELETED(input))
|
||||
return TRUE
|
||||
|
||||
input.on = !input.on
|
||||
input.update_appearance(UPDATE_ICON)
|
||||
if("toggle_output")
|
||||
if (!(chamber in atmos_chambers))
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/vent_pump/output = GLOB.objects_by_id_tag[CHAMBER_OUTPUT_FROM_ID(chamber)]
|
||||
output?.on = !output.on
|
||||
var/obj/machinery/air_sensor/sensor = GLOB.objects_by_id_tag[connected_sensors[chamber]]
|
||||
if(QDELETED(sensor))
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/vent_pump/output = GLOB.objects_by_id_tag[sensor.outlet_id || ""]
|
||||
if(QDELETED(output))
|
||||
return TRUE
|
||||
|
||||
output.on = !output.on
|
||||
output.update_appearance(UPDATE_ICON)
|
||||
if("adjust_input")
|
||||
if (!(chamber in atmos_chambers))
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/air_sensor/sensor = GLOB.objects_by_id_tag[connected_sensors[chamber]]
|
||||
if(QDELETED(sensor))
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/outlet_injector/input = GLOB.objects_by_id_tag[sensor.inlet_id || ""]
|
||||
if(QDELETED(input))
|
||||
return TRUE
|
||||
|
||||
var/target = text2num(params["rate"])
|
||||
if(isnull(target))
|
||||
return TRUE
|
||||
target = clamp(target, 0, MAX_TRANSFER_RATE)
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/outlet_injector/input = GLOB.objects_by_id_tag[CHAMBER_INPUT_FROM_ID(chamber)]
|
||||
input?.volume_rate = clamp(target, 0, min(input.airs[1].volume, MAX_TRANSFER_RATE))
|
||||
input.volume_rate = clamp(target, 0, min(input.airs[1].volume, MAX_TRANSFER_RATE))
|
||||
if("adjust_output")
|
||||
if (!(chamber in atmos_chambers))
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/air_sensor/sensor = GLOB.objects_by_id_tag[connected_sensors[chamber]]
|
||||
if(QDELETED(sensor))
|
||||
return TRUE
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/vent_pump/output = GLOB.objects_by_id_tag[sensor.outlet_id || ""]
|
||||
if(QDELETED(output))
|
||||
return TRUE
|
||||
|
||||
var/target = text2num(params["rate"])
|
||||
if(isnull(target))
|
||||
return TRUE
|
||||
target = clamp(target, 0, ATMOS_PUMP_MAX_PRESSURE)
|
||||
|
||||
var/obj/machinery/atmospherics/components/unary/vent_pump/output = GLOB.objects_by_id_tag[CHAMBER_OUTPUT_FROM_ID(chamber)]
|
||||
output?.internal_pressure_bound = clamp(target, 0, ATMOS_PUMP_MAX_PRESSURE)
|
||||
output.internal_pressure_bound = target
|
||||
if("reconnect")
|
||||
reconnect(usr)
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/monitored
|
||||
on = TRUE
|
||||
volume_rate = MAX_TRANSFER_RATE
|
||||
/// The air sensor type this injector is linked to
|
||||
var/chamber_id
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/monitored/Initialize(mapload)
|
||||
id_tag = CHAMBER_INPUT_FROM_ID(chamber_id)
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
var/chamber_id
|
||||
|
||||
/obj/machinery/meter/monitored/Initialize(mapload, new_piping_layer)
|
||||
id_tag = CHAMBER_SENSOR_FROM_ID(chamber_id)
|
||||
id_tag = assign_random_name()
|
||||
if(mapload)
|
||||
GLOB.map_loaded_sensors[chamber_id] = id_tag
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/meter/monitored/layer2
|
||||
|
||||
@@ -43,34 +43,6 @@ GLOBAL_LIST_INIT(atmos_pipe_recipes, list(
|
||||
new /datum/pipe_info/pipe("4-Way Manifold", /obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w, FALSE),
|
||||
new /datum/pipe_info/pipe("Junction", /obj/machinery/atmospherics/pipe/heat_exchanging/junction, FALSE),
|
||||
new /datum/pipe_info/pipe("Heat Exchanger", /obj/machinery/atmospherics/components/unary/heat_exchanger, FALSE),
|
||||
),
|
||||
"Air Sensors" = list(
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/plasma_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/oxygen_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/nitrogen_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/mix_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/nitrous_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/air_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/carbon_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/bz_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/freon_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/halon_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/healium_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/hydrogen_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/hypernoblium_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/miasma_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/nitrium_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/pluoxium_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/proto_nitrate_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/tritium_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/water_vapor_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/zauker_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/helium_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/antinoblium_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/incinerator_tank),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/ordnance_burn_chamber),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/ordnance_freezer_chamber),
|
||||
new /datum/pipe_info/sensor(/obj/machinery/air_sensor/engine_chamber),
|
||||
)
|
||||
))
|
||||
|
||||
@@ -112,9 +84,6 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
var/dirtype = PIPE_BENDABLE
|
||||
var/all_layers
|
||||
|
||||
/datum/pipe_info/proc/Params()
|
||||
return ""
|
||||
|
||||
/datum/pipe_info/proc/get_preview(selected_dir, selected = FALSE)
|
||||
var/list/dirs
|
||||
switch(dirtype)
|
||||
@@ -154,14 +123,6 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
|
||||
return rows
|
||||
|
||||
/datum/pipe_info/sensor
|
||||
dirtype = PIPE_ONEDIR
|
||||
|
||||
/datum/pipe_info/sensor/New(obj/machinery/air_sensor/sensor)
|
||||
id = sensor
|
||||
name = capitalize(replacetext(initial(sensor.name), "gas sensor", ""))
|
||||
icon_state = "gsensor1"
|
||||
|
||||
/datum/pipe_info/pipe/New(label, obj/machinery/atmospherics/path, use_five_layers)
|
||||
name = label
|
||||
id = path
|
||||
@@ -170,9 +131,6 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
var/obj/item/pipe/c = initial(path.construction_type)
|
||||
dirtype = initial(c.RPD_type)
|
||||
|
||||
/datum/pipe_info/pipe/Params()
|
||||
return "makepipe=[id]&type=[dirtype]"
|
||||
|
||||
/datum/pipe_info/meter
|
||||
icon_state = "meter"
|
||||
dirtype = PIPE_ONEDIR
|
||||
@@ -180,9 +138,6 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
/datum/pipe_info/meter/New(label)
|
||||
name = label
|
||||
|
||||
/datum/pipe_info/meter/Params()
|
||||
return "makemeter=[id]&type=[dirtype]"
|
||||
|
||||
/datum/pipe_info/disposal/New(label, obj/path, dt=PIPE_UNARY)
|
||||
name = label
|
||||
id = path
|
||||
@@ -193,9 +148,6 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
|
||||
dirtype = dt
|
||||
|
||||
/datum/pipe_info/disposal/Params()
|
||||
return "dmake=[id]&type=[dirtype]"
|
||||
|
||||
/datum/pipe_info/transit/New(label, obj/path, dt=PIPE_UNARY)
|
||||
name = label
|
||||
id = path
|
||||
@@ -309,12 +261,6 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
ui_interact(user)
|
||||
|
||||
/obj/item/pipe_dispenser/pre_attack_secondary(obj/machinery/atmospherics/target, mob/user, params)
|
||||
if(istype(target, /obj/machinery/air_sensor))
|
||||
if(!do_after(user, destroy_speed, target))
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
qdel(target)
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
|
||||
if(!istype(target, /obj/machinery/atmospherics))
|
||||
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
|
||||
if(target.pipe_color && target.piping_layer)
|
||||
@@ -377,13 +323,6 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
for(var/i in 1 to cat.len)
|
||||
var/datum/pipe_info/info = cat[i]
|
||||
|
||||
//skip sensors which are already in the world so we dont create duplicate ones
|
||||
if(info.type == /datum/pipe_info/sensor)
|
||||
var/datum/pipe_info/sensor/sensor_info = info
|
||||
var/obj/machinery/air_sensor/sensor = sensor_info.id
|
||||
if(GLOB.objects_by_id_tag[CHAMBER_SENSOR_FROM_ID(initial(sensor.chamber_id))] != null)
|
||||
continue
|
||||
|
||||
r += list(list(
|
||||
"pipe_name" = info.name,
|
||||
"pipe_index" = i,
|
||||
@@ -391,8 +330,7 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
))
|
||||
if(info == recipe)
|
||||
data["selected_category"] = c
|
||||
if(r.len == 0) //when all air sensors are installed this list will become empty
|
||||
continue
|
||||
|
||||
data["categories"] += list(list("cat_name" = c, "recipes" = r))
|
||||
|
||||
var/list/init_directions = list("north" = FALSE, "south" = FALSE, "east" = FALSE, "west" = FALSE)
|
||||
@@ -587,14 +525,6 @@ GLOBAL_LIST_INIT(transit_tube_recipes, list(
|
||||
PM.setAttachLayer(piping_layer)
|
||||
if(mode & WRENCH_MODE)
|
||||
PM.wrench_act(user, src)
|
||||
else if(recipe.type == /datum/pipe_info/sensor)
|
||||
if(do_after(user, atmos_build_speed, target = attack_target))
|
||||
activate()
|
||||
var/datum/pipe_info/sensor/sensor_recipe = recipe
|
||||
var/obj/machinery/air_sensor/sensor_blueprint = sensor_recipe.id
|
||||
new sensor_blueprint(get_turf(attack_target))
|
||||
//change the recipe as the current one becomes unavailable
|
||||
recipe = first_atmos
|
||||
else
|
||||
if(recipe.all_layers == FALSE && (piping_layer == 1 || piping_layer == 5))
|
||||
balloon_alert(user, "cant build on this layer!")
|
||||
|
||||
@@ -4,4 +4,3 @@
|
||||
/datum/asset/spritesheet/pipes/create_spritesheets()
|
||||
for (var/each in list('icons/obj/atmospherics/pipes/pipe_item.dmi', 'icons/obj/atmospherics/pipes/disposal.dmi', 'icons/obj/atmospherics/pipes/transit_tube.dmi', 'icons/obj/plumbing/fluid_ducts.dmi'))
|
||||
InsertAll("", each, GLOB.alldirs)
|
||||
Insert(sprite_name = "gsensor1", I = 'icons/obj/stationobjs.dmi', icon_state = "gsensor1")
|
||||
|
||||
@@ -654,7 +654,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 27)
|
||||
|
||||
///Used for air alarm link helper, which connects air alarm to a sensor with corresponding chamber_id
|
||||
/obj/machinery/airalarm/proc/setup_chamber_link()
|
||||
var/obj/machinery/air_sensor/sensor = GLOB.objects_by_id_tag[CHAMBER_SENSOR_FROM_ID(air_sensor_chamber_id)]
|
||||
var/obj/machinery/air_sensor/sensor = GLOB.objects_by_id_tag[GLOB.map_loaded_sensors[air_sensor_chamber_id]]
|
||||
if(isnull(sensor))
|
||||
log_mapping("[src] at [AREACOORD(src)] tried to connect to a sensor, but no sensor with chamber_id:[air_sensor_chamber_id] found!")
|
||||
return
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
///Rate of operation of the device
|
||||
var/volume_rate = 50
|
||||
|
||||
///id of air sensor its connected to
|
||||
var/chamber_id
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/Initialize(mapload)
|
||||
if(isnull(id_tag))
|
||||
id_tag = assign_random_name()
|
||||
. = ..()
|
||||
|
||||
var/static/list/tool_screentips = list(
|
||||
TOOL_MULTITOOL = list(
|
||||
SCREENTIP_CONTEXT_LMB = "Log to link later with air sensor",
|
||||
@@ -42,27 +42,17 @@
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/multitool_act(mob/living/user, obj/item/multitool/multi_tool)
|
||||
. = ..()
|
||||
if (!istype(multi_tool))
|
||||
return .
|
||||
|
||||
if(istype(multi_tool.buffer, /obj/machinery/air_sensor))
|
||||
var/obj/machinery/air_sensor/sensor = multi_tool.buffer
|
||||
sensor.inlet_id = id_tag
|
||||
multi_tool.buffer = null
|
||||
balloon_alert(user, "input linked to sensor")
|
||||
return TOOL_ACT_TOOLTYPE_SUCCESS
|
||||
|
||||
balloon_alert(user, "saved in buffer")
|
||||
multi_tool.buffer = src
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/wrench_act(mob/living/user, obj/item/I)
|
||||
. = ..()
|
||||
if(.)
|
||||
disconnect_chamber()
|
||||
|
||||
///called when its either unwrenched or destroyed
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/proc/disconnect_chamber()
|
||||
if(chamber_id != null)
|
||||
GLOB.objects_by_id_tag -= CHAMBER_INPUT_FROM_ID(chamber_id)
|
||||
chamber_id = null
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/Destroy()
|
||||
disconnect_chamber()
|
||||
return ..()
|
||||
return TOOL_ACT_TOOLTYPE_SUCCESS
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/outlet_injector/CtrlClick(mob/user)
|
||||
if(can_interact(user))
|
||||
|
||||
@@ -52,23 +52,17 @@
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/multitool_act(mob/living/user, obj/item/multitool/multi_tool)
|
||||
. = ..()
|
||||
if (!istype(multi_tool))
|
||||
return .
|
||||
|
||||
if(istype(multi_tool.buffer, /obj/machinery/air_sensor))
|
||||
var/obj/machinery/air_sensor/sensor = multi_tool.buffer
|
||||
sensor.outlet_id = id_tag
|
||||
multi_tool.buffer = null
|
||||
balloon_alert(user, "output linked to sensor")
|
||||
return TOOL_ACT_TOOLTYPE_SUCCESS
|
||||
|
||||
balloon_alert(user, "saved in buffer")
|
||||
multi_tool.buffer = src
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/wrench_act(mob/living/user, obj/item/wrench)
|
||||
. = ..()
|
||||
if(.)
|
||||
disconnect_chamber()
|
||||
|
||||
///called when its either unwrenched or destroyed
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/proc/disconnect_chamber()
|
||||
if(chamber_id != null)
|
||||
GLOB.objects_by_id_tag -= CHAMBER_OUTPUT_FROM_ID(chamber_id)
|
||||
chamber_id = null
|
||||
return TOOL_ACT_TOOLTYPE_SUCCESS
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/Destroy()
|
||||
disconnect_from_area()
|
||||
@@ -77,8 +71,6 @@
|
||||
if(vent_area)
|
||||
vent_area.air_vents -= src
|
||||
|
||||
disconnect_chamber()
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/machinery/atmospherics/components/unary/vent_pump/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change)
|
||||
|
||||
Reference in New Issue
Block a user