From 184e3992f33cb01d7632c631879f3d3712909f40 Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Tue, 21 Jul 2020 11:56:23 -0700
Subject: [PATCH] fixes
---
code/_onclick/click.dm | 6 +++---
code/_onclick/hud/screen_objects.dm | 1 +
code/_onclick/right_item_attack.dm | 5 ++---
code/game/machinery/_machinery.dm | 2 +-
code/game/objects/items/devices/forcefieldprojector.dm | 2 +-
code/game/objects/items/powerfist.dm | 3 +--
code/game/objects/items/storage/boxes.dm | 8 ++++----
code/game/objects/items/storage/dakis.dm | 2 +-
code/game/objects/items/stunbaton.dm | 4 +++-
code/modules/food_and_drinks/drinks/drinks.dm | 5 ++++-
code/modules/food_and_drinks/food/snacks.dm | 6 ++++--
code/modules/mining/aux_base_camera.dm | 2 +-
code/modules/mob/living/living_active_block.dm | 3 +--
code/modules/mob/living/silicon/robot/robot.dm | 3 ++-
code/modules/power/lighting.dm | 4 +---
15 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm
index 900123320e..58cc5e5dca 100644
--- a/code/_onclick/click.dm
+++ b/code/_onclick/click.dm
@@ -316,11 +316,11 @@
/mob/living/carbon/human/CtrlClick(mob/user)
if(ishuman(user) && Adjacent(user) && !user.incapacitated())
- if(world.time < user.next_move)
+ if(!user.CheckActionCooldown())
return FALSE
var/mob/living/carbon/human/H = user
H.dna.species.grab(H, src, H.mind.martial_art)
- H.changeNext_move(CLICK_CD_MELEE)
+ H.DelayNextAction(CLICK_CD_MELEE)
else
..()
/*
@@ -380,7 +380,7 @@
return
/mob/living/LaserEyes(atom/A, params)
- changeNext_move(CLICK_CD_RANGE)
+ DelayNextAction(CLICK_CD_RANGE)
var/obj/item/projectile/beam/LE = new /obj/item/projectile/beam( loc )
LE.icon = 'icons/effects/genetics.dmi'
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index 366bec52b7..126cc18907 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -176,6 +176,7 @@
/obj/screen/inventory/hand/Click(location, control, params)
if(hud?.mymob && (hud.mymob != usr))
return
+ var/mob/user = hud.mymob
// just redirect clicks
if(user.active_hand_index == held_index)
diff --git a/code/_onclick/right_item_attack.dm b/code/_onclick/right_item_attack.dm
index bba3b14e2e..4ac9c96c8e 100644
--- a/code/_onclick/right_item_attack.dm
+++ b/code/_onclick/right_item_attack.dm
@@ -1,10 +1,9 @@
/obj/item/proc/rightclick_melee_attack_chain(mob/user, atom/target, params)
if(!alt_pre_attack(target, user, params)) //Hey, does this item have special behavior that should override all normal right-click functionality?
if(!target.altattackby(src, user, params)) //Does the target do anything special when we right-click on it?
- melee_attack_chain(user, target, params) //Ugh. Lame! I'm filing a legal complaint about the discrimination against the right mouse button!
+ . = melee_attack_chain(user, target, params) //Ugh. Lame! I'm filing a legal complaint about the discrimination against the right mouse button!
else
- altafterattack(target, user, TRUE, params)
- return
+ . = altafterattack(target, user, TRUE, params)
/obj/item/proc/alt_pre_attack(atom/A, mob/living/user, params)
return FALSE //return something other than false if you wanna override attacking completely
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 6ef13ac36f..3faf6d5727 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -313,7 +313,7 @@ Class Procs:
if(user.a_intent != INTENT_HARM)
return attack_hand(user)
else
- user.changeNext_move(CLICK_CD_MELEE)
+ user.DelayNextAction(CLICK_CD_MELEE)
user.do_attack_animation(src, ATTACK_EFFECT_PUNCH)
user.visible_message("[user.name] smashes against \the [src.name] with its paws.", null, null, COMBAT_MESSAGE_RANGE)
take_damage(4, BRUTE, "melee", 1)
diff --git a/code/game/objects/items/devices/forcefieldprojector.dm b/code/game/objects/items/devices/forcefieldprojector.dm
index 03ca110ec8..9ef9d73705 100644
--- a/code/game/objects/items/devices/forcefieldprojector.dm
+++ b/code/game/objects/items/devices/forcefieldprojector.dm
@@ -43,7 +43,7 @@
user.visible_message("[user] projects a forcefield!","You project a forcefield.")
var/obj/structure/projected_forcefield/F = new(T, src)
current_fields += F
- user.changeNext_move(CLICK_CD_MELEE)
+ user.DelayNextAction(CLICK_CD_MELEE)
/obj/item/forcefield_projector/attack_self(mob/user)
if(LAZYLEN(current_fields))
diff --git a/code/game/objects/items/powerfist.dm b/code/game/objects/items/powerfist.dm
index b7e2d22d2f..217c26d5de 100644
--- a/code/game/objects/items/powerfist.dm
+++ b/code/game/objects/items/powerfist.dm
@@ -14,12 +14,11 @@
w_class = WEIGHT_CLASS_NORMAL
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 40)
resistance_flags = FIRE_PROOF
- click_delay = CLICK_CD_MELEE * 1.5
+ attack_speed = CLICK_CD_MELEE * 1.5
var/fisto_setting = 1
var/gasperfist = 3
var/obj/item/tank/internals/tank = null //Tank used for the gauntlet's piston-ram.
-
/obj/item/melee/powerfist/examine(mob/user)
. = ..()
if(!in_range(user, src))
diff --git a/code/game/objects/items/storage/boxes.dm b/code/game/objects/items/storage/boxes.dm
index 02ae867240..975621ead1 100644
--- a/code/game/objects/items/storage/boxes.dm
+++ b/code/game/objects/items/storage/boxes.dm
@@ -726,9 +726,9 @@ obj/item/storage/box/stingbangs
return (BRUTELOSS)
/obj/item/storage/box/hug/attack_self(mob/user)
- ..()
- user.changeNext_move(CLICK_CD_MELEE)
- playsound(loc, "rustle", 50, 1, -5)
+ . = ..()
+ user.DelayNextAction(CLICK_CD_MELEE)
+ playsound(src, "rustle", 50, 1, -5)
user.visible_message("[user] hugs \the [src].","You hug \the [src].")
SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT,"hugbox", /datum/mood_event/hugbox)
@@ -1423,4 +1423,4 @@ obj/item/storage/box/stingbangs
/obj/item/storage/box/strange_seeds_5pack/PopulateContents()
for(var/i in 1 to 5)
- new /obj/item/seeds/random(src)
\ No newline at end of file
+ new /obj/item/seeds/random(src)
diff --git a/code/game/objects/items/storage/dakis.dm b/code/game/objects/items/storage/dakis.dm
index 1939593c8e..29f12df4c4 100644
--- a/code/game/objects/items/storage/dakis.dm
+++ b/code/game/objects/items/storage/dakis.dm
@@ -47,6 +47,6 @@
if(INTENT_HARM)
user.visible_message("[user] punches the [name]!")
playsound(src, 'sound/effects/shieldbash.ogg', 50, 1)
- user.changeNext_move(CLICK_CD_MELEE)
+ user.DelayNextAction(CLICK_CD_MELEE)
////////////////////////////
diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm
index fa0c9ba693..574036f07c 100644
--- a/code/game/objects/items/stunbaton.dm
+++ b/code/game/objects/items/stunbaton.dm
@@ -145,7 +145,6 @@
/obj/item/melee/baton/alt_pre_attack(atom/A, mob/living/user, params)
. = common_baton_melee(A, user, TRUE) //return true (attackchain interrupt) if this also returns true. no harm-disarming.
- user.changeNext_move(CLICK_CD_MELEE)
//return TRUE to interrupt attack chain.
/obj/item/melee/baton/proc/common_baton_melee(mob/M, mob/living/user, disarming = FALSE)
@@ -153,6 +152,9 @@
return FALSE
if(turned_on && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
clowning_around(user)
+ if(!user.CheckActionCooldown(CLICK_CD_MELEE))
+ return TRUE
+ user.DelayNextAction()
if(IS_STAMCRIT(user)) //CIT CHANGE - makes it impossible to baton in stamina softcrit
to_chat(user, "You're too exhausted to use [src] properly.")
return TRUE
diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm
index 2e68c57abd..821edba89c 100644
--- a/code/modules/food_and_drinks/drinks/drinks.dm
+++ b/code/modules/food_and_drinks/drinks/drinks.dm
@@ -23,7 +23,6 @@
gulp_size = max(round(reagents.total_volume / 5), 5)
/obj/item/reagent_containers/food/drinks/attack(mob/living/M, mob/user, def_zone)
-
if(!reagents || !reagents.total_volume)
to_chat(user, "[src] is empty!")
return 0
@@ -56,6 +55,10 @@
playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1)
return 1
+/obj/item/reagent_containers/food/drinks/CheckAttackCooldown(mob/user, atom/target)
+ var/fast = HAS_TRAIT(user, TRAIT_VORACIOUS) && (user == target)
+ return user.CheckActionCooldown(fast? CLICK_CD_RANGE : CLICK_CD_MELEE)
+
/obj/item/reagent_containers/food/drinks/afterattack(obj/target, mob/user , proximity)
. = ..()
if(!proximity)
diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm
index de264ff0e4..76fe01b072 100644
--- a/code/modules/food_and_drinks/food/snacks.dm
+++ b/code/modules/food_and_drinks/food/snacks.dm
@@ -129,8 +129,6 @@ All foods are distributed among various categories. Use common sense.
else if(fullness > (600 * (1 + M.overeatduration / 2000))) // The more you eat - the more you can eat
user.visible_message("[user] cannot force any more of \the [src] to go down [user.p_their()] throat!", "You cannot force any more of \the [src] to go down your throat!")
return 0
- if(HAS_TRAIT(M, TRAIT_VORACIOUS))
- M.changeNext_move(CLICK_CD_MELEE * 0.5) //nom nom nom
else
if(!isbrain(M)) //If you're feeding it to someone else.
if(fullness <= (600 * (1 + M.overeatduration / 1000)))
@@ -167,6 +165,10 @@ All foods are distributed among various categories. Use common sense.
return 0
+/obj/item/reagent_containers/food/snacks/CheckAttackCooldown(mob/user, atom/target)
+ var/fast = HAS_TRAIT(user, TRAIT_VORACIOUS) && (user == target)
+ return user.CheckActionCooldown(fast? CLICK_CD_RANGE : CLICK_CD_MELEE)
+
/obj/item/reagent_containers/food/snacks/examine(mob/user)
. = ..()
if(food_quality >= 70)
diff --git a/code/modules/mining/aux_base_camera.dm b/code/modules/mining/aux_base_camera.dm
index d461523744..be0a41427f 100644
--- a/code/modules/mining/aux_base_camera.dm
+++ b/code/modules/mining/aux_base_camera.dm
@@ -187,7 +187,7 @@
if(LAZYLEN(S.rcd_vals(owner,B.RCD)))
rcd_target = S //If we don't break out of this loop we'll get the last placed thing
- owner.changeNext_move(CLICK_CD_RANGE)
+ owner.DelayNextAction(CLICK_CD_RANGE)
B.RCD.afterattack(rcd_target, owner, TRUE) //Activate the RCD and force it to work remotely!
playsound(target_turf, 'sound/items/deconstruct.ogg', 60, 1)
diff --git a/code/modules/mob/living/living_active_block.dm b/code/modules/mob/living/living_active_block.dm
index 4211b2cfd9..bb6e08ee0f 100644
--- a/code/modules/mob/living/living_active_block.dm
+++ b/code/modules/mob/living/living_active_block.dm
@@ -10,8 +10,7 @@
REMOVE_TRAIT(src, TRAIT_SPRINT_LOCKED, ACTIVE_BLOCK_TRAIT)
remove_movespeed_modifier(/datum/movespeed_modifier/active_block)
var/datum/block_parry_data/data = I.get_block_parry_data()
- if(timeToNextMove() < data.block_end_click_cd_add)
- changeNext_move(data.block_end_click_cd_add)
+ DelayNextAction(data.block_end_click_cd_add)
return TRUE
/mob/living/proc/ACTIVE_BLOCK_START(obj/item/I)
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index a265771024..4fcd6d1dbd 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -289,6 +289,7 @@
/mob/living/silicon/robot/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weldingtool) && (user.a_intent != INTENT_HARM || user == src))
+ user.DelayNextAction(CLICK_CD_MELEE)
if (!getBruteLoss())
to_chat(user, "[src] is already in good condition!")
return
@@ -310,7 +311,7 @@
return
else if(istype(W, /obj/item/stack/cable_coil) && wiresexposed)
- user.changeNext_move(CLICK_CD_MELEE)
+ user.DelayNextAction(CLICK_CD_MELEE)
if (getFireLoss() > 0 || getToxLoss() > 0)
if(src == user)
to_chat(user, "You start fixing yourself...")
diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm
index 2ecc8f44d0..20f7ce099a 100644
--- a/code/modules/power/lighting.dm
+++ b/code/modules/power/lighting.dm
@@ -597,9 +597,7 @@
/obj/machinery/light/on_attack_hand(mob/living/carbon/human/user)
. = ..()
- if(.)
- return
- user.changeNext_move(CLICK_CD_MELEE)
+ user.DelayNextAction(CLICK_CD_MELEE)
add_fingerprint(user)
if(status == LIGHT_EMPTY)