Skip to content

Commit

Permalink
[MIRROR] [no gbp] actually fixes bot access (#2180)
Browse files Browse the repository at this point in the history
* [no gbp] actually fixes bot access (#82809)

## About The Pull Request
real fix to bots having AA. also i forgot to address simple bots in my
previous attempt so this fixes them too

## Why It's Good For The Game
fixes bots having AA 

## Changelog
:cl:
fix: all bots have their normal accesses restored
/:cl:

* [no gbp] actually fixes bot access

---------

Co-authored-by: Ben10Omintrix <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Apr 25, 2024
1 parent 0cfd747 commit 7cdd30c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
9 changes: 6 additions & 3 deletions code/modules/jobs/access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
if(isAdminGhostAI(accessor))
//Access can't stop the abuse
return TRUE
//If the mob has the simple_access component with the requried access, we let them in.
var/attempted_access = SEND_SIGNAL(accessor, COMSIG_MOB_TRIED_ACCESS, src)
if(attempted_access & ACCESS_ALLOWED)
return TRUE
if(attempted_access & ACCESS_DISALLOWED)
return FALSE
if(HAS_SILICON_ACCESS(accessor))
if(ispAI(accessor))
return FALSE
Expand All @@ -28,9 +34,6 @@
if(onSyndieBase() && loc != accessor)
return FALSE
return TRUE //AI can do whatever it wants
//If the mob has the simple_access component with the requried access, we let them in.
else if(SEND_SIGNAL(accessor, COMSIG_MOB_TRIED_ACCESS, src) & ACCESS_ALLOWED)
return TRUE
//If the mob is holding a valid ID, we let them in. get_active_held_item() is on the mob level, so no need to copypasta everywhere.
else if(check_access(accessor.get_active_held_item()) || check_access(accessor.get_inactive_held_item()))
return TRUE
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/basic/bots/_bots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ GLOBAL_LIST_INIT(command_strings, list(
AddElement(/datum/element/relay_attackers)
RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(handle_loop_movement))
RegisterSignal(src, COMSIG_ATOM_WAS_ATTACKED, PROC_REF(after_attacked))
RegisterSignal(src, COMSIG_OBJ_ALLOWED, PROC_REF(attempt_access))
RegisterSignal(src, COMSIG_MOB_TRIED_ACCESS, PROC_REF(attempt_access))
ADD_TRAIT(src, TRAIT_NO_GLIDE, INNATE_TRAIT)
GLOB.bots_list += src

Expand Down Expand Up @@ -757,7 +757,7 @@ GLOBAL_LIST_INIT(command_strings, list(
/mob/living/basic/bot/proc/attempt_access(mob/bot, obj/door_attempt)
SIGNAL_HANDLER

return (door_attempt.check_access(access_card) ? COMPONENT_OBJ_ALLOW : COMPONENT_OBJ_DISALLOW)
return (door_attempt.check_access(access_card) ? ACCESS_ALLOWED : ACCESS_DISALLOWED)

/mob/living/basic/bot/proc/generate_speak_list()
return null
Expand Down
15 changes: 8 additions & 7 deletions code/modules/mob/living/simple_animal/bot/bot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@

pa_system = new(src, automated_announcements = automated_announcements)
pa_system.Grant(src)
RegisterSignal(src, COMSIG_MOB_TRIED_ACCESS, PROC_REF(attempt_access))

/mob/living/simple_animal/bot/Destroy()
GLOB.bots_list -= src
Expand Down Expand Up @@ -951,13 +952,13 @@ Pass a positive integer as an argument to override a bot's default speed.
calc_summon_path()
tries = 0

/mob/living/simple_animal/bot/Bump(atom/A) //Leave no door unopened!
. = ..()
if((istype(A, /obj/machinery/door/airlock) || istype(A, /obj/machinery/door/window)) && (!isnull(access_card)))
var/obj/machinery/door/D = A
if(D.check_access(access_card))
D.open()
frustration = 0
/mob/living/simple_animal/bot/proc/attempt_access(mob/bot, obj/door_attempt)
SIGNAL_HANDLER

if(door_attempt.check_access(access_card))
frustration = 0
return ACCESS_ALLOWED
return ACCESS_DISALLOWED

/mob/living/simple_animal/bot/ui_data(mob/user)
var/list/data = list()
Expand Down

0 comments on commit 7cdd30c

Please sign in to comment.