This commit is contained in:
silicons
2020-07-20 10:46:52 -07:00
parent 58e26c540c
commit 984796b8c6
17 changed files with 53 additions and 63 deletions
+7 -16
View File
@@ -133,34 +133,25 @@
/obj/item
// Standard clickdelay variables
/// Amount of time to check for from a mob's last attack, checked before an attack happens
var/preattack_cooldown_check = CLICK_CD_MELEE
/// Amount of time to delay a mob's next attack, added after an attack happens
var/postattack_cooldown_penalty = 0
/// Amount of time to check for from a mob's last attack, checked before an attack happens. Lower = faster attacks
var/attack_speed = CLICK_CD_MELEE
/// Amount of time to hard-stagger (no clicking at all) the mob when attacking. Lower = better
var/attack_unwieldlyness = 0
/// This item bypasses any click delay mods
var/clickdelay_mod_bypass = FALSE
/// This item checks clickdelay from a user's delayed next action variable rather than the last time they attacked.
var/clickdelay_from_next_action = FALSE
/// This item ignores next action delays.
var/clickdelay_ignores_next_action = FALSE
/// This item sets clickdelay in preattack rather than post attack. This means it's set in a melee attack even if the user doesn't bash or bop it against something.
var/clickdelay_set_on_pre_attack = FALSE
/**
* Checks if a user's clickdelay is met for a standard attack
* Checks if a user's clickdelay is met for a standard attack, this is called before an attack happens.
*/
/obj/item/proc/PreattackClickdelayCheck(mob/user, atom/target)
/obj/item/proc/CheckAttackCooldown(mob/user, atom/target)
return user.CheckActionCooldown(action_cooldown_preattack, clickdelay_from_next_action, clickdelay_mod_bypass, clickdelay_ignores_next_action)
/**
* Called if check is successful before the attack happens.
*/
/obj/item/proc/PreattackClickdelaySet(mob/user, atom/target)
if(clickdelay_set_on_pre_attack)
user.DelayNextAction(0, FALSE, TRUE)
/**
* Called after a successful attack to set a mob's clickdelay.
*/
/obj/item/proc/PostattackClickdelaySet(mob/user, atom/target)
/obj/item/proc/ApplyAttackCooldown(mob/user, atom/target)
user.DelayNextAction(postattack_cooldown_penalty, clickdelay_mod_bypass, FALSE)