mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
Grab movespeed modifier (#47728)
* Migrates grab move delay to a movemod Doesn't work until all grab state changes are hooked in * Replaces grab_state sets with proc `\bgrab_state\s*?=\s*?(\w+)` => `setGrabState($1)` Check over the results, this will catch a couple false positives * Catches a missed increment and fixes a bug
This commit is contained in:
committed by
Rob Bailey
parent
6ee01f2977
commit
d8d1abadd1
@@ -17,6 +17,7 @@
|
||||
//ids
|
||||
|
||||
#define MOVESPEED_ID_MOB_WALK_RUN_CONFIG_SPEED "MOB_WALK_RUN"
|
||||
#define MOVESPEED_ID_MOB_GRAB_STATE "MOB_GRAB_STATE"
|
||||
#define MOVESPEED_ID_CONFIG_SPEEDMOD "MOB_CONFIG_MODIFIER"
|
||||
|
||||
#define MOVESPEED_ID_SLIME_REAGENTMOD "SLIME_REAGENT_MODIFIER"
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
D.grabbedby(A, 1)
|
||||
if(old_grab_state == GRAB_PASSIVE)
|
||||
D.drop_all_held_items()
|
||||
A.grab_state = GRAB_AGGRESSIVE //Instant agressive grab if on grab intent
|
||||
A.setGrabState(GRAB_AGGRESSIVE) //Instant agressive grab if on grab intent
|
||||
log_combat(A, D, "grabbed", addition="aggressively")
|
||||
D.visible_message("<span class='warning'>[A] violently grabs [D]!</span>", \
|
||||
"<span class='userdanger'>You're grabbed violently by [A]!</span>", "<span class='hear'>You hear sounds of aggressive fondling!</span>", COMBAT_MESSAGE_RANGE, A)
|
||||
@@ -201,7 +201,7 @@
|
||||
D.SetSleeping(400)
|
||||
restraining = FALSE
|
||||
if(A.grab_state < GRAB_NECK)
|
||||
A.grab_state = GRAB_NECK
|
||||
A.setGrabState(GRAB_NECK)
|
||||
else
|
||||
restraining = FALSE
|
||||
return FALSE
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
D.visible_message("<span class='warning'>[A] violently grabs [D]!</span>", \
|
||||
"<span class='userdanger'>You're violently grabbed by [A]!</span>", "<span class='hear'>You hear sounds of aggressive fondling!</span>", null, A)
|
||||
to_chat(A, "<span class='danger'>You violently grab [D]!</span>")
|
||||
A.grab_state = GRAB_AGGRESSIVE //Instant aggressive grab
|
||||
A.setGrabState(GRAB_AGGRESSIVE) //Instant aggressive grab
|
||||
else
|
||||
log_combat(A, D, "grabbed", addition="passively")
|
||||
A.grab_state = GRAB_PASSIVE
|
||||
A.setGrabState(GRAB_PASSIVE)
|
||||
if(4)
|
||||
A.do_attack_animation(D, ATTACK_EFFECT_PUNCH)
|
||||
atk_verb = "headbutt"
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
D.grabbedby(A, 1)
|
||||
if(old_grab_state == GRAB_PASSIVE)
|
||||
D.drop_all_held_items()
|
||||
A.grab_state = GRAB_AGGRESSIVE //Instant agressive grab if on grab intent
|
||||
A.setGrabState(GRAB_AGGRESSIVE) //Instant agressive grab if on grab intent
|
||||
log_combat(A, D, "grabbed", addition="aggressively")
|
||||
D.visible_message("<span class='warning'>[A] violently grabs [D]!</span>", \
|
||||
"<span class='userdanger'>You're violently grabbed by [A]!</span>", "<span class='hear'>You hear aggressive shuffling!</span>", null, A)
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
return FALSE
|
||||
// Are we trying to pull something we are already pulling? Then enter grab cycle and end.
|
||||
if(AM == pulling)
|
||||
grab_state = state
|
||||
setGrabState(state)
|
||||
if(istype(AM,/mob/living))
|
||||
var/mob/living/AMob = AM
|
||||
AMob.grabbedby(src)
|
||||
@@ -143,7 +143,7 @@
|
||||
AM.pulledby.stop_pulling() //an object can't be pulled by two mobs at once.
|
||||
pulling = AM
|
||||
AM.pulledby = src
|
||||
grab_state = state
|
||||
setGrabState(state)
|
||||
if(ismob(AM))
|
||||
var/mob/M = AM
|
||||
log_combat(src, M, "grabbed", addition="passive grab")
|
||||
@@ -157,7 +157,7 @@
|
||||
pulling.pulledby = null
|
||||
var/mob/living/ex_pulled = pulling
|
||||
pulling = null
|
||||
grab_state = 0
|
||||
setGrabState(0)
|
||||
if(isliving(ex_pulled))
|
||||
var/mob/living/L = ex_pulled
|
||||
L.update_mobility()// mob gets up if it was lyng down in a chokehold
|
||||
@@ -868,6 +868,11 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/// Updates the grab state of the movable
|
||||
/// This exists to act as a hook for behaviour
|
||||
/atom/movable/proc/setGrabState(newstate)
|
||||
grab_state = newstate
|
||||
|
||||
/obj/item/proc/do_pickup_animation(atom/target)
|
||||
set waitfor = FALSE
|
||||
if(!istype(loc, /turf))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/mob/living/carbon/movement_delay()
|
||||
. = ..()
|
||||
. += grab_state * 3 //can't go fast while grabbing something.
|
||||
|
||||
if(!get_leg_ignore()) //ignore the fact we lack legs
|
||||
var/leg_amount = get_num_legs()
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
if(user.a_intent != INTENT_GRAB)
|
||||
to_chat(user, "<span class='warning'>You must be on grab intent to upgrade your grab further!</span>")
|
||||
return 0
|
||||
user.grab_state++
|
||||
user.setGrabState(user.grab_state + 1)
|
||||
switch(user.grab_state)
|
||||
if(GRAB_AGGRESSIVE)
|
||||
var/add_log = ""
|
||||
|
||||
@@ -1218,3 +1218,11 @@
|
||||
/mob/setMovetype(newval)
|
||||
. = ..()
|
||||
update_movespeed(FALSE)
|
||||
|
||||
/// Updates the grab state of the mob and updates movespeed
|
||||
/mob/setGrabState(newstate)
|
||||
. = ..()
|
||||
if(grab_state == GRAB_PASSIVE)
|
||||
remove_movespeed_modifier(MOVESPEED_ID_MOB_GRAB_STATE, update=TRUE)
|
||||
else
|
||||
add_movespeed_modifier(MOVESPEED_ID_MOB_GRAB_STATE, update=TRUE, priority=100, override=TRUE, multiplicative_slowdown=grab_state*3, blacklisted_movetypes=FLOATING)
|
||||
|
||||
Reference in New Issue
Block a user