Skip to content

Commit

Permalink
the stars burn bright, so bright
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Atlas committed Aug 23, 2024
1 parent 4047eeb commit cfb5f69
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 9 deletions.
66 changes: 65 additions & 1 deletion code/controllers/subsystems/processing/odyssey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ SUBSYSTEM_DEF(odyssey)
data["scenario_name"] = SSodyssey.scenario.name
data["scenario_desc"] = SSodyssey.scenario.desc
data["scenario_canonicity"] = SSodyssey.scenario.scenario_type == SCENARIO_TYPE_CANON ? "Canon" : "Non-Canon"
data["is_storyteller"] = isstoryteller(user)

if(length(scenario.roles))
data["scenario_roles"] = list()
Expand All @@ -131,7 +132,8 @@ SUBSYSTEM_DEF(odyssey)
list(
"name" = scenario_role.name,
"desc" = scenario_role.desc,
"outfit" = "[scenario_role.outfit]"
"outfit" = "[scenario_role.outfit]",
"type" = scenario_role.type
)
)
return data
Expand All @@ -156,5 +158,67 @@ SUBSYSTEM_DEF(odyssey)
if(ispath(outfit_type, /obj/outfit))
player.preEquipOutfit(outfit_type, FALSE)
player.equipOutfit(outfit_type, FALSE)
return TRUE

if("edit_scenario_name")
if(!isstoryteller(usr))
return

var/new_scenario_name = tgui_input_text(usr, "Insert the new name for your scenario. Remember that this will be visible for anyone in the Stat Panel.", "Odyssey Panel", max_length = MAX_NAME_LEN)
if(!new_scenario_name)
return

log_and_message_admins("has changed the scenario name from [SSodyssey.scenario.name] to [new_scenario_name]")
SSodyssey.scenario.name = new_scenario_name
return TRUE

if("edit_scenario_desc")
if(!isstoryteller(usr))
return

var/new_scenario_desc = tgui_input_text(usr, "Insert the new description for your scenario. This is visible only in the Odyssey Panel.", "Odyssey Panel", max_length = MAX_MESSAGE_LEN)
if(!new_scenario_desc)
return

log_and_message_admins("has changed the scenario description")
SSodyssey.scenario.desc = new_scenario_desc
return TRUE

if("edit_role")
if(!isstoryteller(usr) && !check_rights(R_ADMIN))
return

var/role_path = text2path(params["role_type"])
if(!role_path || !ispath(role_path, /singleton/role))
to_chat(usr, SPAN_WARNING("Invalid or inexisting role!"))
return

var/singleton/role/role_to_edit = GET_SINGLETON(role_path)
var/editing_name = params["new_name"]
var/editing_desc = params["new_desc"]
var/editing_outfit = params["edit_outfit"]

if(editing_name)
var/new_name = tgui_input_text(usr, "Insert the new name for this role.", "Odyssey Panel", max_length = MAX_NAME_LEN)
if(new_name)
log_and_message_admins("has changed the [role_to_edit.name] role's name to [new_name]")
role_to_edit.name = new_name
return TRUE

if(editing_desc)
var/new_desc = tgui_input_text(usr, "Insert the new description for this role.", "Odyssey Panel", max_length = MAX_MESSAGE_LEN)
if(new_desc)
log_and_message_admins("has changed the [role_to_edit.name] role's description")
role_to_edit.desc = new_desc
return TRUE

if(editing_outfit)
var/chosen_outfit = tgui_input_list(usr, "Select the new outfit for this role.", "Odyssey Panel", GLOB.outfit_cache)
if(chosen_outfit)
var/obj/outfit/new_outfit = GLOB.outfit_cache[chosen_outfit]
if(new_outfit)
log_and_message_admins("has changed the [role_to_edit.name] role's outfit from [role_to_edit.outfit] to [new_outfit]")
role_to_edit.outfit = new_outfit.type
return TRUE


10 changes: 10 additions & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var/list/admin_verbs_admin = list(
/client/proc/rename_silicon, //properly renames silicons,
/client/proc/manage_silicon_laws,
/client/proc/check_antagonists,
/client/proc/odyssey_panel,
/client/proc/dsay, /*talk in deadchat using our ckey/fakekey*/
/client/proc/toggleprayers, /*toggles prayers on/off*/
// /client/proc/toggle_hear_deadcast, /*toggles whether we hear deadchat*/
Expand Down Expand Up @@ -424,6 +425,7 @@ var/list/admin_verbs_mod = list(
/client/proc/dsay,
/datum/admins/proc/show_player_panel,
/client/proc/check_antagonists,
/client/proc/odyssey_panel,
/client/proc/jobbans,
/client/proc/cmd_admin_subtle_message, /*send an message to somebody as a 'voice in their head'*/
/datum/admins/proc/paralyze_mob,
Expand Down Expand Up @@ -492,6 +494,7 @@ var/list/admin_verbs_cciaa = list(
/client/proc/check_fax_history,
/client/proc/aooc,
/client/proc/check_antagonists,
/client/proc/odyssey_panel,
/client/proc/toggle_aooc
)

Expand Down Expand Up @@ -629,6 +632,13 @@ var/list/admin_verbs_cciaa = list(
feedback_add_details("admin_verb","CHA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
return

/client/proc/odyssey_panel()
set name = "Odyssey Panel"
set category = "Admin"

SSodyssey.ui_interact(src)
feedback_add_details("admin_verb","ODP")

/client/proc/jobbans()
set name = "Display Job bans"
set category = "Admin"
Expand Down
78 changes: 70 additions & 8 deletions tgui/packages/tgui/interfaces/OdysseyPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { BooleanLike } from 'common/react';
import { useBackend } from '../backend';
import { Button, NoticeBox, Section } from '../components';
import { Box, Button, NoticeBox, Section } from '../components';
import { Window } from '../layouts';

export type OdysseyData = {
scenario_name: string;
scenario_desc: string;
scenario_canonicity: string;
is_storyteller: BooleanLike;

scenario_roles: Role[];
};
Expand All @@ -14,6 +16,7 @@ type Role = {
name: string;
desc: string;
outfit: string;
type: string;
};

export const OdysseyPanel = (props, context) => {
Expand All @@ -22,8 +25,25 @@ export const OdysseyPanel = (props, context) => {
return (
<Window resizable theme="malfunction" width={500} height={600}>
<Window.Content scrollable>
<Section title={data.scenario_name}>
<NoticeBox>{data.scenario_desc}</NoticeBox>
<Section
title={data.scenario_name}
buttons={
<Button
icon="pencil"
color="green"
disabled={!data.is_storyteller}
onClick={() => act('edit_scenario_name')}
/>
}>
<NoticeBox>
{data.scenario_desc}{' '}
<Button
icon="pencil"
color="green"
disabled={!data.is_storyteller}
onClick={() => act('edit_scenario_desc')}
/>
</NoticeBox>
This is a {data.scenario_canonicity} scenario.
</Section>
{data.scenario_roles && data.scenario_roles.length ? (
Expand Down Expand Up @@ -53,14 +73,56 @@ export const RoleDisplay = (props, context) => {
title={role.name}
key={role.name}
buttons={
!data.is_storyteller ? (
<Button
content="Equip"
color="green"
disabled={data.is_storyteller}
icon="star"
onClick={() =>
act('equip_outfit', { outfit_type: role.outfit })
}
/>
) : (
<Button
icon="pencil"
color="green"
disabled={!data.is_storyteller}
onClick={() =>
act('edit_role', { new_name: 1, role_type: role.type })
}
/>
)
}>
{role.desc}{' '}
{data.is_storyteller ? (
<Button
content="Equip"
icon="pencil"
color="green"
icon="star"
onClick={() => act('equip_outfit', { outfit_type: role.outfit })}
disabled={!data.is_storyteller}
onClick={() =>
act('edit_role', { new_desc: 1, role_type: role.type })
}
/>
}>
{role.desc}
) : (
''
)}
{data.is_storyteller ? (
<Box>
{' '}
Current Outfit: {role.outfit}{' '}
<Button
content="Edit"
icon="pencil"
color="red"
onClick={() =>
act('edit_role', { edit_outfit: 1, role_type: role.type })
}
/>{' '}
</Box>
) : (
''
)}
</Section>
))}
</Section>
Expand Down

0 comments on commit cfb5f69

Please sign in to comment.