diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index b521719c6da..13c424959f9 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -379,7 +379,7 @@ var/list/blood_splatter_icons = list()
/atom/proc/clear_reagents_to_vomit_pool(mob/living/carbon/M, obj/effect/decal/cleanable/vomit/V)
M.reagents.trans_to(V, M.reagents.total_volume / 10)
- for(var/datum/reagent/R in reagents.reagent_list) //clears the stomach of anything that might be digested as food
+ for(var/datum/reagent/R in M.reagents.reagent_list) //clears the stomach of anything that might be digested as food
if(istype(R, /datum/reagent/consumable))
var/datum/reagent/consumable/nutri_check = R
if(nutri_check.nutriment_factor >0)
diff --git a/code/modules/mob/interactive.dm b/code/modules/mob/interactive.dm
index ee4808bbc6b..b52dead481b 100644
--- a/code/modules/mob/interactive.dm
+++ b/code/modules/mob/interactive.dm
@@ -123,16 +123,16 @@
set name = "Customize SNPC"
set desc = "Customise the SNPC"
set category = "Admin"
-
+
if(!holder)
return
-
+
if(A)
if(!istype(A,/mob/living/carbon/human/interactive))
return
var/mob/living/carbon/human/interactive/T = A
var/cjob = input("Choose Job") as null|anything in SSjob.occupations.Copy()
-
+
if(cjob)
T.myjob = cjob
T.job = T.myjob.title
@@ -142,7 +142,7 @@
T.myjob.equip(T)
T.myjob.apply_fingerprints(T)
T.doSetup()
-
+
var/doTele = input("Place the SNPC in their department?") as null|anything in list("Yes","No")
if(doTele)
if(doTele == "Yes")
@@ -451,8 +451,9 @@
update_icons()
update_hands = 0
- if(grabbed_by.len > 0)
- for(var/obj/item/weapon/grab/G in grabbed_by)
+ if(grabbed_by.len)
+ for(var/X in grabbed_by)
+ var/obj/item/weapon/grab/G = X
if(Adjacent(G))
a_intent = "disarm"
G.assailant.attack_hand(src)
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 7d78d0a2e66..7831cfb6625 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -86,16 +86,19 @@ Sorry Giacom. Please don't be mad :(
if(now_pushing)
return 1
- //BubbleWrap: Should stop you pushing a restrained person out of the way
- if(istype(M, /mob/living))
- for(var/mob/MM in range(1,M))
- if( ((MM.pulling == M && ( M.restrained() && !( MM.restrained() ) && MM.stat == CONSCIOUS)) || locate(/obj/item/weapon/grab, M.grabbed_by.len)) )
- if ( !(world.time % 5) )
- src << "[M] is restrained, you cannot push past."
- return 1
- if( M.pulling == MM && ( MM.restrained() && !( M.restrained() ) && M.stat == CONSCIOUS) )
- if ( !(world.time % 5) )
- src << "[M] is restraining [MM], you cannot push past."
+ //Should stop you pushing a restrained person out of the way
+ if(isliving(M))
+ var/mob/living/L = M
+ if((L.pulledby && L.restrained()) || L.grabbed_by.len)
+ if(!(world.time % 5))
+ src << "[L] is restrained, you cannot push past."
+ return 1
+
+ if(L.pulling)
+ var/mob/P = L.pulling
+ if(P.restrained())
+ if(!(world.time % 5))
+ src << "[L] is restraining [P], you cannot push past."
return 1
//switch our position with M
@@ -570,18 +573,17 @@ Sorry Giacom. Please don't be mad :(
if ((get_dist(src, pulling) > 1 || diag))
if (isliving(pulling))
var/mob/living/M = pulling
- var/ok = 1
- if (locate(/obj/item/weapon/grab, M.grabbed_by))
+ var/pull_ok = 1
+ if (M.grabbed_by.len)
if (prob(75))
var/obj/item/weapon/grab/G = pick(M.grabbed_by)
- if (istype(G, /obj/item/weapon/grab))
- visible_message("[src] has pulled [G.affecting] from [G.assailant]'s grip.")
- qdel(G)
+ visible_message("[src] has pulled [G.affecting] from [G.assailant]'s grip.")
+ qdel(G)
else
- ok = 0
- if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
- ok = 0
- if (ok)
+ pull_ok = 0
+ if (M.grabbed_by.len)
+ pull_ok = 0
+ if (pull_ok)
var/atom/movable/t = M.pulling
M.stop_pulling()
@@ -652,17 +654,18 @@ Sorry Giacom. Please don't be mad :(
set name = "Resist"
set category = "IC"
- if(!isliving(src) || next_move > world.time)
+ if(!isliving(src) || next_move > world.time || stat || weakened || stunned || paralysis)
return
changeNext_move(CLICK_CD_RESIST)
//resisting grabs (as if it helps anyone...)
- if(!stat && canmove && !restrained())
+ if(canmove && !restrained())
var/resisting = 0
for(var/obj/O in requests)
qdel(O)
resisting++
- for(var/obj/item/weapon/grab/G in grabbed_by)
+ for(var/X in grabbed_by)
+ var/obj/item/weapon/grab/G = X
resisting++
if(G.state == GRAB_PASSIVE)
qdel(G)
@@ -685,10 +688,9 @@ Sorry Giacom. Please don't be mad :(
resist_buckle()
//Breaking out of a container (Locker, sleeper, cryo...)
- else if(loc && istype(loc, /obj) && !isturf(loc))
- if(stat == CONSCIOUS && !stunned && !weakened && !paralysis)
- var/obj/C = loc
- C.container_resist(src)
+ else if(isobj(loc))
+ var/obj/C = loc
+ C.container_resist(src)
else if(canmove)
if(on_fire)
diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm
index a29cc3b29fd..f088aafdcbb 100644
--- a/code/modules/mob/mob_grab.dm
+++ b/code/modules/mob/mob_grab.dm
@@ -88,7 +88,8 @@
affecting.hand = 1
affecting.drop_item()
affecting.hand = h
- for(var/obj/item/weapon/grab/G in affecting.grabbed_by)
+ for(var/X in affecting.grabbed_by)
+ var/obj/item/weapon/grab/G = X
if(G == src) continue
if(G.state == GRAB_AGGRESSIVE)
allow_upgrade = 0
diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm
index ded58659e79..87c441971e0 100644
--- a/code/modules/mob/mob_movement.dm
+++ b/code/modules/mob/mob_movement.dm
@@ -207,7 +207,7 @@
///Called by client/Move()
///Checks to see if you are being grabbed and if so attemps to break it
/client/proc/Process_Grab()
- if(locate(/obj/item/weapon/grab, locate(/obj/item/weapon/grab, mob.grabbed_by.len)))
+ if(mob.grabbed_by.len)
var/list/grabbing = list()
if(istype(mob.l_hand, /obj/item/weapon/grab))
@@ -218,26 +218,29 @@
var/obj/item/weapon/grab/G = mob.r_hand
grabbing += G.affecting
- for(var/obj/item/weapon/grab/G in mob.grabbed_by)
- if(G.state == GRAB_PASSIVE && !grabbing.Find(G.assailant))
- qdel(G)
+ for(var/X in mob.grabbed_by)
+ var/obj/item/weapon/grab/G = X
+ switch(G.state)
- if(G.state == GRAB_AGGRESSIVE)
- move_delay = world.time + 10
- if(!prob(25))
- return 1
- mob.visible_message("[mob] has broken free of [G.assailant]'s grip!")
- qdel(G)
+ if(GRAB_PASSIVE)
+ if(!grabbing.Find(G.assailant)) //moving always breaks a passive grab unless we are also grabbing our grabber.
+ qdel(G)
- if(G.state == GRAB_NECK)
- move_delay = world.time + 10
- if(!prob(5))
- return 1
- mob.visible_message("[mob] has broken free of [G.assailant]'s headlock!")
- qdel(G)
+ if(GRAB_AGGRESSIVE)
+ move_delay = world.time + 10
+ if(!prob(25))
+ return 1
+ mob.visible_message("[mob] has broken free of [G.assailant]'s grip!")
+ qdel(G)
+
+ if(GRAB_NECK)
+ move_delay = world.time + 10
+ if(!prob(5))
+ return 1
+ mob.visible_message("[mob] has broken free of [G.assailant]'s headlock!")
+ qdel(G)
return 0
-
///Process_Incorpmove
///Called by client/Move()
///Allows mobs to run though walls