This commit is contained in:
Fluffy
2023-12-13 19:03:06 +00:00
committed by GitHub
parent 4f94c7678c
commit 22a6057a2e
8 changed files with 126 additions and 34 deletions
+23 -1
View File
@@ -24,30 +24,52 @@
return ..()
/**
* Buckles an `/atom/movable` to this obj, performed by a `/mob`
*
* Returns `TRUE` if the buckling was successful, `FALSE` otherwise
*
* * buckling_atom - The `/atom/movable` to buckle
* * user - The `/mob` that performs the buclking action
*/
/obj/proc/buckle(atom/movable/buckling_atom, mob/user)
if(!buckling_atom.can_be_buckled || buckling_atom.buckled_to)
return FALSE
if(!is_type_in_list(buckling_atom, can_buckle))
return FALSE
if(buckling_atom.loc != loc)
step_towards(buckling_atom, src)
if(buckling_atom.loc != loc)
return FALSE
if(buckling_atom != user && isliving(buckling_atom))
var/mob/living/buckling_mob = buckling_atom
if(!buckling_mob.lying && !do_mob(user, buckling_mob, 3 SECONDS))
//If the mob is not lying, check if there's an user that is performing the action, if there is add 3 seconds to perform the action,
//otherwise just continue as do_mob requires an user and a target
if(!buckling_mob.lying && !isnull(user) && !do_mob(user, buckling_mob, 3 SECONDS))
return FALSE
buckling_atom.buckled_to = src
buckled = buckling_atom
if(istype(buckling_atom, /mob/living))
var/mob/living/buckling_mob = buckling_atom
if(length(buckling_mob.pinned) || (buckle_require_restraints && !buckling_mob.restrained()))
return FALSE
buckling_mob.set_dir(buckle_dir ? buckle_dir : dir)
buckling_mob.facing_dir = null
buckling_mob.update_canmove()
else
buckling_atom.anchored = TRUE
post_buckle(buckling_atom)
buckling_atom.layer = layer + 0.1
return TRUE
@@ -206,7 +206,7 @@
if(do_after(user, 2 SECONDS, affecting, DO_UNIQUE))
affecting.forceMove(loc)
spawn(0)
if(buckle(affecting))
if(buckle(affecting, user))
affecting.visible_message(\
SPAN_DANGER("[affecting.name] is buckled to [src] by [user.name]!"),\
SPAN_DANGER("You are buckled to [src] by [user.name]!"),\