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**
![Screenshot
(247)](https://github.com/tgstation/tgstation/assets/110812394/6a7eb501-4414-4f01-a6ef-3e9b70f4af06)

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>
This commit is contained in:
SyncIt21
2023-06-21 18:25:34 +00:00
committed by GitHub
co-authored by Time-Green
parent 805bc2f5e6
commit 903eea5a69
11 changed files with 312 additions and 159 deletions
-1
View File
@@ -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)