Ports bay's supermatter monitor modular program

This commit is contained in:
CitadelStationBot
2017-06-28 10:05:53 -05:00
parent d2ff4f2374
commit d1a77ef774
21 changed files with 350 additions and 3 deletions
+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"] = 1
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)