[MIRROR] moves robot decals and animations to an ui (#11851)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-10-21 15:51:47 -07:00
committed by GitHub
parent d7653b0b93
commit dca44a6098
14 changed files with 258 additions and 45 deletions

View File

@@ -18,6 +18,7 @@ GLOBAL_VAR_INIT(allowed_ghost_spawns, 2)
if(isobserver(user))
var/mob/observer/dead/observer = user
observer.selecting_ghostrole = FALSE
qdel(src)
/datum/tgui_module/ghost_spawn_menu/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
. = ..()

View File

@@ -4,7 +4,7 @@
var/list/species_whitelist = list(),
var/list/species_blacklist = list(),
var/datum/tgui_state/state = GLOB.tgui_self_state)
var/datum/tgui_module/appearance_changer/AC = new(src, src, check_species_whitelist, species_whitelist, species_blacklist)
var/datum/tgui_module/appearance_changer/self_deleting/AC = new(src, src, check_species_whitelist, species_whitelist, species_blacklist)
AC.flags = flags
AC.tgui_interact(user, custom_state = state)

View File

@@ -491,50 +491,6 @@
handle_light()
update_icon()
/mob/living/silicon/robot/verb/toggle_robot_decals() // loads overlay UNDER lights.
set category = "Abilities.Settings"
set name = "Toggle Extra Decals"
if(!sprite_datum)
return
if(!LAZYLEN(sprite_datum.sprite_decals))
to_chat(src, span_warning("This module does not support decals."))
return
var/extra_message = "Enabled decals:\n"
for(var/decal in robotdecal_on)
extra_message += decal + "\n"
var/decal_to_toggle = tgui_input_list(src, "Please select which decal you want to toggle\n[extra_message]", "Decal Toggle", sprite_datum.sprite_decals)
if(!decal_to_toggle)
return
decal_to_toggle = lowertext(decal_to_toggle)
if(robotdecal_on.Find(decal_to_toggle))
robotdecal_on -= decal_to_toggle
to_chat(src, span_filter_notice("You disable your \"[decal_to_toggle]\" extra apperances."))
else
robotdecal_on += decal_to_toggle
to_chat(src, span_filter_notice("You enable your \"[decal_to_toggle]\" extra apperances."))
update_icon()
/mob/living/silicon/robot/verb/flick_robot_animation()
set category = "Abilities.Settings"
set name = "Flick Animation"
if(!sprite_datum)
return
if(!LAZYLEN(sprite_datum.sprite_animations))
to_chat(src, span_warning("This module does not support animations."))
return
var/animation_to_play = tgui_input_list(src, "Please select which decal you want to flick", "Flick Decal", sprite_datum.sprite_animations)
if(!animation_to_play)
return
flick("[sprite_datum.sprite_icon_state]-[animation_to_play]", src)
/mob/living/silicon/robot/verb/toggle_glowy_stomach()
set category = "Abilities.Settings"
set name = "Toggle Glowing Stomach & Accents"

View File

@@ -0,0 +1,66 @@
// Robot decal and animation control
/datum/tgui_module/robot_ui_decals
name = "Robot Decal & Animation Control"
tgui_id = "RobotDecals"
/datum/tgui_module/robot_ui_decals/tgui_state(mob/user)
return GLOB.tgui_self_state
/datum/tgui_module/robot_ui_decals/tgui_static_data()
var/list/data = ..()
var/mob/living/silicon/robot/R = host
if(!R.sprite_datum)
return data
data["all_decals"] = R.sprite_datum.sprite_decals
data["all_animations"] = R.sprite_datum.sprite_animations
return data
/datum/tgui_module/robot_ui_decals/tgui_data()
var/list/data = ..()
var/mob/living/silicon/robot/R = host
data["active_decals"] = R.robotdecal_on
var/robot_theme = R.get_ui_theme()
if(robot_theme)
data["theme"] = robot_theme
return data
/datum/tgui_module/robot_ui_decals/tgui_act(action, params)
. = ..()
if(.)
return
var/mob/living/silicon/robot/R = host
if(!R.sprite_datum)
return FALSE
switch(action)
if("toggle_decal")
if(!LAZYLEN(R.sprite_datum.sprite_decals))
return FALSE
var/decal_to_toggle = lowertext(params["value"])
if(!(decal_to_toggle in R.sprite_datum.sprite_decals))
return FALSE
if(R.robotdecal_on.Find(decal_to_toggle))
R.robotdecal_on -= decal_to_toggle
else
R.robotdecal_on += decal_to_toggle
R.update_icon()
. = TRUE
if("flick_animation")
if(!LAZYLEN(R.sprite_datum.sprite_animations))
return FALSE
var/animation_to_flick = lowertext(params["value"])
if(!(animation_to_flick in R.sprite_datum.sprite_animations))
return FALSE
R.cut_overlays()
R.ImmediateOverlayUpdate()
flick("[R.sprite_datum.sprite_icon_state]-[animation_to_flick]", R)
R.update_icon()
. = TRUE

View File

@@ -14,6 +14,7 @@
if(isrobot(user))
var/mob/living/silicon/robot/R = user
R.selecting_module = FALSE
qdel(src)
/datum/tgui_module/robot_ui_module/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
. = ..()

View File

@@ -52,6 +52,7 @@
QDEL_NULL(idcard)
if(laws)
QDEL_NULL(laws)
clear_subsystems()
return ..()
/mob/living/silicon/proc/init_id()

View File

@@ -46,6 +46,15 @@
AH.register_alarm(src, /mob/living/silicon/proc/receive_alarm)
queued_alarms[AH] = list() // Makes sure alarms remain listed in consistent order
/mob/living/silicon/proc/clear_subsystems()
QDEL_NULL(alarm_monitor)
QDEL_NULL(atmos_control)
QDEL_NULL(crew_monitor)
QDEL_NULL(crew_manifest)
QDEL_NULL(law_manager)
QDEL_NULL(power_monitor)
QDEL_NULL(rcon)
/********************
* Alarm Monitor *
********************/
@@ -108,3 +117,23 @@
set name = "RCON"
rcon.tgui_interact(src)
/mob/living/silicon/robot
var/datum/tgui_module/robot_ui_decals/decal_control
/mob/living/silicon/robot/init_subsystems()
..()
decal_control = new(src)
/mob/living/silicon/robot/clear_subsystems()
QDEL_NULL(decal_control)
..()
/mob/living/silicon/robot/verb/toggle_robot_decals()
set category = "Abilities.Settings"
set name = "Control Robot Decals & Animations"
if(!sprite_datum)
return
decal_control.tgui_interact(src)

View File

@@ -11,6 +11,10 @@
var/number_pages = 0
/datum/tgui_module/player_notes/tgui_close(mob/user)
. = ..()
qdel(src)
/datum/tgui_module/player_notes/proc/filter_ckeys(var/page, var/filter)
var/savefile/S=new("data/player_notes.sav")
var/list/note_keys
@@ -106,6 +110,10 @@
var/key = null
/datum/tgui_module/player_notes_info/tgui_close(mob/user)
. = ..()
qdel(src)
/datum/tgui_module/player_notes_info/tgui_state(mob/user)
return ADMIN_STATE(R_ADMIN|R_EVENT|R_DEBUG)

View File

@@ -4,6 +4,10 @@
name = "Admin Shuttle Controller"
tgui_id = "AdminShuttleController"
/datum/tgui_module/admin_shuttle_controller/tgui_close(mob/user)
. = ..()
qdel(src)
/datum/tgui_module/admin_shuttle_controller/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
var/list/data = ..()

View File

@@ -1024,6 +1024,10 @@
return STATUS_CLOSE
return ..()
/datum/tgui_module/appearance_changer/vore/tgui_close(mob/user)
. = ..()
qdel(src)
/datum/tgui_module/appearance_changer/vore/update_active_camera_screen()
cam_screen.vis_contents = list(owner)
cam_background.icon_state = "clear"
@@ -1066,6 +1070,10 @@
flags = APPEARANCE_ALL_COSMETIC
customize_usr = TRUE
/datum/tgui_module/appearance_changer/cocoon/tgui_close(mob/user)
. = ..()
qdel(src)
/datum/tgui_module/appearance_changer/cocoon/tgui_status(mob/user, datum/tgui_state/state)
if(!istype(owner.loc, /obj/item/holder/micro))
return STATUS_CLOSE
@@ -1079,6 +1087,10 @@
flags = APPEARANCE_ALL_COSMETIC
customize_usr = TRUE
/datum/tgui_module/appearance_changer/superpower/tgui_close(mob/user)
. = ..()
qdel(src)
/datum/tgui_module/appearance_changer/superpower/tgui_status(mob/user, datum/tgui_state/state)
var/datum/gene/G = get_gene_from_trait(/datum/trait/positive/superpower_morph)
if(!owner.dna.GetSEState(G.block))
@@ -1093,6 +1105,10 @@
flags = APPEARANCE_ALL_COSMETIC
customize_usr = TRUE
/datum/tgui_module/appearance_changer/innate/tgui_close(mob/user)
. = ..()
qdel(src)
/datum/tgui_module/appearance_changer/innate/tgui_status(mob/user, datum/tgui_state/state)
if(owner.stat != CONSCIOUS)
return STATUS_CLOSE
@@ -1148,3 +1164,8 @@
// Add listeners back
owner.AddComponent(/datum/component/recursive_move)
RegisterSignal(owner, COMSIG_OBSERVER_MOVED, PROC_REF(update_active_camera_screen), TRUE)
/datum/tgui_module/appearance_changer/self_deleting
/datum/tgui_module/appearance_changer/self_deleting/tgui_close(mob/user)
. = ..()
qdel(src)

View File

@@ -217,3 +217,7 @@
/datum/tgui_module/law_manager/admin
/datum/tgui_module/law_manager/admin/tgui_state(mob/user)
return ADMIN_STATE(R_ADMIN|R_EVENT|R_DEBUG)
/datum/tgui_module/law_manager/admin/tgui_close(mob/user)
. = ..()
qdel(src)

View File

@@ -166,6 +166,10 @@
/datum/tgui_module/ship/fullmonty/tgui_state(mob/user)
return ADMIN_STATE(R_ADMIN|R_EVENT|R_DEBUG)
/datum/tgui_module/ship/fullmonty/tgui_close(mob/user)
. = ..()
qdel(src)
/datum/tgui_module/ship/fullmonty/New(host, obj/effect/overmap/visitable/ship/new_linked)
. = ..()
if(!istype(new_linked))

View File

@@ -0,0 +1,117 @@
import { useState } from 'react';
import { useBackend } from 'tgui/backend';
import { Window } from 'tgui/layouts';
import { Box, Button, Input, Section, Stack } from 'tgui-core/components';
import { createSearch } from 'tgui-core/string';
type Data = {
theme?: string;
all_decals?: string[] | null;
all_animations?: string[] | null;
active_decals: string[];
};
export const RobotDecals = () => {
const { act, data } = useBackend<Data>();
const { theme, all_decals, all_animations, active_decals } = data;
const [decalSearchText, setDecalSearchText] = useState('');
const [animationSearchText, setAnimationSearchText] = useState('');
const decalSearcher = createSearch(decalSearchText, (decal: string) => decal);
const filteredDecals = all_decals?.filter(decalSearcher) ?? [];
const animationSearcher = createSearch(
animationSearchText,
(anim: string) => anim,
);
const filteredAnimations = all_animations?.filter(animationSearcher) ?? [];
return (
<Window width={350} height={400} theme={theme || 'ntos'}>
<Window.Content>
<Stack fill>
<Stack.Item grow>
<Section fill title="Robot Decals">
<Stack vertical fill>
<Stack.Item>
<Input
fluid
placeholder="Search for decals..."
value={decalSearchText}
onChange={(value: string) => setDecalSearchText(value)}
/>
</Stack.Item>
<Stack.Divider />
<Stack.Item grow>
<Section fill scrollable>
<Stack vertical fill>
{!filteredDecals.length ? (
<Box color="red">No decals found.</Box>
) : (
filteredDecals.map((decal) => (
<Stack.Item key={decal}>
<Button.Checkbox
fluid
checked={active_decals.includes(decal)}
onClick={() =>
act('toggle_decal', { value: decal })
}
>
{decal}
{active_decals.includes(decal)
? ` (${active_decals.indexOf(decal) + 1})`
: ''}
</Button.Checkbox>
</Stack.Item>
))
)}
</Stack>
</Section>
</Stack.Item>
</Stack>
</Section>
</Stack.Item>
<Stack.Item grow>
<Section fill title="Robot Animations">
<Stack vertical fill>
<Stack.Item>
<Input
fluid
placeholder="Search for animations..."
value={animationSearchText}
onChange={(value: string) => setAnimationSearchText(value)}
/>
</Stack.Item>
<Stack.Divider />
<Stack.Item grow>
<Section fill scrollable>
<Stack vertical fill>
{!filteredAnimations.length ? (
<Box color="red">No animations found.</Box>
) : (
filteredAnimations.map((anim) => (
<Stack.Item key={anim}>
<Button
fluid
ellipsis
onClick={() =>
act('flick_animation', { value: anim })
}
>
{anim}
</Button>
</Stack.Item>
))
)}
</Stack>
</Section>
</Stack.Item>
</Stack>
</Section>
</Stack.Item>
</Stack>
</Window.Content>
</Window>
);
};

View File

@@ -3562,6 +3562,7 @@
#include "code\modules\mob\living\silicon\robot\robot_remote_control.dm"
#include "code\modules\mob\living\silicon\robot\robot_simple_items.dm"
#include "code\modules\mob\living\silicon\robot\robot_ui.dm"
#include "code\modules\mob\living\silicon\robot\robot_ui_decals.dm"
#include "code\modules\mob\living\silicon\robot\robot_ui_module.dm"
#include "code\modules\mob\living\silicon\robot\dogborg\dog_defense_modules.dm"
#include "code\modules\mob\living\silicon\robot\dogborg\dog_modules.dm"