This commit is contained in:
silicons
2020-07-18 18:29:09 -07:00
parent 7c5d4f863d
commit 0b98b0409b
10 changed files with 60 additions and 33 deletions
+7 -5
View File
@@ -76,7 +76,7 @@
face_atom(A)
if(next_move > world.time) // in the year 2000...
if(!CheckActionCooldown())
return
if(!modifiers["catcher"] && A.IsObscured())
@@ -108,8 +108,9 @@
if(W)
W.melee_attack_chain(src, A, params)
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
if(ismob(A) && !CheckActionCooldown(CLICK_CD_MELEE))
return
DelayNextAction()
UnarmedAttack(A)
return
@@ -122,8 +123,9 @@
if(W)
W.melee_attack_chain(src, A, params)
else
if(ismob(A))
changeNext_move(CLICK_CD_MELEE)
if(ismob(A) && !CheckActionCooldown(CLICK_CD_MELEE))
return
DelayNextAction()
UnarmedAttack(A, 1)
else
if(W)
+3 -3
View File
@@ -272,7 +272,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
var/mob/living/L = usr
if(!istype(L) || !L.can_resist())
return
L.changeNext_move(CLICK_CD_RESIST)
L.last_resist = world.time
if(CHECK_MOBILITY(L, MOBILITY_MOVE))
return L.resist_fire() //I just want to start a flame in your hearrrrrrtttttt.
@@ -600,7 +600,7 @@ so as to remain in compliance with the most up-to-date laws."
var/mob/living/L = usr
if(!istype(L) || !L.can_resist())
return
L.changeNext_move(CLICK_CD_RESIST)
L.last_resist = world.time
if(CHECK_MOBILITY(L, MOBILITY_MOVE) && (L.last_special <= world.time))
return L.resist_restraints()
@@ -608,7 +608,7 @@ so as to remain in compliance with the most up-to-date laws."
var/mob/living/L = usr
if(!istype(L) || !L.can_resist())
return
L.changeNext_move(CLICK_CD_RESIST)
L.last_resist = world.time
if(L.last_special <= world.time)
return L.resist_buckle()
+4 -3
View File
@@ -21,6 +21,7 @@
return
if(QDELETED(src) || QDELETED(target))
return
PostattackClickdelaySet(user, target))
afterattack(target, user, TRUE, params)
/// Like melee_attack_chain but for ranged.
@@ -41,6 +42,9 @@
/obj/item/proc/pre_attack(atom/A, mob/living/user, params) //do stuff before attackby!
if(SEND_SIGNAL(src, COMSIG_ITEM_PRE_ATTACK, A, user, params) & COMPONENT_NO_ATTACK)
return TRUE
if(!PreatackClickdelayCheck(user, A))
return TRUE
PreattackClickdelaySet(user, A)
return FALSE //return TRUE to avoid calling attackby after this proc does stuff
// No comment
@@ -55,10 +59,7 @@
/mob/living/attackby(obj/item/I, mob/living/user, params, attackchain_flags, damage_multiplier)
if(..())
return TRUE
I.attack_delay_done = FALSE //Should be set TRUE in pre_attacked_by()
. = I.attack(src, user, attackchain_flags, damage_multiplier)
if(!I.attack_delay_done) //Otherwise, pre_attacked_by() should handle it.
user.changeNext_move(I.click_delay)
/obj/item/proc/attack(mob/living/M, mob/living/user, attackchain_flags = NONE, damage_multiplier = 1)
if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user) & COMPONENT_ITEM_NO_ATTACK)
+1 -10
View File
@@ -58,15 +58,6 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
/// How long, in deciseconds, this staggers for, if null it will autocalculate from w_class and force. Unlike total mass this supports 0 and negatives.
var/stagger_force
/**
* Set FALSE and then checked at the end of on mob/living/attackby(), set TRUE on living/pre_attacked_by().
* Should it be FALSE by the end of the item/attack(), that means the item overrode the standard attack behaviour
* and the user still needs the delay applied. We can't be using return values since that'll stop afterattack() from being triggered.
*/
var/attack_delay_done = FALSE
///next_move click/attack delay of this item.
var/click_delay = CLICK_CD_MELEE
var/slot_flags = 0 //This is used to determine on which slots an item can fit.
var/current_equipped_slot
pass_flags = PASSTABLE
@@ -1113,4 +1104,4 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
jostle_pain_mult = (!isnull(embedding["jostle_pain_mult"]) ? embedding["jostle_pain_mult"] : EMBEDDED_JOSTLE_PAIN_MULTIPLIER),\
pain_stam_pct = (!isnull(embedding["pain_stam_pct"]) ? embedding["pain_stam_pct"] : EMBEDDED_PAIN_STAM_PCT),\
embed_chance_turf_mod = (!isnull(embedding["embed_chance_turf_mod"]) ? embedding["embed_chance_turf_mod"] : EMBED_CHANCE_TURF_MOD))
return TRUE
return TRUE
+2 -2
View File
@@ -58,7 +58,7 @@
if(T)
user.visible_message("[user] cleans \the [T] with [src].", "<span class='notice'>You clean \the [T] with [src].</span>")
clean(T)
user.changeNext_move(CLICK_CD_MELEE)
user.DelayNextAction(CLICK_CD_MELEE)
user.do_attack_animation(T, used_item = src)
if(istype(L))
L.adjustStaminaLossBuffered(stamusage)
@@ -128,4 +128,4 @@
return ..()
/obj/item/mop/advanced/cyborg
insertable = FALSE
insertable = FALSE
-1
View File
@@ -40,4 +40,3 @@
user.visible_message("<span class='warning'>[user] waves around \the \"[label]\" sign.</span>")
else
user.visible_message("<span class='warning'>[user] waves around blank sign.</span>")
user.changeNext_move(CLICK_CD_MELEE)
+5 -3
View File
@@ -103,7 +103,8 @@
. = ..()
if(.)
return
user.changeNext_move(CLICK_CD_MELEE)
if(!M.CheckActionCooldown(CLICK_CD_MELEE))
return
user.do_attack_animation(src, ATTACK_EFFECT_KICK)
user.visible_message("<span class='warning'>[user] hits [src].</span>", null, null, COMBAT_MESSAGE_RANGE)
log_combat(user, src, "hit")
@@ -111,8 +112,9 @@
take_damage(rand(5,10), BRUTE, "melee", 1)
/obj/structure/grille/attack_alien(mob/living/user)
if(!M.CheckActionCooldown(CLICK_CD_MELEE))
return
user.do_attack_animation(src)
user.changeNext_move(CLICK_CD_MELEE)
user.visible_message("<span class='warning'>[user] mangles [src].</span>", null, null, COMBAT_MESSAGE_RANGE)
if(!shock(user, 70))
take_damage(20, BRUTE, "melee", 1)
@@ -134,7 +136,7 @@
. = . || (mover.pass_flags & PASSGRILLE)
/obj/structure/grille/attackby(obj/item/W, mob/user, params)
user.changeNext_move(CLICK_CD_MELEE)
user.DelayNextAction(CLICK_CD_MELEE)
add_fingerprint(user)
if(istype(W, /obj/item/wirecutters))
if(!shock(user, 100))
+1 -1
View File
@@ -30,7 +30,7 @@
if(.)
return
user.do_attack_animation(src, ATTACK_EFFECT_PUNCH)
user.changeNext_move(CLICK_CD_MELEE)
user.DelayNextAction(CLICK_CD_MELEE)
take_damage(5 , BRUTE, "melee", 1)
/obj/structure/holosign/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
+6 -5
View File
@@ -113,12 +113,11 @@
return FALSE
/turf/closed/wall/attack_paw(mob/living/user)
user.changeNext_move(CLICK_CD_MELEE)
return attack_hand(user)
/turf/closed/wall/attack_animal(mob/living/simple_animal/M)
M.changeNext_move(CLICK_CD_MELEE)
if(!M.CheckActionCooldown(CLICK_CD_MELEE))
return
M.do_attack_animation(src)
if((M.environment_smash & ENVIRONMENT_SMASH_WALLS) || (M.environment_smash & ENVIRONMENT_SMASH_RWALLS))
playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1)
@@ -141,13 +140,15 @@
. = ..()
if(.)
return
user.changeNext_move(CLICK_CD_MELEE)
if(!M.CheckActionCooldown(CLICK_CD_MELEE))
return
to_chat(user, "<span class='notice'>You push the wall but nothing happens!</span>")
playsound(src, 'sound/weapons/genhit.ogg', 25, 1)
add_fingerprint(user)
/turf/closed/wall/attackby(obj/item/W, mob/user, params)
user.changeNext_move(CLICK_CD_MELEE)
if(!M.CheckActionCooldown(CLICK_CD_MELEE))
return
if (!user.IsAdvancedToolUser())
to_chat(user, "<span class='warning'>You don't have the dexterity to do this!</span>")
return
+31
View File
@@ -60,3 +60,34 @@
*/
/mob/proc/CheckResistCooldown()
return (world.time >= (last_resist + resist_cooldown))
/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
/// 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
/**
* Checks if a user's clickdelay is met for a standard attack
*/
/obj/item/proc/PreattackClickdelayCheck(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)
user.DelayNextAction(0, FALSe, TRUE)
/**
* Called after a successful attack to set a mob's clickdelay.
*/
/obj/item/proc/PostattackClickdelaySet(mob/user, atom/target)
user.DelayNextAction(postattack_cooldown_penalty, clickdelay_mod_bypass, FALSE)