diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index f45f2daa07b..107e8aee518 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -148,17 +148,18 @@ return 1 /mob/living/forceMove(atom/destination) - stop_pulling() if(buckled) - buckled.unbuckle_mob(src,force=1) - // in lieu of "unbuckle_all_mobs" + addtimer(src, "check_buckled", 1, TRUE) if(buckled_mob) - unbuckle_mob(buckled_mob,force=1) + addtimer(buckled_mob, "check_buckled", 1, TRUE) + if(pulling) + addtimer(src, "check_pull", 1, TRUE) . = ..() if(client) reset_perspective(destination) update_canmove() //if the mob was asleep inside a container and then got forceMoved out we need to make them fall. + //called when src is thrown into hit_atom /atom/movable/proc/throw_impact(atom/hit_atom, var/speed) if(istype(hit_atom,/mob/living)) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 0297a372dff..ea692339ac3 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -113,3 +113,7 @@ "You hear metal clanking.") add_fingerprint(user) return M + +/mob/living/proc/check_buckled() + if(buckled && !(buckled in loc)) + buckled.unbuckle_mob(src, force=1) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index ddb4d2beb60..44ba3cb99c3 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -894,45 +894,6 @@ var/list/slot_equipment_priority = list( \ if(!Adjacent(usr)) return show_inv(usr) -//this and stop_pulling really ought to be /mob/living procs -/mob/proc/start_pulling(atom/movable/AM) - if(src == AM) // Trying to pull yourself is a shortcut to stop pulling - stop_pulling() - return - if(!AM || !isturf(AM.loc)) //if there's no object or the object being pulled is inside something: abort! - return - if(!(AM.anchored)) - AM.add_fingerprint(src) - - // If we're pulling something then drop what we're currently pulling and pull this instead. - if(pulling) - // Are we trying to pull something we are already pulling? Then just stop here, no need to continue. - if(AM == pulling) - return - stop_pulling() - - src.pulling = AM - AM.pulledby = src - if(pullin) - pullin.update_icon(src) - if(ismob(AM)) - var/mob/M = AM - if(!iscarbon(src)) - M.LAssailant = null - else - M.LAssailant = usr - -/mob/verb/stop_pulling() - - set name = "Stop Pulling" - set category = "IC" - - if(pulling) - pulling.pulledby = null - pulling = null - if(pullin) - pullin.update_icon(src) - /mob/proc/can_use_hands() return diff --git a/code/modules/mob/pulling.dm b/code/modules/mob/pulling.dm new file mode 100644 index 00000000000..6a6a66675b0 --- /dev/null +++ b/code/modules/mob/pulling.dm @@ -0,0 +1,41 @@ +//this and stop_pulling really ought to be /mob/living procs +/mob/proc/start_pulling(atom/movable/AM) + if(src == AM) // Trying to pull yourself is a shortcut to stop pulling + stop_pulling() + return + if(!AM || !isturf(AM.loc)) //if there's no object or the object being pulled is inside something: abort! + return + if(!(AM.anchored)) + AM.add_fingerprint(src) + + // If we're pulling something then drop what we're currently pulling and pull this instead. + if(pulling) + // Are we trying to pull something we are already pulling? Then just stop here, no need to continue. + if(AM == pulling) + return + stop_pulling() + + src.pulling = AM + AM.pulledby = src + if(pullin) + pullin.update_icon(src) + if(ismob(AM)) + var/mob/M = AM + if(!iscarbon(src)) + M.LAssailant = null + else + M.LAssailant = usr + +/mob/verb/stop_pulling() + set name = "Stop Pulling" + set category = "IC" + + if(pulling) + pulling.pulledby = null + pulling = null + if(pullin) + pullin.update_icon(src) + +/mob/living/proc/check_pull() + if(pulling && !(pulling in orange(1))) + stop_pulling() diff --git a/paradise.dme b/paradise.dme index d27aa499fa0..814d6963c0f 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1443,6 +1443,7 @@ #include "code\modules\mob\mob_helpers.dm" #include "code\modules\mob\mob_movement.dm" #include "code\modules\mob\mob_transformation_simple.dm" +#include "code\modules\mob\pulling.dm" #include "code\modules\mob\say.dm" #include "code\modules\mob\status_procs.dm" #include "code\modules\mob\transform_procs.dm"