Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI Remote Control Fixes #20198

Merged
merged 10 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/_onclick/hud/screen_object_types/ai_screen_objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 158,7 @@
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
if(AI.anchored)
AI.remote_control_shell()
AI.remote_control()
else
to_chat(AI, SPAN_WARNING("You are unable to get a good connection while unanchored from the station systems."))

Expand Down
33 changes: 28 additions & 5 deletions code/controllers/subsystems/virtual_reality.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 60,16 @@ SUBSYSTEM_DEF(virtualreality)
var/mob/living/vr_mob = null // In which mob is our mind
var/mob/living/old_mob = null // Which mob is our old mob

// Return to our original body
/// Return to original body
/mob/proc/body_return()
set name = "Return to Body"
set category = "IC"

if(old_mob)
ckey_transfer(old_mob)
languages = list(GLOB.all_languages[LANGUAGE_TCB])
if(old_mob.client)
old_mob.client.init_verbs() // We need to have the stat panel to update, so we call this directly
to_chat(old_mob, SPAN_NOTICE("System exited safely, we hope you enjoyed your stay."))
old_mob = null
else
Expand All @@ -81,6 83,8 @@ SUBSYSTEM_DEF(virtualreality)
if(old_mob)
ckey_transfer(old_mob)
speech_synthesizer_langs = list(GLOB.all_languages[LANGUAGE_TCB])
if(old_mob.client)
old_mob.client.init_verbs()
to_chat(old_mob, SPAN_NOTICE("System exited safely, we hope you enjoyed your stay."))
old_mob = null
else
Expand All @@ -95,6 99,8 @@ SUBSYSTEM_DEF(virtualreality)
ckey_transfer(old_mob)
languages = list(GLOB.all_languages[LANGUAGE_TCB])
internal_id.access = list()
if(old_mob.client)
old_mob.client.init_verbs()
to_chat(old_mob, SPAN_NOTICE("System exited safely, we hope you enjoyed your stay."))
old_mob = null
else
Expand All @@ -108,6 114,8 @@ SUBSYSTEM_DEF(virtualreality)
if(old_mob)
ckey_transfer(old_mob)
languages = list(GLOB.all_languages[LANGUAGE_TCB])
if(old_mob.client)
old_mob.client.init_verbs()
to_chat(old_mob, SPAN_NOTICE("System exited safely, we hope you enjoyed your stay."))
old_mob = null
qdel(src)
Expand Down Expand Up @@ -138,10 146,17 @@ SUBSYSTEM_DEF(virtualreality)
target.client.screen |= global_hud.vr_control

if(istype(target, /mob/living/simple_animal/spiderbot))
var/mob/living/simple_animal/spiderbot/spider = target
var/obj/item/card/id/original_id = M.GetIdCard()
if(original_id)
var/mob/living/simple_animal/spiderbot/SB = target
SB.internal_id.access = original_id.access
// Update radio
var/obj/item/device/encryptionkey/Key = spider.radio.keyslot
var/obj/item/device/radio/Radio = M.get_radio()
if(Key && Radio)
Key.channels = Radio.channels
spider.radio.recalculateChannels()

target.client.init_verbs()
to_chat(target, SPAN_NOTICE("Connection established, system suite active and calibrated."))
Expand Down Expand Up @@ -173,7 188,7 @@ SUBSYSTEM_DEF(virtualreality)
if(null_vr_mob)
target.vr_mob = null

/datum/controller/subsystem/virtualreality/proc/mech_selection(var/user, var/network)
/datum/controller/subsystem/virtualreality/proc/mech_selection(var/user, var/network, var/return_list)
Ben10083 marked this conversation as resolved.
Show resolved Hide resolved
var/list/mech = list()

for(var/mob/living/heavy_vehicle/R in mechs[network])
Expand All @@ -194,9 209,13 @@ SUBSYSTEM_DEF(virtualreality)
mech[R.name] = R

if(!length(mech))
to_chat(user, SPAN_WARNING("No active remote mechs are available."))
if(!return_list)
to_chat(user, SPAN_WARNING("No active remote mechs are available."))
return

if(return_list)
return mech

var/choice = tgui_input_list(usr, "Please select a remote control compatible mech to take over.", "Remote Mech Selection", mech)
if(!choice)
return
Expand Down Expand Up @@ -230,7 249,7 @@ SUBSYSTEM_DEF(virtualreality)

mind_transfer(user, robot[choice])

/datum/controller/subsystem/virtualreality/proc/bound_selection(var/user, var/network)
/datum/controller/subsystem/virtualreality/proc/bound_selection(var/user, var/network, var/return_list)
Ben10083 marked this conversation as resolved.
Show resolved Hide resolved
var/list/bound = list()

for(var/mob/living/silicon/R in bounded[network])
Expand All @@ -246,9 265,13 @@ SUBSYSTEM_DEF(virtualreality)
bound = R

if(!length(bound))
to_chat(user, SPAN_WARNING("No active remote units are available."))
if(!return_list)
to_chat(user, SPAN_WARNING("No active remote units are available."))
return

if(return_list)
return bound

var/choice = tgui_input_list(usr, "Please select a remote control unit to take over.", "Remote Unit Selection", bound)
if(!(choice in bound))
return
Expand Down
13 changes: 7 additions & 6 deletions code/game/objects/items/devices/radio/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 636,13 @@ var/global/list/default_interrogation_channels = list(
channels = list(CHANNEL_COMMON = TRUE, CHANNEL_ENTERTAINMENT = TRUE)
syndie = FALSE

var/mob/living/silicon/robot/D = loc
if(D.module)
for(var/ch_name in D.module.channels)
if(ch_name in channels)
continue
channels[ch_name] = D.module.channels[ch_name]
if(isrobot(loc))
var/mob/living/silicon/robot/D = loc
if(D.module)
for(var/ch_name in D.module.channels)
if(ch_name in channels)
continue
channels[ch_name] = D.module.channels[ch_name]
if(keyslot)
for(var/ch_name in keyslot.channels)
if(ch_name in channels)
Expand Down
4 changes: 3 additions & 1 deletion code/modules/heavy_vehicle/mech_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 233,13 @@
LAZYDISTINCTADD(user.additional_vision_handlers, src)
update_icon()
GLOB.move_manager.stop_looping(src) // stop it from auto moving when the pilot gets in
return 1
return TRUE

/mob/living/heavy_vehicle/proc/eject(var/mob/user, var/silent)
if(!user || !(user in src.contents))
return
if(remote)
usr.body_return()
if(hatch_closed)
if(hatch_locked)
if(!silent) to_chat(user, SPAN_WARNING("The [body.hatch_descriptor] is locked."))
Expand Down
5 changes: 4 additions & 1 deletion code/modules/heavy_vehicle/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 131,7 @@
. = ..()

/mob/living/heavy_vehicle/IsAdvancedToolUser()
return 1
return TRUE

/mob/living/heavy_vehicle/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
SHOULD_CALL_PARENT(FALSE) //Special snowflake case
Expand Down Expand Up @@ -321,6 321,9 @@
dummy = new dummy_type(get_turf(src))
dummy.real_name = "Remote-Bot"
dummy.name = dummy.real_name
// Give dummy a blank encryption key for later editing if spiderbot
if(istype(dummy, /mob/living/simple_animal/spiderbot) && !istype(dummy, /mob/living/simple_animal/spiderbot/ai))
dummy.radio.keyslot = new /obj/item/device/encryptionkey
remove_verb(dummy, /mob/living/proc/ventcrawl)
remove_verb(dummy, /mob/living/proc/hide)
if(dummy_colour)
Expand Down
29 changes: 24 additions & 5 deletions code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 21,7 @@ var/list/ai_verbs_default = list(
/mob/living/silicon/ai/proc/core,
/mob/living/silicon/ai/proc/pick_icon,
/mob/living/silicon/ai/proc/sensor_mode,
/mob/living/silicon/ai/proc/remote_control_shell,
/mob/living/silicon/ai/proc/remote_control,
/mob/living/silicon/ai/proc/show_laws_verb,
/mob/living/silicon/ai/proc/toggle_acceleration,
/mob/living/silicon/ai/proc/toggle_camera_light,
Expand Down Expand Up @@ -800,14 800,33 @@ var/list/ai_verbs_default = list(
set desc = "Augment visual feed with internal sensor overlays"
toggle_sensor_mode()

/mob/living/silicon/ai/proc/remote_control_shell()
set name = "Remote Control Shell"
/mob/living/silicon/ai/proc/remote_control()
Ben10083 marked this conversation as resolved.
Show resolved Hide resolved
set name = "Remote Control"
set category = "AI Commands"
set desc = "Remotely control any active shells on your AI shell network."
set desc = "Remotely control any active shells or mechs on your AI network."

if(check_unable(AI_CHECK_WIRELESS))
return
SSvirtualreality.bound_selection(src, REMOTE_AI_ROBOT)

// Grab from relevant networks
var/list/remote_shell = SSvirtualreality.bound_selection(src, REMOTE_AI_ROBOT, TRUE)
var/list/remote_mech = SSvirtualreality.mech_selection(src, REMOTE_AI_MECH, TRUE)
var/list/remote = flatten_list(list(remote_shell, remote_mech))

if(!length(remote))
to_chat(usr, SPAN_WARNING("No active remote units are available."))
return
var/choice = tgui_input_list(usr, "Please select what to take over.", "Remote Control Selection", remote)
if(!choice)
return

// Transfer
if(choice in remote_mech)
var/mob/living/heavy_vehicle/chosen_mech = remote_mech[choice]
var/mob/living/remote_pilot = chosen_mech.pilots[1] // the first pilot
Ben10083 marked this conversation as resolved.
Show resolved Hide resolved
SSvirtualreality.mind_transfer(src, remote_pilot)
else
SSvirtualreality.mind_transfer(src, choice)

/mob/living/silicon/ai/proc/toggle_hologram_movement()
set name = "Toggle Hologram Movement"
Expand Down
7 changes: 7 additions & 0 deletions code/modules/mob/living/simple_animal/friendly/spiderbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 332,13 @@
spawn(3)//A slight delay to let us finish walking out from under the door
layer = initial(layer)

/mob/living/simple_animal/spiderbot/zMove(direction)
if(istype(loc, /mob/living/heavy_vehicle))
var/mob/living/heavy_vehicle/mech = loc
mech.zMove(direction)
return
..()

/mob/living/simple_animal/spiderbot/get_bullet_impact_effect_type(var/def_zone)
return BULLET_IMPACT_METAL

Expand Down
5 changes: 5 additions & 0 deletions code/modules/tgui/states/default.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 59,8 @@ GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new)
to_chat(src, SPAN_WARNING("Access denied."))

return min(..(), UI_UPDATE)

/mob/living/simple_animal/spiderbot/default_can_use_topic(src_object)
if(ismech(src_object))
return UI_INTERACTIVE
..()
Ben10083 marked this conversation as resolved.
Show resolved Hide resolved
62 changes: 62 additions & 0 deletions html/changelogs/Ben10083 - Remote Fixes.yml
Original file line number Diff line number Diff line change
@@ -0,0 1,62 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# - (fixes bugs)
# wip
# - (work in progress)
# qol
# - (quality of life)
# soundadd
# - (adds a sound)
# sounddel
# - (removes a sound)
# rscadd
# - (adds a feature)
# rscdel
# - (removes a feature)
# imageadd
# - (adds an image or sprite)
# imagedel
# - (removes an image or sprite)
# spellcheck
# - (fixes spelling or grammar)
# experiment
# - (experimental change)
# balance
# - (balance changes)
# code_imp
# - (misc internal code change)
# refactor
# - (refactors code)
# config
# - (makes a change to the config files)
# admin
# - (makes changes to administrator tools)
# server
# - (miscellaneous changes to server)
#################################

# Your name.
author: Ben10083

# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True

# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
changes:
- bugfix: "AI can remote control mechs again."
- bugfix: "Remote controlled exosuits now can travel between zlevels if capable."
- bugfix: "Remote control no longer makes the client lose verbs until restart."
- bugfix: "Remote controlled exosuit radios now will use the channels the user has access to."
- qol: "Pressing eject in a remotely controlled mech now exits remote control."
Loading