Nerfs ERT IK carbine fire rate, fixes automatic_fire component rounding error (#29645)

* Fixes rounding error in automatic_fire component, nerfs lasercarbine fire rate

* Update code/modules/mob/living/carbon/human/human_mob.dm

Co-authored-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

* Update code/modules/mob/living/carbon/human/human_mob.dm

Co-authored-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>

---------

Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
This commit is contained in:
chuga-git
2025-07-04 19:26:12 +00:00
committed by GitHub
co-authored by CRUNCH Burzah
parent f0c83f9803
commit 04b81c360c
4 changed files with 66 additions and 3 deletions
@@ -73,10 +73,73 @@
GLOB.human_list -= src
UnregisterSignal(src, COMSIG_BODY_TRANSFER_TO)
/datum/hit_feedback
var/timeof
var/damage
var/damage_type
var/projectile_type
var/target_zone
/datum/hit_feedback/New(timeof, damage, damage_type, projectile_type, target_zone)
src.timeof = timeof
src.damage = damage
src.damage_type = damage_type
src.projectile_type = projectile_type
src.target_zone = target_zone
/mob/living/carbon/human/dummy
real_name = "Test Dummy"
status_flags = GODMODE|CANPUSH
var/list/hits = list()
var/first_hit = 0
var/last_hit = 0
var/timer_id = TIMER_ID_NULL
/mob/living/carbon/human/dummy/bullet_act(obj/item/projectile/P, def_zone)
if(!first_hit)
first_hit = world.time
visible_message("Started tracking hit at time [first_hit]!")
last_hit = world.time
var/datum/hit_feedback/packet = new(last_hit, P.damage, P.damage_type, P.type, def_zone)
hits.Add(packet)
timer_id = addtimer(CALLBACK(src, PROC_REF(check_done)), 3 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE)
visible_message("Hit [length(hits)]: [P.damage] dmg from [P.type] at time [last_hit]")
return ..()
/mob/living/carbon/human/dummy/proc/check_done()
if(!first_hit)
return
var/delta_now = world.time - last_hit
// Tracking window is still open
if(delta_now < 3 SECONDS)
return
// Stop counting, print, and reset
if(timer_id != TIMER_ID_NULL)
deltimer(timer_id)
timer_id = TIMER_ID_NULL
print_summary()
first_hit = 0
last_hit = 0
hits.Cut()
/mob/living/carbon/human/dummy/proc/print_summary()
if(!length(hits) || !first_hit || !last_hit)
CRASH("Tried to print a summary with no hits/first_hit/last_hit: [hits], [first_hit], [last_hit]")
var/N = length(hits)
var/delta = 1
if(length(hits) > 1)
delta = (last_hit - first_hit)/10 // deciseconds -> seconds
var/hits_per_sec = N/delta
var/total_damage = 0
for(var/hit in hits)
var/datum/hit_feedback/h = hit
total_damage += h.damage
var/damage_per_sec = total_damage/delta
log_debug("############# Starting hit report #############")
log_debug("Counted [N] hits in [delta] sec, start/stop time = [first_hit] - [last_hit] dsec")
log_debug("Fire rate = [hits_per_sec] hits/sec")
log_debug("Total damage = [total_damage], DPS = [damage_per_sec]")
log_debug("############### End hit report ################")
/mob/living/carbon/human/skrell/Initialize(mapload)
. = ..(mapload, /datum/species/skrell)
+1 -1
View File
@@ -145,7 +145,7 @@
/obj/item/gun/energy/disabler/smg/Initialize(mapload)
. = ..()
AddComponent(/datum/component/automatic_fire, 0.15 SECONDS, allow_akimbo = FALSE)
AddComponent(/datum/component/automatic_fire, 0.20 SECONDS, allow_akimbo = FALSE)
/obj/item/gun/energy/disabler/cyborg
name = "cyborg disabler"
@@ -387,7 +387,7 @@
/obj/item/gun/projectile/automatic/lasercarbine/Initialize(mapload)
. = ..()
AddComponent(/datum/component/automatic_fire, 0.15 SECONDS, allow_akimbo = FALSE)
AddComponent(/datum/component/automatic_fire, 0.30 SECONDS, allow_akimbo = FALSE)
/obj/item/gun/projectile/automatic/lasercarbine/update_icon_state()
icon_state = "lasercarbine[magazine ? "-[CEILING(get_ammo(0)/5, 1)*5]" : ""]"