better device database, pins and sorting / slot class + types

This commit is contained in:
Rachel Powers
2024-04-14 03:14:46 -07:00
parent fb192fbbe6
commit 9283d9d939
7 changed files with 32484 additions and 1951 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1 +1,128 @@
{"words":["Astroloy","Autolathe","bapal","bapz","bapzal","batchmode","batchmodes","bdns","bdnsal","bdse","bdseal","beqal","beqz","beqzal","bgeal","bgez","bgezal","bgtal","bgtz","bgtzal","bleal","blez","blezal","bltal","bltz","bltzal","bnaal","bnan","bnaz","bnazal","bneal","bnez","bnezal","brap","brapz","brdns","brdse","breq","breqz","brge","brgez","brgt","brgtz","brle","brlez","brlt","brltz","brna","brnan","brnaz","brne","brnez","Circuitboard","codegen","Depressurising","endpos","getd","Hardsuit","hardwrap","hashables","hstack","infile","jetpack","Keybind","lbns","logicable","logicslottypes","logictype","logictypes","lparen","Mineables","modelist","ninf","noconflict","offcanvas","overcolumn","Overlength","pedia","pinf","popperjs","preproc","Pressurising","putd","QUICKFIX","reagentmode","reagentmodes","rocketstation","rparen","sapz","sattellite","sdns","sdse","seqz","serde","sgez","sgtz","slez","slotlogic","slotlogicable","slotlogictype","slotlogictypes","slottype","sltz","snan","snanz","snaz","snez","splitn","Stationeers","stationpedia","themelist","tokentype","trunc","whos","regen","regen","tablist","tabpanel","labelledby"],"flagWords":[],"language":"en","version":"0.2"}
{
"words": [
"Astroloy",
"Autolathe",
"bapal",
"bapz",
"bapzal",
"batchmode",
"batchmodes",
"bdns",
"bdnsal",
"bdse",
"bdseal",
"beqal",
"beqz",
"beqzal",
"bgeal",
"bgez",
"bgezal",
"bgtal",
"bgtz",
"bgtzal",
"bleal",
"blez",
"blezal",
"bltal",
"bltz",
"bltzal",
"bnaal",
"bnan",
"bnaz",
"bnazal",
"bneal",
"bnez",
"bnezal",
"brap",
"brapz",
"brdns",
"brdse",
"breq",
"breqz",
"brge",
"brgez",
"brgt",
"brgtz",
"brle",
"brlez",
"brlt",
"brltz",
"brna",
"brnan",
"brnaz",
"brne",
"brnez",
"Circuitboard",
"codegen",
"Depressurising",
"deviceslength",
"endpos",
"getd",
"Hardsuit",
"hardwrap",
"hashables",
"hstack",
"infile",
"jetpack",
"Keybind",
"labelledby",
"lbns",
"logicable",
"logicslottypes",
"logictype",
"logictypes",
"lparen",
"Mineables",
"modelist",
"ninf",
"noconflict",
"offcanvas",
"overcolumn",
"Overlength",
"pedia",
"pinf",
"popperjs",
"preproc",
"Pressurising",
"putd",
"QUICKFIX",
"reagentmode",
"reagentmodes",
"regen",
"rocketstation",
"rparen",
"sapz",
"sattellite",
"sdns",
"sdse",
"seqz",
"serde",
"sgez",
"sgtz",
"slez",
"slotclass",
"slotlogic",
"slotlogicable",
"slotlogictype",
"slotlogictypes",
"slottype",
"sltz",
"snan",
"snanz",
"snaz",
"snez",
"sortingclass",
"splitn",
"Stationeers",
"stationpedia",
"tablist",
"tabpanel",
"themelist",
"tokentype",
"trunc",
"whos"
],
"flagWords": [],
"language": "en",
"version": "0.2"
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -226,7 +226,7 @@ export class VMDeviceCard extends VMDeviceMixin(BaseElement) {
renderSlots(): HTMLTemplateResult {
return html`
<div clas="slots">
<div class="slots">
${this.slots.map((slot, index, _slots) => this.renderSlot(slot, index))}
</div>
`;
@@ -465,7 +465,7 @@ export class VMAddDeviceButton extends BaseElement {
this._deviceDB = val;
this._strutures = new Map(
Object.values(this.deviceDB.db)
.filter((entry) => this.deviceDB.strutures.includes(entry.name), this)
.filter((entry) => this.deviceDB.structures.includes(entry.name), this)
.filter(
(entry) => this.deviceDB.logic_enabled.includes(entry.name),
this,

View File

@@ -1,11 +1,395 @@
export type SortingClass =
| "Default"
| "Kits"
| "Tools"
| "Resources"
| "Food"
| "Clothing"
| "Appliances"
| "Atmospherics"
| "Storage"
| "Ores"
| "Ices";
export type SlotClass =
| "None"
| "Helmet"
| "Suit"
| "Back"
| "GasFilter"
| "GasCanister"
| "Motherboard"
| "Circuitboard"
| "DataDisk"
| "Organ"
| "Ore"
| "Plant"
| "Uniform"
| "Entity"
| "Battery"
| "Egg"
| "Belt"
| "Tool"
| "Appliance"
| "Ingot"
| "Torpedo"
| "Cartridge"
| "AccessCard"
| "Magazine"
| "Circuit"
| "Bottle"
| "ProgrammableChip"
| "Glasses"
| "CreditCard"
| "DirtCanister"
| "SensorProcessingUnit"
| "LiquidCanister"
| "LiquidBottle"
| "Wreckage"
| "SoundCartridge"
| "DrillHead"
| "ScanningHead"
| "Flare"
| "Blocked";
export type NetworkType =
| "None"
| "Pipe"
| "Power"
| "Data"
| "Chute"
| "Elevator"
| "PipeLiquid"
| "LandingPad"
| "LaunchPad"
| "PowerAndData"
| "All";
export type ConnectionRole =
| "None"
| "Input"
| "Input2"
| "Output"
| "Output2"
| "Waste";
export type FieldType = "Read" | "Write" | "ReadWrite";
export type LogicType =
| "Acceleration"
| "Activate"
| "AirRelease"
| "AlignmentError"
| "Apex"
| "AutoLand"
| "AutoShutOff"
| "Bpm"
| "BurnTimeRemaining"
| "Bypass"
| "CelestialHash"
| "CelestialParentHash"
| "Channel"
| "Channel0"
| "Channel1"
| "Channel2"
| "Channel3"
| "Channel4"
| "Channel5"
| "Channel6"
| "Channel7"
| "Charge"
| "Chart"
| "ChartedNavPoints"
| "ClearMemory"
| "CollectableGoods"
| "Color"
| "Combustion"
| "CombustionInput"
| "CombustionInput2"
| "CombustionLimiter"
| "CombustionOutput"
| "CombustionOutput2"
| "CompletionRatio"
| "ContactTypeId"
| "CurrentCode"
| "CurrentResearchPodType"
| "Density"
| "DestinationCode"
| "Discover"
| "DistanceAu"
| "DistanceKm"
| "DrillCondition"
| "DryMass"
| "Eccentricity"
| "ElevatorLevel"
| "ElevatorSpeed"
| "EntityState"
| "EnvironmentEfficiency"
| "Error"
| "ExhaustVelocity"
| "ExportCount"
| "ExportQuantity"
| "ExportSlotHash"
| "ExportSlotOccupant"
| "Filtration"
| "FlightControlRule"
| "Flush"
| "ForceWrite"
| "ForwardX"
| "ForwardY"
| "ForwardZ"
| "Fuel"
| "Harvest"
| "Horizontal"
| "HorizontalRatio"
| "Idle"
| "ImportCount"
| "ImportQuantity"
| "ImportSlotHash"
| "ImportSlotOccupant"
| "Inclination"
| "Index"
| "InterrogationProgress"
| "LineNumber"
| "Lock"
| "ManualResearchRequiredPod"
| "Mass"
| "Maximum"
| "MinWattsToContact"
| "MineablesInQueue"
| "MineablesInVicinity"
| "MinedQuantity"
| "MinimumWattsToContact"
| "Mode"
| "NavPoints"
| "NextWeatherEventTime"
| "None"
| "On"
| "Open"
| "OperationalTemperatureEfficiency"
| "OrbitPeriod"
| "Orientation"
| "Output"
| "OverShootTarget"
| "PassedMoles"
| "Plant"
| "PlantEfficiency1"
| "PlantEfficiency2"
| "PlantEfficiency3"
| "PlantEfficiency4"
| "PlantGrowth1"
| "PlantGrowth2"
| "PlantGrowth3"
| "PlantGrowth4"
| "PlantHash1"
| "PlantHash2"
| "PlantHash3"
| "PlantHash4"
| "PlantHealth1"
| "PlantHealth2"
| "PlantHealth3"
| "PlantHealth4"
| "PositionX"
| "PositionY"
| "PositionZ"
| "Power"
| "PowerActual"
| "PowerGeneration"
| "PowerPotential"
| "PowerRequired"
| "PrefabHash"
| "Pressure"
| "PressureEfficiency"
| "PressureExternal"
| "PressureInput"
| "PressureInput2"
| "PressureInternal"
| "PressureOutput"
| "PressureOutput2"
| "PressureSetting"
| "Progress"
| "Quantity"
| "Ratio"
| "RatioCarbonDioxide"
| "RatioCarbonDioxideInput"
| "RatioCarbonDioxideInput2"
| "RatioCarbonDioxideOutput"
| "RatioCarbonDioxideOutput2"
| "RatioHydrogen"
| "RatioLiquidCarbonDioxide"
| "RatioLiquidCarbonDioxideInput"
| "RatioLiquidCarbonDioxideInput2"
| "RatioLiquidCarbonDioxideOutput"
| "RatioLiquidCarbonDioxideOutput2"
| "RatioLiquidHydrogen"
| "RatioLiquidNitrogen"
| "RatioLiquidNitrogenInput"
| "RatioLiquidNitrogenInput2"
| "RatioLiquidNitrogenOutput"
| "RatioLiquidNitrogenOutput2"
| "RatioLiquidNitrousOxide"
| "RatioLiquidNitrousOxideInput"
| "RatioLiquidNitrousOxideInput2"
| "RatioLiquidNitrousOxideOutput"
| "RatioLiquidNitrousOxideOutput2"
| "RatioLiquidOxygen"
| "RatioLiquidOxygenInput"
| "RatioLiquidOxygenInput2"
| "RatioLiquidOxygenOutput"
| "RatioLiquidOxygenOutput2"
| "RatioLiquidPollutant"
| "RatioLiquidPollutantInput"
| "RatioLiquidPollutantInput2"
| "RatioLiquidPollutantOutput"
| "RatioLiquidPollutantOutput2"
| "RatioLiquidVolatiles"
| "RatioLiquidVolatilesInput"
| "RatioLiquidVolatilesInput2"
| "RatioLiquidVolatilesOutput"
| "RatioLiquidVolatilesOutput2"
| "RatioNitrogen"
| "RatioNitrogenInput"
| "RatioNitrogenInput2"
| "RatioNitrogenOutput"
| "RatioNitrogenOutput2"
| "RatioNitrousOxide"
| "RatioNitrousOxideInput"
| "RatioNitrousOxideInput2"
| "RatioNitrousOxideOutput"
| "RatioNitrousOxideOutput2"
| "RatioOxygen"
| "RatioOxygenInput"
| "RatioOxygenInput2"
| "RatioOxygenOutput"
| "RatioOxygenOutput2"
| "RatioPollutant"
| "RatioPollutantInput"
| "RatioPollutantInput2"
| "RatioPollutantOutput"
| "RatioPollutantOutput2"
| "RatioPollutedWater"
| "RatioSteam"
| "RatioSteamInput"
| "RatioSteamInput2"
| "RatioSteamOutput"
| "RatioSteamOutput2"
| "RatioVolatiles"
| "RatioVolatilesInput"
| "RatioVolatilesInput2"
| "RatioVolatilesOutput"
| "RatioVolatilesOutput2"
| "RatioWater"
| "RatioWaterInput"
| "RatioWaterInput2"
| "RatioWaterOutput"
| "RatioWaterOutput2"
| "ReEntryAltitude"
| "Reagents"
| "RecipeHash"
| "ReferenceId"
| "RequestHash"
| "RequiredPower"
| "ReturnFuelCost"
| "Richness"
| "Rpm"
| "SemiMajorAxis"
| "Setting"
| "SettingInput"
| "SettingInputHash"
| "SettingOutput"
| "SettingOutputHash"
| "SignalID"
| "SignalStrength"
| "Sites"
| "Size"
| "SizeX"
| "SizeY"
| "SizeZ"
| "SolarAngle"
| "SolarConstant"
| "SolarIrradiance"
| "SoundAlert"
| "Stress"
| "Survey"
| "TargetPadIndex"
| "TargetX"
| "TargetY"
| "TargetZ"
| "Temperature"
| "TemperatureDifferentialEfficiency"
| "TemperatureExternal"
| "TemperatureInput"
| "TemperatureInput2"
| "TemperatureOutput"
| "TemperatureOutput2"
| "TemperatureSetting"
| "Throttle"
| "Thrust"
| "ThrustToWeight"
| "Time"
| "TimeToDestination"
| "TotalMoles"
| "TotalMolesInput"
| "TotalMolesInput2"
| "TotalMolesOutput"
| "TotalMolesOutput2"
| "TotalQuantity"
| "TrueAnomaly"
| "Unknown"
| "VelocityMagnitude"
| "VelocityRelativeX"
| "VelocityRelativeY"
| "VelocityRelativeZ"
| "VelocityX"
| "VelocityY"
| "VelocityZ"
| "Vertical"
| "VerticalRatio"
| "Volume"
| "VolumeOfLiquid"
| "WattsReachingContact"
| "Weight"
| "WorkingGasEfficiency";
export type SlotLogicType =
| "Charge"
| "ChargeRatio"
| "Class"
| "Damage"
| "Efficiency"
| "FilterType"
| "Growth"
| "Health"
| "LineNumber"
| "Lock"
| "Mature"
| "MaxQuantity"
| "None"
| "OccupantHash"
| "Occupied"
| "On"
| "Open"
| "PrefabHash"
| "Pressure"
| "PressureAir"
| "PressureWaste"
| "Quantity"
| "ReferenceId"
| "Seeding"
| "SortingClass"
| "Temperature"
| "Volume";
export type ReagentMode = "Contents" | "Recipe" | "Required" | "TotalContents";
export type BatchMode = "Average" | "Maximum" | "Minimum" | "Sum";
export type DeviceDBEntry = {
name: string;
hash: number;
desc: string;
logic?: { [key: string]: string };
slots?: { name: string; typ: string }[];
logic?: { [key in LogicType]: FieldType };
slotlogic?: { [key in SlotLogicType]: number[] };
slots?: { name: string; typ: SlotClass }[];
modes?: { [key: string]: string };
conn?: { [key: string]: string[] };
conn?: { [key in SlotLogicType]: [NetworkType, ConnectionRole] };
slotclass?: SlotClass;
sorting?: SortingClass;
pins?: number;
};
export type DeviceDB = {
@@ -13,8 +397,9 @@ export type DeviceDB = {
slot_logic_enabled: string[];
devices: string[];
items: string[];
strutures: string[];
structures: string[];
db: {
[key: string]: DeviceDBEntry;
};
names_by_hash: { [key: number]: string };
};

View File

@@ -3,7 +3,7 @@ import re
from collections import defaultdict
from pathlib import Path
from pprint import pprint
from typing import Any # type: ignore[Any]
from typing import Any, NotRequired # type: ignore[Any]
from typing import TypedDict
@@ -29,7 +29,10 @@ class PediaPage(TypedDict):
LogicSlotInsert: list[LInsert]
ModeInsert: list[LInsert]
ConnectionInsert: list[LInsert]
ConnectionList: list[list[str]]
ConnectionList: NotRequired[list[list[str]]]
SlotClass: NotRequired[str]
SortingClass: NotRequired[str]
DevicesLength: NotRequired[int]
class Pedia(TypedDict):
@@ -50,6 +53,9 @@ class DBPage(TypedDict):
slotlogic: dict[str, list[int]] | None
modes: dict[int, str] | None
conn: dict[int, list[str]] | None
slotclass: str | None
sorting: str | None
pins: int | None
def extract_all() -> None:
@@ -59,7 +65,7 @@ def extract_all() -> None:
with (Path("data") / "Stationpedia.json").open("r") as f:
pedia = json.load(f)
for page in pedia["pages"]:
item: DBPage = defaultdict(list) # type: ignore[reportAssignmenType]
item: DBPage = defaultdict(list) # type: ignore[reportAssignmentType]
match page:
case {
@@ -73,8 +79,12 @@ def extract_all() -> None:
"LogicSlotInsert": slotlogic,
"ModeInsert": modes,
"ConnectionInsert": _,
"ConnectionList": connections,
}:
connections = page.get("ConnectionList", None)
slotclass = page.get("SlotClass", None)
sortingclass = page.get("SortingClass", None)
deviceslength = page.get("DevicesLength", None)
item["name"] = name
item["hash"] = name_hash
item["desc"] = re.sub(linkPat, r"\1", desc)
@@ -82,7 +92,7 @@ def extract_all() -> None:
case []:
item["slots"] = None
case _:
item["slots"] = [{}] * len(slots) # type: ignore[reportAssignmenType]
item["slots"] = [{}] * len(slots) # type: ignore[reportAssignmentType]
for slot in slots:
item["slots"][int(slot["SlotIndex"])] = {
"name": slot["SlotName"],
@@ -120,13 +130,18 @@ def extract_all() -> None:
]
match connections:
case []:
case [] | None:
item["conn"] = None
case _:
item["conn"] = {}
for index, [conn_typ, conn_role] in enumerate(connections):
item["conn"][index] = [conn_typ, conn_role]
item["slotclass"] = slotclass
item["sorting"] = sortingclass
item["pins"] = deviceslength
case _:
print(f"NON-CONFORMING: ")
pprint(page)
@@ -145,11 +160,11 @@ def extract_all() -> None:
if item["logic"] is not None and item["conn"] is not None
]
strutures = [
structures = [
item["name"] for item in db.values() if item["name"].startswith("Structure")
]
items = [item["name"] for item in db.values() if item["name"] not in strutures]
items = [item["name"] for item in db.values() if item["name"] not in structures]
def clean_nones(value: Any) -> Any: # type: ignore[Any]
if isinstance(value, list):
@@ -168,12 +183,15 @@ def extract_all() -> None:
"logic_enabled": logicable,
"slot_logic_enabled": slotlogicable,
"devices": devices,
"strutures": strutures,
"structures": structures,
"items": items,
"db": db,
"names_by_hash": {page["hash"]: page["name"] for page in db.values()}
}
),
f,
indent=1,
sort_keys=True,
)
if __name__ == "__main__":