This commit is contained in:
SandPoot
2024-05-23 21:53:15 -03:00
parent 2e5e548369
commit ad0f659226
47 changed files with 164 additions and 231 deletions
+52
View File
@@ -0,0 +1,52 @@
/datum/crew_manifest
/datum/crew_manifest/ui_state(mob/user)
return GLOB.always_state
/datum/crew_manifest/ui_status(mob/user, datum/ui_state/state)
return (isnewplayer(user) || isobserver(user) || isAI(user) || ispAI(user)) ? UI_INTERACTIVE : UI_CLOSE
/datum/crew_manifest/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "CrewManifest")
ui.open()
/datum/crew_manifest/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
if (..())
return
/datum/crew_manifest/ui_data(mob/user)
var/list/positions = list(
DEPARTMENT_COMMAND = 0,
DEPARTMENT_SECURITY = 0,
DEPARTMENT_ENGINEERING = 0,
DEPARTMENT_MEDICAL = 0,
DEPARTMENT_SCIENCE = 0,
DEPARTMENT_CARGO = 0,
DEPARTMENT_SERVICE = 0,
DEPARTMENT_SILICON = 0
)
var/list/departments = list(
list("flag" = DEPARTMENT_BITFLAG_COMMAND, "name" = DEPARTMENT_COMMAND),
list("flag" = DEPARTMENT_BITFLAG_SECURITY, "name" = DEPARTMENT_SECURITY),
list("flag" = DEPARTMENT_BITFLAG_ENGINEERING, "name" = DEPARTMENT_ENGINEERING),
list("flag" = DEPARTMENT_BITFLAG_MEDICAL, "name" = DEPARTMENT_MEDICAL),
list("flag" = DEPARTMENT_BITFLAG_SCIENCE, "name" = DEPARTMENT_SCIENCE),
list("flag" = DEPARTMENT_BITFLAG_CARGO, "name" = DEPARTMENT_CARGO),
list("flag" = DEPARTMENT_BITFLAG_SERVICE, "name" = DEPARTMENT_SERVICE),
list("flag" = DEPARTMENT_BITFLAG_SILICON, "name" = DEPARTMENT_SILICON)
)
for(var/datum/job/job in SSjob.occupations)
for(var/department in departments)
// Check if the job is part of a department using its flag
// Will return true for Research Director if the department is Science or Command, for example
if(job.departments & department["flag"])
// Add open positions to current department
positions[department["name"]] += (job.total_positions - job.current_positions)
return list(
"manifest" = GLOB.data_core.get_manifest(),
"positions" = positions
)
@@ -720,11 +720,10 @@
return
client.crew_manifest_delay = world.time + (1 SECONDS)
var/dat = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'></head><body>"
dat += "<h4>Crew Manifest</h4>"
dat += GLOB.data_core.get_manifest(OOC = 1)
if(!GLOB.crew_manifest_tgui)
GLOB.crew_manifest_tgui = new /datum/crew_manifest(src)
src << browse(dat, "window=manifest;size=387x420;can_close=1")
GLOB.crew_manifest_tgui.ui_interact(src)
/mob/dead/new_player/Move()
return FALSE
+3 -4
View File
@@ -730,11 +730,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
return
client.crew_manifest_delay = world.time + (1 SECONDS)
var/dat
dat += "<h4>Crew Manifest</h4>"
dat += GLOB.data_core.get_manifest()
if(!GLOB.crew_manifest_tgui)
GLOB.crew_manifest_tgui = new /datum/crew_manifest(src)
src << browse(dat, "window=manifest;size=387x420;can_close=1")
GLOB.crew_manifest_tgui.ui_interact(src)
//this is called when a ghost is drag clicked to something.
/mob/dead/observer/MouseDrop(atom/over)
+3 -6
View File
@@ -413,13 +413,10 @@
return
client.crew_manifest_delay = world.time + (1 SECONDS)
var/dat = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><title>Crew Roster</title></head><body><b>Crew Roster:</b><br><br>"
if(!GLOB.crew_manifest_tgui)
GLOB.crew_manifest_tgui = new /datum/crew_manifest(src)
dat += GLOB.data_core.get_manifest()
dat += "</body></html>"
src << browse(dat, "window=airoster")
onclose(src, "airoster")
GLOB.crew_manifest_tgui.ui_interact(src)
/mob/living/silicon/update_transform(do_animate)
var/matrix/ntransform = matrix(transform) //aka transform.Copy()