mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 09:08:30 +01:00
Change some for loop with grabbed_by to be typeless since grabbed_by only contains grabs.
Replace super weird "locate(/obj/item/weapon/grab, locate(/obj/item/weapon/grab, mob.grabbed_by.len))" by simple if(grabbed_by.len)" Cleans up Process_Grab to be easier to read. Simplifies MobBump() proc, especially the part about pushing a mob that is pulling or is pullsed/grabbed. We no longer check for mobs in a 1 tile radius every time we bump a mob. Fixes runtime with clear_reagents_to_vomit_pool() due to a typo.
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 << "<span class='warning'>[M] is restrained, you cannot push past.</span>"
|
||||
return 1
|
||||
if( M.pulling == MM && ( MM.restrained() && !( M.restrained() ) && M.stat == CONSCIOUS) )
|
||||
if ( !(world.time % 5) )
|
||||
src << "<span class='warning'>[M] is restraining [MM], you cannot push past.</span>"
|
||||
//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 << "<span class='warning'>[L] is restrained, you cannot push past.</span>"
|
||||
return 1
|
||||
|
||||
if(L.pulling)
|
||||
var/mob/P = L.pulling
|
||||
if(P.restrained())
|
||||
if(!(world.time % 5))
|
||||
src << "<span class='warning'>[L] is restraining [P], you cannot push past.</span>"
|
||||
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("<span class='danger'>[src] has pulled [G.affecting] from [G.assailant]'s grip.</span>")
|
||||
qdel(G)
|
||||
visible_message("<span class='danger'>[src] has pulled [G.affecting] from [G.assailant]'s grip.</span>")
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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("<span class='warning'>[mob] has broken free of [G.assailant]'s grip!</span>")
|
||||
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("<span class='warning'>[mob] has broken free of [G.assailant]'s headlock!</span>")
|
||||
qdel(G)
|
||||
if(GRAB_AGGRESSIVE)
|
||||
move_delay = world.time + 10
|
||||
if(!prob(25))
|
||||
return 1
|
||||
mob.visible_message("<span class='warning'>[mob] has broken free of [G.assailant]'s grip!</span>")
|
||||
qdel(G)
|
||||
|
||||
if(GRAB_NECK)
|
||||
move_delay = world.time + 10
|
||||
if(!prob(5))
|
||||
return 1
|
||||
mob.visible_message("<span class='warning'>[mob] has broken free of [G.assailant]'s headlock!</span>")
|
||||
qdel(G)
|
||||
return 0
|
||||
|
||||
|
||||
///Process_Incorpmove
|
||||
///Called by client/Move()
|
||||
///Allows mobs to run though walls
|
||||
|
||||
Reference in New Issue
Block a user