Fix mules dropping IDs when unloading after the AI called them (#16878)

* Fixes bot access bug.
Gives bots new access on their ID instead of a new ID.
Fixing mules dropping IDs after the AI called them

* Update code/modules/mob/living/simple_animal/bot/bot.dm

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
This commit is contained in:
Farie82
2021-10-09 23:10:25 +02:00
committed by GitHub
parent c731152513
commit 849f9d8a17
@@ -537,19 +537,16 @@ Pass a positive integer as an argument to override a bot's default speed.
bot_reset() //Reset a bot before setting it to call mode.
var/area/end_area = get_area(waypoint)
//For giving the bot temporary all-access.
var/obj/item/card/id/all_access = new /obj/item/card/id
var/datum/job/captain/All = new/datum/job/captain
all_access.access = All.get_access()
access_card.access = All.get_access() // Give the bot temporary all access
set_path(get_path_to(src, waypoint, /turf/proc/Distance_cardinal, 0, 200, id=all_access))
set_path(get_path_to(src, waypoint, /turf/proc/Distance_cardinal, 0, 200, id = access_card))
calling_ai = caller //Link the AI to the bot!
ai_waypoint = waypoint
if(path && path.len) //Ensures that a valid path is calculated!
if(!on)
turn_on() //Saves the AI the hassle of having to activate a bot manually.
access_card = all_access //Give the bot all-access while under the AI's command.
if(client)
reset_access_timer_id = addtimer(CALLBACK (src, .proc/bot_reset), 600, TIMER_OVERRIDE|TIMER_STOPPABLE) //if the bot is player controlled, they get the extra access for a limited time
to_chat(src, "<span class='notice'><span class='big'>Priority waypoint set by [calling_ai] <b>[caller]</b>. Proceed to <b>[end_area.name]</b>.</span><br>[path.len-1] meters to destination. You have been granted additional door access for 60 seconds.</span>")
@@ -562,6 +559,7 @@ Pass a positive integer as an argument to override a bot's default speed.
if(message)
to_chat(calling_ai, "<span class='danger'>Failed to calculate a valid route. Ensure destination is clear of obstructions and within range.</span>")
calling_ai = null
access_card.access = prev_access // Don't forget to reset it
set_path(null)
/mob/living/simple_animal/bot/proc/call_mode() //Handles preparing a bot for a call, as well as calling the move proc.