mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: better lib
This commit is contained in:
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();
|
||||
Reference in new issue
Block a user