diff --git a/code/modules/admin/modify_robot.dm b/code/modules/admin/modify_robot.dm
index 216367e07a..59da4550be 100644
--- a/code/modules/admin/modify_robot.dm
+++ b/code/modules/admin/modify_robot.dm
@@ -51,10 +51,11 @@
.["target"]["active"] = target.icon_selected
.["target"]["front"] = icon2base64(get_flat_icon(target,dir=SOUTH,no_anim=TRUE))
.["target"]["side"] = icon2base64(get_flat_icon(target,dir=WEST,no_anim=TRUE))
+ .["target"]["side_alt"] = icon2base64(get_flat_icon(target,dir=EAST,no_anim=TRUE))
.["target"]["back"] = icon2base64(get_flat_icon(target,dir=NORTH,no_anim=TRUE))
var/list/target_items = list()
for(var/obj/item in target.module.modules)
- target_items += list(list("item" = item.name, "ref" = "\ref[item]", "icon" = icon2html(item, user, sourceonly=TRUE), "desc" = item.desc))
+ target_items += list(list("name" = item.name, "ref" = "\ref[item]", "icon" = icon2html(item, user, sourceonly=TRUE), "desc" = item.desc))
.["target"]["modules"] = target_items
var/list/module_options = list()
for(var/module in robot_modules)
@@ -102,6 +103,7 @@
var/obj/item/weapon/gun/energy/kinetic_accelerator/kin = locate() in target.module.modules
if(kin)
.["target"]["pka"] = list()
+ .["target"]["pka"]["name"] = kin.name
var/list/installed_modkits = list()
for(var/obj/item/borg/upgrade/modkit/modkit in kin.modkits)
installed_modkits += list(list("name" = modkit.name, "ref" = "\ref[modkit]", "costs" = modkit.cost))
@@ -132,6 +134,16 @@
.["target"]["pka"]["modkits"] = modkits
.["target"]["pka"]["capacity"] = kin.get_remaining_mod_capacity()
.["target"]["pka"]["max_capacity"] = kin.max_mod_capacity
+ // Radio section
+ var/list/radio_channels = list()
+ for(var/channel in target.radio.channels)
+ radio_channels += channel
+ var/list/availalbe_channels = list()
+ for(var/channel in (radiochannels - target.radio.channels))
+ availalbe_channels += channel
+ .["target"]["radio_channels"] = radio_channels
+ .["target"]["availalbe_channels"] = availalbe_channels
+
// Section for source data for the module we might want to salvage
if(source)
.["source"] = list()
@@ -146,7 +158,7 @@
break
if(exists)
continue
- source_items += list(list("item" = item.name, "ref" = "\ref[item]", "icon" = icon2html(item, user, sourceonly=TRUE), "desc" = item.desc))
+ source_items += list(list("name" = item.name, "ref" = "\ref[item]", "icon" = icon2html(item, user, sourceonly=TRUE), "desc" = item.desc))
.["source"]["modules"] = source_items
var/list/all_robots = list()
for(var/mob/living/silicon/robot/R in silicon_mob_list)
@@ -283,6 +295,10 @@
target.hands.icon_state = target.get_hud_module_icon()
target.hud_used.update_robot_modules_display()
return TRUE
+ if("ert_toggle")
+ target.crisis_override = !target.crisis_override
+ target.module_reset(FALSE)
+ return TRUE
if("add_compatibility")
target.module.supported_upgrades |= text2path(params["upgrade"])
return TRUE
@@ -321,3 +337,34 @@
kin.modkits.Remove(rem_kit)
qdel(rem_kit)
return TRUE
+ if("add_channel")
+ var/selected_radio_channel = params["channel"]
+ if(selected_radio_channel == CHANNEL_SPECIAL_OPS)
+ target.radio.centComm = 1
+ if(selected_radio_channel == CHANNEL_RAIDER)
+ qdel(target.radio.keyslot)
+ target.radio.keyslot = new /obj/item/device/encryptionkey/raider(target)
+ target.radio.syndie = 1
+ if(selected_radio_channel == CHANNEL_MERCENARY)
+ qdel(target.radio.keyslot)
+ target.radio.keyslot = new /obj/item/device/encryptionkey/syndicate(target)
+ target.radio.syndie = 1
+ target.module.channels += list("[selected_radio_channel]" = 1)
+ target.radio.channels[selected_radio_channel] += target.module.channels[selected_radio_channel]
+ target.radio.secure_radio_connections[selected_radio_channel] += radio_controller.add_object(target.radio, radiochannels[selected_radio_channel], RADIO_CHAT)
+ return TRUE
+ if("rem_channel")
+ var/selected_radio_channel = params["channel"]
+ if(selected_radio_channel == CHANNEL_SPECIAL_OPS)
+ target.radio.centComm = 0
+ target.module.channels -= selected_radio_channel
+ if((selected_radio_channel == CHANNEL_MERCENARY || selected_radio_channel == CHANNEL_RAIDER) && !(target.module.channels[CHANNEL_RAIDER] || target.module.channels[CHANNEL_MERCENARY]))
+ qdel(target.radio.keyslot)
+ target.radio.keyslot = null
+ target.radio.syndie = 0
+ target.radio.channels = list()
+ for(var/n_chan in target.module.channels)
+ target.radio.channels[n_chan] -= target.module.channels[n_chan]
+ radio_controller.remove_object(target.radio, radiochannels[selected_radio_channel])
+ target.radio.secure_radio_connections -= selected_radio_channel
+ return TRUE
diff --git a/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotModules.tsx b/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotModules.tsx
index 606d8bc65e..460865679f 100644
--- a/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotModules.tsx
+++ b/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotModules.tsx
@@ -1,6 +1,3 @@
-import { filter } from 'common/collections';
-import { flow } from 'common/fp';
-import { createSearch } from 'common/string';
import { useState } from 'react';
import { useBackend } from 'tgui/backend';
import {
@@ -17,6 +14,7 @@ import {
} from 'tgui/components';
import { NoSpriteWarning } from '../components';
+import { prepareSearch } from '../functions';
import { Module, Source, Target } from '../types';
export const ModifyRobotModules = (props: {
@@ -61,13 +59,34 @@ export const ModifyRobotModules = (props: {
-
@@ -100,22 +119,8 @@ export const ModifyRobotModules = (props: {
);
};
-function prepareSearch(modules: Module[], searchText: string = ''): Module[] {
- const testSearch = createSearch(searchText, (module: Module) => module.item);
- return flow([
- (modules: Module[]) => {
- // Optional search term
- if (!searchText) {
- return modules;
- } else {
- return filter(modules, testSearch);
- }
- },
- ])(modules);
-}
-
const SelectionField = (props: {
- previewImage: string | null;
+ previewImage: string | undefined;
searchText: string;
onSearchText: Function;
action: string;
@@ -172,7 +177,7 @@ const SelectionField = (props: {
- {modul_option.item}
+ {modul_option.name}
{
const { act } = useBackend();
const { target } = props;
+ const [searchModkitText, setSearchModkitText] = useState('');
+ const [searchInstalledtext, setSearchInstalledtext] = useState('');
return (
<>
@@ -15,37 +27,67 @@ export const ModifyRobotPKA = (props: { target: Target }) => {
{target.name} has no PKA installed.
) : (
-
+
+
Remaining Capacity: {target.pka.capacity}
- {target.pka.modkits.map((modkit, i) => {
- return (
-
- act('install_modkit', {
- modkit: modkit.path,
- })
- }
- >
- {modkit.name} {modkit.costs}
-
- );
- })}
+
+ setSearchModkitText(value)}
+ />
+
+ {prepareSearch(target.pka.modkits, searchModkitText).map(
+ (modkit, i) => {
+ return (
+
+ act('install_modkit', {
+ modkit: modkit.path,
+ })
+ }
+ >
+ {modkit.name} {modkit.costs}
+
+ );
+ },
+ )}
-
-
+
+
+
+
+
+
+
Used Capacity: {target.pka.max_capacity - target.pka.capacity}
- {target.pka.installed_modkits.map((modkit, i) => {
+
+ setSearchInstalledtext(value)}
+ />
+
+ {prepareSearch(
+ target.pka.installed_modkits,
+ searchInstalledtext,
+ ).map((modkit, i) => {
return (
{
>
);
};
+
+function getPKAIcon(modules: Module[], name: string) {
+ if (modules) {
+ const module = modules.filter((module) => module.name === name);
+ if (module.length > 0) {
+ return module[0].icon;
+ }
+ }
+ return '';
+}
diff --git a/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotRadio.tsx b/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotRadio.tsx
new file mode 100644
index 0000000000..1c72109e38
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotRadio.tsx
@@ -0,0 +1,125 @@
+import { useState } from 'react';
+import { useBackend } from 'tgui/backend';
+import {
+ Button,
+ Divider,
+ Flex,
+ Icon,
+ Image,
+ Input,
+ Section,
+ Stack,
+} from 'tgui/components';
+
+import { NoSpriteWarning } from '../components';
+import { prepareSearch } from '../functions';
+import { Target } from '../types';
+
+export const ModifyRobotRadio = (props: { target: Target }) => {
+ const { target } = props;
+ const [searchChannelAddText, setSearchChannelAddText] = useState('');
+ const [searchChannelRemoveText, setSearchChannelRemoveText] =
+ useState('');
+
+ return (
+ <>
+ {!target.active && }
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+};
+
+const RadioSection = (props: {
+ title: string;
+ searchText: string;
+ onSearchText: Function;
+ channels: string[];
+ action: string;
+ buttonColor: string;
+ buttonIcon: string;
+}) => {
+ const { act } = useBackend();
+ const {
+ title,
+ searchText,
+ onSearchText,
+ channels,
+ action,
+ buttonColor,
+ buttonIcon,
+ } = props;
+ return (
+
+ );
+};
diff --git a/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotUpgrades.tsx b/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotUpgrades.tsx
index e2ee002640..6bdd9a7eae 100644
--- a/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotUpgrades.tsx
+++ b/tgui/packages/tgui/interfaces/ModifyRobot/ModifyRobotTabs/ModifyRobotUpgrades.tsx
@@ -1,12 +1,34 @@
+import { useState } from 'react';
import { useBackend } from 'tgui/backend';
-import { Button, Flex, Image, Section, Stack } from 'tgui/components';
+import {
+ Button,
+ Divider,
+ Flex,
+ Image,
+ Input,
+ Section,
+ Stack,
+} from 'tgui/components';
import { NoSpriteWarning } from '../components';
import { install2col } from '../constants';
+import { prepareSearch } from '../functions';
import { Target, Upgrade } from '../types';
export const ModifyRobotUpgrades = (props: { target: Target }) => {
const { target } = props;
+ const [searchAddCompatibilityText, setSearchAddCompatibilityText] =
+ useState('');
+ const [searchRemoveCompatibilityText, setSearchRemoveCompatibilityText] =
+ useState('');
+ const [searchUtilityUpgradeText, setsearchUtilityUpgradeText] =
+ useState('');
+ const [searchBasicUpgradeText, setSearchBasicUpgradeText] =
+ useState('');
+ const [searchAdvancedUpgradeText, setSearchAdvancedUpgradeText] =
+ useState('');
+ const [searchRestrictedUpgradeText, setSearchRestrictedUpgradeText] =
+ useState('');
return (
<>
@@ -15,6 +37,8 @@ export const ModifyRobotUpgrades = (props: { target: Target }) => {
@@ -33,6 +57,8 @@ export const ModifyRobotUpgrades = (props: { target: Target }) => {
@@ -42,6 +68,8 @@ export const ModifyRobotUpgrades = (props: { target: Target }) => {
@@ -49,6 +77,8 @@ export const ModifyRobotUpgrades = (props: { target: Target }) => {
@@ -56,6 +86,8 @@ export const ModifyRobotUpgrades = (props: { target: Target }) => {
@@ -63,6 +95,8 @@ export const ModifyRobotUpgrades = (props: { target: Target }) => {
@@ -74,16 +108,25 @@ export const ModifyRobotUpgrades = (props: { target: Target }) => {
const UpgradeSection = (props: {
title: string;
+ searchText: string;
+ onSearchText: Function;
upgrades: Upgrade[];
action: string;
}) => {
const { act } = useBackend();
- const { title, upgrades, action } = props;
+ const { title, searchText, onSearchText, upgrades, action } = props;
return (
+ onSearchText(value)}
+ />
+
- {upgrades.map((upgrade, i) => {
+ {prepareSearch(upgrades, searchText).map((upgrade, i) => {
return (
(
+ objects: T[],
+ searchText: string = '',
+): T[] {
+ const testSearch = createSearch(searchText, (object: T): string => {
+ if (typeof object === 'string') {
+ return object;
+ } else {
+ return object['name'];
+ }
+ });
+ return flow([
+ (objects: T[]) => {
+ // Optional search term
+ if (!searchText) {
+ return objects as any;
+ } else {
+ return filter(objects, testSearch) as any;
+ }
+ },
+ ])(objects);
+}
diff --git a/tgui/packages/tgui/interfaces/ModifyRobot/index.tsx b/tgui/packages/tgui/interfaces/ModifyRobot/index.tsx
index 330bdb2b1a..c1f3a854e4 100644
--- a/tgui/packages/tgui/interfaces/ModifyRobot/index.tsx
+++ b/tgui/packages/tgui/interfaces/ModifyRobot/index.tsx
@@ -1,4 +1,4 @@
-import { useState } from 'react';
+import { useEffect, useState } from 'react';
import { useBackend } from 'tgui/backend';
import {
Box,
@@ -16,6 +16,7 @@ import { Window } from 'tgui/layouts';
import { ModifyRobotNoModule } from './ModifyRobotNoModule';
import { ModifyRobotModules } from './ModifyRobotTabs/ModifyRobotModules';
import { ModifyRobotPKA } from './ModifyRobotTabs/ModifyRobotPKA';
+import { ModifyRobotRadio } from './ModifyRobotTabs/ModifyRobotRadio';
import { ModifyRobotUpgrades } from './ModifyRobotTabs/ModifyRobotUpgrades';
import { Data } from './types';
@@ -27,6 +28,12 @@ export const ModifyRobot = (props) => {
const [tab, setTab] = useState(0);
const [robotName, setRobotName] = useState(target ? target.name : '');
+ useEffect(() => {
+ if (target?.name) {
+ setRobotName(target.name);
+ }
+ }, [target?.name]);
+
const tabs: React.JSX.Element[] = [];
tabs[0] = (
@@ -38,7 +45,7 @@ export const ModifyRobot = (props) => {
);
tabs[1] = ;
tabs[2] = ;
- tabs[3] = ;
+ tabs[3] = ;
tabs[4] = ;
tabs[5] = ;
tabs[6] = ;
@@ -69,7 +76,7 @@ export const ModifyRobot = (props) => {
}
/>
- {!!target && (
+ {!!target?.module && (
<>