From aef68ff87a9222756d30b632f01dfb2b6b15e1d8 Mon Sep 17 00:00:00 2001
From: Arkatos1 <43862960+Arkatos1@users.noreply.github.com>
Date: Sun, 1 Mar 2020 21:30:59 +0100
Subject: [PATCH] tgui: Remote Robot Control (#49622)
This PR converts AI's Remote Robot Control from html based interface to tgui with some tweaks and improvements.
---
code/modules/mob/living/silicon/ai/ai.dm | 50 ++-----------
.../mob/living/silicon/ai/robot_control.dm | 74 +++++++++++++++++++
tgstation.dme | 1 +
.../tgui/interfaces/RemoteRobotControl.js | 68 +++++++++++++++++
tgui/packages/tgui/public/tgui.bundle.js | 4 +-
tgui/packages/tgui/routes.js | 5 ++
6 files changed, 155 insertions(+), 47 deletions(-)
create mode 100644 code/modules/mob/living/silicon/ai/robot_control.dm
create mode 100644 tgui/packages/tgui/interfaces/RemoteRobotControl.js
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index fef33432611..afc8e8d7100 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -98,6 +98,8 @@
var/list/cam_hotkeys = new/list(9)
var/cam_prev
+ var/datum/robot_control/robot_control
+
/mob/living/silicon/ai/Initialize(mapload, datum/ai_laws/L, mob/target_ai)
. = ..()
if(!target_ai) //If there is no player/brain inside.
@@ -414,25 +416,6 @@
else
to_chat(src, "Target is not on or near any active cameras on the station.")
return
- if(href_list["callbot"]) //Command a bot to move to a selected location.
- if(call_bot_cooldown > world.time)
- to_chat(src, "Error: Your last call bot command is still processing, please wait for the bot to finish calculating a route.")
- return
- Bot = locate(href_list["callbot"]) in GLOB.alive_mob_list
- if(!Bot || Bot.remote_disabled || control_disabled)
- return //True if there is no bot found, the bot is manually emagged, or the AI is carded with wireless off.
- waypoint_mode = 1
- to_chat(src, "Set your waypoint by clicking on a valid location free of obstructions.")
- return
- if(href_list["interface"]) //Remotely connect to a bot!
- Bot = locate(href_list["interface"]) in GLOB.alive_mob_list
- if(!Bot || Bot.remote_disabled || control_disabled)
- return
- Bot.attack_ai(src)
- if(href_list["botrefresh"]) //Refreshes the bot control panel.
- botcall()
- return
-
if (href_list["ai_take_control"]) //Mech domination
var/obj/mecha/M = locate(href_list["ai_take_control"]) in GLOB.mechas_list
if (!M)
@@ -478,33 +461,11 @@
set category = "AI Commands"
set name = "Access Robot Control"
set desc = "Wirelessly control various automatic robots."
- if(incapacitated())
- return
- if(control_disabled)
- to_chat(src, "Wireless control is disabled.")
- return
- var/turf/ai_current_turf = get_turf(src)
- var/ai_Zlevel = ai_current_turf.z
- var/d
- d += "Query network status
"
- d += "