From ba9b3e3676abaf83021962a42f133d40bcd0818f Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:53:52 +0100 Subject: [PATCH] include renaming --- code/game/objects/items/antag_spawners.dm | 1 - code/game/objects/items/robot/robot_parts.dm | 1 - code/game/objects/structures/ghost_pods/silicon.dm | 2 -- .../objects/structures/ghost_pods/silicon_vr.dm | 1 - code/modules/mob/living/silicon/robot/robot.dm | 13 +++++-------- .../mob/living/silicon/robot/robot_ui_module.dm | 11 +++++++++++ code/modules/mob/transform_procs.dm | 1 - .../tgui/interfaces/RobotChoose/IconSection.tsx | 13 +++++++++++-- tgui/packages/tgui/interfaces/RobotChoose/index.tsx | 7 ++++++- tgui/packages/tgui/interfaces/RobotChoose/types.ts | 1 + 10 files changed, 34 insertions(+), 17 deletions(-) diff --git a/code/game/objects/items/antag_spawners.dm b/code/game/objects/items/antag_spawners.dm index 8371f5b0175..28817531895 100644 --- a/code/game/objects/items/antag_spawners.dm +++ b/code/game/objects/items/antag_spawners.dm @@ -118,7 +118,6 @@ to speak with your team, and learn what their plan is for today.")) R.key = C.key -// R.Namepick() // Apparnetly making someone a merc lets them pick a name, so this isn't needed. spawn(1) mercs.add_antagonist(R.mind, FALSE, TRUE, FALSE, FALSE, FALSE) diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 32af47b31af..2667b9d3f66 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -225,7 +225,6 @@ feedback_inc("cyborg_birth",1) callHook("borgify", list(O)) - O.namepick() qdel(src) else diff --git a/code/game/objects/structures/ghost_pods/silicon.dm b/code/game/objects/structures/ghost_pods/silicon.dm index 64ac8f5674b..4f50784aed2 100644 --- a/code/game/objects/structures/ghost_pods/silicon.dm +++ b/code/game/objects/structures/ghost_pods/silicon.dm @@ -31,7 +31,6 @@ from the pod is not a crewmember.")) R.ckey = M.ckey visible_message(span_warning("As \the [src] opens, the eyes of the robot flicker as it is activated.")) - R.namepick() log_and_message_admins("successfully opened \a [src] and got a Lost Drone.") ..() @@ -57,7 +56,6 @@ definiton of 'your gravesite' is where your pod is.")) R.ckey = M.ckey visible_message(span_warning("As \the [src] opens, the eyes of the robot flicker as it is activated.")) - R.namepick() ..() /obj/structure/ghost_pod/ghost_activated/swarm_drone diff --git a/code/game/objects/structures/ghost_pods/silicon_vr.dm b/code/game/objects/structures/ghost_pods/silicon_vr.dm index cfc3b781d2f..1039349f2e1 100644 --- a/code/game/objects/structures/ghost_pods/silicon_vr.dm +++ b/code/game/objects/structures/ghost_pods/silicon_vr.dm @@ -21,7 +21,6 @@ from the pod is not a crewmember.")) R.ckey = M.ckey visible_message(span_warning("As \the [src] opens, the eyes of the robot flicker as it is activated.")) - R.namepick() log_and_message_admins("successfully opened \a [src] and got a Lost Drone.") used = TRUE return TRUE diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index cf978597b2f..28e680a0b76 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -407,15 +407,12 @@ to_chat(usr, "You can't pick another custom name. [isshell(src) ? "" : "Go ask for a name change."]") return 0 - spawn(0) - var/newname - newname = sanitizeSafe(tgui_input_text(src,"You are a robot. Enter a name, or leave blank for the default name.", "Name change","", MAX_NAME_LEN), MAX_NAME_LEN) - if (newname) - custom_name = newname - sprite_name = newname + var/newname = sanitizeSafe(tgui_input_text(src,"You are a robot. Enter a name, or leave blank for the default name.", "Name change","", MAX_NAME_LEN), MAX_NAME_LEN) + if (newname) + custom_name = newname + sprite_name = newname - updatename() - update_icon() + updatename() /mob/living/silicon/robot/verb/extra_customization() set name = "Customize Appearance" diff --git a/code/modules/mob/living/silicon/robot/robot_ui_module.dm b/code/modules/mob/living/silicon/robot/robot_ui_module.dm index 78b9c592e40..883ad8c22c9 100644 --- a/code/modules/mob/living/silicon/robot/robot_ui_module.dm +++ b/code/modules/mob/living/silicon/robot/robot_ui_module.dm @@ -3,6 +3,7 @@ name = "Robot Module Configurator" tgui_id = "RobotChoose" var/selected_module + var/newName var/datum/robot_sprite/sprite_datum /datum/tgui_module/robot_ui_module/tgui_state(mob/user) @@ -50,6 +51,8 @@ var/mob/living/silicon/robot/R = host var/datum/asset/spritesheet/robot_icons/spritesheet = get_asset_datum(/datum/asset/spritesheet/robot_icons) + data["currentName"] = newName ? newName : R.name + if(selected_module) data["selected_module"] = selected_module if(!SSrobot_sprites) @@ -112,7 +115,15 @@ sprite_datum = S break . = TRUE + if("rename") + var/name = params["value"] + if(name) + newName = sanitizeSafe(name, MAX_NAME_LEN) if("confirm") + if(!R.custom_name) + if (newName) + R.custom_name = newName + R.sprite_name = newName R.icon_selected = 1 var/module_type = robot_modules[selected_module] R.modtype = selected_module diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index a686e35de7b..5d018586f1d 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -190,7 +190,6 @@ O.custom_speech_bubble = B.custom_speech_bubble callHook("borgify", list(O)) - O.namepick() spawn(0) // Mobs still instantly del themselves, thus we need to spawn or O will never be returned qdel(src) diff --git a/tgui/packages/tgui/interfaces/RobotChoose/IconSection.tsx b/tgui/packages/tgui/interfaces/RobotChoose/IconSection.tsx index 20a03b5cd09..5426dac0c15 100644 --- a/tgui/packages/tgui/interfaces/RobotChoose/IconSection.tsx +++ b/tgui/packages/tgui/interfaces/RobotChoose/IconSection.tsx @@ -1,13 +1,14 @@ import { useBackend } from 'tgui/backend'; -import { Box, Button, Flex, Section, Stack } from 'tgui-core/components'; +import { Box, Button, Flex, Input, Section, Stack } from 'tgui-core/components'; import { classes } from 'tgui-core/react'; export const IconSection = (props: { + currentName: string; sprite?: string | null; size?: string | null; }) => { const { act } = useBackend(); - const { sprite, size } = props; + const { currentName, sprite, size } = props; return (
} > + + act('rename', { value })} + maxLength={52} + /> + {!!sprite && !!size && ( <> diff --git a/tgui/packages/tgui/interfaces/RobotChoose/index.tsx b/tgui/packages/tgui/interfaces/RobotChoose/index.tsx index e3fe8f5a0f9..50288a56a69 100644 --- a/tgui/packages/tgui/interfaces/RobotChoose/index.tsx +++ b/tgui/packages/tgui/interfaces/RobotChoose/index.tsx @@ -16,6 +16,7 @@ export const RobotChoose = (props) => { selected_module, sprite_datum, theme, + currentName, sprite_datum_class, sprite_datum_size, } = data; @@ -34,7 +35,11 @@ export const RobotChoose = (props) => { sortable={possible_sprites} selected={sprite_datum} /> - + diff --git a/tgui/packages/tgui/interfaces/RobotChoose/types.ts b/tgui/packages/tgui/interfaces/RobotChoose/types.ts index 18b57f6ce0d..4febf2232a6 100644 --- a/tgui/packages/tgui/interfaces/RobotChoose/types.ts +++ b/tgui/packages/tgui/interfaces/RobotChoose/types.ts @@ -1,6 +1,7 @@ export type Data = { possible_modules: string[]; possible_sprites?: spriteOption[]; + currentName: string; theme?: string; selected_module?: string; sprite_datum?: string | null;