From e3d3f2b8e955498ba1c39535a994fa22061099af Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Mon, 23 Jul 2012 07:45:27 +0000 Subject: [PATCH] - Added support for pulledby, which tells you who is pulling this object. - Replaced all the .pulling = object instances with start_pulling() and stop_pulling(). Use these from now on. - Ian and Runtime will now no longer move when being pulled git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4155 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/dna.dm | 2 +- code/game/machinery/Sleeper.dm | 2 +- code/game/machinery/bots/mulebot.dm | 2 +- code/game/machinery/cryo.dm | 2 +- code/game/machinery/rechargestation.dm | 2 +- code/game/machinery/suit_storage_unit.dm | 2 +- code/game/mecha/mecha.dm | 2 +- code/game/objects/devices/PDA/PDA.dm | 2 +- code/game/objects/effect_system.dm | 2 +- .../game/objects/items/weapons/clown_items.dm | 6 ++-- .../items/weapons/implants/implantchair.dm | 2 +- code/game/turf.dm | 22 +++++++------- .../living/carbon/alien/humanoid/humanoid.dm | 16 +++++----- .../mob/living/carbon/alien/larva/larva.dm | 12 ++++---- code/modules/mob/living/carbon/human/human.dm | 16 +++++----- .../living/carbon/human/human_attackhand.dm | 2 +- .../mob/living/carbon/human/update_icons.dm | 2 +- .../mob/living/carbon/metroid/metroid.dm | 12 ++++---- .../mob/living/carbon/monkey/monkey.dm | 16 +++++----- .../mob/living/carbon/monkey/update_icons.dm | 2 +- .../modules/mob/living/silicon/robot/robot.dm | 16 +++++----- code/modules/mob/living/simple_animal/bear.dm | 1 + code/modules/mob/living/simple_animal/life.dm | 8 +++-- code/modules/mob/mob.dm | 30 ++++++++++++++----- code/modules/mob/mob_grab.dm | 2 +- code/modules/mob/mob_movement.dm | 4 +-- code/modules/mob/screen.dm | 2 +- code/modules/power/engine.dm | 6 ++-- code/modules/recycling/conveyor2.dm | 6 ++-- code/unused/Agouri_stuff.dm | 20 ++++++------- code/unused/conveyor.dm | 6 ++-- code/unused/dna.dm | 4 +-- code/unused/hivebot/hivebot.dm | 14 ++++----- code/unused/vehicle.dm | 2 +- 34 files changed, 133 insertions(+), 114 deletions(-) diff --git a/code/game/dna.dm b/code/game/dna.dm index a6d2a1cfd5a..d621ae4f393 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -659,7 +659,7 @@ if (usr.abiotic()) usr << "\blue Subject cannot have abiotic items on." return - usr.pulling = null + usr.stop_pulling() usr.client.perspective = EYE_PERSPECTIVE usr.client.eye = src usr.loc = src diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index c4798c372ca..60b7c7fa13b 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -378,7 +378,7 @@ if(src.occupant) usr << "\blue The sleeper is already occupied!" return - usr.pulling = null + usr.stop_pulling() usr.client.perspective = EYE_PERSPECTIVE usr.client.eye = src usr.loc = src diff --git a/code/game/machinery/bots/mulebot.dm b/code/game/machinery/bots/mulebot.dm index b12a61c9854..24c3d8faee6 100644 --- a/code/game/machinery/bots/mulebot.dm +++ b/code/game/machinery/bots/mulebot.dm @@ -766,7 +766,7 @@ src.visible_message("\red [src] bumps into [M]!") else src.visible_message("\red [src] knocks over [M]!") - M.pulling = null + M.stop_pulling() M.Stun(8) M.Weaken(5) M.lying = 1 diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index d30e0fbca77..08419372b58 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -232,7 +232,7 @@ if (M.client) M.client.perspective = EYE_PERSPECTIVE M.client.eye = src - M.pulling = null + M.stop_pulling() M.loc = src if(M.health > -100 && (M.health < 0 || M.sleeping)) M << "\blue You feel a cold liquid surround you. Your skin starts to freeze up." diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 58095c0a9f9..9181701d5f4 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -142,7 +142,7 @@ usr<<"\blue Without a powercell, you can't be recharged." //Make sure they actually HAVE a cell, now that they can get in while powerless. --NEO return - usr.pulling = null + usr.stop_pulling() if(usr && usr.client) usr.client.perspective = EYE_PERSPECTIVE usr.client.eye = src diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 363b6ab583e..1f5bc348869 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -452,7 +452,7 @@ for (var/mob/V in viewers(usr)) V.show_message("[usr] starts squeezing into the suit storage unit!", 3) if(do_after(usr, 10)) - usr.pulling = null + usr.stop_pulling() usr.client.perspective = EYE_PERSPECTIVE usr.client.eye = src usr.loc = src diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 8a0d3b7a36b..4119aac8d8a 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -1022,7 +1022,7 @@ H.client.perspective = EYE_PERSPECTIVE H.client.eye = src */ - H.pulling = null + H.stop_pulling() H.forceMove(src) src.occupant = H src.add_fingerprint(H) diff --git a/code/game/objects/devices/PDA/PDA.dm b/code/game/objects/devices/PDA/PDA.dm index ab8c2aba690..8c3e4e339e3 100644 --- a/code/game/objects/devices/PDA/PDA.dm +++ b/code/game/objects/devices/PDA/PDA.dm @@ -1029,7 +1029,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if (src.cartridge:honk_charges < 5) src.cartridge:honk_charges++ - M.pulling = null + M.stop_pulling() M << "\blue You slipped on the PDA!" playsound(src.loc, 'slip.ogg', 50, 1, -3) M.Stun(8) diff --git a/code/game/objects/effect_system.dm b/code/game/objects/effect_system.dm index 4a9e2df01cc..d75844ab20e 100644 --- a/code/game/objects/effect_system.dm +++ b/code/game/objects/effect_system.dm @@ -895,7 +895,7 @@ steam.start() -- spawns the effect if (istype(M, /mob/living/carbon/human) && (istype(M:shoes, /obj/item/clothing/shoes) && M:shoes.flags&NOSLIP)) return - M.pulling = null + M.stop_pulling() M << "\blue You slipped on the foam!" playsound(src.loc, 'slip.ogg', 50, 1, -3) M.Stun(5) diff --git a/code/game/objects/items/weapons/clown_items.dm b/code/game/objects/items/weapons/clown_items.dm index 4c892471140..ae385487874 100644 --- a/code/game/objects/items/weapons/clown_items.dm +++ b/code/game/objects/items/weapons/clown_items.dm @@ -13,7 +13,7 @@ BIKE HORN if (istype(M, /mob/living/carbon/human) && (isobj(M:shoes) && M:shoes.flags&NOSLIP)) return - M.pulling = null + M.stop_pulling() M << "\blue You slipped on the [name]!" playsound(src.loc, 'slip.ogg', 50, 1, -3) M.Stun(4) @@ -25,7 +25,7 @@ BIKE HORN if (istype(M, /mob/living/carbon/human) && (isobj(M:shoes) && M:shoes.flags&NOSLIP)) return - M.pulling = null + M.stop_pulling() M << "\blue You slipped on the [name]!" playsound(src.loc, 'slip.ogg', 50, 1, -3) M.Stun(8) @@ -37,7 +37,7 @@ BIKE HORN if (istype(M, /mob/living/carbon/human) && (isobj(M:shoes) && M:shoes.flags&NOSLIP)) return - M.pulling = null + M.stop_pulling() M << "\blue You slipped on the [name]!" playsound(src.loc, 'slip.ogg', 50, 1, -3) M.Stun(3) diff --git a/code/game/objects/items/weapons/implants/implantchair.dm b/code/game/objects/items/weapons/implants/implantchair.dm index 878dbafb5a4..454da6b2ce3 100644 --- a/code/game/objects/items/weapons/implants/implantchair.dm +++ b/code/game/objects/items/weapons/implants/implantchair.dm @@ -116,7 +116,7 @@ if(M.client) M.client.perspective = EYE_PERSPECTIVE M.client.eye = src - M.pulling = null + M.stop_pulling() M.loc = src src.occupant = M src.add_fingerprint(usr) diff --git a/code/game/turf.dm b/code/game/turf.dm index faedf21a527..ae8921fd4f4 100644 --- a/code/game/turf.dm +++ b/code/game/turf.dm @@ -256,7 +256,7 @@ if(1) if(istype(M, /mob/living/carbon/human)) // Added check since monkeys don't have shoes if ((M.m_intent == "run") && !(istype(M:shoes, /obj/item/clothing/shoes) && M:shoes.flags&NOSLIP)) - M.pulling = null + M.stop_pulling() step(M, M.dir) M << "\blue You slipped on the wet floor!" playsound(src.loc, 'slip.ogg', 50, 1, -3) @@ -267,7 +267,7 @@ return else if(!istype(M, /mob/living/carbon/metroid)) if (M.m_intent == "run") - M.pulling = null + M.stop_pulling() step(M, M.dir) M << "\blue You slipped on the wet floor!" playsound(src.loc, 'slip.ogg', 50, 1, -3) @@ -279,7 +279,7 @@ if(2) //lube if(!istype(M, /mob/living/carbon/metroid)) - M.pulling = null + M.stop_pulling() step(M, M.dir) spawn(1) step(M, M.dir) spawn(2) step(M, M.dir) @@ -1259,13 +1259,13 @@ turf/simulated/floor/proc/update_icon() var/mob/M = user.pulling // if(M==user) //temporary hack to stop runtimes. ~Carn -// user.pulling = null //but...fixed the root of the problem +// user.stop_pulling() //but...fixed the root of the problem // return //shoudn't be needed now, unless somebody fucks with pulling again. var/mob/t = M.pulling - M.pulling = null + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - M.pulling = t + M.start_pulling(t) else step(user.pulling, get_dir(user.pulling.loc, src)) return @@ -1549,9 +1549,9 @@ turf/simulated/floor/proc/update_icon() if (ismob(user.pulling)) var/mob/M = user.pulling var/mob/t = M.pulling - M.pulling = null + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - M.pulling = t + M.start_pulling(t) else step(user.pulling, get_dir(user.pulling.loc, src)) return @@ -1570,10 +1570,10 @@ turf/simulated/floor/proc/update_icon() return if (ismob(user.pulling)) var/mob/M = user.pulling - var/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - M.pulling = t + M.start_pulling(t) else step(user.pulling, get_dir(user.pulling.loc, src)) return diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 2d5e83f0f30..6b63ad92ede 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -156,7 +156,7 @@ return 0 if (restrained()) - pulling = null + stop_pulling() var/t7 = 1 if (restrained()) @@ -169,7 +169,7 @@ if (pulling && pulling.loc) if(!( isturf(pulling.loc) )) - pulling = null + stop_pulling() return else if(Debug) @@ -178,7 +178,7 @@ ///// if(pulling && pulling.anchored) - pulling = null + stop_pulling() return if (!restrained()) @@ -203,21 +203,21 @@ if (locate(/obj/item/weapon/grab, M.grabbed_by.len)) ok = 0 if (ok) - var/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(pulling, get_dir(pulling.loc, T)) - M.pulling = t + M.start_pulling(t) else if (pulling) if (istype(pulling, /obj/structure/window)) if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST) for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T))) - pulling = null + stop_pulling() if (pulling) step(pulling, get_dir(pulling.loc, T)) else - pulling = null + stop_pulling() . = ..() if ((s_active && !( s_active in contents ) )) s_active.close(src) diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 811b4f98a66..c9fd8f03fbb 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -165,7 +165,7 @@ if (pulling && pulling.loc) if(!( isturf(pulling.loc) )) - pulling = null + stop_pulling() return else if(Debug) @@ -174,7 +174,7 @@ ///// if(pulling && pulling.anchored) - pulling = null + stop_pulling() return if (!restrained()) @@ -199,15 +199,15 @@ if (locate(/obj/item/weapon/grab, M.grabbed_by.len)) ok = 0 if (ok) - var/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(pulling, get_dir(pulling.loc, T)) - M.pulling = t + M.start_pulling(t) else if (pulling) step(pulling, get_dir(pulling.loc, T)) else - pulling = null + stop_pulling() . = ..() if ((s_active && !( s_active in contents ) )) s_active.close(src) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index cfe88ee27ce..6e714773286 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -263,7 +263,7 @@ return if (restrained()) - pulling = null + stop_pulling() var/t7 = 1 @@ -277,7 +277,7 @@ if (pulling && pulling.loc) if(!( isturf(pulling.loc) )) - pulling = null + stop_pulling() return else if(Debug) @@ -286,7 +286,7 @@ ///// if(pulling && pulling.anchored) - pulling = null + stop_pulling() return if (!restrained()) @@ -311,8 +311,8 @@ if (locate(/obj/item/weapon/grab, M.grabbed_by.len)) ok = 0 if (ok) - var/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() //this is the gay blood on floor shit -- Added back -- Skie if (M.lying && (prob(M.getBruteLoss() / 6))) @@ -322,17 +322,17 @@ step(pulling, get_dir(pulling.loc, T)) - M.pulling = t + M.start_pulling(t) else if (pulling) if (istype(pulling, /obj/structure/window)) if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST) for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T))) - pulling = null + stop_pulling() if (pulling) step(pulling, get_dir(pulling.loc, T)) else - pulling = null + stop_pulling() . = ..() if ((s_active && !( s_active in contents ) )) s_active.close(src) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index de1b510c88b..8ba29ba87f9 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -192,7 +192,7 @@ if(pulling) visible_message("\red [M] has broken [src]'s grip on [pulling]!") talked = 1 - pulling = null + stop_pulling() //BubbleWrap: Disarming also breaks a grab - this will also stop someone being choked, won't it? if(istype(l_hand, /obj/item/weapon/grab)) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index fe6b8a8e7c1..91a75859a08 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -584,7 +584,7 @@ Please contact me on #coderbus IRC. ~Carn x /mob/living/carbon/human/update_inv_handcuffed(var/update_icons=1) if(handcuffed) - pulling = null //TODO: should be handled elsewhere + stop_pulling() //TODO: should be handled elsewhere overlays_lying[HANDCUFF_LAYER] = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "handcuff2") overlays_standing[HANDCUFF_LAYER] = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "handcuff1") else diff --git a/code/modules/mob/living/carbon/metroid/metroid.dm b/code/modules/mob/living/carbon/metroid/metroid.dm index 1712d5bf766..4b9fd879d25 100644 --- a/code/modules/mob/living/carbon/metroid/metroid.dm +++ b/code/modules/mob/living/carbon/metroid/metroid.dm @@ -237,7 +237,7 @@ if (pulling && pulling.loc) if(!( isturf(pulling.loc) )) - pulling = null + stop_pulling() return else if(Debug) @@ -246,7 +246,7 @@ ///// if(pulling && pulling.anchored) - pulling = null + stop_pulling() return if (!restrained()) @@ -271,15 +271,15 @@ if (locate(/obj/item/weapon/grab, M.grabbed_by.len)) ok = 0 if (ok) - var/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(pulling, get_dir(pulling.loc, T)) - M.pulling = t + M.start_pulling(t) else if (pulling) step(pulling, get_dir(pulling.loc, T)) else - pulling = null + stop_pulling() . = ..() if ((s_active && !( s_active in contents ) )) s_active.close(src) diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index a801fb81c43..41170bb7824 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -403,7 +403,7 @@ if (buckled) return if (restrained()) - pulling = null + stop_pulling() var/t7 = 1 if (restrained()) for(var/mob/M in range(src, 1)) @@ -411,11 +411,11 @@ return 0 if ((t7 && pulling && get_dist(src, pulling) <= 1)) if (pulling.anchored) - pulling = null + stop_pulling() var/T = loc . = ..() if (!( isturf(pulling.loc) )) - pulling = null + stop_pulling() return if (!( restrained() )) var/diag = get_dir(src, pulling) @@ -425,20 +425,20 @@ if ((ismob(pulling) && (get_dist(src, pulling) > 1 || diag))) if (istype(pulling, type)) var/mob/M = pulling - var/mob/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(pulling, get_dir(pulling.loc, T)) - M.pulling = t + M.start_pulling(t) else if (pulling) if (istype(pulling, /obj/structure/window)) if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST) for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T))) - pulling = null + stop_pulling() if (pulling) step(pulling, get_dir(pulling.loc, T)) else - pulling = null + stop_pulling() . = ..() if ((s_active && !( contents.Find(s_active) ))) s_active.close(src) diff --git a/code/modules/mob/living/carbon/monkey/update_icons.dm b/code/modules/mob/living/carbon/monkey/update_icons.dm index d2d5b2845b4..b38b9634893 100644 --- a/code/modules/mob/living/carbon/monkey/update_icons.dm +++ b/code/modules/mob/living/carbon/monkey/update_icons.dm @@ -84,7 +84,7 @@ /mob/living/carbon/monkey/update_inv_handcuffed(var/update_icons=1) if(handcuffed) - pulling = null + stop_pulling() overlays_lying[M_HANDCUFF_LAYER] = image("icon" = 'icons/mob/monkey.dmi', "icon_state" = "handcuff2") overlays_standing[M_HANDCUFF_LAYER] = image("icon" = 'icons/mob/monkey.dmi', "icon_state" = "handcuff1") else diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index c26d4c5e174..d4447a63134 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -875,7 +875,7 @@ Frequency: return if (restrained()) - pulling = null + stop_pulling() var/t7 = 1 if (restrained()) @@ -888,7 +888,7 @@ Frequency: if (pulling && pulling.loc) if(!( isturf(pulling.loc) )) - pulling = null + stop_pulling() return else if(Debug) @@ -897,7 +897,7 @@ Frequency: ///// if(pulling && pulling.anchored) - pulling = null + stop_pulling() return if (!restrained()) @@ -921,20 +921,20 @@ Frequency: if (locate(/obj/item/weapon/grab, M.grabbed_by.len)) ok = 0 if (ok) - var/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(pulling, get_dir(pulling.loc, T)) - M.pulling = t + M.start_pulling(t) else if (pulling) if (istype(pulling, /obj/structure/window)) if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST) for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T))) - pulling = null + stop_pulling() if (pulling) step(pulling, get_dir(pulling.loc, T)) else - pulling = null + stop_pulling() . = ..() if ((s_active && !( s_active in contents ) )) s_active.close(src) diff --git a/code/modules/mob/living/simple_animal/bear.dm b/code/modules/mob/living/simple_animal/bear.dm index a06be621551..d9c3494d4c9 100644 --- a/code/modules/mob/living/simple_animal/bear.dm +++ b/code/modules/mob/living/simple_animal/bear.dm @@ -24,6 +24,7 @@ response_disarm = "gently pushes aside the" response_harm = "pokes the" + stop_automated_movement_when_pulled = 0 health = 60 //Space bears aren't affected by atmos. diff --git a/code/modules/mob/living/simple_animal/life.dm b/code/modules/mob/living/simple_animal/life.dm index 48f83ea6994..d9fd4997521 100644 --- a/code/modules/mob/living/simple_animal/life.dm +++ b/code/modules/mob/living/simple_animal/life.dm @@ -15,7 +15,8 @@ var/meat_amount = 0 var/meat_type var/stop_automated_movement = 0 //Use this to temporarely stop random movement or to if you write special movement code for animals. - + var/stop_automated_movement_when_pulled = 1 //When set to 1 this stops the animal from moving when someone is pulling it. + //Interaction var/response_help = "You try to help" var/response_disarm = "You try to disarm" @@ -114,8 +115,9 @@ if(isturf(src.loc) && !resting && !buckled && canmove) //This is so it only moves if it's not inside a closet, gentics machine, etc. turns_since_move++ if(turns_since_move >= turns_per_move) - Move(get_step(src,pick(cardinal))) - turns_since_move = 0 + if(!(stop_automated_movement_when_pulled && pulledby)) //Soma animals don't move when pulled + Move(get_step(src,pick(cardinal))) + turns_since_move = 0 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 844e34cb6c9..0432bfc88c6 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -501,22 +501,38 @@ if(LinkBlocked(usr.loc,loc)) return show_inv(usr) +/atom/movable + var/mob/pulledby = null + /atom/movable/verb/pull() set name = "Pull" set category = "IC" set src in oview(1) - if ( !usr || usr==src || !istype(src.loc,/turf) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort! + usr.start_pulling(src) + return + +/mob/proc/stop_pulling() + if(pulling) + pulling.pulledby = null + pulling = null + +/mob/proc/start_pulling(var/atom/movable/AM) + if ( !AM || !usr || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort! return - if (!( anchored )) - usr.pulling = src - if(ismob(src)) - var/mob/M = src - if(!istype(usr, /mob/living/carbon)) + + if (!( AM.anchored )) + if(pulling) + stop_pulling() + + src.pulling = AM + AM.pulledby = src + if(ismob(AM)) + var/mob/M = AM + if(!iscarbon(src)) M.LAssailant = null else M.LAssailant = usr - return /atom/verb/examine() set name = "Examine" diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index 1995e1f950e..fe929461e50 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -62,7 +62,7 @@ assailant.client.screen -= hud1 assailant.client.screen += hud1 if (assailant.pulling == affecting || assailant.pulling == structure) - assailant.pulling = null + assailant.stop_pulling() if (structure) structure.loc = assailant.loc diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 1ab9d726377..e2090c6e1f4 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -93,7 +93,7 @@ if(!usr.pulling) usr << "\blue You are not pulling anything." return - usr.pulling = null + usr.stop_pulling() /client/verb/swap_hand() set hidden = 1 @@ -541,4 +541,4 @@ prob_slip = 0 // Changing this to zero to make it line up with the comment. prob_slip = round(prob_slip) - return(prob_slip) + return(prob_slip) \ No newline at end of file diff --git a/code/modules/mob/screen.dm b/code/modules/mob/screen.dm index 6a97677d571..8c30f773321 100644 --- a/code/modules/mob/screen.dm +++ b/code/modules/mob/screen.dm @@ -434,7 +434,7 @@ usr.hud_used.action_intent.icon_state = "disarm" usr.hud_used.show_intent_icons = 0 if("pull") - usr.pulling = null + usr.stop_pulling() if("throw") if (!usr.stat && isturf(usr.loc) && !usr.restrained()) usr:toggle_throw_mode() diff --git a/code/modules/power/engine.dm b/code/modules/power/engine.dm index 06f5c4b880f..09f90611f40 100644 --- a/code/modules/power/engine.dm +++ b/code/modules/power/engine.dm @@ -10,10 +10,10 @@ return if (ismob(user.pulling)) var/mob/M = user.pulling - var/mob/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - M.pulling = t + M.start_pulling(t) else step(user.pulling, get_dir(user.pulling.loc, src)) return diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 71f7e0bcc67..e3d3add7ff2 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -103,12 +103,12 @@ return if (ismob(user.pulling)) var/mob/M = user.pulling - M.pulling = null + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - user.pulling = null + user.stop_pulling() else step(user.pulling, get_dir(user.pulling.loc, src)) - user.pulling = null + user.stop_pulling() return diff --git a/code/unused/Agouri_stuff.dm b/code/unused/Agouri_stuff.dm index 508c46f6a0d..a2a33bdf6a8 100644 --- a/code/unused/Agouri_stuff.dm +++ b/code/unused/Agouri_stuff.dm @@ -210,7 +210,7 @@ if(1) if(istype(M, /mob/living/carbon/human)) // Added check since monkeys don't have shoes if ((M.m_intent == "run") && !(istype(M:shoes, /obj/item/clothing/shoes) && M:shoes.flags&NOSLIP)) - M.pulling = null + M.stop_pulling() step(M, M.dir) M << "\blue You slipped on the wet floor!" playsound(src.loc, 'slip.ogg', 50, 1, -3) @@ -221,7 +221,7 @@ return else if(!istype(M, /mob/living/carbon/metroid)) if (M.m_intent == "run") - M.pulling = null + M.stop_pulling() step(M, M.dir) M << "\blue You slipped on the wet floor!" playsound(src.loc, 'slip.ogg', 50, 1, -3) @@ -233,7 +233,7 @@ if(2) //lube if(!istype(M, /mob/living/carbon/metroid)) - M.pulling = null + M.stop_pulling() step(M, M.dir) spawn(1) step(M, M.dir) spawn(2) step(M, M.dir) @@ -1003,9 +1003,9 @@ turf/simulated/floor/return_siding_icon_state() if (ismob(user.pulling)) var/mob/M = user.pulling var/mob/t = M.pulling - M.pulling = null + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - M.pulling = t + M.start_pulling(t) else step(user.pulling, get_dir(user.pulling.loc, src)) return @@ -1288,9 +1288,9 @@ turf/simulated/floor/return_siding_icon_state() if (ismob(user.pulling)) var/mob/M = user.pulling var/mob/t = M.pulling - M.pulling = null + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - M.pulling = t + M.start_pulling(t) else step(user.pulling, get_dir(user.pulling.loc, src)) return @@ -1309,10 +1309,10 @@ turf/simulated/floor/return_siding_icon_state() return if (ismob(user.pulling)) var/mob/M = user.pulling - var/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - M.pulling = t + M.start_pulling(t) else step(user.pulling, get_dir(user.pulling.loc, src)) return diff --git a/code/unused/conveyor.dm b/code/unused/conveyor.dm index 1dfabc7b29e..86f5ff1deba 100644 --- a/code/unused/conveyor.dm +++ b/code/unused/conveyor.dm @@ -147,12 +147,12 @@ return if (ismob(user.pulling)) var/mob/M = user.pulling - M.pulling = null + M.stop_pulling() step(user.pulling, get_dir(user.pulling.loc, src)) - user.pulling = null + user.stop_pulling() else step(user.pulling, get_dir(user.pulling.loc, src)) - user.pulling = null + user.stop_pulling() return diff --git a/code/unused/dna.dm b/code/unused/dna.dm index d3fa4adf489..7ec9fba840d 100644 --- a/code/unused/dna.dm +++ b/code/unused/dna.dm @@ -250,7 +250,7 @@ if (usr.abiotic()) usr << "\blue Subject cannot have abiotic items on." return - usr.pulling = null + usr.stop_pulling() usr.client.perspective = EYE_PERSPECTIVE usr.client.eye = src usr.loc = src @@ -871,7 +871,7 @@ if (usr.abiotic()) usr << "\blue Subject cannot have abiotic items on." return - usr.pulling = null + usr.stop_pulling() usr.client.perspective = EYE_PERSPECTIVE usr.client.eye = src usr.loc = src diff --git a/code/unused/hivebot/hivebot.dm b/code/unused/hivebot/hivebot.dm index 9ee9314ed5b..d0b9c9f0ba9 100644 --- a/code/unused/hivebot/hivebot.dm +++ b/code/unused/hivebot/hivebot.dm @@ -428,7 +428,7 @@ Frequency: return if (src.restrained()) - src.pulling = null + src.stop_pulling() var/t7 = 1 if (src.restrained()) @@ -441,7 +441,7 @@ Frequency: if (src.pulling && src.pulling.loc) if(!( isturf(src.pulling.loc) )) - src.pulling = null + src.stop_pulling() return else if(Debug) @@ -450,7 +450,7 @@ Frequency: ///// if(src.pulling && src.pulling.anchored) - src.pulling = null + src.stop_pulling() return if (!src.restrained()) @@ -474,15 +474,15 @@ Frequency: if (locate(/obj/item/weapon/grab, M.grabbed_by.len)) ok = 0 if (ok) - var/t = M.pulling - M.pulling = null + var/atom/movable/t = M.pulling + M.stop_pulling() step(src.pulling, get_dir(src.pulling.loc, T)) - M.pulling = t + M.start_pulling(t) else if (src.pulling) step(src.pulling, get_dir(src.pulling.loc, T)) else - src.pulling = null + src.stop_pulling() . = ..() if ((src.s_active && !( s_active in src.contents ) )) src.s_active.close(src) diff --git a/code/unused/vehicle.dm b/code/unused/vehicle.dm index e7f9ff31a16..12e7aeb91dc 100644 --- a/code/unused/vehicle.dm +++ b/code/unused/vehicle.dm @@ -175,7 +175,7 @@ if ((O.client && !( O.blinded ))) O << text("\blue [] loads [] into []!", H, H.pulling, src) - H.pulling = null + H.stop_pulling() /obj/machinery/vehicle/space_ship