it is literally working
This commit is contained in:
parent
841f07c847
commit
a0c330384a
17 changed files with 499 additions and 63 deletions
|
|
@ -11,6 +11,13 @@ interface FactorioEvent<T extends FactorioObjectData> {
|
|||
tick: uint;
|
||||
}
|
||||
|
||||
interface Colour {
|
||||
alpha: float;
|
||||
blue: float;
|
||||
green: float;
|
||||
red: float;
|
||||
}
|
||||
|
||||
interface PositionData {
|
||||
x: double;
|
||||
y: double;
|
||||
|
|
@ -19,6 +26,9 @@ interface PositionData {
|
|||
interface PlayerData extends FactorioObjectData {
|
||||
associated_characters_unit_numbers: uint[];
|
||||
character_unit_number: uint | null;
|
||||
chat_colour: Colour;
|
||||
colour: Colour;
|
||||
last_online: uint;
|
||||
name: string;
|
||||
object_name: string;
|
||||
position: PositionData;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ export namespace Serdes {
|
|||
character_unit_number: player.character?.unit_number ?? null,
|
||||
associated_characters_unit_numbers: charIds,
|
||||
position: positionTableToTable(player.position),
|
||||
colour: mapColour(player.color),
|
||||
chat_colour: mapColour(player.chat_color),
|
||||
last_online: player.last_online
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -62,4 +65,14 @@ export namespace Serdes {
|
|||
}
|
||||
}
|
||||
|
||||
export function mapColour(color: Color): Colour {
|
||||
color = (color as ColorTable)
|
||||
return {
|
||||
red: color.r ?? 0,
|
||||
green: color.g ?? 0,
|
||||
blue: color.b ?? 0,
|
||||
alpha: color.a ?? 0,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue