Skip to content

Commit

Permalink
Buckled mobs will now be checked for access alongside the mount (#10205)
Browse files Browse the repository at this point in the history
* Buckled mobs will now be checked for access alongside the mount

* Allow object-specific buckled access behavior

* Slight refactor to allow for customizable buckle access behavior

* Infinite loop failsafe

* blegh

* Update code/modules/jobs/access.dm

---------

Co-authored-by: EvilDragonfiend <[email protected]>
  • Loading branch information
Absolucy and EvilDragonfiend authored Dec 1, 2023
1 parent 0b0ab89 commit 7e206d3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions code/modules/jobs/access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//check if it doesn't require any access at all
if(src.check_access(null))
return TRUE
if(length(accessor.buckled_mobs) && handle_buckled_access(accessor))
return TRUE
if(issilicon(accessor))
var/mob/living/silicon/S = accessor
return check_access(S.internal_id_card) //AI can do whatever it wants
Expand All @@ -31,6 +33,15 @@
return TRUE
return FALSE

/obj/proc/handle_buckled_access(mob/accessor)
. = FALSE
// check if someone riding on / buckled to them has access
for(var/mob/living/buckled in accessor.buckled_mobs)
if(accessor == buckled || buckled == src) // just in case to prevent a possible infinite loop scenario (but it won't happen)
continue
if(allowed(buckled))
return TRUE

/obj/item/proc/GetAccess()
return list()

Expand Down

0 comments on commit 7e206d3

Please sign in to comment.