feat: some healths

This commit is contained in:
tresabhi committed 2025-01-30 11:31:55 -06:00
1 parent 67f312075a
commit c6f4a13abc
6 files changed
+510 -425

No files matched your search

+28 -28
View File
@@ -9,31 +9,31 @@ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "blitzkit";
export interface I18nString {
export interface I18n {
locales: { [key: string]: string };
}
export interface I18nString_LocalesEntry {
export interface I18n_LocalesEntry {
key: string;
value: string;
}
function createBaseI18nString(): I18nString {
function createBaseI18n(): I18n {
return { locales: {} };
}
export const I18nString: MessageFns<I18nString> = {
encode(message: I18nString, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
export const I18n: MessageFns<I18n> = {
encode(message: I18n, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
Object.entries(message.locales).forEach(([key, value]) => {
I18nString_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
I18n_LocalesEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): I18nString {
decode(input: BinaryReader | Uint8Array, length?: number): I18n {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseI18nString();
const message = createBaseI18n();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -42,7 +42,7 @@ export const I18nString: MessageFns<I18nString> = {
break;
}
const entry1 = I18nString_LocalesEntry.decode(reader, reader.uint32());
const entry1 = I18n_LocalesEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.locales[entry1.key] = entry1.value;
}
@@ -57,7 +57,7 @@ export const I18nString: MessageFns<I18nString> = {
return message;
},
fromJSON(object: any): I18nString {
fromJSON(object: any): I18n {
return {
locales: isObject(object.locales)
? Object.entries(object.locales).reduce<{ [key: string]: string }>((acc, [key, value]) => {
@@ -68,7 +68,7 @@ export const I18nString: MessageFns<I18nString> = {
};
},
toJSON(message: I18nString): unknown {
toJSON(message: I18n): unknown {
const obj: any = {};
if (message.locales) {
const entries = Object.entries(message.locales);
@@ -82,11 +82,11 @@ export const I18nString: MessageFns<I18nString> = {
return obj;
},
create<I extends Exact<DeepPartial<I18nString>, I>>(base?: I): I18nString {
return I18nString.fromPartial(base ?? ({} as any));
create<I extends Exact<DeepPartial<I18n>, I>>(base?: I): I18n {
return I18n.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<I18nString>, I>>(object: I): I18nString {
const message = createBaseI18nString();
fromPartial<I extends Exact<DeepPartial<I18n>, I>>(object: I): I18n {
const message = createBaseI18n();
message.locales = Object.entries(object.locales ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = globalThis.String(value);
@@ -97,12 +97,12 @@ export const I18nString: MessageFns<I18nString> = {
},
};
function createBaseI18nString_LocalesEntry(): I18nString_LocalesEntry {
function createBaseI18n_LocalesEntry(): I18n_LocalesEntry {
return { key: "", value: "" };
}
export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
encode(message: I18nString_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
export const I18n_LocalesEntry: MessageFns<I18n_LocalesEntry> = {
encode(message: I18n_LocalesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.key !== undefined) {
writer.uint32(10).string(message.key);
}
@@ -112,10 +112,10 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): I18nString_LocalesEntry {
decode(input: BinaryReader | Uint8Array, length?: number): I18n_LocalesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseI18nString_LocalesEntry();
const message = createBaseI18n_LocalesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@@ -144,14 +144,14 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
return message;
},
fromJSON(object: any): I18nString_LocalesEntry {
fromJSON(object: any): I18n_LocalesEntry {
return {
key: globalThis.String(assertSet("I18nString_LocalesEntry.key", object.key)),
value: globalThis.String(assertSet("I18nString_LocalesEntry.value", object.value)),
key: globalThis.String(assertSet("I18n_LocalesEntry.key", object.key)),
value: globalThis.String(assertSet("I18n_LocalesEntry.value", object.value)),
};
},
toJSON(message: I18nString_LocalesEntry): unknown {
toJSON(message: I18n_LocalesEntry): unknown {
const obj: any = {};
if (message.key !== undefined) {
obj.key = message.key;
@@ -162,11 +162,11 @@ export const I18nString_LocalesEntry: MessageFns<I18nString_LocalesEntry> = {
return obj;
},
create<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(base?: I): I18nString_LocalesEntry {
return I18nString_LocalesEntry.fromPartial(base ?? ({} as any));
create<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(base?: I): I18n_LocalesEntry {
return I18n_LocalesEntry.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<I18nString_LocalesEntry>, I>>(object: I): I18nString_LocalesEntry {
const message = createBaseI18nString_LocalesEntry();
fromPartial<I extends Exact<DeepPartial<I18n_LocalesEntry>, I>>(object: I): I18n_LocalesEntry {
const message = createBaseI18n_LocalesEntry();
message.key = object.key ?? "";
message.value = object.value ?? "";
return message;
+4 -3
View File
@@ -72,11 +72,12 @@ message ModuleHealth {
required float max_regen_health = 2;
// the range from 0 to this where the module is "red" and doesn't function
// all the while healing; after surpassing this, the "yellow" phase is reached
required float hysteresis_health = 3;
// undefined for modules like ammo bays
optional float hysteresis_health = 3;
// the heal rate (per second); this won't apply if the health is at or above
// max_regen hence always leaving it in the "yellow" phase until repaired
required float health_regen_per_second = 4;
required float health_regen_per_sec = 4;
// damage received (per second) to the modules when caught on fire; this can
// be undefined for some modules like the gun or chassis
optional float health_burn_per_second = 5;
optional float health_burn_per_sec = 5;
}
File diff suppressed because it is too large. Load diff