Skip to content
This repository has been archived by the owner on Sep 21, 2024. It is now read-only.

Weapon timer feels wrong #83

Open
a-beyblade opened this issue Nov 12, 2023 · 1 comment
Open

Weapon timer feels wrong #83

a-beyblade opened this issue Nov 12, 2023 · 1 comment

Comments

@a-beyblade
Copy link

This code doesn't implement surviv.io's timer system correctly:

weaponCooldownOver(): boolean {
return Date.now() - this.activeWeapon.cooldown >= this.activeWeapon.cooldownDuration &&
(this.activeWeaponInfo.weaponClass !== "sniper"
? Date.now() - (this.activeWeaponInfo.switchDelay * 1000) >= this.activeWeapon.switchCooldown
: true);
}

In the "old system" before the double pump nerf around Sep 2018, it should be

weaponCooldownOver(): boolean { 
    return Date.now() - this.activeWeapon.cooldown >= this.activeWeapon.cooldownDuration; 
}

In the "new system" between that and their shutdown, it would involve the "free switch timer", which I describe in great detail at surviv-underclock/docs. In that document, effective switch delay roughly corresponds to weapon cooldown.

@a-beyblade
Copy link
Author

I made a mistake: in the old system, switching should also replace the cooldown timer with the switch delay since the last switch, which would be

weaponCooldownOver(): boolean { 
    return Date.now() - this.activeWeapon.cooldown >= (weaponWasSwitchedAfterShot) ? this.activeWeaponInfo.switchDelay * 1000 : this.activeWeapon.cooldownDuration; 
}

(weaponWasSwitchedAfterShot) needs to be replaced with code that checks for whether the weapon was no-slowed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant