AI Remote Control Fixes (#20198)

Fixes https://github.com/Aurorastation/Aurora.3/issues/13267
Fixes https://github.com/Aurorastation/Aurora.3/issues/16881
Fixes https://github.com/Aurorastation/Aurora.3/issues/14039
Fixes https://github.com/Aurorastation/Aurora.3/issues/14062

Also adds QoL where pressing eject on remote controlled mechs exits
remote control.

---------

Co-authored-by: Ben10083 <Ben10083@users.noreply.github.com>
This commit is contained in:
Ben
2024-12-03 12:44:02 +00:00
committed by GitHub
co-authored by Ben10083
parent 0c3e762d93
commit 534a0774eb
10 changed files with 238 additions and 113 deletions
+53 -20
View File
@@ -60,7 +60,7 @@ 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"
@@ -68,6 +68,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() // 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
@@ -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
@@ -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
@@ -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)
@@ -137,11 +145,18 @@ SUBSYSTEM_DEF(virtualreality)
if(target.client)
target.client.screen |= global_hud.vr_control
if(istype(target, /mob/living/simple_animal/spiderbot))
if(istype(target, /mob/living/simple_animal/spiderbot) && !istype(target, /mob/living/simple_animal/spiderbot/ai))
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."))
@@ -173,7 +188,8 @@ SUBSYSTEM_DEF(virtualreality)
if(null_vr_mob)
target.vr_mob = null
/datum/controller/subsystem/virtualreality/proc/mech_selection(var/user, var/network)
/// Returns a list with all remote controlable exosuits on the given network
/datum/controller/subsystem/virtualreality/proc/mech_choices(var/user, var/network)
var/list/mech = list()
for(var/mob/living/heavy_vehicle/R in mechs[network])
@@ -193,19 +209,26 @@ SUBSYSTEM_DEF(virtualreality)
continue
mech[R.name] = R
if(!length(mech))
return mech
/// Retrieves a list returned by mech_choices and prompts user to select an option to transfer to
/datum/controller/subsystem/virtualreality/proc/mech_selection(var/user, var/network)
var/list/remote = mech_choices(user, network)
if(!length(remote))
to_chat(user, SPAN_WARNING("No active remote mechs are available."))
return
var/choice = tgui_input_list(usr, "Please select a remote control compatible mech to take over.", "Remote Mech Selection", mech)
var/choice = tgui_input_list(usr, "Please select a remote control compatible mech to take over.", "Remote Mech Selection", remote)
if(!choice)
return
var/mob/living/heavy_vehicle/chosen_mech = mech[choice]
var/mob/living/heavy_vehicle/chosen_mech = remote[choice]
var/mob/living/remote_pilot = chosen_mech.pilots[1] // the first pilot
mind_transfer(user, remote_pilot)
/datum/controller/subsystem/virtualreality/proc/robot_selection(var/user, var/network)
/// Returns a list with all remote controlable robots on the given network
/datum/controller/subsystem/virtualreality/proc/robot_choices(var/user, var/network)
var/list/robot = list()
for(var/mob/living/R in robots[network])
@@ -220,17 +243,22 @@ SUBSYSTEM_DEF(virtualreality)
continue
robot[R.name] = R
if(!length(robot))
to_chat(user, SPAN_WARNING("No active remote robots are available."))
return robot
/// Retrieves a list returned by robot_choices and prompts user to select an option to transfer to
/datum/controller/subsystem/virtualreality/proc/robot_selection(var/user, var/network)
var/list/remote = robot_choices(user, network)
if(!length(remote))
to_chat(user, SPAN_WARNING("No active remote units are available."))
var/choice = tgui_input_list(usr, "Please select a remote control unit to take over.", "Remote Unit Selection", remote)
if(!(choice in remote))
return
var/choice = tgui_input_list(usr, "Please select a remote control robot to take over.", "Remote Robot Selection", robot)
if(!choice)
return
mind_transfer(user, choice)
mind_transfer(user, robot[choice])
/datum/controller/subsystem/virtualreality/proc/bound_selection(var/user, var/network)
/// Returns a list with all remote controlable bound on the given network
/datum/controller/subsystem/virtualreality/proc/bound_choices(var/user, var/network)
var/list/bound = list()
for(var/mob/living/silicon/R in bounded[network])
@@ -245,16 +273,21 @@ SUBSYSTEM_DEF(virtualreality)
continue
bound += R
if(!length(bound))
to_chat(user, SPAN_WARNING("No active remote units are available."))
return
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))
/// Retrieves a list returned by bound_choices and prompts user to select an option to transfer to
/datum/controller/subsystem/virtualreality/proc/bound_selection(var/user, var/network)
var/list/remote = bound_choices(user, network)
if(!length(remote))
to_chat(user, SPAN_WARNING("No active remote units are available."))
var/choice = tgui_input_list(usr, "Please select a remote control unit to take over.", "Remote Unit Selection", remote)
if(!(choice in remote))
return
mind_transfer(user, choice)
/datum/controller/subsystem/virtualreality/proc/create_virtual_reality_avatar(var/mob/living/carbon/human/user)
if(GLOB.virtual_reality_spawn.len)
var/mob/living/carbon/human/virtual_reality/H = new /mob/living/carbon/human/virtual_reality(pick(GLOB.virtual_reality_spawn))