Skip to content

Commit

Permalink
Консоль для мониторинга температуры и давления (#1138)
Browse files Browse the repository at this point in the history
<!-- Пишите **НИЖЕ** заголовков и **ВЫШЕ** комментариев, иначе что то
может пойти не так. -->
<!-- Вы можете прочитать Contributing.MD, если хотите узнать больше. -->

## Что этот PR делает
Добавляет консоль с новым анимированным спрайтом экрана консоли, новым
TGUI для отображения графиков температуры и давления, **без
необходимости игроку быть рядом с консолью (process)**
**Демонстрация работы:** https://www.youtube.com/watch?v=vGxUh1rOL2U
<!-- Вкратце опишите изменения, которые вносите. -->
<!-- Опишите **все** изменения, так как противное может сказаться на
рассмотрении этого PR'а! -->
<!-- Если вы исправляете Issue, добавьте "Fixes #xxxx" (где xxxx - номер
Issue) где-нибудь в описании PR'а. Это автоматически закроет Issue после
принятия PR'а. -->

## Почему это хорошо для игры
Позволяет с помощью мультиметра подключить к консоли Gas Sensor, и Meter
(RPD => devices), и видеть на графике изменение показателей температуры
и давления в динамике.
Полезно для инженерного отдела, потому как наглядная визуализация всегда
лучше сухих цифр.

<!-- Опишите, почему, по вашему, следует добавить эти изменения в игру.
-->

## Изображения изменений
~~**СМ еще никогда не горел так информативно**~~

![1](https://github.com/ss220club/Paradise-SS220/assets/87367109/9161f339-3978-4dbd-a254-84a350472244)

![2](https://github.com/ss220club/Paradise-SS220/assets/87367109/d7b17fae-5f16-4ef7-919f-b62031b8dcf4)


![5850147e85193d37](https://github.com/ss220club/Paradise-SS220/assets/87367109/3d767d81-f53e-4d7f-89bb-e423a6ae9adb)
**Плата с наименованием Atmospheric Graph Monitor, для печати необходимы
programin =2, engineering =3**

![circuit](https://github.com/ss220club/Paradise-SS220/assets/87367109/c69032f3-2825-4c12-9b37-e9415d3ad426)

![green](https://github.com/ss220club/Paradise-SS220/assets/87367109/eac6cbee-acaf-4567-bcb7-1bd068db3db4)

### **UPD**
Консоли расположены в следующих точках:
**Дельта** (пришлось украсть стол из пластали и перенести сварочную
маску)

![дельта](https://github.com/ss220club/Paradise-SS220/assets/87367109/2edf1c48-8e4e-4908-b319-ea9307fd27a4)
**Кибериада**

![Кибериада](https://github.com/ss220club/Paradise-SS220/assets/87367109/bdcbf80d-9fc2-4970-b24f-62c62adb53bb)
**Метастейшон**

![Цереброн](https://github.com/ss220club/Paradise-SS220/assets/87367109/fe099d9f-3e60-40ee-99e7-57a1ebc2a7c6)

![подсказка](https://github.com/ss220club/Paradise-SS220/assets/87367109/bcc7c989-8b03-4f65-822c-dfdbd7aacaa1)



<!-- Если вы не меняли карту или спрайты, можете опустить эту секцию.
Если хотите, можете вставить видео. -->

## Тестирование
Тестировал на локальном сервере:
Протестировано создание платы в автомате для печати плат;
Протестированы отображение показателей в динамике;
Протестировано отображение спрайта экрана консоли в разных направлениях;

Для тестирования с помощью Game Panel необходимо найти консоль
**pt_monitor**.
<!-- Как вы тестировали свой PR, если делали это вовсе? -->

## Changelog

:cl:
add: Добавлена консоль для мониторинга температуры и давления. Датчики к
ней можно подключить с помощью мультитула.
/:cl:

<!-- Оба :cl:'а должны быть на месте, что-бы чейнджлог работал! Вы
можете написать свой ник справа от первого :cl:, если хотите. Иначе
будет использован ваш ник на ГитХабе. -->
<!-- Вы можете использовать несколько записей с одинаковым префиксом
(Они используются только для иконки в игре) и удалить ненужные. Помните,
что чейнджлог должен быть понятен обычным игроком. -->
<!-- Если чейнджлог не влияет на игроков(например, это рефактор), вы
можете исключить всю секцию. -->

---------

Co-authored-by: desunovu <[email protected]>
  • Loading branch information
VentelR and Desunovu committed Apr 19, 2024
1 parent a4a85e8 commit 5ac0f86
Show file tree
Hide file tree
Showing 10 changed files with 676 additions and 105 deletions.
21 changes: 18 additions & 3 deletions _maps/map_files220/stations/boxstation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -38513,6 +38513,9 @@
dir = 4
},
/obj/machinery/light/directional/south,
/obj/machinery/atmospherics/meter{
autolink_id = "sm_sen_cold"
},
/turf/simulated/floor/plasteel{
icon_state = "darkyellow"
},
Expand Down Expand Up @@ -40352,7 +40355,6 @@
},
/obj/machinery/atmospherics/pipe/simple/visible/cyan,
/obj/machinery/light/directional/west,
/obj/machinery/atmospherics/meter,
/turf/simulated/floor/plasteel{
dir = 8;
icon_state = "darkyellow"
Expand Down Expand Up @@ -80922,6 +80924,13 @@
icon_state = "freezerfloor"
},
/area/station/maintenance/disposal)
"qCM" = (
/obj/machinery/atmospherics/air_sensor{
autolink_id = "sm_sen_cont";
output = 127
},
/turf/simulated/floor/engine,
/area/station/engineering/engine/supermatter)
"qCO" = (
/obj/effect/decal/cleanable/dirt,
/obj/machinery/atmospherics/pipe/simple/visible/cyan{
Expand Down Expand Up @@ -88757,7 +88766,9 @@
dir = 4
},
/obj/machinery/light/directional/south,
/obj/machinery/atmospherics/meter,
/obj/machinery/atmospherics/meter{
autolink_id = "sm_sen_hot"
},
/turf/simulated/floor/plasteel{
icon_state = "darkyellow"
},
Expand Down Expand Up @@ -90900,6 +90911,10 @@
/area/station/science/explab/chamber)
"uiw" = (
/obj/structure/extinguisher_cabinet/directional/east,
/obj/machinery/computer/general_air_control/pt_monitor{
dir = 1;
autolink_sensors = list("sm_sen_hot"="Горячий Контур","sm_sen_cold"="Холодный Контур","sm_sen_cont"="Зона Содержания")
},
/turf/simulated/floor/plasteel{
dir = 6;
icon_state = "darkyellow"
Expand Down Expand Up @@ -138550,7 +138565,7 @@ dah
wQQ
mkq
dPA
cSI
qCM
phw
cSI
nic
Expand Down
26 changes: 20 additions & 6 deletions _maps/map_files220/stations/deltastation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -7332,7 +7332,9 @@
/turf/simulated/floor/plasteel,
/area/station/engineering/controlroom)
"aGa" = (
/obj/machinery/atmospherics/meter,
/obj/machinery/atmospherics/meter{
autolink_id = "sm_sen_cold"
},
/obj/machinery/atmospherics/pipe/manifold/visible,
/obj/structure/cable/yellow{
d1 = 4;
Expand Down Expand Up @@ -8284,6 +8286,9 @@
pixel_y = -4
},
/obj/effect/turf_decal/delivery/hollow,
/obj/item/clothing/head/welding/flamedecal/blue{
pixel_y = 5
},
/turf/simulated/floor/plasteel,
/area/station/engineering/controlroom)
"aJH" = (
Expand Down Expand Up @@ -56142,9 +56147,9 @@
/turf/simulated/floor/plasteel,
/area/station/engineering/controlroom)
"gBF" = (
/obj/structure/table/reinforced,
/obj/item/clothing/head/welding/flamedecal/blue{
pixel_y = 5
/obj/machinery/computer/general_air_control/pt_monitor{
dir = 8;
autolink_sensors = list("sm_sen_hot"="Горячий Контур","sm_sen_cold"="Холодный Контур","sm_sen_cont"="Зона Содержания")
},
/turf/simulated/floor/plasteel,
/area/station/engineering/controlroom)
Expand Down Expand Up @@ -89109,6 +89114,13 @@
icon_state = "neutralfull"
},
/area/station/hallway/primary/central/ne)
"qQH" = (
/obj/machinery/atmospherics/air_sensor{
autolink_id = "sm_sen_cont";
output = 127
},
/turf/simulated/floor/engine,
/area/station/engineering/engine/supermatter)
"qQK" = (
/obj/machinery/atmospherics/pipe/simple/hidden/supply{
dir = 9
Expand Down Expand Up @@ -107080,7 +107092,9 @@
/obj/effect/turf_decal/stripes/line{
dir = 1
},
/obj/machinery/atmospherics/meter,
/obj/machinery/atmospherics/meter{
autolink_id = "sm_sen_hot"
},
/turf/simulated/floor/plasteel,
/area/station/engineering/controlroom)
"wBK" = (
Expand Down Expand Up @@ -136244,7 +136258,7 @@ nUm
kJd
aAa
aBX
aAa
qQH
mxm
aAa
aCZ
Expand Down
42 changes: 24 additions & 18 deletions _maps/map_files220/stations/metastation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -9345,21 +9345,12 @@
/turf/simulated/floor/engine,
/area/station/engineering/engine/supermatter)
"aRg" = (
/obj/machinery/atmospherics/meter,
/obj/machinery/atmospherics/pipe/manifold/visible/cyan{
dir = 8;
initialize_directions = 11
},
/obj/structure/cable{
d1 = 1;
d2 = 2;
icon_state = "1-2"
},
/obj/effect/turf_decal/stripes/line{
dir = 4
/obj/machinery/atmospherics/air_sensor{
autolink_id = "sm_sen_cont";
output = 127
},
/turf/simulated/floor/engine,
/area/station/engineering/control)
/area/station/engineering/engine/supermatter)
"aRm" = (
/obj/machinery/light/small/directional/south,
/turf/simulated/floor/plating,
Expand Down Expand Up @@ -10045,6 +10036,9 @@
/obj/effect/turf_decal/stripes/line{
dir = 4
},
/obj/machinery/atmospherics/meter{
autolink_id = "sm_sen_cold"
},
/turf/simulated/floor/engine,
/area/station/engineering/control)
"aTK" = (
Expand Down Expand Up @@ -43844,10 +43838,10 @@
d2 = 8;
icon_state = "1-8"
},
/obj/machinery/atmospherics/meter,
/obj/effect/turf_decal/stripes/line{
dir = 1
},
/obj/machinery/atmospherics/meter,
/turf/simulated/floor/engine,
/area/station/engineering/control)
"ded" = (
Expand Down Expand Up @@ -45938,10 +45932,10 @@
},
/area/station/hallway/primary/aft)
"dXb" = (
/obj/machinery/atmospherics/meter,
/obj/machinery/atmospherics/pipe/manifold/visible/cyan,
/obj/machinery/light/directional/south,
/obj/effect/turf_decal/stripes/line,
/obj/machinery/atmospherics/meter,
/turf/simulated/floor/engine,
/area/station/engineering/control)
"dXu" = (
Expand Down Expand Up @@ -59483,6 +59477,9 @@
/obj/effect/turf_decal/stripes/line{
dir = 4
},
/obj/machinery/atmospherics/meter{
autolink_id = "sm_sen_hot"
},
/turf/simulated/floor/engine,
/area/station/engineering/control)
"knq" = (
Expand Down Expand Up @@ -78779,6 +78776,15 @@
},
/turf/simulated/floor/plasteel,
/area/station/science/toxins/mixing)
"tij" = (
/obj/machinery/computer/general_air_control/pt_monitor{
dir = 4;
autolink_sensors = list("sm_sen_hot"="Горячий Контур","sm_sen_cold"="Холодный Контур","sm_sen_cont"="Зона Содержания")
},
/turf/simulated/floor/plasteel{
icon_state = "dark"
},
/area/station/engineering/control)
"tio" = (
/obj/structure/cable/yellow{
d1 = 1;
Expand Down Expand Up @@ -130635,7 +130641,7 @@ fWD
xWl
sLD
jwN
nRh
tij
pcW
pcW
pcW
Expand Down Expand Up @@ -131914,7 +131920,7 @@ nYI
pFo
aMU
aPa
aRg
aPa
aTJ
aPs
aVs
Expand Down Expand Up @@ -132945,7 +132951,7 @@ kGw
aRs
aTK
aRf
aSo
aRg
aTV
mzf
dqm
Expand Down
1 change: 1 addition & 0 deletions modular_ss220/modular_ss220.dme
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "silicons/_silicons.dme"
#include "windows_airbag/_windows_airbag.dme"
#include "clumsy_table/_clumsy_table.dme"
#include "pt_monitor/_pt_monitor.dme"

// --- MISC --- //
#include "administration/_administration.dme"
Expand Down
4 changes: 4 additions & 0 deletions modular_ss220/pt_monitor/_pt_monitor.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/datum/modpack/pt_monitor
name = "Pressure Temperature monitor"
desc = "График изменения температуры и давления. С любовью, для SS220"
author = "VentelR, Desunovu"
3 changes: 3 additions & 0 deletions modular_ss220/pt_monitor/_pt_monitor.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "_pt_monitor.dm"

#include "code/items/pt_monitor.dm"
124 changes: 124 additions & 0 deletions modular_ss220/pt_monitor/code/items/pt_monitor.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#define SENSOR_PRESSURE (1<<0)
#define SENSOR_TEMPERATURE (1<<1)
#define NO_DATA_VALUE null
#define MAX_RECORD_SIZE 20
#define RECORD_INTERVAL 3 SECONDS
#define LONG_RECORD_INTERVAL 30 SECONDS
#define LAZYINITLISTSIZED(L, N) if(!L) L = new/list(N)
#define ADD_TO_HISTORY(history_list, measurement) \
history_list += measurement; \
if(length(history_list) > MAX_RECORD_SIZE) history_list.Cut(1, 2)

/datum/design/pt_monitor
name = "Console Board (Atmospheric Graph Monitor)"
desc ="Позволяет распечатать плату, для создания Atmospheric Graph Monitor."
id = "pt_monitor"
req_tech = list("programming" = 2, "engineering" = 3)
build_type = IMPRINTER
materials = list(MAT_GLASS = 1000)
build_path = /obj/item/circuitboard/pt_monitor
category = list("Computer Boards")

/obj/item/circuitboard/pt_monitor
board_name = "Atmospheric Graph Monitor"
icon_state = "engineering"
build_path = /obj/machinery/computer/general_air_control/pt_monitor
origin_tech = "programming=2;engineering=3"

/obj/machinery/computer/general_air_control/pt_monitor
name = "Atmospheric graph monitoring console"
desc = "Используется для мониторинга давления и температуры с помощью подключаемых мультитулом датчиков."
icon = 'modular_ss220/pt_monitor/icons/pt_monitor.dmi'
icon_screen = "screen"
icon_keyboard = "atmos_key"
circuit = /obj/item/circuitboard/pt_monitor

var/next_record_time = 0
var/next_long_record_time = 0

/obj/machinery/computer/general_air_control/pt_monitor/proc/init_history_lists()
for(var/sensor_name in sensor_name_data_map)
LAZYINITLISTSIZED(sensor_name_data_map[sensor_name]["pressure_history"], MAX_RECORD_SIZE)
LAZYINITLISTSIZED(sensor_name_data_map[sensor_name]["temperature_history"], MAX_RECORD_SIZE)
LAZYINITLISTSIZED(sensor_name_data_map[sensor_name]["long_pressure_history"], MAX_RECORD_SIZE)
LAZYINITLISTSIZED(sensor_name_data_map[sensor_name]["long_temperature_history"], MAX_RECORD_SIZE)

/obj/machinery/computer/general_air_control/pt_monitor/LateInitialize()
. = ..()
init_history_lists()

/obj/machinery/computer/general_air_control/pt_monitor/ui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AtmosGraphMonitor", name)
ui.open()

/obj/machinery/computer/general_air_control/pt_monitor/configure_sensors(mob/living/user, obj/item/multitool/M)
. = ..()
init_history_lists()

/obj/machinery/computer/general_air_control/pt_monitor/refresh_sensors()
var/log_long_record = FALSE
var/current_time = world.time

if(current_time < next_record_time)
return
next_record_time = current_time + RECORD_INTERVAL

if(current_time >= next_long_record_time)
log_long_record = TRUE
next_long_record_time = current_time + LONG_RECORD_INTERVAL

for(var/sensor_name in sensor_name_uid_map)
var/obj/machinery/atmospherics/atmos_sensor = locateUID(sensor_name_uid_map[sensor_name])
// Проверка что сенсор существует
if(QDELETED(atmos_sensor))
sensor_name_uid_map -= sensor_name
sensor_name_data_map -= sensor_name
continue

var/list/sensor_data = sensor_name_data_map[sensor_name]
var/list/sensor_pressure_history = sensor_data["pressure_history"]
var/list/sensor_temperature_history = sensor_data["temperature_history"]
var/list/sensor_long_pressure_history = sensor_data["long_pressure_history"]
var/list/sensor_long_temperature_history = sensor_data["long_temperature_history"]
var/current_pressure
var/current_temperature

if(istype(atmos_sensor, /obj/machinery/atmospherics/air_sensor))
var/obj/machinery/atmospherics/air_sensor/sensor = atmos_sensor
var/datum/gas_mixture/air_sample = sensor.return_air()
current_pressure = (sensor.output & SENSOR_PRESSURE) ? air_sample.return_pressure() : NO_DATA_VALUE
current_temperature = (sensor.output & SENSOR_TEMPERATURE) ? air_sample.return_temperature() : NO_DATA_VALUE
else if(istype(atmos_sensor, /obj/machinery/atmospherics/meter))
var/obj/machinery/atmospherics/meter/the_meter = atmos_sensor
if(the_meter.target)
var/datum/gas_mixture/meter_air_sample = the_meter.target.return_air()
current_pressure = meter_air_sample ? meter_air_sample.return_pressure() : NO_DATA_VALUE
current_temperature = meter_air_sample ? meter_air_sample.return_temperature() : NO_DATA_VALUE
else
sensor_name_uid_map -= sensor_name
sensor_name_data_map -= sensor_name
CRASH("Sensor of unexpected type was found: [atmos_sensor.type]")

ADD_TO_HISTORY(sensor_pressure_history, current_pressure)
ADD_TO_HISTORY(sensor_temperature_history, current_temperature)

if(log_long_record)
ADD_TO_HISTORY(sensor_long_pressure_history, current_pressure)
ADD_TO_HISTORY(sensor_long_temperature_history, current_temperature)

/obj/machinery/computer/general_air_control/pt_monitor/process()
if(!is_operational() || length(sensor_name_uid_map) < 1)
return

refresh_all()

#undef SENSOR_PRESSURE
#undef SENSOR_TEMPERATURE
#undef NO_DATA_VALUE
#undef MAX_RECORD_SIZE
#undef RECORD_INTERVAL
#undef LONG_RECORD_INTERVAL
#undef LAZYINITLISTSIZED
#undef ADD_TO_HISTORY
Binary file added modular_ss220/pt_monitor/icons/pt_monitor.dmi
Binary file not shown.
Loading

0 comments on commit 5ac0f86

Please sign in to comment.