mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-22 12:47:16 +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:
@@ -209,7 +209,8 @@ var/list/admin_verbs_debug = list(
|
||||
/client/proc/show_gm_status,
|
||||
/datum/admins/proc/change_weather,
|
||||
/datum/admins/proc/change_time,
|
||||
/client/proc/admin_give_modifier
|
||||
/client/proc/admin_give_modifier,
|
||||
/client/proc/simple_DPS
|
||||
)
|
||||
|
||||
var/list/admin_verbs_paranoid_debug = list(
|
||||
@@ -290,6 +291,7 @@ var/list/admin_verbs_hideable = list(
|
||||
/client/proc/kill_airgroup,
|
||||
/client/proc/debug_controller,
|
||||
/client/proc/startSinglo,
|
||||
/client/proc/simple_DPS,
|
||||
/client/proc/cmd_debug_mob_lists,
|
||||
/client/proc/cmd_debug_using_map,
|
||||
/client/proc/cmd_debug_del_all,
|
||||
|
||||
@@ -16,6 +16,56 @@
|
||||
|
||||
// callproc moved to code/modules/admin/callproc
|
||||
|
||||
/client/proc/simple_DPS()
|
||||
set name = "Simple DPS"
|
||||
set category = "Debug"
|
||||
set desc = "Gives a really basic idea of how much hurt something in-hand does."
|
||||
|
||||
var/obj/item/I = null
|
||||
var/mob/living/user = null
|
||||
if(isliving(usr))
|
||||
user = usr
|
||||
I = user.get_active_hand()
|
||||
if(!I || !istype(I))
|
||||
to_chat(user, "<span class='warning'>You need to have something in your active hand, to use this verb.</span>")
|
||||
return
|
||||
var/weapon_attack_speed = user.get_attack_speed(I) / 10
|
||||
var/weapon_damage = I.force
|
||||
|
||||
if(istype(I, /obj/item/weapon/gun))
|
||||
var/obj/item/weapon/gun/G = I
|
||||
var/obj/item/projectile/P
|
||||
|
||||
if(istype(I, /obj/item/weapon/gun/energy))
|
||||
var/obj/item/weapon/gun/energy/energy_gun = G
|
||||
P = new energy_gun.projectile_type()
|
||||
|
||||
else if(istype(I, /obj/item/weapon/gun/projectile))
|
||||
var/obj/item/weapon/gun/projectile/projectile_gun = G
|
||||
var/obj/item/ammo_casing/ammo = projectile_gun.chambered
|
||||
P = ammo.BB
|
||||
|
||||
else
|
||||
to_chat(user, "<span class='warning'>DPS calculation by this verb is not supported for \the [G]'s type. Energy or Ballistic only, sorry.</span>")
|
||||
|
||||
weapon_damage = P.damage
|
||||
weapon_attack_speed = G.fire_delay / 10
|
||||
qdel(P)
|
||||
|
||||
var/DPS = weapon_damage / weapon_attack_speed
|
||||
to_chat(user, "<span class='notice'>Damage: [weapon_damage]</span>")
|
||||
to_chat(user, "<span class='notice'>Attack Speed: [weapon_attack_speed]/s</span>")
|
||||
to_chat(user, "<span class='notice'>\The [I] does <b>[DPS]</b> damage per second.</span>")
|
||||
if(DPS > 0)
|
||||
to_chat(user, "<span class='notice'>At your maximum health ([user.getMaxHealth()]), it would take approximately;</span>")
|
||||
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - config.health_threshold_softcrit) / DPS] seconds to softcrit you. ([config.health_threshold_softcrit] health)</span>")
|
||||
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - config.health_threshold_crit) / DPS] seconds to hardcrit you. ([config.health_threshold_crit] health)</span>")
|
||||
to_chat(user, "<span class='notice'>[(user.getMaxHealth() - config.health_threshold_dead) / DPS] seconds to kill you. ([config.health_threshold_dead] health)</span>")
|
||||
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need to be a living mob, with hands, and for an object to be in your active hand, to use this verb.</span>")
|
||||
return
|
||||
|
||||
/client/proc/Cell()
|
||||
set category = "Debug"
|
||||
set name = "Cell"
|
||||
|
||||
@@ -238,7 +238,7 @@
|
||||
|
||||
/obj/effect/plant/attackby(var/obj/item/weapon/W, var/mob/user)
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
plant_controller.add_plant(src)
|
||||
|
||||
if(istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/weapon/surgical/scalpel))
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
"<span class='warning'>You hear shredding and ripping.</span>")
|
||||
unbuckle()
|
||||
else
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
health -= rand(1,5)
|
||||
var/text = pick("rip","tear","pull", "bite", "tug")
|
||||
user.visible_message(\
|
||||
|
||||
@@ -568,7 +568,7 @@
|
||||
return
|
||||
|
||||
else if(O.force && seed)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(O))
|
||||
user.visible_message("<span class='danger'>\The [seed.display_name] has been attacked by [user] with \the [O]!</span>")
|
||||
if(!dead)
|
||||
health -= O.force
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
var/accuracy_dispersion // Positive numbers make gun firing cover a wider tile range, and therefore more inaccurate. Negatives help negate dispersion penalties.
|
||||
var/metabolism_percent // Adjusts the mob's metabolic rate, which affects reagent processing. Won't affect mobs without reagent processing.
|
||||
var/icon_scale_percent // Makes the holder's icon get scaled up or down.
|
||||
var/attack_speed_percent // Makes the holder's 'attack speed' (click delay) shorter or longer.
|
||||
|
||||
/datum/modifier/New(var/new_holder, var/new_origin)
|
||||
holder = new_holder
|
||||
@@ -206,6 +207,9 @@
|
||||
if(!isnull(icon_scale_percent))
|
||||
effects += "Your appearance is [multipler_to_percentage(icon_scale_percent, TRUE)] [icon_scale_percent > 1 ? "larger" : "smaller"]."
|
||||
|
||||
if(!isnull(attack_speed_percent))
|
||||
effects += "The delay between attacking is [multipler_to_percentage(attack_speed_percent, TRUE)] [disable_duration_percent > 1.0 ? "longer" : "shorter"]."
|
||||
|
||||
return jointext(effects, "<br>")
|
||||
|
||||
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
return
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if (WT.remove_fuel(0))
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(WT))
|
||||
adjustBruteLoss(-30)
|
||||
updatehealth()
|
||||
add_fingerprint(user)
|
||||
@@ -502,7 +502,7 @@
|
||||
return
|
||||
var/obj/item/stack/cable_coil/coil = W
|
||||
if (coil.use(1))
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
adjustFireLoss(-30)
|
||||
updatehealth()
|
||||
for(var/mob/O in viewers(user, null))
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
// Otherwise they're probably fighting the slime.
|
||||
if(prob(25))
|
||||
visible_message("<span class='danger'>\The [user]'s [W] passes right through [src]!</span>")
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@
|
||||
user << "<span class='warning'>You can't reach your [src.name] while holding [tool] in your [owner.get_bodypart_name(grasp)].</span>"
|
||||
return 0
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(tool))
|
||||
if(!do_mob(user, owner, 10))
|
||||
user << "<span class='warning'>You must stand still to do that.</span>"
|
||||
return 0
|
||||
|
||||
@@ -699,7 +699,7 @@
|
||||
var/mob/living/carbon/human/H = user
|
||||
|
||||
if(H.species.can_shred(H))
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
user.visible_message("<span call='warning'>[user.name] slashes at the [src.name]!</span>", "<span class='notice'>You slash at the [src.name]!</span>")
|
||||
playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1)
|
||||
|
||||
|
||||
@@ -527,7 +527,7 @@
|
||||
if(istype(user,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.species.can_shred(H))
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed())
|
||||
for(var/mob/M in viewers(src))
|
||||
M.show_message("<font color='red'>[user.name] smashed the light!</font>", 3, "You hear a tinkle of breaking glass", 2)
|
||||
broken()
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
user << "<span class='warning'>\The [blocked] is in the way!</span>"
|
||||
return
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) //puts a limit on how fast people can eat/drink things
|
||||
user.setClickCooldown(user.get_attack_speed(src)) //puts a limit on how fast people can eat/drink things
|
||||
self_feed_message(user)
|
||||
reagents.trans_to_mob(user, issmall(user) ? ceil(amount_per_transfer_from_this/2) : amount_per_transfer_from_this, CHEM_INGEST)
|
||||
feed_sound(user)
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
other_feed_message_start(user, target)
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
if(!do_mob(user, target))
|
||||
return
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
user << "<span class='warning'>\The [blocked] is in the way!</span>"
|
||||
return
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) //puts a limit on how fast people can eat/drink things
|
||||
user.setClickCooldown(user.get_attack_speed(src)) //puts a limit on how fast people can eat/drink things
|
||||
if (fullness <= 50)
|
||||
M << "<span class='danger'>You hungrily chew out a piece of [src] and gobble it!</span>"
|
||||
if (fullness > 50 && fullness <= 150)
|
||||
@@ -101,7 +101,7 @@
|
||||
user.visible_message("<span class='danger'>[user] cannot force anymore of [src] down [M]'s throat.</span>")
|
||||
return 0
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
if(!do_mob(user, M)) return
|
||||
|
||||
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been fed [src.name] by [user.name] ([user.ckey]) Reagents: [reagentlist(src)]</font>")
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
user.visible_message("<span class='warning'>[user] attempts to force [M] to swallow \the [src].</span>")
|
||||
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(src))
|
||||
if(!do_mob(user, M))
|
||||
return
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
if(W.force)
|
||||
adjust_strength(-W.force / 20)
|
||||
user.do_attack_animation(src)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
..()
|
||||
|
||||
/obj/effect/energy_field/attack_hand(var/mob/living/user)
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
if(health < maxhealth)
|
||||
if(open)
|
||||
health = min(maxhealth, health+10)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
playsound(src, T.usesound, 50, 1)
|
||||
user.visible_message("<font color='red'>[user] repairs [src]!</font>","<font color='blue'> You repair [src]!</font>")
|
||||
else
|
||||
@@ -104,7 +104,7 @@
|
||||
else
|
||||
user << "<span class='notice'>Unable to repair while [src] is off.</span>"
|
||||
else if(hasvar(W,"force") && hasvar(W,"damtype"))
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
user.setClickCooldown(user.get_attack_speed(W))
|
||||
switch(W.damtype)
|
||||
if("fire")
|
||||
health -= W.force * fire_dam_coeff
|
||||
|
||||
@@ -899,6 +899,7 @@
|
||||
|
||||
evasion = 2
|
||||
slowdown = -1
|
||||
attack_speed_percent = 0.75
|
||||
|
||||
|
||||
// *********************
|
||||
|
||||
Reference in New Issue
Block a user