Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
CampinKiller24 committed Aug 9, 2023
1 parent c22eb47 commit 6bee7fa
Show file tree
Hide file tree
Showing 6 changed files with 306 additions and 2 deletions.
1 change: 1 addition & 0 deletions aurorastation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,7 @@
#include "code\modules\modular_computers\file_system\programs\civilian\crusher_control.dm"
#include "code\modules\modular_computers\file_system\programs\civilian\janitor.dm"
#include "code\modules\modular_computers\file_system\programs\command\account_database.dm"
#include "code\modules\modular_computers\file_system\programs\command\away_manifest.dm"
#include "code\modules\modular_computers\file_system\programs\command\card.dm"
#include "code\modules\modular_computers\file_system\programs\command\command_and_communications.dm"
#include "code\modules\modular_computers\file_system\programs\command\docks.dm"
Expand Down
8 changes: 8 additions & 0 deletions code/controllers/subsystems/records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

var/list/warrants
var/list/viruses
var/list/shuttle_manifests

var/list/excluded_fields
var/list/localized_fields
Expand All @@ -34,6 +35,7 @@
records_locked = list()
warrants = list()
viruses = list()
shuttle_manifests = list()
excluded_fields = list()
localized_fields = list()
manifest = list()
Expand Down Expand Up @@ -106,6 +108,8 @@
warrants += record
if(/datum/record/virus)
viruses += record
if(/datum/record/shuttle_manifest)
shuttle_manifests += record

/datum/controller/subsystem/records/proc/update_record(var/datum/record/record)
switch(record.type)
Expand All @@ -118,6 +122,8 @@
warrants |= record
if(/datum/record/virus)
viruses |= record
if(/datum/record/shuttle_manifest)
shuttle_manifests |= record
onModify(record)

/datum/controller/subsystem/records/proc/remove_record(var/datum/record/record)
Expand All @@ -131,6 +137,8 @@
warrants -= record
if(/datum/record/virus)
viruses *= record
if(/datum/record/shuttle_manifest)
shuttle_manifests -= record
onDelete(record)
qdel(record)

Expand Down
11 changes: 11 additions & 0 deletions code/datums/records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,14 @@ var/warrant_uid = 0
var/antigen
var/spread_type = "Unknown"
cmp_field = "name"

//Manifest record
/datum/record/shuttle_manifest
name = "Unknown"
var/shuttle = "Unknown"
cmp_field = "name"

var/shuttle_uid = 0
/datum/record/shuttle_manifest/New()
..()
id = shuttle_uid++
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@
new /datum/computer_file/program/aidiag(comp),
new /datum/computer_file/program/chemistry_codex(comp),
new /datum/computer_file/program/scanner/science(comp),
new /datum/computer_file/program/scanner/gas(comp)
new /datum/computer_file/program/scanner/gas(comp),
new /datum/computer_file/program/away_manifest(comp)
)
return _prg_list

Expand All @@ -179,6 +180,7 @@
new /datum/computer_file/program/records/employment(comp),
new /datum/computer_file/program/chemistry_codex(comp),
new /datum/computer_file/program/scanner/science(comp),
new /datum/computer_file/program/away_manifest(comp),
new /datum/computer_file/program/scanner/gas(comp)
)
return _prg_list
Expand All @@ -200,6 +202,7 @@
new /datum/computer_file/program/card_mod(comp),
new /datum/computer_file/program/comm(comp, TRUE),
new /datum/computer_file/program/docks(comp),
new /datum/computer_file/program/away_manifest(comp),
new /datum/computer_file/program/records/employment(comp)
)
return _prg_list
Expand Down Expand Up @@ -262,6 +265,7 @@
new /datum/computer_file/program/card_mod(comp),
new /datum/computer_file/program/comm(comp, FALSE),
new /datum/computer_file/program/docks(comp),
new /datum/computer_file/program/away_manifest(comp),
new /datum/computer_file/program/records/employment(comp),
new /datum/computer_file/program/records/security(comp)
)
Expand All @@ -283,6 +287,7 @@
new /datum/computer_file/program/card_mod(comp),
new /datum/computer_file/program/comm(comp, TRUE),
new /datum/computer_file/program/docks(comp),
new /datum/computer_file/program/away_manifest(comp),
new /datum/computer_file/program/camera_monitor(comp),
new /datum/computer_file/program/digitalwarrant(comp),
new /datum/computer_file/program/penal_mechs(comp),
Expand Down Expand Up @@ -492,7 +497,8 @@
new /datum/computer_file/program/civilian/cargoorder(comp),
new /datum/computer_file/program/civilian/cargodelivery(comp),
new /datum/computer_file/program/comm(comp, FALSE),
new /datum/computer_file/program/docks(comp)
new /datum/computer_file/program/docks(comp),
new /datum/computer_file/program/away_manifest(comp)
)
return _prg_list

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/datum/computer_file/program/away_manifest
filename = "awayshuttlemanifest"
filedesc = "Shuttle Manifest Program"
extended_desc = "Used to view the manifest of the Horizon's shuttles."
program_icon_state = "away"
program_key_icon_state = "lightblue_key"
color = LIGHT_COLOR_BLUE
size = 8
requires_ntnet = TRUE
available_on_ntnet = TRUE
required_access_run = access_heads
required_access_download = access_heads //change to || others?
usage_flags = PROGRAM_ALL_REGULAR
tgui_id = "AwayShuttleManifest"
var/datum/record/shuttle_manifest/active_record //do I need this? Or should I do like, a custom type with the vars from the tgui file

/datum/computer_file/program/away_manifest/ui_data(mob/user)
var/list/data = list()

if(active_record)
data["active_record"] = list(
"name" = active_record.name,
"shuttle" = active_record.shuttle
)
else
var/list/allshuttles = list()
for (var/datum/record/shuttle_manifest/m in SSrecords.shuttle_manifests)
allshuttles += list(list(
"name" = m.name,
"shuttle" = m.shuttle
))
data["allshuttles"] = allshuttles
data["active_record"] = null
return data

/datum/computer_file/program/away_manifest/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return

switch(action)
if("am_menu")
active_record = null
SStgui.update_uis(computer)

if("editentry")
for(var/datum/record/shuttle_manifest/m in SSrecords.shuttle_manifests)
if(m.id == text2num(params["editentry"]))
active_record = m
break

if("back")
active_record = null
SStgui.update_uis(computer)

//Check ID for command/ops/research
var/mob/user = usr
if(!istype(user))
return
var/obj/item/card/id/I = user.GetIdCard()
if(!istype(I) || !I.registered_name || !(access_heads in I.access) || issilicon(user) || !(access_research in I.access) || !(access_cargo in I.access))
to_chat(user, SPAN_WARNING("Authentication error: Unable to locate ID with appropriate access to allow this operation."))
return

switch(action)
if("addentry")
. = TRUE
//do I need to make a new record type for this?
//probably add a 'shuttle manifest' or whatever record to the datums
var/datum/record/shuttle_manifest/m = new()
var/temp = sanitize(input(usr, "Which shuttle is this for?") as null|anything in list("Canary", "Intrepid", "Spark"))
if(!computer.use_check_and_message(user))
if(temp == "Canary")
m.name = "Unknown"
m.shuttle = "Canary"
if(temp == "Intrepid")
m.name = "Unknown"
m.shuttle = "Intrepid"
if(temp == "Spark")
m.name = "Unknown"
m.shuttle = "Spark"
if(isnull(temp))
return
active_record = m

if("saveentry")
SSrecords.update_record(active_record)
active_record = null
SStgui.update_uis(computer)

if("deleteentry")
SSrecords.remove_record(active_record)
active_record = null
SStgui.update_uis(computer)

if("editentryname")
. = TRUE
var/names = list()
for(var/datum/record/general/r in SSrecords.records)
names += r.name
var/newname = sanitize(input(usr, "Please enter name.") as null|anything in names)
if(!computer.use_check_and_message(user))
if(!newname)
return
active_record.name = newname

if("editentrynamecustom")
. = TRUE
var/newname = sanitize(input("Please enter name.") as null|text)
if(!computer.use_check_and_message(user))
if(!newname)
return
active_record.name = newname
165 changes: 165 additions & 0 deletions tgui/packages/tgui/interfaces/AwayShuttleManifest.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import { useBackend } from '../backend';
import { Button, LabeledList, NoticeBox, Section, Table } from '../components';
import { NtosWindow } from '../layouts';

export type AwayShuttleData = {
shuttle_manifest: ShuttleCrew[];
active_record: ShuttleCrew;
};

type ShuttleCrew = {
name: string;
shuttle: string;
id: number;
};

export const AwayShuttleManifest = (props, context) => {
const { act, data } = useBackend<AwayShuttleData>(context);

return (
<NtosWindow resizable width={900} height={600}>
<NtosWindow.Content scrollable>
{data.active_record ? <ManifestEntryEdit /> : <AllShuttles />}
</NtosWindow.Content>
</NtosWindow>
);
};

export const ManifestEntryEdit = (props, context) => {
const { act, data } = useBackend<AwayShuttleData>(context);

return (
<Section
title="Edit Manifest"
buttons={
<>
<Button content="Back" onClick={() => act('am_menu')} />
<Button
content="Save"
color="green"
onClick={() => act('saveentry')}
/>
<Button
content="Delete"
color="red"
onClick={() => act('deleteentry')}
/>
</>
}>
<LabeledList>
<LabeledList.Item label="Name">
{data.active_record.name}&nbsp;
<Button
icon="user"
tooltip="Use a name found in the records."
onClick={() => act('editentryname')}
/>
<Button
icon="question"
tooltip="Use a custom name."
onClick={() => act('editentrynamecustom')}
/>
</LabeledList.Item>
/*<LabeledList.Item label="Shuttle">
{data.active_record.shuttle}&nbsp;
<Button
icon="sticky-note"
tooltip="Edit shuttle."
onClick={() => act('editentryshuttle')}
/>
</LabeledList.Item>*/
</LabeledList>
</Section>
);
};

export const AllShuttles = (props, context) => {
const { act, data} = useBackend<AwayShuttleData>(context);

return (
<>
<Section
title="SCCV Canary"
buttons={
<Button content="Add Entry" onClick={() => act ('addentry')} />
}>
{data.shuttle_manifest && data.shuttle_manifest.length ? (
<Table>
<Table.Row header>
<Table.Cell>Name</Table.Cell>
</Table.Row>
{data.shuttle_manifest
.filter((w) => w.shuttle === 'Canary')
.map((ShuttleCrew) => (
<Table.Row key={ShuttleCrew.id}>
<Table.Cell>
<Button
content={ShuttleCrew.name}
onClick={() =>
act('editentry', { editentry: ShuttleCrew.id })
}
/>
</Table.Cell>
<Table.Cell>{ShuttleCrew.shuttle}</Table.Cell>
</Table.Row>
))}
</Table>
) : (
<NoticeBox>No crew detected.</NoticeBox>
)}
<Section
title="SCCV Intrepid"
buttons={
<Button content="Add Entry" onClick={() => act ('addentry')} />
}>
{data.shuttle_manifest && data.shuttle_manifest.length ? (
<Table>
<Table.Row header>
<Table.Cell>Name</Table.Cell>
</Table.Row>
{data.shuttle_manifest
.filter((w) => w.shuttle === 'Intrepid')
.map((ShuttleCrew) => (
<Table.Row key={ShuttleCrew.id}>
<Table.Cell>
<Button
content={ShuttleCrew.name}
onClick={() =>
act('editentry', { editentry: ShuttleCrew.id })
}
/>
</Table.Cell>
<Table.Cell>{ShuttleCrew.shuttle}</Table.Cell>
</Table.Row>
))}
</Table>
) : (
<NoticeBox>No crew detected.</NoticeBox>
<Section
title="SCCV Spark"
buttons={
<Button content="Add Entry" onClick={() => act ('addentry')} />
}>
{data.shuttle_manifest && data.shuttle_manifest.length ? (
<Table>
<Table.Row header>
<Table.Cell>Name</Table.Cell>
</Table.Row>
{data.shuttle_manifest
.filter((w) => w.shuttle === 'Spark')
.map((ShuttleCrew) => (
<Table.Row key={ShuttleCrew.id}>
<Table.Cell>
<Button
content={ShuttleCrew.name}
onClick={() =>
act('editentry', { editentry: ShuttleCrew.id })
}
/>
</Table.Cell>
<Table.Cell>{ShuttleCrew.shuttle}</Table.Cell>
</Table.Row>
))}
</Table>
) : (
<NoticeBox>No crew detected.</NoticeBox>

0 comments on commit 6bee7fa

Please sign in to comment.