clip characteristics

This commit is contained in:
tresabhi committed 2026-06-03 13:00:36 -05:00
1 parent bb0b932d26
commit 632989087c
1 file changed
+21 -4
@@ -8,6 +8,7 @@ import type { Tank } from "@protos/tank";
import { radToDeg } from "three/src/math/MathUtils.js"; import { radToDeg } from "three/src/math/MathUtils.js";
import { applyPitchYawLimits } from "./applyPitchYawLimits"; import { applyPitchYawLimits } from "./applyPitchYawLimits";
import { TerrainHardness, type TankState } from "./tankState"; import { TerrainHardness, type TankState } from "./tankState";
import { attribute } from "three/src/nodes/core/AttributeNode.js";
export type CharacteristicOutput = number | number[] | string | null; export type CharacteristicOutput = number | number[] | string | null;
@@ -127,6 +128,8 @@ export const characteristics = {
}, },
dpm({ characteristic }) { dpm({ characteristic }) {
// TODO: add burst effect
let dps: number; let dps: number;
const gunType = characteristic("gun_type")!; const gunType = characteristic("gun_type")!;
const damage = characteristic("damage") as number; const damage = characteristic("damage") as number;
@@ -399,12 +402,26 @@ export const characteristics = {
return clipPotential; return clipPotential;
}, },
burst_size() { burst_size({ attributeSafe }) {
return -Infinity; const burstSize = attributeSafe(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_BURST_SIZE,
);
if (burstSize === null || burstSize === 1) return null;
return burstSize;
}, },
intra_burst() { intra_burst({ characteristic, attribute }) {
return -Infinity; const burstSize = characteristic("burst_size");
if (burstSize === null) return null;
const burstRate = attribute(
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_BURST_RATE,
);
return 60 / burstRate;
}, },
dispersion_angle({ characteristic }) { dispersion_angle({ characteristic }) {