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
+1
View File
@@ -8,6 +8,7 @@
icon = 'icons/obj/card.dmi'
item_flags = NOBLUDGEON
w_class = WEIGHT_CLASS_TINY
attack_cooldown = CLICK_CD_MELEE
var/datum/supply_pack/discounted_pack
var/discount_pct_off = 0.05
var/obj/machinery/computer/cargo/inserted_console
+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)
+2 -2
View File
@@ -812,11 +812,11 @@
return
/obj/item/light/attack(mob/living/M, mob/living/user, def_zone)
..()
. = ..()
shatter()
/obj/item/light/attack_obj(obj/O, mob/living/user)
..()
. = ..()
shatter()
/obj/item/light/proc/shatter()
+1 -2
View File
@@ -366,8 +366,7 @@
/obj/item/gun/attack_obj(obj/O, mob/user)
if(user.a_intent == INTENT_HARM)
if(bayonet)
O.attackby(bayonet, user)
return TRUE
return O.attackby(bayonet, user)
return ..()
/obj/item/gun/attackby(obj/item/I, mob/user, params)