mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: modules list and translations
This commit is contained in:
1 parent
8afc334aa7
commit
e6f9b07b20
23 files changed
+2301
-788
No files matched your search
@@ -1,7 +0,0 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message I18n {
|
||||
map<string, string> locales = 1;
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
// @ts-nocheck
|
||||
export * from './i18n.ts';
|
||||
export * from './legacy_average_definitions.ts';
|
||||
export * from './legacy_camouflage_definitions.ts';
|
||||
export * from './legacy_consumable_definitions.ts';
|
||||
@@ -15,4 +14,6 @@ export * from './legacy_tank_definitions.ts';
|
||||
export * from './reviews.ts';
|
||||
export * from './tank.ts';
|
||||
export * from './tanks.ts';
|
||||
export * from './tank_armor.ts';
|
||||
export * from './tank_armor.ts';
|
||||
export * from './tank_model.ts';
|
||||
export * from './utils.ts';
|
||||
@@ -2,6 +2,8 @@ syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "packages/core/src/protos/utils.proto";
|
||||
|
||||
message ModelDefinitions {
|
||||
map<uint32, ModelDefinition> models = 1;
|
||||
}
|
||||
@@ -20,12 +22,6 @@ message Armor {
|
||||
repeated uint32 spaced = 2;
|
||||
}
|
||||
|
||||
message Vector3 {
|
||||
required float x = 1;
|
||||
required float y = 2;
|
||||
required float z = 3;
|
||||
}
|
||||
|
||||
message InitialTurretRotation {
|
||||
required float yaw = 1;
|
||||
required float pitch = 2;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Vector3, createBaseVector3 } from "./utils";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
@@ -47,12 +48,6 @@ export interface Armor_ThicknessEntry {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export interface Vector3 {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
export interface InitialTurretRotation {
|
||||
yaw: number;
|
||||
pitch: number;
|
||||
@@ -814,98 +809,6 @@ export const Armor_ThicknessEntry: MessageFns<Armor_ThicknessEntry> = {
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseVector3(): Vector3 {
|
||||
return { x: 0, y: 0, z: 0 };
|
||||
}
|
||||
|
||||
export const Vector3: MessageFns<Vector3> = {
|
||||
encode(message: Vector3, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.x !== 0) {
|
||||
writer.uint32(13).float(message.x);
|
||||
}
|
||||
if (message.y !== 0) {
|
||||
writer.uint32(21).float(message.y);
|
||||
}
|
||||
if (message.z !== 0) {
|
||||
writer.uint32(29).float(message.z);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Vector3 {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseVector3();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 13) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.x = reader.float();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 21) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.y = reader.float();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 29) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.z = reader.float();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Vector3 {
|
||||
return {
|
||||
x: globalThis.Number(assertSet("Vector3.x", object.x)),
|
||||
y: globalThis.Number(assertSet("Vector3.y", object.y)),
|
||||
z: globalThis.Number(assertSet("Vector3.z", object.z)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Vector3): unknown {
|
||||
const obj: any = {};
|
||||
if (message.x !== 0) {
|
||||
obj.x = message.x;
|
||||
}
|
||||
if (message.y !== 0) {
|
||||
obj.y = message.y;
|
||||
}
|
||||
if (message.z !== 0) {
|
||||
obj.z = message.z;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Vector3>, I>>(base?: I): Vector3 {
|
||||
return Vector3.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Vector3>, I>>(object: I): Vector3 {
|
||||
const message = createBaseVector3();
|
||||
message.x = object.x ?? 0;
|
||||
message.y = object.y ?? 0;
|
||||
message.z = object.z ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseInitialTurretRotation(): InitialTurretRotation {
|
||||
return { yaw: 0, pitch: 0, roll: 0 };
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
syntax = "proto2";
|
||||
|
||||
import "packages/core/src/protos/i18n.proto";
|
||||
import "packages/core/src/protos/utils.proto";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
@@ -8,4 +8,12 @@ message Tank {
|
||||
required string id = 1;
|
||||
required string slug = 2;
|
||||
required I18n name = 3;
|
||||
map<string, Turret> turrets = 4;
|
||||
map<string, Gun> guns = 5;
|
||||
}
|
||||
|
||||
message Turret {
|
||||
}
|
||||
|
||||
message Gun {
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { I18n, createBaseI18n } from "./i18n";
|
||||
import { I18n, createBaseI18n } from "./utils";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
@@ -14,10 +14,28 @@ export interface Tank {
|
||||
id: string;
|
||||
slug: string;
|
||||
name: I18n;
|
||||
turrets: { [key: string]: Turret };
|
||||
guns: { [key: string]: Gun };
|
||||
}
|
||||
|
||||
export interface Tank_TurretsEntry {
|
||||
key: string;
|
||||
value: Turret | undefined;
|
||||
}
|
||||
|
||||
export interface Tank_GunsEntry {
|
||||
key: string;
|
||||
value: Gun | undefined;
|
||||
}
|
||||
|
||||
export interface Turret {
|
||||
}
|
||||
|
||||
export interface Gun {
|
||||
}
|
||||
|
||||
function createBaseTank(): Tank {
|
||||
return { id: "", slug: "", name: createBaseI18n() };
|
||||
return { id: "", slug: "", name: createBaseI18n(), turrets: {}, guns: {} };
|
||||
}
|
||||
|
||||
export const Tank: MessageFns<Tank> = {
|
||||
@@ -31,6 +49,12 @@ export const Tank: MessageFns<Tank> = {
|
||||
if (message.name !== undefined) {
|
||||
I18n.encode(message.name, writer.uint32(26).fork()).join();
|
||||
}
|
||||
Object.entries(message.turrets).forEach(([key, value]) => {
|
||||
Tank_TurretsEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).join();
|
||||
});
|
||||
Object.entries(message.guns).forEach(([key, value]) => {
|
||||
Tank_GunsEntry.encode({ key: key as any, value }, writer.uint32(42).fork()).join();
|
||||
});
|
||||
return writer;
|
||||
},
|
||||
|
||||
@@ -65,6 +89,28 @@ export const Tank: MessageFns<Tank> = {
|
||||
message.name = I18n.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
case 4: {
|
||||
if (tag !== 34) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry4 = Tank_TurretsEntry.decode(reader, reader.uint32());
|
||||
if (entry4.value !== undefined) {
|
||||
message.turrets[entry4.key] = entry4.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
case 5: {
|
||||
if (tag !== 42) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry5 = Tank_GunsEntry.decode(reader, reader.uint32());
|
||||
if (entry5.value !== undefined) {
|
||||
message.guns[entry5.key] = entry5.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
@@ -79,6 +125,18 @@ export const Tank: MessageFns<Tank> = {
|
||||
id: globalThis.String(assertSet("Tank.id", object.id)),
|
||||
slug: globalThis.String(assertSet("Tank.slug", object.slug)),
|
||||
name: I18n.fromJSON(assertSet("Tank.name", object.name)),
|
||||
turrets: isObject(object.turrets)
|
||||
? Object.entries(object.turrets).reduce<{ [key: string]: Turret }>((acc, [key, value]) => {
|
||||
acc[key] = Turret.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
: {},
|
||||
guns: isObject(object.guns)
|
||||
? Object.entries(object.guns).reduce<{ [key: string]: Gun }>((acc, [key, value]) => {
|
||||
acc[key] = Gun.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
: {},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -93,6 +151,24 @@ export const Tank: MessageFns<Tank> = {
|
||||
if (message.name !== undefined) {
|
||||
obj.name = I18n.toJSON(message.name);
|
||||
}
|
||||
if (message.turrets) {
|
||||
const entries = Object.entries(message.turrets);
|
||||
if (entries.length > 0) {
|
||||
obj.turrets = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.turrets[k] = Turret.toJSON(v);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (message.guns) {
|
||||
const entries = Object.entries(message.guns);
|
||||
if (entries.length > 0) {
|
||||
obj.guns = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.guns[k] = Gun.toJSON(v);
|
||||
});
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
@@ -106,6 +182,258 @@ export const Tank: MessageFns<Tank> = {
|
||||
message.name = (object.name !== undefined && object.name !== null)
|
||||
? I18n.fromPartial(object.name)
|
||||
: createBaseI18n();
|
||||
message.turrets = Object.entries(object.turrets ?? {}).reduce<{ [key: string]: Turret }>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = Turret.fromPartial(value);
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
message.guns = Object.entries(object.guns ?? {}).reduce<{ [key: string]: Gun }>((acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = Gun.fromPartial(value);
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseTank_TurretsEntry(): Tank_TurretsEntry {
|
||||
return { key: "", value: createBaseTurret() };
|
||||
}
|
||||
|
||||
export const Tank_TurretsEntry: MessageFns<Tank_TurretsEntry> = {
|
||||
encode(message: Tank_TurretsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
Turret.encode(message.value, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Tank_TurretsEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTank_TurretsEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = Turret.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Tank_TurretsEntry {
|
||||
return {
|
||||
key: globalThis.String(assertSet("Tank_TurretsEntry.key", object.key)),
|
||||
value: Turret.fromJSON(assertSet("Tank_TurretsEntry.value", object.value)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Tank_TurretsEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== undefined) {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
obj.value = Turret.toJSON(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Tank_TurretsEntry>, I>>(base?: I): Tank_TurretsEntry {
|
||||
return Tank_TurretsEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Tank_TurretsEntry>, I>>(object: I): Tank_TurretsEntry {
|
||||
const message = createBaseTank_TurretsEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = (object.value !== undefined && object.value !== null)
|
||||
? Turret.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseTank_GunsEntry(): Tank_GunsEntry {
|
||||
return { key: "", value: createBaseGun() };
|
||||
}
|
||||
|
||||
export const Tank_GunsEntry: MessageFns<Tank_GunsEntry> = {
|
||||
encode(message: Tank_GunsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
Gun.encode(message.value, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Tank_GunsEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTank_GunsEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = Gun.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Tank_GunsEntry {
|
||||
return {
|
||||
key: globalThis.String(assertSet("Tank_GunsEntry.key", object.key)),
|
||||
value: Gun.fromJSON(assertSet("Tank_GunsEntry.value", object.value)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Tank_GunsEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== undefined) {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
obj.value = Gun.toJSON(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Tank_GunsEntry>, I>>(base?: I): Tank_GunsEntry {
|
||||
return Tank_GunsEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Tank_GunsEntry>, I>>(object: I): Tank_GunsEntry {
|
||||
const message = createBaseTank_GunsEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = (object.value !== undefined && object.value !== null) ? Gun.fromPartial(object.value) : undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseTurret(): Turret {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const Turret: MessageFns<Turret> = {
|
||||
encode(_: Turret, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Turret {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTurret();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Turret {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: Turret): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Turret>, I>>(base?: I): Turret {
|
||||
return Turret.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Turret>, I>>(_: I): Turret {
|
||||
const message = createBaseTurret();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseGun(): Gun {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const Gun: MessageFns<Gun> = {
|
||||
encode(_: Gun, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Gun {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseGun();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): Gun {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: Gun): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Gun>, I>>(base?: I): Gun {
|
||||
return Gun.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Gun>, I>>(_: I): Gun {
|
||||
const message = createBaseGun();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
@@ -123,6 +451,10 @@ type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin ? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
syntax = "proto2";
|
||||
|
||||
import "packages/core/src/protos/utils.proto";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message TankModel {
|
||||
map<string, ModuleModel> modules = 1;
|
||||
}
|
||||
|
||||
message ModuleModel {
|
||||
required Vector3 translation = 2;
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/tank_model.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
import { Vector3 } from "./utils";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface TankModel {
|
||||
modules: { [key: string]: ModuleModel };
|
||||
}
|
||||
|
||||
export interface TankModel_ModulesEntry {
|
||||
key: string;
|
||||
value: ModuleModel | undefined;
|
||||
}
|
||||
|
||||
export interface ModuleModel {
|
||||
translation: Vector3;
|
||||
}
|
||||
|
||||
function createBaseTankModel(): TankModel {
|
||||
return { modules: {} };
|
||||
}
|
||||
|
||||
export const TankModel: MessageFns<TankModel> = {
|
||||
encode(message: TankModel, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
Object.entries(message.modules).forEach(([key, value]) => {
|
||||
TankModel_ModulesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
|
||||
});
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): TankModel {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTankModel();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
const entry1 = TankModel_ModulesEntry.decode(reader, reader.uint32());
|
||||
if (entry1.value !== undefined) {
|
||||
message.modules[entry1.key] = entry1.value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): TankModel {
|
||||
return {
|
||||
modules: isObject(object.modules)
|
||||
? Object.entries(object.modules).reduce<{ [key: string]: ModuleModel }>((acc, [key, value]) => {
|
||||
acc[key] = ModuleModel.fromJSON(value);
|
||||
return acc;
|
||||
}, {})
|
||||
: {},
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: TankModel): unknown {
|
||||
const obj: any = {};
|
||||
if (message.modules) {
|
||||
const entries = Object.entries(message.modules);
|
||||
if (entries.length > 0) {
|
||||
obj.modules = {};
|
||||
entries.forEach(([k, v]) => {
|
||||
obj.modules[k] = ModuleModel.toJSON(v);
|
||||
});
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<TankModel>, I>>(base?: I): TankModel {
|
||||
return TankModel.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<TankModel>, I>>(object: I): TankModel {
|
||||
const message = createBaseTankModel();
|
||||
message.modules = Object.entries(object.modules ?? {}).reduce<{ [key: string]: ModuleModel }>(
|
||||
(acc, [key, value]) => {
|
||||
if (value !== undefined) {
|
||||
acc[key] = ModuleModel.fromPartial(value);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
);
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseTankModel_ModulesEntry(): TankModel_ModulesEntry {
|
||||
return { key: "", value: createBaseModuleModel() };
|
||||
}
|
||||
|
||||
export const TankModel_ModulesEntry: MessageFns<TankModel_ModulesEntry> = {
|
||||
encode(message: TankModel_ModulesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.key !== undefined) {
|
||||
writer.uint32(10).string(message.key);
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
ModuleModel.encode(message.value, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): TankModel_ModulesEntry {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseTankModel_ModulesEntry();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 10) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.key = reader.string();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.value = ModuleModel.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): TankModel_ModulesEntry {
|
||||
return {
|
||||
key: globalThis.String(assertSet("TankModel_ModulesEntry.key", object.key)),
|
||||
value: ModuleModel.fromJSON(assertSet("TankModel_ModulesEntry.value", object.value)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: TankModel_ModulesEntry): unknown {
|
||||
const obj: any = {};
|
||||
if (message.key !== undefined) {
|
||||
obj.key = message.key;
|
||||
}
|
||||
if (message.value !== undefined) {
|
||||
obj.value = ModuleModel.toJSON(message.value);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<TankModel_ModulesEntry>, I>>(base?: I): TankModel_ModulesEntry {
|
||||
return TankModel_ModulesEntry.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<TankModel_ModulesEntry>, I>>(object: I): TankModel_ModulesEntry {
|
||||
const message = createBaseTankModel_ModulesEntry();
|
||||
message.key = object.key ?? "";
|
||||
message.value = (object.value !== undefined && object.value !== null)
|
||||
? ModuleModel.fromPartial(object.value)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseModuleModel(): ModuleModel {
|
||||
return { translation: createBaseVector3() };
|
||||
}
|
||||
|
||||
export const ModuleModel: MessageFns<ModuleModel> = {
|
||||
encode(message: ModuleModel, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.translation !== undefined) {
|
||||
Vector3.encode(message.translation, writer.uint32(18).fork()).join();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): ModuleModel {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseModuleModel();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 2: {
|
||||
if (tag !== 18) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.translation = Vector3.decode(reader, reader.uint32());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): ModuleModel {
|
||||
return { translation: Vector3.fromJSON(assertSet("ModuleModel.translation", object.translation)) };
|
||||
},
|
||||
|
||||
toJSON(message: ModuleModel): unknown {
|
||||
const obj: any = {};
|
||||
if (message.translation !== undefined) {
|
||||
obj.translation = Vector3.toJSON(message.translation);
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<ModuleModel>, I>>(base?: I): ModuleModel {
|
||||
return ModuleModel.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<ModuleModel>, I>>(object: I): ModuleModel {
|
||||
const message = createBaseModuleModel();
|
||||
message.translation = (object.translation !== undefined && object.translation !== null)
|
||||
? Vector3.fromPartial(object.translation)
|
||||
: createBaseVector3();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin ? T
|
||||
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends { $case: string; value: unknown } ? { $case: T["$case"]; value?: DeepPartial<T["value"]> }
|
||||
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin ? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
||||
|
||||
function isObject(value: any): boolean {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
function assertSet<T>(field: string, value: T | undefined): T {
|
||||
if (!isSet(value)) {
|
||||
throw new TypeError(`Required field ${field} is not set`);
|
||||
}
|
||||
|
||||
return value as T;
|
||||
}
|
||||
|
||||
export interface MessageFns<T> {
|
||||
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
||||
fromJSON(object: any): T;
|
||||
toJSON(message: T): unknown;
|
||||
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
||||
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message Vector3 {
|
||||
required float x = 1;
|
||||
required float y = 2;
|
||||
required float z = 3;
|
||||
}
|
||||
|
||||
message I18n {
|
||||
map<string, string> locales = 1;
|
||||
}
|
||||
@@ -2,13 +2,19 @@
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.2.2
|
||||
// protoc v5.28.2
|
||||
// source: packages/core/src/protos/i18n.proto
|
||||
// source: packages/core/src/protos/utils.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
||||
|
||||
export const protobufPackage = "blitzkit";
|
||||
|
||||
export interface Vector3 {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
export interface I18n {
|
||||
locales: { [key: string]: string };
|
||||
}
|
||||
@@ -18,6 +24,98 @@ export interface I18n_LocalesEntry {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export function createBaseVector3(): Vector3 {
|
||||
return { x: 0, y: 0, z: 0 };
|
||||
}
|
||||
|
||||
export const Vector3: MessageFns<Vector3> = {
|
||||
encode(message: Vector3, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
||||
if (message.x !== 0) {
|
||||
writer.uint32(13).float(message.x);
|
||||
}
|
||||
if (message.y !== 0) {
|
||||
writer.uint32(21).float(message.y);
|
||||
}
|
||||
if (message.z !== 0) {
|
||||
writer.uint32(29).float(message.z);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: BinaryReader | Uint8Array, length?: number): Vector3 {
|
||||
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseVector3();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1: {
|
||||
if (tag !== 13) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.x = reader.float();
|
||||
continue;
|
||||
}
|
||||
case 2: {
|
||||
if (tag !== 21) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.y = reader.float();
|
||||
continue;
|
||||
}
|
||||
case 3: {
|
||||
if (tag !== 29) {
|
||||
break;
|
||||
}
|
||||
|
||||
message.z = reader.float();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((tag & 7) === 4 || tag === 0) {
|
||||
break;
|
||||
}
|
||||
reader.skip(tag & 7);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Vector3 {
|
||||
return {
|
||||
x: globalThis.Number(assertSet("Vector3.x", object.x)),
|
||||
y: globalThis.Number(assertSet("Vector3.y", object.y)),
|
||||
z: globalThis.Number(assertSet("Vector3.z", object.z)),
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Vector3): unknown {
|
||||
const obj: any = {};
|
||||
if (message.x !== 0) {
|
||||
obj.x = message.x;
|
||||
}
|
||||
if (message.y !== 0) {
|
||||
obj.y = message.y;
|
||||
}
|
||||
if (message.z !== 0) {
|
||||
obj.z = message.z;
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
create<I extends Exact<DeepPartial<Vector3>, I>>(base?: I): Vector3 {
|
||||
return Vector3.fromPartial(base ?? ({} as any));
|
||||
},
|
||||
fromPartial<I extends Exact<DeepPartial<Vector3>, I>>(object: I): Vector3 {
|
||||
const message = createBaseVector3();
|
||||
message.x = object.x ?? 0;
|
||||
message.y = object.y ?? 0;
|
||||
message.z = object.z ?? 0;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
export function createBaseI18n(): I18n {
|
||||
return { locales: {} };
|
||||
}
|
||||
Reference in new issue
Block a user