Merge pull request #1810 from Citadel-Station-13/upstream-merge-28635

[MIRROR] Ports bay's supermatter monitor modular program
This commit is contained in:
LetterJay
2017-06-29 04:47:17 -05:00
committed by GitHub
22 changed files with 366 additions and 19 deletions
+13 -1
View File
@@ -66,4 +66,16 @@
#define PROGRAM_STATE_ACTIVE 2
#define FIREDOOR_OPEN 1
#define FIREDOOR_CLOSED 2
#define FIREDOOR_CLOSED 2
// These are used by supermatter and supermatter monitor program, mostly for UI updating purposes. Higher should always be worse!
#define SUPERMATTER_ERROR -1 // Unknown status, shouldn't happen but just in case.
#define SUPERMATTER_INACTIVE 0 // No or minimal energy
#define SUPERMATTER_NORMAL 1 // Normal operation
#define SUPERMATTER_NOTIFY 2 // Ambient temp > 80% of CRITICAL_TEMPERATURE
#define SUPERMATTER_WARNING 3 // Ambient temp > CRITICAL_TEMPERATURE OR integrity damaged
#define SUPERMATTER_DANGER 4 // Integrity < 50%
#define SUPERMATTER_EMERGENCY 5 // Integrity < 25%
#define SUPERMATTER_DELAMINATING 6 // Pretty obvious.
+7
View File
@@ -205,6 +205,13 @@ GLOBAL_LIST_EMPTY(asset_datums)
"sig_low.gif" = 'icons/program_icons/sig_low.gif',
"sig_lan.gif" = 'icons/program_icons/sig_lan.gif',
"sig_none.gif" = 'icons/program_icons/sig_none.gif',
"smmon_0.gif" = 'icons/program_icons/smmon_0.gif',
"smmon_1.gif" = 'icons/program_icons/smmon_1.gif',
"smmon_2.gif" = 'icons/program_icons/smmon_2.gif',
"smmon_3.gif" = 'icons/program_icons/smmon_3.gif',
"smmon_4.gif" = 'icons/program_icons/smmon_4.gif',
"smmon_5.gif" = 'icons/program_icons/smmon_5.gif',
"smmon_6.gif" = 'icons/program_icons/smmon_6.gif'
)
/datum/asset/simple/pda
+2 -2
View File
@@ -96,7 +96,7 @@ Station Engineer
duffelbag = /obj/item/weapon/storage/backpack/duffelbag/engineering
box = /obj/item/weapon/storage/box/engineer
pda_slot = slot_l_store
backpack_contents = list(/obj/item/device/modular_computer/tablet/preset/advanced=1)
backpack_contents = list(/obj/item/device/modular_computer/tablet/preset/advanced=1)
/datum/outfit/job/engineer/gloved
name = "Station Engineer (Gloves)"
@@ -147,7 +147,7 @@ Atmospheric Technician
duffelbag = /obj/item/weapon/storage/backpack/duffelbag/engineering
box = /obj/item/weapon/storage/box/engineer
pda_slot = slot_l_store
backpack_contents = list(/obj/item/device/modular_computer/tablet/preset/advanced=1)
backpack_contents = list(/obj/item/device/modular_computer/tablet/preset/advanced=1)
/datum/outfit/job/atmos/rig
name = "Atmospheric Technician (Hardsuit)"
@@ -0,0 +1,10 @@
diff a/code/modules/jobs/job_types/engineering.dm b/code/modules/jobs/job_types/engineering.dm (rejected hunks)
@@ -39,7 +39,7 @@ Chief Engineer
head = /obj/item/clothing/head/hardhat/white
gloves = /obj/item/clothing/gloves/color/black/ce
accessory = /obj/item/clothing/accessory/pocketprotector/full
- backpack_contents = list(/obj/item/weapon/melee/classic_baton/telescopic=1,/obj/item/device/modular_computer/tablet/preset/advanced/engi=1)
+ backpack_contents = list(/obj/item/weapon/melee/classic_baton/telescopic=1,/obj/item/device/modular_computer/tablet/preset/advanced=1)
backpack = /obj/item/weapon/storage/backpack/industrial
satchel = /obj/item/weapon/storage/backpack/satchel/eng
@@ -36,6 +36,7 @@
var/obj/item/weapon/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/power_monitor())
hard_drive.store_file(new/datum/computer_file/program/alarm_monitor())
hard_drive.store_file(new/datum/computer_file/program/supermatter_monitor())
// ===== RESEARCH CONSOLE =====
/obj/machinery/modular_computer/console/preset/research
@@ -0,0 +1,132 @@
/datum/computer_file/program/supermatter_monitor
filename = "smmonitor"
filedesc = "Supermatter Monitoring"
ui_header = "smmon_0.gif"
program_icon_state = "smmon_0"
extended_desc = "This program connects to specially calibrated supermatter sensors to provide information on the status of supermatter-based engines."
requires_ntnet = TRUE
transfer_access = GLOB.access_engine
network_destination = "supermatter monitoring system"
size = 5
tgui_id = "ntos_supermatter_monitor"
ui_x = 600
ui_y = 400
var/last_status = SUPERMATTER_INACTIVE
var/list/supermatters
var/obj/machinery/power/supermatter_shard/active // Currently selected supermatter crystal.
/datum/computer_file/program/supermatter_monitor/process_tick()
..()
var/new_status = get_status()
if(last_status != new_status)
last_status = new_status
ui_header = "smmon_[last_status].gif"
if(istype(computer) && !(computer.hardware_flag == PROGRAM_LAPTOP))
program_icon_state = "smmon_[last_status]"
if(istype(computer))
computer.update_icon()
/datum/computer_file/program/supermatter_monitor/run_program(mob/living/user)
. = ..(user)
if(istype(computer) && (computer.hardware_flag == PROGRAM_LAPTOP))
program_icon_state = "engine"
computer.update_icon()
refresh()
/datum/computer_file/program/supermatter_monitor/kill_program(forced = FALSE)
active = null
supermatters = null
..()
// Refreshes list of active supermatter crystals
/datum/computer_file/program/supermatter_monitor/proc/refresh()
supermatters = list()
var/turf/T = get_turf(ui_host())
if(!T)
return
//var/valid_z_levels = (GetConnectedZlevels(T.z) & using_map.station_levels)
for(var/obj/machinery/power/supermatter_shard/S in GLOB.machines)
// Delaminating, not within coverage, not on a tile.
if(!(S.z == ZLEVEL_STATION || S.z == ZLEVEL_MINING || S.z == T.z) || !istype(S.loc, /turf/))
continue
supermatters.Add(S)
if(!(active in supermatters))
active = null
/datum/computer_file/program/supermatter_monitor/proc/get_status()
. = SUPERMATTER_INACTIVE
for(var/obj/machinery/power/supermatter_shard/S in supermatters)
. = max(., S.get_status())
/datum/computer_file/program/supermatter_monitor/ui_data()
var/list/data = get_header_data()
if(istype(active))
var/turf/T = get_turf(active)
if(!T)
active = null
refresh()
return
var/datum/gas_mixture/air = T.return_air()
if(!istype(air))
active = null
return
data["active"] = TRUE
data["SM_integrity"] = active.get_integrity()
data["SM_power"] = active.power
data["SM_ambienttemp"] = air.temperature
data["SM_ambientpressure"] = air.return_pressure()
//data["SM_EPR"] = round((air.total_moles / air.group_multiplier) / 23.1, 0.01)
var/list/gasdata = list()
var/list/gaseslist = list("o2","co2","n2","plasma","n2o")
if(air.total_moles())
for(var/gasid in gaseslist)
gasdata.Add(list(list(
"name"= gasid,
"amount" = round(100*air.gases[gasid][MOLES]/air.total_moles(),0.01))))
else
for(var/gasid in gaseslist)
gasdata.Add(list(list(
"name"= gasid,
"amount" = 0)))
data["gases"] = gasdata
else
var/list/SMS = list()
for(var/obj/machinery/power/supermatter_shard/S in supermatters)
var/area/A = get_area(S)
if(A)
SMS.Add(list(list(
"area_name" = A.name,
"integrity" = S.get_integrity(),
"uid" = S.uid
)))
data["active"] = FALSE
data["supermatters"] = SMS
return data
/datum/computer_file/program/supermatter_monitor/ui_act(action, params)
if(..())
return TRUE
switch(action)
if("PRG_clear")
active = null
return TRUE
if("PRG_refresh")
refresh()
return TRUE
if("PRG_set")
var/newuid = text2num(params["set"])
for(var/obj/machinery/power/supermatter_shard/S in supermatters)
if(S.uid == newuid)
active = S
return TRUE
@@ -0,0 +1,36 @@
diff a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm (rejected hunks)
@@ -70,32 +70,27 @@
refresh()
return
var/datum/gas_mixture/air = T.return_air()
- if(!istype(air))
+ if(!air)
active = null
return
- data["active"] = 1
+ data["active"] = TRUE
data["SM_integrity"] = active.get_integrity()
data["SM_power"] = active.power
data["SM_ambienttemp"] = air.temperature
data["SM_ambientpressure"] = air.return_pressure()
//data["SM_EPR"] = round((air.total_moles / air.group_multiplier) / 23.1, 0.01)
var/list/gasdata = list()
- var/list/relevantgas = list("o2","co2","n2","plasma","n2o","freon")
if(air.total_moles())
for(var/gasid in air.gases)
- if(!gasid in relevantgas)
- continue
gasdata.Add(list(list(
"name"= air.gases[gasid][GAS_META][META_GAS_NAME],
"amount" = round(100*air.gases[gasid][MOLES]/air.total_moles(),0.01))))
else
for(var/gasid in air.gases)
- if(!gasid in relevantgas)
- continue
gasdata.Add(list(list(
"name"= air.gases[gasid][GAS_META][META_GAS_NAME],
"amount" = 0)))
@@ -49,6 +49,12 @@
#define FLUX_ANOMALY "flux_anomaly"
#define PYRO_ANOMALY "pyro_anomaly"
//If integrity percent remaining is less than these values, the monitor sets off the relevant alarm.
#define SUPERMATTER_DELAM_PERCENT 5
#define SUPERMATTER_EMERGENCY_PERCENT 25
#define SUPERMATTER_DANGER_PERCENT 50
#define SUPERMATTER_WARNING_PERCENT 100
/obj/machinery/power/supermatter_shard
name = "supermatter shard"
desc = "A strangely translucent and iridescent crystal that looks like it used to be part of a larger structure."
@@ -165,6 +171,41 @@
/obj/machinery/power/supermatter_shard/get_spans()
return list(SPAN_ROBOT)
#define CRITICAL_TEMPERATURE 10000
/obj/machinery/power/supermatter_shard/proc/get_status()
var/turf/T = get_turf(src)
if(!T)
return SUPERMATTER_ERROR
var/datum/gas_mixture/air = T.return_air()
if(!air)
return SUPERMATTER_ERROR
if(get_integrity() < SUPERMATTER_DELAM_PERCENT)
return SUPERMATTER_DELAMINATING
if(get_integrity() < SUPERMATTER_EMERGENCY_PERCENT)
return SUPERMATTER_EMERGENCY
if(get_integrity() < SUPERMATTER_DANGER_PERCENT)
return SUPERMATTER_DANGER
if((get_integrity() < SUPERMATTER_WARNING_PERCENT) || (air.temperature > CRITICAL_TEMPERATURE))
return SUPERMATTER_WARNING
if(air.temperature > (CRITICAL_TEMPERATURE * 0.8))
return SUPERMATTER_NOTIFY
if(power > 5)
return SUPERMATTER_NORMAL
return SUPERMATTER_INACTIVE
/obj/machinery/power/supermatter_shard/proc/get_integrity()
var/integrity = damage / explosion_point
integrity = round(100 - integrity * 100)
integrity = integrity < 0 ? 0 : integrity
return integrity
/obj/machinery/power/supermatter_shard/proc/explode()
var/turf/T = get_turf(src)
for(var/mob/M in GLOB.mob_list)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

+1
View File
@@ -1837,6 +1837,7 @@
#include "code\modules\modular_computers\file_system\programs\ntnrc_client.dm"
#include "code\modules\modular_computers\file_system\programs\nttransfer.dm"
#include "code\modules\modular_computers\file_system\programs\powermonitor.dm"
#include "code\modules\modular_computers\file_system\programs\sm_monitor.dm"
#include "code\modules\modular_computers\file_system\programs\antagonist\dos.dm"
#include "code\modules\modular_computers\file_system\programs\antagonist\revelation.dm"
#include "code\modules\modular_computers\hardware\_hardware.dm"
File diff suppressed because one or more lines are too long
+16 -16
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,65 @@
<script>
component.exports = {
data: {
integState(charge) {
let max = 100
if(charge == max) return 'good'
else if(charge > (max/2)) return 'average'
else return 'bad'
},
bigState(val,aver,max) {
if(charge > max) return 'bad'
else if(val > aver) return 'average'
else return 'good'
}
}
}
</script>
<link rel='ractive' href='./ntosheader.ract'>
<ntosheader/>
{{#if data.active}}
<ui-button action='PRG_clear'>Back to Menu</ui-button><br>
<ui-display title='Supermatter Status:'>
<ui-section label='Core Integrity'>
<ui-bar min='0' max='100' value='{{adata.SM_integrity}}' state='{{integState(adata.SM_integrity)}}'>{{data.SM_integrity}}%</ui-bar>
</ui-section>
<ui-section label='Relative EER'>
<span class='{{bigState(data.SM_power,150,300)}}'>{{data.SM_power}} MeV/cm3</span>
</ui-section>
<ui-section label='Temperature'>
<span class='{{bigState(data.SM_ambienttemp,4000,5000)}}'>{{data.SM_ambienttemp}} K</span>
</ui-section>
<ui-section label='Pressure'>
<span class='{{bigState(data.SM_ambientpressure,5000,10000)}}'>{{data.SM_ambientpressure}} kPa</span>
</ui-section>
</ui-display>
<hr><br>
<ui-display title='Gas Composition:'>
{{#each data.gases}}
<ui-section label='{{name}}'>
{{amount}} %
</ui-section>
{{/each}}
</ui-display>
{{else}}
<ui-button action='PRG_refresh'>Refresh</ui-button><br>
<ui-display title='Detected Supermatters'>
{{#each data.supermatters}}
<ui-section label='Area'>
{{area_name}} - (#{{uid}})
</ui-section>
<ui-section label='Integrity'>
{{integrity}} %
</ui-section>
<ui-section label='Options'>
<ui-button action='PRG_set' params='{"target" : "{{uid}}"}'>View Details</ui-button>
</ui-section>
{{/each}}
</ui-display>
{{/if}}