mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
fix: some linting for new proto 4
This commit is contained in:
1 parent
f14ca394b5
commit
53a9c5f2de
22 files changed
+155
-133
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { Vector3, type Vector3Tuple } from 'three';
|
||||
import type { Vector3 as BlitzkitVector3 } from '@blitzkit/core';
|
||||
import { Vector3 as THREEVector3 } from 'three';
|
||||
import { rotateDavaVector } from './rotateDavaVector';
|
||||
|
||||
export function correctZYTuple(tuple: Vector3Tuple) {
|
||||
return rotateDavaVector(new Vector3(tuple[0], tuple[1], -tuple[2]));
|
||||
export function correctZYTuple(tuple: BlitzkitVector3) {
|
||||
return rotateDavaVector(new THREEVector3(tuple.x, tuple.y, -tuple.z));
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { equipmentDefinitions } from '@blitzkit/core';
|
||||
import { fetchEquipmentDefinitions } from '@blitzkit/core';
|
||||
import type { EquipmentMatrix } from '../../stores/duel';
|
||||
|
||||
export async function hasEquipment(
|
||||
@@ -6,14 +6,17 @@ export async function hasEquipment(
|
||||
equipmentPreset: string,
|
||||
equipmentMatrix: EquipmentMatrix,
|
||||
) {
|
||||
const awaitedEquipmentDefinitions = await equipmentDefinitions;
|
||||
const presetRows = awaitedEquipmentDefinitions.presets[equipmentPreset];
|
||||
return presetRows.some((equipmentRow, rowIndex) => {
|
||||
return equipmentRow.some((equipment, columnIndex) => {
|
||||
const choice = equipmentMatrix[rowIndex][columnIndex];
|
||||
if (choice === 0) return false;
|
||||
const equipped = equipment[choice === -1 ? 0 : 1];
|
||||
return equipped === id;
|
||||
});
|
||||
const equipmentDefinitions = await fetchEquipmentDefinitions();
|
||||
const preset = equipmentDefinitions.presets[equipmentPreset];
|
||||
return preset.slots.some((slot, index) => {
|
||||
const row = Math.floor(index / 3);
|
||||
const column = index % 3;
|
||||
const choice = equipmentMatrix[row][column];
|
||||
|
||||
if (choice === 0) return false;
|
||||
|
||||
const equipped = slot[choice === -1 ? 'left' : 'right'];
|
||||
|
||||
return equipped === id;
|
||||
});
|
||||
}
|
||||
@@ -2,18 +2,18 @@ import type { GunDefinition } from '@blitzkit/core';
|
||||
|
||||
export function resolveReload(gun: GunDefinition) {
|
||||
if (gun.gunType!.$case === 'regular') {
|
||||
return gun.gunType!.value.regular.reload;
|
||||
return gun.gunType!.value.extension.reload;
|
||||
} else if (gun.gunType!.$case === 'autoLoader') {
|
||||
return (
|
||||
gun.gunType!.value.autoLoader.clipReload +
|
||||
(gun.gunType!.value.autoLoader.shellCount - 1) *
|
||||
gun.gunType!.value.autoLoader.intraClip
|
||||
gun.gunType!.value.extension.clipReload +
|
||||
(gun.gunType!.value.extension.shellCount - 1) *
|
||||
gun.gunType!.value.extension.intraClip
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
gun.gunType!.value.autoReloader.shellReloads.reduce((a, b) => a + b, 0) +
|
||||
(gun.gunType!.value.autoReloader.shellCount - 1) *
|
||||
gun.gunType!.value.autoReloader.intraClip
|
||||
gun.gunType!.value.extension.shellReloads.reduce((a, b) => a + b, 0) +
|
||||
(gun.gunType!.value.extension.shellCount - 1) *
|
||||
gun.gunType!.value.extension.intraClip
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -37,11 +37,11 @@ export function tankToDuelMember(
|
||||
infinityFallback(PROVISION_PREFERENCES.indexOf(b.id)),
|
||||
)
|
||||
.sort((a, b) => (b.crew ?? 0) - (a.crew ?? 0))
|
||||
.slice(0, tank.provisions)
|
||||
.slice(0, tank.maxProvisions)
|
||||
.map(({ id }) => id),
|
||||
engine: tank.engines.at(-1)!,
|
||||
gun,
|
||||
shell: tank.turrets.at(-1)!.guns.at(-1)!.shells[0],
|
||||
shell: tank.turrets.at(-1)!.guns.at(-1)!.gunType!.value.base.shells[0],
|
||||
tank,
|
||||
track: tank.tracks.at(-1)!,
|
||||
yaw: 0,
|
||||
|
||||
Reference in new issue
Block a user