This commit is contained in:
Daniel Maixner 2022-10-03 14:22:17 +02:00
parent 82fa6ebf3b
commit 8c09e48001
4 changed files with 5 additions and 9 deletions

View File

@ -138,7 +138,7 @@ final class Action
public static function getWeaponPrimarySpeedMultiplier(string $itemId): float
{
if (!isset(self::$cacheFloat["getWeaponPrimarySpeedMultiplier-{$itemId}"])) {
self::$cacheFloat["getWeaponPrimarySpeedMultiplier-{$itemId}"] = self::$data["weaponPrimarySpeedMultiplier-{$itemId}"] ?? 0.6;
self::$cacheFloat["getWeaponPrimarySpeedMultiplier-{$itemId}"] = (self::$data["weaponPrimarySpeedMultiplier-{$itemId}"] ?? 60) / 100;
}
return self::$cacheFloat["getWeaponPrimarySpeedMultiplier-{$itemId}"];
}
@ -146,7 +146,7 @@ final class Action
public static function getWeaponSecondarySpeedMultiplier(string $itemId): float
{
if (!isset(self::$cacheFloat["getWeaponSecondarySpeedMultiplier-{$itemId}"])) {
self::$cacheFloat["getWeaponSecondarySpeedMultiplier-{$itemId}"] = self::$data["weaponSecondarySpeedMultiplier-{$itemId}"] ?? 0.8;
self::$cacheFloat["getWeaponSecondarySpeedMultiplier-{$itemId}"] = (self::$data["weaponSecondarySpeedMultiplier-{$itemId}"] ?? 80) / 100;
}
return self::$cacheFloat["getWeaponSecondarySpeedMultiplier-{$itemId}"];
}

View File

@ -43,9 +43,6 @@ final class AttackEvent
foreach ($hits as $hit) {
$bullet->lowerDamage($hit->getHitAntiForce());
$result->addHit($hit);
if (!$bullet->isActive()) {
break;
}
}
}
return $result;

View File

@ -3,7 +3,6 @@
namespace cs\Event;
use Closure;
use cs\Core\Util;
class TimeoutEvent extends Event
{
@ -13,7 +12,7 @@ class TimeoutEvent extends Event
public function __construct(Closure $callback, protected int $timeoutMs)
{
$this->callback = $callback;
$this->tickCountTimeout = Util::millisecondsToFrames($this->timeoutMs);
$this->tickCountTimeout = $this->timeMsToTick($this->timeoutMs);
}
final public function process(int $tick): void

View File

@ -19,7 +19,7 @@ abstract class AmmoBasedWeapon extends BaseWeapon implements Reloadable, AttackE
protected bool $reloading = false;
protected bool $isWeaponPrimary;
private ?ReloadEvent $eventReload = null;
private int $lastAttackTick = -9999;
private int $lastAttackTick = 0;
private int $fireRateTicks;
public function __construct(bool $instantlyEquip = false)
@ -41,7 +41,7 @@ abstract class AmmoBasedWeapon extends BaseWeapon implements Reloadable, AttackE
return false;
}
return ($this->lastAttackTick + $this->fireRateTicks <= $tickId);
return ($this->lastAttackTick === 0 || $this->lastAttackTick + $this->fireRateTicks <= $tickId);
}
public final function attack(AttackEvent $event): ?AttackResult