feat: better lib

This commit is contained in:
TrèsAbhi committed 2024-09-29 22:42:15 -05:00
1 parent 57170469f2
commit 3e18d5a8db
7 files changed
+52 -20

No files matched your search

@@ -1,18 +1,52 @@
import { TankDefinition, TankDefinitions } from '@blitzkit/core';
import { TankClass, TankDefinitions, TankPriceType } from '@blitzkit/core';
export async function definitions() {
console.log('Building definitions...');
const tankDefinitions = new TankDefinitions();
const tanks = tankDefinitions.getTanksMap();
const buffer = TankDefinitions.encode({
tanks: {
1: {
name: 'asd',
ancestors: [],
camouflageMoving: 1,
camouflageOnFire: 1,
camouflages: [],
camouflageStill: 1,
class: TankClass.TANK_CLASS_HEAVY,
description: 'asd',
crew: [],
deprecated: false,
engines: [],
equipmentPreset: '',
fixedCamouflage: false,
health: 1,
id: 1,
maxConsumables: 1,
maxProvisions: 1,
nation: 'usa',
price: {
type: TankPriceType.TANK_PRICE_TYPE_CREDITS,
value: 1,
},
roles: {},
speedBackwards: 1,
speedForwards: 1,
successors: [],
testing: false,
tier: 1,
tracks: [],
turrets: [],
type: 1,
xp: 1,
nameFull: '',
weight: 1,
},
},
}).finish();
const testTank = new TankDefinition();
console.log(buffer.length);
testTank.setName('asd');
tanks.set(1, testTank);
console.log(JSON.stringify(tankDefinitions.toObject(), null, 2));
console.log(TankDefinitions.decode(buffer));
}
definitions();