mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-28 14:37:04 +01:00
Ports HTML manifest to TGUI (#16210)
* Ghost manifest is tgui now * moved to tgui modules * Delete crew_manifest.dm * global * ghost -> nologo * sorry mr. tgui, i forgot about you again * Jade review + more trimming * lobby and silicons get some love * bye bye, all traces of old manifest. * renamed
This commit is contained in:
@@ -5,129 +5,6 @@
|
||||
//This list tracks characters spawned in the world and cannot be modified in-game. Currently referenced by respawn_character().
|
||||
var/list/locked = list()
|
||||
|
||||
/datum/datacore/proc/get_manifest(monochrome, OOC)
|
||||
var/list/heads = new()
|
||||
var/list/sec = new()
|
||||
var/list/eng = new()
|
||||
var/list/med = new()
|
||||
var/list/sci = new()
|
||||
var/list/ser = new()
|
||||
var/list/sup = new()
|
||||
var/list/bot = new()
|
||||
var/list/misc = new()
|
||||
var/list/isactive = new()
|
||||
var/dat = {"
|
||||
<head><style>
|
||||
.manifest {border-collapse:collapse;}
|
||||
.manifest td, th {border:1px solid [monochrome?"black":"#DEF; background-color:white; color:black"]; padding:.25em}
|
||||
.manifest th {height: 2em; [monochrome?"border-top-width: 3px":"background-color: #48C; color:white"]}
|
||||
.manifest tr.head th { [monochrome?"border-top-width: 1px":"background-color: #488;"] }
|
||||
.manifest td:first-child {text-align:right}
|
||||
.manifest tr.alt td {[monochrome?"border-top-width: 2px":"background-color: #DEF"]}
|
||||
</style></head>
|
||||
<table class="manifest" width='350px'>
|
||||
<tr class='head'><th>Name</th><th>Rank</th><th>Activity</th></tr>
|
||||
"}
|
||||
var/even = 0
|
||||
// sort mobs
|
||||
for(var/datum/data/record/t in GLOB.data_core.general)
|
||||
var/name = t.fields["name"]
|
||||
var/rank = t.fields["rank"]
|
||||
var/real_rank = t.fields["real_rank"]
|
||||
if(OOC)
|
||||
var/activetext = "Inactive"
|
||||
for(var/thing in GLOB.human_list)
|
||||
var/mob/living/carbon/human/H = thing
|
||||
if(H.real_name != name)
|
||||
continue
|
||||
if(H.client && H.client.inactivity <= 6000)
|
||||
activetext = "Active"
|
||||
break
|
||||
if(isLivingSSD(H))
|
||||
activetext = "SSD"
|
||||
break
|
||||
isactive[name] = activetext
|
||||
else
|
||||
isactive[name] = t.fields["p_stat"]
|
||||
var/department = 0
|
||||
if(real_rank in GLOB.command_positions)
|
||||
heads[name] = rank
|
||||
department = 1
|
||||
if(real_rank in GLOB.security_positions)
|
||||
sec[name] = rank
|
||||
department = 1
|
||||
if(real_rank in GLOB.engineering_positions)
|
||||
eng[name] = rank
|
||||
department = 1
|
||||
if(real_rank in GLOB.medical_positions)
|
||||
med[name] = rank
|
||||
department = 1
|
||||
if(real_rank in GLOB.science_positions)
|
||||
sci[name] = rank
|
||||
department = 1
|
||||
if(real_rank in GLOB.service_positions)
|
||||
ser[name] = rank
|
||||
department = 1
|
||||
if(real_rank in GLOB.supply_positions)
|
||||
sup[name] = rank
|
||||
department = 1
|
||||
if(real_rank in GLOB.nonhuman_positions)
|
||||
bot[name] = rank
|
||||
department = 1
|
||||
if(!department && !(name in heads))
|
||||
misc[name] = rank
|
||||
if(heads.len > 0)
|
||||
dat += "<tr><th colspan=3>Heads</th></tr>"
|
||||
for(var/name in heads)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[heads[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
if(sec.len > 0)
|
||||
dat += "<tr><th colspan=3>Security</th></tr>"
|
||||
for(var/name in sec)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[sec[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
if(eng.len > 0)
|
||||
dat += "<tr><th colspan=3>Engineering</th></tr>"
|
||||
for(var/name in eng)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[eng[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
if(med.len > 0)
|
||||
dat += "<tr><th colspan=3>Medical</th></tr>"
|
||||
for(var/name in med)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[med[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
if(sci.len > 0)
|
||||
dat += "<tr><th colspan=3>Science</th></tr>"
|
||||
for(var/name in sci)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[sci[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
if(ser.len > 0)
|
||||
dat += "<tr><th colspan=3>Service</th></tr>"
|
||||
for(var/name in ser)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[ser[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
if(sup.len > 0)
|
||||
dat += "<tr><th colspan=3>Supply</th></tr>"
|
||||
for(var/name in sup)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[sup[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
if(bot.len > 0)
|
||||
dat += "<tr><th colspan=3>Silicon</th></tr>"
|
||||
for(var/name in bot)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[bot[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
if(misc.len > 0)
|
||||
dat += "<tr><th colspan=3>Miscellaneous</th></tr>"
|
||||
for(var/name in misc)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[name]</td><td>[misc[name]]</td><td>[isactive[name]]</td></tr>"
|
||||
even = !even
|
||||
|
||||
dat += "</table>"
|
||||
dat = replacetext(dat, "\n", "") // so it can be placed on paper correctly
|
||||
dat = replacetext(dat, "\t", "")
|
||||
return dat
|
||||
|
||||
|
||||
/*
|
||||
We can't just insert in HTML into the TGUI so we need the raw data to play with.
|
||||
Instead of creating this list over and over when someone leaves their PDA open to the page
|
||||
|
||||
@@ -602,12 +602,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
/mob/dead/observer/verb/view_manifest()
|
||||
set name = "View Crew Manifest"
|
||||
set category = "Ghost"
|
||||
|
||||
var/dat
|
||||
dat += "<h4>Crew Manifest</h4>"
|
||||
dat += GLOB.data_core.get_manifest(OOC = TRUE)
|
||||
|
||||
src << browse(dat, "window=manifest;size=370x420;can_close=1")
|
||||
GLOB.generic_crew_manifest.ui_interact(usr, state = GLOB.observer_state)
|
||||
|
||||
//this is called when a ghost is drag clicked to something.
|
||||
/mob/dead/observer/MouseDrop(atom/over)
|
||||
|
||||
@@ -288,13 +288,7 @@
|
||||
|
||||
// this function displays the stations manifest in a separate window
|
||||
/mob/living/silicon/proc/show_station_manifest()
|
||||
var/dat
|
||||
dat += "<h4>Crew Manifest</h4>"
|
||||
if(GLOB.data_core)
|
||||
dat += GLOB.data_core.get_manifest(1) // make it monochrome
|
||||
dat += "<br>"
|
||||
src << browse(dat, "window=airoster")
|
||||
onclose(src, "airoster")
|
||||
GLOB.generic_crew_manifest.ui_interact(usr, state = GLOB.not_incapacitated_state)
|
||||
|
||||
/mob/living/silicon/assess_threat() //Secbots won't hunt silicon units
|
||||
return -10
|
||||
@@ -373,4 +367,3 @@
|
||||
/////////////////////////////////// EAR DAMAGE ////////////////////////////////////
|
||||
/mob/living/silicon/can_hear()
|
||||
. = TRUE
|
||||
|
||||
|
||||
@@ -586,11 +586,7 @@
|
||||
client.prefs.language = "None"
|
||||
|
||||
/mob/new_player/proc/ViewManifest()
|
||||
var/dat = "<html><body>"
|
||||
dat += "<h4>Crew Manifest</h4>"
|
||||
dat += GLOB.data_core.get_manifest(OOC = 1)
|
||||
|
||||
src << browse(dat, "window=manifest;size=370x420;can_close=1")
|
||||
GLOB.generic_crew_manifest.ui_interact(usr, state = GLOB.always_state)
|
||||
|
||||
/mob/new_player/Move()
|
||||
return 0
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
GLOBAL_DATUM_INIT(generic_crew_manifest, /datum/ui_module/generic_crew_manifest, new)
|
||||
|
||||
/datum/ui_module/generic_crew_manifest
|
||||
name = "Crew Manifest"
|
||||
|
||||
/datum/ui_module/generic_crew_manifest/ui_interact(user, ui_key = "GenericCrewManifest", datum/tgui/ui = null, datum/tgui/master_ui = null, state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "GenericCrewManifest", name, 588, 510, master_ui, state)
|
||||
ui.set_autoupdate(FALSE)
|
||||
ui.open()
|
||||
|
||||
/datum/ui_module/generic_crew_manifest/ui_data(user)
|
||||
var/list/data = list()
|
||||
GLOB.data_core.get_manifest_json()
|
||||
data["manifest"] = GLOB.PDA_Manifest
|
||||
return data
|
||||
@@ -2457,6 +2457,7 @@
|
||||
#include "code\modules\tgui\modules\atmos_control.dm"
|
||||
#include "code\modules\tgui\modules\crew_monitor.dm"
|
||||
#include "code\modules\tgui\modules\ert_manager.dm"
|
||||
#include "code\modules\tgui\modules\generic_crew_manifest.dm"
|
||||
#include "code\modules\tgui\modules\law_manager.dm"
|
||||
#include "code\modules\tgui\modules\power_monitor.dm"
|
||||
#include "code\modules\tgui\modules\volume_mixer.dm"
|
||||
|
||||
@@ -28,6 +28,7 @@ import './styles/themes/retro.scss';
|
||||
import './styles/themes/safe.scss';
|
||||
import './styles/themes/security.scss';
|
||||
import './styles/themes/syndicate.scss';
|
||||
import './styles/themes/nologo.scss';
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Section } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
import { CrewManifest } from "./common/CrewManifest";
|
||||
|
||||
export const GenericCrewManifest = (props, context) => {
|
||||
return (
|
||||
<Window resizable theme="nologo">
|
||||
<Window.Content scrollable>
|
||||
<Section noTopPadding>
|
||||
<CrewManifest />
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
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,5 @@
|
||||
.theme-nologo {
|
||||
.Layout__content {
|
||||
background-image: none;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user