diff --git a/code/modules/admin/modify_robot.dm b/code/modules/admin/modify_robot.dm index 3c1682f40e..1ffcf78be2 100644 --- a/code/modules/admin/modify_robot.dm +++ b/code/modules/admin/modify_robot.dm @@ -84,7 +84,7 @@ .["target"]["availalbe_channels"] = availalbe_channels // Components .["target"]["components"] = get_components() - .["cell"] = target.cell?.name + .["cell"] = list("name" = target.cell?.name, "charge" = target.cell?.charge, "maxcharge" = target.cell?.maxcharge) .["cell_options"] = get_cells() // Access .["id_icon"] = icon2html(target.idcard, user, sourceonly=TRUE) @@ -368,6 +368,17 @@ if(istype(C, /datum/robot_component/cell)) target.cell = null return TRUE + if("adjust_cell_charge") + target.cell.charge = text2num(params["charge"]) + return TRUE + if("adjust_brute") + var/datum/robot_component/C = locate(params["component"]) + C.brute_damage = text2num(params["damage"]) + return TRUE + if("adjust_electronics") + var/datum/robot_component/C = locate(params["component"]) + C.electronics_damage = text2num(params["damage"]) + return TRUE if("add_access") target.idcard.access += text2num(params["access"]) return TRUE diff --git a/code/modules/client/preference_setup/loadout/loadout_accessories.dm b/code/modules/client/preference_setup/loadout/loadout_accessories.dm index 64e5e86cce..39ac6ae97e 100644 --- a/code/modules/client/preference_setup/loadout/loadout_accessories.dm +++ b/code/modules/client/preference_setup/loadout/loadout_accessories.dm @@ -568,62 +568,4 @@ Talon pin "Studded Belt" = /obj/item/clothing/accessory/belt/studded ) gear_tweaks += new/datum/gear_tweak/path(wristband_lists) - gear_tweaks += gear_tweak_free_color_choice - -/datum/gear/accessory/plushie - display_name = "Plushie Selection" - description = "A single plushie of your selection!" - path = /obj/item/toy/plushie/nymph - -/datum/gear/accessory/plushie/New() - ..() - var/plushie = list( - "Nymph" = /obj/item/toy/plushie/nymph, - "Mouse" = /obj/item/toy/plushie/mouse, - "Kitten" = /obj/item/toy/plushie/kitten, - "Lizard" = /obj/item/toy/plushie/lizard, - "Black cat" = /obj/item/toy/plushie/black_cat, - "Black fox" = /obj/item/toy/plushie/black_fox, - "Blue fox" = /obj/item/toy/plushie/blue_fox, - "Carp plushie" = /obj/random/carp_plushie, - "Coffee fox" = /obj/item/toy/plushie/coffee_fox, - "Corgi" = /obj/item/toy/plushie/corgi, - "Crimson fox" = /obj/item/toy/plushie/crimson_fox, - "Deer" = /obj/item/toy/plushie/deer, - "Girly corgi" = /obj/item/toy/plushie/girly_corgi, - "Grey cat" = /obj/item/toy/plushie/grey_cat, - "Marble fox" = /obj/item/toy/plushie/marble_fox, - "Octopus" = /obj/item/toy/plushie/octopus, - "Orange cat" = /obj/item/toy/plushie/orange_cat, - "Orange fox" = /obj/item/toy/plushie/orange_fox, - "Pink fox" = /obj/item/toy/plushie/pink_fox, - "Purple fox" = /obj/item/toy/plushie/purple_fox, - "Red fox" = /obj/item/toy/plushie/red_fox, - "Robo corgi" = /obj/item/toy/plushie/robo_corgi, - "Siamese cat" = /obj/item/toy/plushie/siamese_cat, - "Spider" = /obj/item/toy/plushie/spider, - "Tabby cat" = /obj/item/toy/plushie/tabby_cat, - "Tuxedo cat" = /obj/item/toy/plushie/tuxedo_cat, - "White cat" = /obj/item/toy/plushie/white_cat, - "Lizard" = /obj/item/toy/plushie/lizardplushie, - "Kobold" = /obj/item/toy/plushie/lizardplushie/kobold, - "Resh" = /obj/item/toy/plushie/lizardplushie/resh, - "Slime" = /obj/item/toy/plushie/slimeplushie, - "Box" = /obj/item/toy/plushie/box, - "Robot" = /obj/item/toy/plushie/borgplushie, - "Medihound" = /obj/item/toy/plushie/borgplushie/medihound, - "Scrubpuppy" = /obj/item/toy/plushie/borgplushie/scrubpuppy, - "Foxbear" = /obj/item/toy/plushie/foxbear, - "Operative" = /obj/item/toy/plushie/nukeplushie, - "Otter" = /obj/item/toy/plushie/otter, - "Vox" = /obj/item/toy/plushie/vox, - "Shark" = /obj/item/toy/plushie/shark, - "Sec Drake" = /obj/item/toy/plushie/borgplushie/drake/sec, - "Med Drake" = /obj/item/toy/plushie/borgplushie/drake/med, - "Sci Drake" = /obj/item/toy/plushie/borgplushie/drake/sci, - "Jani Drake" = /obj/item/toy/plushie/borgplushie/drake/jani, - "Eng Drake" = /obj/item/toy/plushie/borgplushie/drake/eng, - "Mine Drake" = /obj/item/toy/plushie/borgplushie/drake/mine, - "Trauma Drake" = /obj/item/toy/plushie/borgplushie/drake/trauma, - ) - gear_tweaks += new/datum/gear_tweak/path(plushie) + gear_tweaks += gear_tweak_free_color_choice \ No newline at end of file diff --git a/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotComponent.tsx b/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotComponent.tsx index 4450c6009c..8423630acd 100644 --- a/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotComponent.tsx +++ b/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotComponent.tsx @@ -1,9 +1,11 @@ +import { toFixed } from 'common/math'; import { capitalize } from 'common/string'; import { useState } from 'react'; import { useBackend } from 'tgui/backend'; import { Box, Button, + Collapsible, Divider, Dropdown, Flex, @@ -11,24 +13,26 @@ import { Image, Input, Section, + Slider, Stack, } from 'tgui/components'; import { NoSpriteWarning } from '../components'; import { prepareSearch } from '../functions'; -import { Cell, Component, Target } from '../types'; +import { Cell, Component, InstalledCell, Target } from '../types'; export const ModifyRobotComponent = (props: { target: Target; - cell: string | null; + cell: InstalledCell; cells: Record; }) => { + const { act } = useBackend(); const { target, cell, cells } = props; const [searchComponentReplaceText, setSearchComponentReplaceText] = useState(''); const [searchComponentRemoveText, setSearchComponentRemoveText] = useState(''); - const [selectedCell, setSelectedCell] = useState(cell || ''); + const [selectedCell, setSelectedCell] = useState(cell.name || ''); const cell_options = Object.keys(cells) as Array; return ( @@ -46,7 +50,7 @@ export const ModifyRobotComponent = (props: { buttonIcon="arrows-spin" celltype={cells[selectedCell]?.path} selected_cell={selectedCell} - cell={cell || undefined} + cell={cell.name || undefined} /> @@ -65,13 +69,32 @@ export const ModifyRobotComponent = (props: {
Current cell:{' '} - {cell ? ( - capitalize(cell) + {cell.name ? ( + capitalize(cell.name) ) : ( No cell installed! )} + toFixed(value, 2)} + disabled={!cell.charge} + minValue={0} + maxValue={100} + value={((cell.charge || 0) / (cell.maxcharge || 1)) * 100} + onChange={(e, value) => + act('adjust_cell_charge', { + charge: (value / 100) * (cell.maxcharge || 0), + }) + } + > + + Current charge + + {cell.charge} + +
+
+ + {target.components.map((component, i) => { + return ( + + + act('adjust_brute', { + component: component.ref, + damage: value, + }) + } + > + + Brute damage + + {component.brute_damage} + + + + act('adjust_electronics', { + component: component.ref, + damage: value, + }) + } + > + + Electronics damage + + + {component.electronics_damage} + + + + + ); + })} + +
diff --git a/tgui/packages/tgui/interfaces/ModifyRobot/types.ts b/tgui/packages/tgui/interfaces/ModifyRobot/types.ts index 02b840948b..d5bb7aeadf 100644 --- a/tgui/packages/tgui/interfaces/ModifyRobot/types.ts +++ b/tgui/packages/tgui/interfaces/ModifyRobot/types.ts @@ -5,7 +5,7 @@ export type Data = { target: Target | null; all_robots: DropdownEntry[]; model_options: string[] | null; - cell: string | null; + cell: InstalledCell; cell_options: Record; id_icon: string; access_options: Access[] | undefined; @@ -98,6 +98,12 @@ export type PKA = { max_capacity: number; }; +export type InstalledCell = { + name: string | null; + charge: number | null; + maxcharge: number | null; +}; + export type Cell = { path: string; charge: number;