mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: terrain hardness
This commit is contained in:
1 parent
be821c1f8b
commit
5034ec1aa0
4 files changed
+34
-48
No files matched your search
@@ -6,7 +6,7 @@ import {
|
||||
} from "@protos/blitz_static_tank_upgrade_single_stage";
|
||||
import { radToDeg } from "three/src/math/MathUtils.js";
|
||||
import { applyPitchYawLimits } from "./applyPitchYawLimits";
|
||||
import type { TankState } from "./tankState";
|
||||
import { TerrainHardness, type TankState } from "./tankState";
|
||||
|
||||
export type CharacteristicOutput = number | number[] | null;
|
||||
|
||||
@@ -282,33 +282,28 @@ export const characteristics = {
|
||||
return attribute(TankAttributeChange_AttributeName.ATTRIBUTE_NAME_MASS);
|
||||
},
|
||||
|
||||
terrain_coefficient_hard({ attribute }) {
|
||||
return attribute(
|
||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_HARD
|
||||
);
|
||||
terrain_coefficient({ attribute, state }) {
|
||||
let name: TankAttributeChange_AttributeName;
|
||||
|
||||
switch (state.terrainHardness) {
|
||||
case TerrainHardness.Soft:
|
||||
name =
|
||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_SOFT;
|
||||
break;
|
||||
case TerrainHardness.Medium:
|
||||
name =
|
||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_MEDIUM;
|
||||
break;
|
||||
case TerrainHardness.Hard:
|
||||
name =
|
||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_HARD;
|
||||
break;
|
||||
}
|
||||
|
||||
return attribute(name);
|
||||
},
|
||||
|
||||
terrain_coefficient_medium({ attribute }) {
|
||||
return attribute(
|
||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_MEDIUM
|
||||
);
|
||||
},
|
||||
|
||||
terrain_coefficient_soft({ attribute }) {
|
||||
return attribute(
|
||||
TankAttributeChange_AttributeName.ATTRIBUTE_NAME_TERRAIN_RESISTANCE_SOFT
|
||||
);
|
||||
},
|
||||
|
||||
power_to_weight_hard() {
|
||||
return -Infinity;
|
||||
},
|
||||
|
||||
power_to_weight_medium() {
|
||||
return -Infinity;
|
||||
},
|
||||
|
||||
power_to_weight_soft() {
|
||||
power_to_weight() {
|
||||
return -Infinity;
|
||||
},
|
||||
|
||||
@@ -318,15 +313,7 @@ export const characteristics = {
|
||||
);
|
||||
},
|
||||
|
||||
hull_traverse_speed_hard() {
|
||||
return -Infinity;
|
||||
},
|
||||
|
||||
hull_traverse_speed_medium() {
|
||||
return -Infinity;
|
||||
},
|
||||
|
||||
hull_traverse_speed_soft() {
|
||||
hull_traverse_speed() {
|
||||
return -Infinity;
|
||||
},
|
||||
|
||||
|
||||
@@ -65,18 +65,10 @@ export const characteristicsOrder: CharacteristicsOrder = [
|
||||
{ name: "engine_power", units: "bhp" },
|
||||
{ name: "weight", units: "t" },
|
||||
|
||||
{ name: "terrain_coefficient_hard" },
|
||||
{ name: "terrain_coefficient_medium" },
|
||||
{ name: "terrain_coefficient_soft" },
|
||||
|
||||
{ name: "power_to_weight_hard", units: "bhp_t" },
|
||||
{ name: "power_to_weight_medium", units: "bhp_t" },
|
||||
{ name: "power_to_weight_soft", units: "bhp_t" },
|
||||
|
||||
{ name: "terrain_coefficient" },
|
||||
{ name: "power_to_weight", units: "bhp_t" },
|
||||
{ name: "hull_traverse_speed", units: "deg_s" },
|
||||
{ name: "turret_traverse_speed", units: "deg_s" },
|
||||
{ name: "hull_traverse_speed_hard", units: "deg_s" },
|
||||
{ name: "hull_traverse_speed_medium", units: "deg_s" },
|
||||
{ name: "hull_traverse_speed_soft", units: "deg_s" },
|
||||
|
||||
{ toy: "traverse" },
|
||||
],
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
export enum TerrainHardness {
|
||||
Soft,
|
||||
Medium,
|
||||
Hard,
|
||||
}
|
||||
|
||||
export interface TankState {
|
||||
stage: number;
|
||||
|
||||
shell: number;
|
||||
speed: number;
|
||||
isHullTraversing: boolean;
|
||||
isTurretTraversing: boolean;
|
||||
isShooting: boolean;
|
||||
isGunDamaged: boolean;
|
||||
terrainHardness: TerrainHardness;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Varuna } from "varuna";
|
||||
import type { TankState } from "../core/tankopedia/tankState";
|
||||
import { TerrainHardness, type TankState } from "../core/tankopedia/tankState";
|
||||
|
||||
interface Tankopedia {
|
||||
protagonist: TankState;
|
||||
@@ -14,5 +14,6 @@ export const Tankopedia = new Varuna<Tankopedia, number>((maxStage) => ({
|
||||
isShooting: false,
|
||||
isTurretTraversing: false,
|
||||
speed: 0,
|
||||
terrainHardness: TerrainHardness.Hard,
|
||||
},
|
||||
}));
|
||||
Reference in new issue
Block a user