mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-22 19:46:36 +01:00
Adds Variable Click Delay
Now certain weapons can strike faster or slower than usual. No weapons currently do this as this PR just lays the groundwork for that. The click delay can also be modified with traits. The slime agility modifier makes attacks happen 25% sooner. Adds debug test verb to display a weapon's DPS. It's really basic but should be sufficient for future force adjustments I might do in the future.
This commit is contained in:
@@ -120,7 +120,7 @@
|
||||
|
||||
/obj/effect/alien/resin/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
var/aforce = W.force
|
||||
health = max(0, health - aforce)
|
||||
playsound(loc, 'sound/effects/attackblob.ogg', 100, 1)
|
||||
@@ -227,7 +227,7 @@ Alien plants should do something if theres a lot of poison
|
||||
return
|
||||
|
||||
/obj/effect/alien/weeds/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
if(W.attack_verb.len)
|
||||
visible_message("<span class='danger'>\The [src] have been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]</span>")
|
||||
else
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
return
|
||||
|
||||
/obj/effect/spider/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
|
||||
if(W.attack_verb.len)
|
||||
visible_message("<span class='warning'>\The [src] have been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]</span>")
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
var/list/sprite_sheets_obj = list()
|
||||
|
||||
var/toolspeed = 1.0 // This is a multipler on how 'fast' a tool works. e.g. setting this to 0.5 will make the tool work twice as fast.
|
||||
var/attackspeed = DEFAULT_ATTACK_COOLDOWN // How long click delay will be when using this, in 1/10ths of a second. Checked in the user's get_attack_speed().
|
||||
var/addblends // Icon overlay for ADD highlights when applicable.
|
||||
|
||||
/obj/item/New()
|
||||
@@ -457,7 +458,7 @@ var/list/global/slot_flags_enumeration = list(
|
||||
M.attack_log += "\[[time_stamp()]\]<font color='orange'> Attacked by [user.name] ([user.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])</font>"
|
||||
msg_admin_attack("[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)") //BS12 EDIT ALG
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
user.do_attack_animation(M)
|
||||
|
||||
src.add_fingerprint(user)
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] to flash [M.name] ([M.ckey])</font>")
|
||||
msg_admin_attack("[user.name] ([user.ckey]) Used the [src.name] to flash [M.name] ([M.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
user.do_attack_animation(M)
|
||||
|
||||
if(!clown_check(user)) return
|
||||
@@ -75,9 +75,6 @@
|
||||
if(!check_capacitor(user))
|
||||
return
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.do_attack_animation(M)
|
||||
|
||||
playsound(src.loc, 'sound/weapons/flash.ogg', 100, 1)
|
||||
var/flashfail = 0
|
||||
|
||||
@@ -147,7 +144,7 @@
|
||||
/obj/item/device/flash/attack_self(mob/living/carbon/user as mob, flag = 0, emp = 0)
|
||||
if(!user || !clown_check(user)) return
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
|
||||
if(broken)
|
||||
user.show_message("<span class='warning'>The [src.name] is broken</span>", 2)
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
else
|
||||
user << "<span class='notice'>\The [M]'s pupils narrow.</span>"
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) //can be used offensively
|
||||
user.setClickCooldown(user.get_attack_speed(src)) //can be used offensively
|
||||
M.flash_eyes()
|
||||
else
|
||||
return ..()
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
if(!S.get_damage())
|
||||
user << "<span class='notice'>Nothing to fix here.</span>"
|
||||
else if(can_use(1))
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
if(S.open >= 2)
|
||||
if(do_after(user,5 * toolspeed))
|
||||
S.heal_damage(20, 20, robo_repair = 1)
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
msg_admin_attack("[key_name(user)] attempted to handcuff [key_name(H)]")
|
||||
feedback_add_details("handcuffs","H")
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
user.do_attack_animation(H)
|
||||
|
||||
user.visible_message("<span class='danger'>\The [user] has put [cuff_type] on \the [H]!</span>")
|
||||
@@ -286,7 +286,7 @@ var/last_chew = 0
|
||||
msg_admin_attack("[key_name(user)] attempted to legcuff [key_name(H)]")
|
||||
feedback_add_details("legcuffs","H")
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
user.do_attack_animation(H)
|
||||
|
||||
user.visible_message("<span class='danger'>\The [user] has put [cuff_type] on \the [H]!</span>")
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
var/obj/O = AM
|
||||
O.emp_act(3) // A weaker severity is used because this has infinite uses.
|
||||
playsound(get_turf(O), 'sound/effects/EMPulse.ogg', 100, 1)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) // A lot of objects don't set click delay.
|
||||
user.setClickCooldown(user.get_attack_speed(src)) // A lot of objects don't set click delay.
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/melee/energy/sword/ionic_rapier/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
var/max_carry = 10
|
||||
|
||||
/obj/item/weapon/tray/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
// Drop all the things. All of them.
|
||||
overlays.Cut()
|
||||
for(var/obj/item/I in carrying)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
msg_admin_attack("[user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
user.do_attack_animation(M)
|
||||
|
||||
if (!(istype(user, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
|
||||
@@ -134,7 +134,7 @@
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/energy_net/user_unbuckle_mob(mob/user)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
visible_message("<span class='danger'>[user] begins to tear at \the [src]!</span>")
|
||||
if(do_after(usr, escape_time, src, incapacitation_flags = INCAPACITATION_DEFAULT & ~(INCAPACITATION_RESTRAINED | INCAPACITATION_BUCKLED_FULLY)))
|
||||
if(!buckled_mob)
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
health = maxhealth
|
||||
else
|
||||
take_damage(C.force)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(C))
|
||||
return ..()
|
||||
|
||||
/obj/structure/catwalk/Crossed()
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
|
||||
/obj/structure/displaycase/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
user.do_attack_animation(src)
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 50, 1)
|
||||
src.health -= W.force
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
to_chat(user, "<span class='warning'>You need more energy to use the punching bag. Go eat something.</span>")
|
||||
else
|
||||
if(user.a_intent == I_HURT)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
flick("[icon_state]_hit", src)
|
||||
playsound(src.loc, 'sound/effects/woodhit.ogg', 25, 1, -1)
|
||||
user.do_attack_animation(src)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
to_chat(user, "<span class='warning'>\The [W] is ineffective at harming \the [src].</span>")
|
||||
|
||||
hit_animation()
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
user.do_attack_animation(src)
|
||||
|
||||
// Shakes the tree slightly, more or less stolen from lockers.
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
/obj/structure/grille/attack_hand(mob/user as mob)
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
playsound(loc, 'sound/effects/grillehit.ogg', 80, 1)
|
||||
user.do_attack_animation(src)
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
//window placing end
|
||||
|
||||
else if(!(W.flags & CONDUCT) || !shock(user, 70))
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
user.do_attack_animation(src)
|
||||
playsound(loc, 'sound/effects/grillehit.ogg', 80, 1)
|
||||
switch(W.damtype)
|
||||
|
||||
@@ -258,7 +258,7 @@
|
||||
else
|
||||
playsound(loc, 'sound/effects/grillehit.ogg', 50, 1)
|
||||
take_damage(W.force)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ var/global/list/stool_cache = list() //haha stool
|
||||
/obj/item/weapon/stool/attack(mob/M as mob, mob/user as mob)
|
||||
if (prob(5) && istype(M,/mob/living))
|
||||
user.visible_message("<span class='danger'>[user] breaks [src] over [M]'s back!</span>")
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
user.do_attack_animation(M)
|
||||
|
||||
user.drop_from_inventory(src)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
/obj/structure/toilet/attack_hand(mob/living/user as mob)
|
||||
if(swirlie)
|
||||
usr.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
usr.setClickCooldown(user.get_attack_speed())
|
||||
usr.visible_message("<span class='danger'>[user] slams the toilet seat onto [swirlie.name]'s head!</span>", "<span class='notice'>You slam the toilet seat onto [swirlie.name]'s head!</span>", "You hear reverberating porcelain.")
|
||||
swirlie.adjustBruteLoss(5)
|
||||
return
|
||||
@@ -54,7 +54,7 @@
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/weapon/grab))
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(I))
|
||||
var/obj/item/weapon/grab/G = I
|
||||
|
||||
if(isliving(G.affecting))
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 50, 1)
|
||||
|
||||
/obj/structure/window/attack_hand(mob/user as mob)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
if(HULK in user.mutations)
|
||||
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!"))
|
||||
user.visible_message("<span class='danger'>[user] smashes through [src]!</span>")
|
||||
@@ -200,7 +200,7 @@
|
||||
return
|
||||
|
||||
/obj/structure/window/attack_generic(var/mob/user, var/damage)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
if(!damage)
|
||||
return
|
||||
if(damage >= 10)
|
||||
@@ -295,7 +295,7 @@
|
||||
var/obj/item/frame/F = W
|
||||
F.try_build(src)
|
||||
else
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
if(W.damtype == BRUTE || W.damtype == BURN)
|
||||
user.do_attack_animation(src)
|
||||
hit(W.force)
|
||||
|
||||
Reference in New Issue
Block a user