mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
[TGUI] Cyborg self diagnosis report (#16345)
* tgui diagnosis * mochi and sabre review * final tweaks (maybe) moves getDamageColor out of component makes silicon subsystems GC better * Update tgui.bundle.js
This commit is contained in:
@@ -48,6 +48,8 @@
|
||||
if(brute_damage + electronics_damage >= max_damage)
|
||||
destroy()
|
||||
|
||||
SStgui.update_uis(owner.self_diagnosis)
|
||||
|
||||
/datum/robot_component/proc/heal_damage(brute, electronics, updating_health = TRUE)
|
||||
if(installed != 1)
|
||||
// If it's not installed, can't repair it.
|
||||
@@ -59,6 +61,8 @@
|
||||
brute_damage = max(0, brute_damage - brute)
|
||||
electronics_damage = max(0, electronics_damage - electronics)
|
||||
|
||||
SStgui.update_uis(owner.self_diagnosis)
|
||||
|
||||
/datum/robot_component/proc/is_powered()
|
||||
return (installed == 1) && (brute_damage + electronics_damage < max_damage) && (powered)
|
||||
|
||||
@@ -68,6 +72,8 @@
|
||||
return
|
||||
powered = 1
|
||||
|
||||
SStgui.update_uis(owner.self_diagnosis)
|
||||
|
||||
/datum/robot_component/proc/disable()
|
||||
if(!component_disabled)
|
||||
go_offline()
|
||||
@@ -85,6 +91,8 @@
|
||||
else
|
||||
go_offline()
|
||||
|
||||
SStgui.update_uis(owner.self_diagnosis)
|
||||
|
||||
/datum/robot_component/proc/go_online()
|
||||
return
|
||||
|
||||
|
||||
@@ -306,6 +306,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
|
||||
QDEL_NULL(cell)
|
||||
QDEL_NULL(robot_suit)
|
||||
QDEL_NULL(spark_system)
|
||||
QDEL_NULL(self_diagnosis)
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/robot/proc/pick_module()
|
||||
@@ -506,30 +507,6 @@ GLOBAL_LIST_INIT(robot_verbs_default, list(
|
||||
set name = "Show Station Manifest"
|
||||
show_station_manifest()
|
||||
|
||||
/mob/living/silicon/robot/proc/self_diagnosis()
|
||||
if(!is_component_functioning("diagnosis unit"))
|
||||
return null
|
||||
|
||||
var/dat = "<HEAD><TITLE>[src.name] Self-Diagnosis Report</TITLE></HEAD><BODY>\n"
|
||||
for(var/V in components)
|
||||
var/datum/robot_component/C = components[V]
|
||||
if(C.installed == 0)
|
||||
dat += "<b>[C.name]</b><br>MISSING<br>"
|
||||
else
|
||||
dat += "<b>[C.name]</b>[C.installed == -1 ? "<br>DESTROYED" : ""]<br><table><tr><td>Brute Damage:</td><td>[C.brute_damage]</td></tr><tr><td>Electronics Damage:</td><td>[C.electronics_damage]</td></tr><tr><td>Powered:</td><td>[C.is_powered() ? "Yes" : "No"]</td></tr><tr><td>Toggled:</td><td>[ C.toggled ? "Yes" : "No"]</td></table><br>"
|
||||
return dat
|
||||
|
||||
/mob/living/silicon/robot/verb/self_diagnosis_verb()
|
||||
set category = "Robot Commands"
|
||||
set name = "Self Diagnosis"
|
||||
|
||||
if(!is_component_functioning("diagnosis unit"))
|
||||
to_chat(src, "<span class='warning'>Your self-diagnosis component isn't functioning.</span>")
|
||||
|
||||
var/dat = self_diagnosis()
|
||||
src << browse(dat, "window=robotdiagnosis")
|
||||
|
||||
|
||||
/mob/living/silicon/robot/verb/toggle_component()
|
||||
set category = "Robot Commands"
|
||||
set name = "Toggle Component"
|
||||
|
||||
@@ -61,6 +61,10 @@
|
||||
|
||||
/mob/living/silicon/Destroy()
|
||||
GLOB.silicon_mob_list -= src
|
||||
QDEL_NULL(atmos_control)
|
||||
QDEL_NULL(crew_monitor)
|
||||
QDEL_NULL(law_manager)
|
||||
QDEL_NULL(power_monitor)
|
||||
return ..()
|
||||
|
||||
/mob/living/silicon/proc/alarm_triggered(src, class, area/A, list/O, obj/alarmsource)
|
||||
|
||||
@@ -18,8 +18,16 @@
|
||||
/mob/living/silicon/proc/subsystem_power_monitor
|
||||
)
|
||||
|
||||
/mob/living/silicon/robot
|
||||
var/datum/ui_module/robot_self_diagnosis/self_diagnosis
|
||||
silicon_subsystems = list(
|
||||
/mob/living/silicon/robot/proc/self_diagnosis,
|
||||
/mob/living/silicon/proc/subsystem_law_manager
|
||||
)
|
||||
|
||||
/mob/living/silicon/robot/drone
|
||||
silicon_subsystems = list(
|
||||
/mob/living/silicon/robot/proc/self_diagnosis,
|
||||
/mob/living/silicon/proc/subsystem_law_manager,
|
||||
/mob/living/silicon/proc/subsystem_power_monitor
|
||||
)
|
||||
@@ -33,6 +41,10 @@
|
||||
law_manager = new(src)
|
||||
power_monitor = new(src)
|
||||
|
||||
/mob/living/silicon/robot/init_subsystems()
|
||||
. = ..()
|
||||
self_diagnosis = new(src)
|
||||
|
||||
/********************
|
||||
* Atmos Control *
|
||||
********************/
|
||||
@@ -68,3 +80,12 @@
|
||||
|
||||
power_monitor.ui_interact(usr, state = GLOB.self_state)
|
||||
|
||||
/mob/living/silicon/robot/proc/self_diagnosis()
|
||||
set category = "Robot Commands"
|
||||
set name = "Self Diagnosis"
|
||||
|
||||
if(!is_component_functioning("diagnosis unit"))
|
||||
to_chat(src, "<span class='warning'>Your self-diagnosis component isn't functioning.</span>")
|
||||
return
|
||||
|
||||
self_diagnosis.ui_interact(src)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/datum/ui_module/robot_self_diagnosis
|
||||
/// The robot who can use this UI to diagnose themselves.
|
||||
var/mob/living/silicon/robot/owner
|
||||
|
||||
/datum/ui_module/robot_self_diagnosis/New(mob/living/silicon/S)
|
||||
if(!istype(S))
|
||||
CRASH("A [S.type] was passed to /datum/ui_module/robot_self_diagnosis/New().")
|
||||
owner = S
|
||||
|
||||
/datum/ui_module/robot_self_diagnosis/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.always_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "RobotSelfDiagnosis", "Component Self Diagnosis", 280, 480, master_ui, state)
|
||||
ui.set_autoupdate(FALSE)
|
||||
ui.open()
|
||||
|
||||
/datum/ui_module/robot_self_diagnosis/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
for(var/c in owner.components)
|
||||
var/datum/robot_component/C = owner.components[c]
|
||||
data["component_data"] += list(list(
|
||||
"name" = C.name,
|
||||
"installed" = C.installed,
|
||||
"brute_damage" = C.brute_damage,
|
||||
"electronic_damage" = C.electronics_damage,
|
||||
"max_damage" = C.max_damage,
|
||||
"powered" = C.is_powered(),
|
||||
"status" = C.toggled
|
||||
))
|
||||
return data
|
||||
Reference in New Issue
Block a user