Skip to content

Commit

Permalink
Malf AIs and Combat-Upgraded AIs can now use the borg console to deto…
Browse files Browse the repository at this point in the history
…nate borgs (again). (tgstation#64874)

Allows Malf/Combat AIs to detonate borgs, to fulfill their various goals. Non-emagged borgs will leave a possibly angry and vengeful brain behind.
This was removed when the robotics console was reworked a bit ago, with the assumption that Malf AIs could use Machine Overload to accomplish the same task. This is incorrect (and also, having to use 20 malfbux to get rid of a borg that's braindead or sloppy enough to reveal you is lame). So we re-add this one thing.
  • Loading branch information
zxaber committed Feb 19, 2022
1 parent 658863b commit 11e9899
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
20 changes: 20 additions & 0 deletions code/game/machinery/computer/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
else if(isAdminGhostAI(user))
data["can_hack"] = TRUE

data["can_detonate"] = FALSE
if(isAI(user))
var/mob/living/silicon/ai/ai = user
data["can_detonate"] = !isnull(ai.malf_picker)

data["cyborgs"] = list()
for(var/mob/living/silicon/robot/R in GLOB.silicon_mobs)
if(!can_control(user, R))
Expand Down Expand Up @@ -96,6 +101,20 @@
to_chat(usr, span_danger("Cyborg locked by an user with superior permissions."))
else
to_chat(usr, span_danger("Access Denied."))

if("killbot") //Malf AIs, and AIs with a combat upgrade, can detonate their cyborgs remotely.
if(!isAI(usr))
return
var/mob/living/silicon/ai/ai = usr
if(!ai.malf_picker)
return
var/mob/living/silicon/robot/target = locate(params["ref"]) in GLOB.silicon_mobs
if(!istype(target))
return
if(target.connected_ai != ai)
return
target.self_destruct(usr)

if("magbot")
var/mob/living/silicon/S = usr
if((istype(S) && S.hack_software) || isAdminGhostAI(usr))
Expand All @@ -105,6 +124,7 @@
message_admins("[ADMIN_LOOKUPFLW(usr)] emagged cyborg [key_name_admin(R)] using robotic console!")
R.SetEmagged(TRUE)
R.logevent("WARN: root privleges granted to PID [num2hex(rand(1,65535), -1)][num2hex(rand(1,65535), -1)].") //random eight digit hex value. Two are used because rand(1,4294967295) throws an error

if("killdrone")
if(allowed(usr))
var/mob/living/simple_animal/drone/D = locate(params["ref"]) in GLOB.mob_list
Expand Down
17 changes: 15 additions & 2 deletions tgui/packages/tgui/interfaces/RoboticsControlConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const RoboticsControlConsole = (props, context) => {
const [tab, setTab] = useSharedState(context, 'tab', 1);
const {
can_hack,
can_detonate,
cyborgs = [],
drones = [],
} = data;
Expand All @@ -32,7 +33,10 @@ export const RoboticsControlConsole = (props, context) => {
</Tabs.Tab>
</Tabs>
{tab === 1 && (
<Cyborgs cyborgs={cyborgs} can_hack={can_hack} />
<Cyborgs
cyborgs={cyborgs}
can_hack={can_hack}
can_detonate={can_detonate} />
)}
{tab === 2 && (
<Drones drones={drones} />
Expand All @@ -43,7 +47,7 @@ export const RoboticsControlConsole = (props, context) => {
};

const Cyborgs = (props, context) => {
const { cyborgs, can_hack } = props;
const { cyborgs, can_hack, can_detonate } = props;
const { act, data } = useBackend(context);
if (!cyborgs.length) {
return (
Expand Down Expand Up @@ -75,6 +79,15 @@ const Cyborgs = (props, context) => {
onClick={() => act('stopbot', {
ref: cyborg.ref,
})} />
{!!can_detonate && (
<Button.Confirm
icon="bomb"
content="Detonate"
color="bad"
onClick={() => act('killbot', {
ref: cyborg.ref,
})} />
)}
</>
)}>
<LabeledList>
Expand Down

0 comments on commit 11e9899

Please sign in to comment.