Buckling Bug Fixes

Prevents unintended self-dragging to pipes and other chairs.
This commit is contained in:
TheFurryFeline
2019-05-02 22:13:02 -04:00
committed by GitHub
parent 6470a08ae3
commit dda0a9055d
+23 -13
View File
@@ -49,22 +49,12 @@
unbuckle_all_mobs()
return ..()
//TFF 2/5/19: Polaris port for buckling-related bugs - chair-related buckling disabled
/atom/movable/proc/buckle_mob(mob/living/M, forced = FALSE, check_loc = TRUE)
if(!buckled_mobs)
buckled_mobs = list()
if(!istype(M))
return FALSE
if(check_loc && M.loc != loc)
return FALSE
if((!can_buckle && !forced) || M.buckled || M.pinned.len || (buckled_mobs.len >= max_buckled_mobs) || (buckle_require_restraints && !M.restrained()))
return FALSE
if(has_buckled_mobs() && buckled_mobs.len >= max_buckled_mobs) //Handles trying to buckle yourself to the chair when someone is on it
to_chat(M, "<span class='notice'>\The [src] can't buckle anymore people.</span>")
if(!can_buckle_check(M, forced))
return FALSE
M.buckled = src
@@ -130,6 +120,9 @@
if(M in buckled_mobs)
to_chat(user, "<span class='warning'>\The [M] is already buckled to \the [src].</span>")
return FALSE
//TFF 2/5/19: Polaris port for buckling-related bugs - check for whether someone's buckled
if(!can_buckle_check(M, forced))
return FALSE
add_fingerprint(user)
// unbuckle_mob()
@@ -184,6 +177,23 @@
L.set_dir(dir)
return TRUE
//TFF 2/5/19: Polaris port for buckling-related bugs - check for whether someone's buckled
/atom/movable/proc/can_buckle_check(mob/living/M, forced = FALSE)
if(!buckled_mobs)
buckled_mobs = list()
if(!istype(M))
return FALSE
if((!can_buckle && !forced) || M.buckled || M.pinned.len || (buckled_mobs.len >= max_buckled_mobs) || (buckle_require_restraints && !M.restrained()))
return FALSE
if(has_buckled_mobs() && buckled_mobs.len >= max_buckled_mobs) //Handles trying to buckle yourself to the chair when someone is on it
to_chat(M, "<span class='notice'>\The [src] can't buckle anymore people.</span>")
return FALSE
return TRUE
/atom/movable/Move(atom/newloc, direct = 0)
. = ..()
if(. && has_buckled_mobs() && !handle_buckled_mob_movement(newloc, direct)) //movement failed due to buckled mob(s)
@@ -193,4 +203,4 @@
riding_datum.handle_vehicle_layer()
riding_datum.handle_vehicle_offsets()
//VOREStation Add End