-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
smaller DOM updates & easier data update paths. fix sl-select problems with force update on signal sub Signed-off-by: Rachel Powers <[email protected]>
- Loading branch information
Showing
11 changed files
with
4,355 additions
and
3,576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 20, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
":dep stationeers_data = { path = \"./stationeers_data\" }\n", | ||
":dep const-crc32 = \"1.3.0\"\n", | ||
":dep color-eyre\n", | ||
":dep serde_path_to_error\n", | ||
":dep serde_ignored\n", | ||
":dep serde\n", | ||
":dep serde_json\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 21, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"use color_eyre::eyre;\n", | ||
"pub fn parse_value<'a, T: serde::Deserialize<'a>>(\n", | ||
" jd: impl serde::Deserializer<'a>,\n", | ||
") -> Result<T, color_eyre::Report> {\n", | ||
" let mut track = serde_path_to_error::Track::new();\n", | ||
" let path = serde_path_to_error::Deserializer::new(jd, &mut track);\n", | ||
" let mut fun = |path: serde_ignored::Path| {\n", | ||
" eprintln!(\"Found ignored key: {path}\");\n", | ||
" };\n", | ||
" serde_ignored::deserialize(path, &mut fun).map_err(|e| {\n", | ||
" eyre::eyre!(\n", | ||
" \"path: {track} | error = {e}\",\n", | ||
" track = track.path().to_string(),\n", | ||
" )\n", | ||
" })\n", | ||
"}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 25, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"{7274344: StructureLogicDevice(StructureLogicDeviceTemplate { prefab: PrefabInfo { prefab_name: \"StructureAutoMinerSmall\", prefab_hash: 7274344, desc: \"The <link=Recurso><color=#0080FFFF>Recurso</color></link> SquareDig autominer is a structure that when built will mine a vertical 2x2 shaft until it hits bedrock. The autominer can be connected to a chute system, and is controllable by a logic network. Note that the autominer outputs more <link=OrePage><color=#0080FFFF>ore</color></link> than a conventional <link=ThingItemMiningDrill><color=green>Mining Drill</color></link> over the same area.\", name: \"Autominer (Small)\" }, structure: StructureInfo { small_grid: true }, thermal_info: None, internal_atmo_info: None, logic: LogicInfo { logic_slot_types: {0: {}, 1: {}}, logic_types: {Power: Read, Open: ReadWrite, Error: Read, Activate: ReadWrite, On: ReadWrite, RequiredPower: Read, ClearMemory: Write, ExportCount: Read, ImportCount: Read, PrefabHash: Read, ReferenceId: Read, NameHash: Read}, modes: None, transmission_receiver: false, wireless_logic: false, circuit_holder: false }, slots: [SlotInfo { name: \"Import\", typ: None }, SlotInfo { name: \"Export\", typ: None }], device: DeviceInfo { connection_list: [ConnectionInfo { typ: Chute, role: Input }, ConnectionInfo { typ: Chute, role: Output }, ConnectionInfo { typ: Data, role: None }, ConnectionInfo { typ: Power, role: None }], device_pins_length: None, has_activate_state: true, has_atmosphere: false, has_color_state: false, has_lock_state: false, has_mode_state: false, has_on_off_state: true, has_open_state: true, has_reagents: false } }), 111280987: ItemLogic(ItemLogicTemplate { prefab: PrefabInfo { prefab_name: \"ItemTerrainManipulator\", prefab_hash: 111280987, desc: \"0.Mode0\\n1.Mode1\", name: \"Terrain Manipulator\" }, item: ItemInfo { consumable: false, filter_type: None, ingredient: false, max_quantity: 1, reagents: None, slot_class: Tool, sorting_class: Default }, thermal_info: None, internal_atmo_info: None, logic: LogicInfo { logic_slot_types: {0: {Occupied: Read, OccupantHash: Read, Quantity: Read, Damage: Read, Charge: Read, ChargeRatio: Read, Class: Read, MaxQuantity: Read, ReferenceId: Read}, 1: {Occupied: Read, OccupantHash: Read, Quantity: Read, Damage: Read, Class: Read, MaxQuantity: Read, ReferenceId: Read}}, logic_types: {Power: Read, Mode: ReadWrite, Error: Read, Activate: ReadWrite, On: ReadWrite, ReferenceId: Read}, modes: Some({0: \"Mode0\", 1: \"Mode1\"}), transmission_receiver: false, wireless_logic: false, circuit_holder: false }, slots: [SlotInfo { name: \"Battery\", typ: Battery }, SlotInfo { name: \"Dirt Canister\", typ: Ore }] })}\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"let entries = r#\"\n", | ||
"{\n", | ||
"\"7274344\": {\n", | ||
" \"templateType\": \"StructureLogicDevice\",\n", | ||
" \"prefab\": {\n", | ||
" \"prefab_name\": \"StructureAutoMinerSmall\",\n", | ||
" \"prefab_hash\": 7274344,\n", | ||
" \"desc\": \"The <link=Recurso><color=#0080FFFF>Recurso</color></link> SquareDig autominer is a structure that when built will mine a vertical 2x2 shaft until it hits bedrock. The autominer can be connected to a chute system, and is controllable by a logic network. Note that the autominer outputs more <link=OrePage><color=#0080FFFF>ore</color></link> than a conventional <link=ThingItemMiningDrill><color=green>Mining Drill</color></link> over the same area.\",\n", | ||
" \"name\": \"Autominer (Small)\"\n", | ||
" },\n", | ||
" \"structure\": {\n", | ||
" \"small_grid\": true\n", | ||
" },\n", | ||
" \"logic\": {\n", | ||
" \"logic_slot_types\": {\n", | ||
" \"0\": {},\n", | ||
" \"1\": {}\n", | ||
" },\n", | ||
" \"logic_types\": {\n", | ||
" \"Power\": \"Read\",\n", | ||
" \"Open\": \"ReadWrite\",\n", | ||
" \"Error\": \"Read\",\n", | ||
" \"Activate\": \"ReadWrite\",\n", | ||
" \"On\": \"ReadWrite\",\n", | ||
" \"RequiredPower\": \"Read\",\n", | ||
" \"ClearMemory\": \"Write\",\n", | ||
" \"ExportCount\": \"Read\",\n", | ||
" \"ImportCount\": \"Read\",\n", | ||
" \"PrefabHash\": \"Read\",\n", | ||
" \"ReferenceId\": \"Read\",\n", | ||
" \"NameHash\": \"Read\"\n", | ||
" },\n", | ||
" \"transmission_receiver\": false,\n", | ||
" \"wireless_logic\": false,\n", | ||
" \"circuit_holder\": false\n", | ||
" },\n", | ||
" \"slots\": [\n", | ||
" {\n", | ||
" \"name\": \"Import\",\n", | ||
" \"typ\": \"None\"\n", | ||
" },\n", | ||
" {\n", | ||
" \"name\": \"Export\",\n", | ||
" \"typ\": \"None\"\n", | ||
" }\n", | ||
" ],\n", | ||
" \"device\": {\n", | ||
" \"connection_list\": [\n", | ||
" {\n", | ||
" \"typ\": \"Chute\",\n", | ||
" \"role\": \"Input\"\n", | ||
" },\n", | ||
" {\n", | ||
" \"typ\": \"Chute\",\n", | ||
" \"role\": \"Output\"\n", | ||
" },\n", | ||
" {\n", | ||
" \"typ\": \"Data\",\n", | ||
" \"role\": \"None\"\n", | ||
" },\n", | ||
" {\n", | ||
" \"typ\": \"Power\",\n", | ||
" \"role\": \"None\"\n", | ||
" }\n", | ||
" ],\n", | ||
" \"has_activate_state\": true,\n", | ||
" \"has_atmosphere\": false,\n", | ||
" \"has_color_state\": false,\n", | ||
" \"has_lock_state\": false,\n", | ||
" \"has_mode_state\": false,\n", | ||
" \"has_on_off_state\": true,\n", | ||
" \"has_open_state\": true,\n", | ||
" \"has_reagents\": false\n", | ||
" }\n", | ||
" },\n", | ||
" \"111280987\": {\n", | ||
" \"templateType\": \"ItemLogic\",\n", | ||
" \"prefab\": {\n", | ||
" \"prefab_name\": \"ItemTerrainManipulator\",\n", | ||
" \"prefab_hash\": 111280987,\n", | ||
" \"desc\": \"0.Mode0\\n1.Mode1\",\n", | ||
" \"name\": \"Terrain Manipulator\"\n", | ||
" },\n", | ||
" \"item\": {\n", | ||
" \"consumable\": false,\n", | ||
" \"ingredient\": false,\n", | ||
" \"max_quantity\": 1,\n", | ||
" \"slot_class\": \"Tool\",\n", | ||
" \"sorting_class\": \"Default\"\n", | ||
" },\n", | ||
" \"logic\": {\n", | ||
" \"logic_slot_types\": {\n", | ||
" \"0\": {\n", | ||
" \"Occupied\": \"Read\",\n", | ||
" \"OccupantHash\": \"Read\",\n", | ||
" \"Quantity\": \"Read\",\n", | ||
" \"Damage\": \"Read\",\n", | ||
" \"Charge\": \"Read\",\n", | ||
" \"ChargeRatio\": \"Read\",\n", | ||
" \"Class\": \"Read\",\n", | ||
" \"MaxQuantity\": \"Read\",\n", | ||
" \"ReferenceId\": \"Read\"\n", | ||
" },\n", | ||
" \"1\": {\n", | ||
" \"Occupied\": \"Read\",\n", | ||
" \"OccupantHash\": \"Read\",\n", | ||
" \"Quantity\": \"Read\",\n", | ||
" \"Damage\": \"Read\",\n", | ||
" \"Class\": \"Read\",\n", | ||
" \"MaxQuantity\": \"Read\",\n", | ||
" \"ReferenceId\": \"Read\"\n", | ||
" }\n", | ||
" },\n", | ||
" \"logic_types\": {\n", | ||
" \"Power\": \"Read\",\n", | ||
" \"Mode\": \"ReadWrite\",\n", | ||
" \"Error\": \"Read\",\n", | ||
" \"Activate\": \"ReadWrite\",\n", | ||
" \"On\": \"ReadWrite\",\n", | ||
" \"ReferenceId\": \"Read\"\n", | ||
" },\n", | ||
" \"modes\": {\n", | ||
" \"0\": \"Mode0\",\n", | ||
" \"1\": \"Mode1\"\n", | ||
" },\n", | ||
" \"transmission_receiver\": false,\n", | ||
" \"wireless_logic\": false,\n", | ||
" \"circuit_holder\": false\n", | ||
" },\n", | ||
" \"slots\": [\n", | ||
" {\n", | ||
" \"name\": \"Battery\",\n", | ||
" \"typ\": \"Battery\"\n", | ||
" },\n", | ||
" {\n", | ||
" \"name\": \"Dirt Canister\",\n", | ||
" \"typ\": \"Ore\"\n", | ||
" }\n", | ||
" ]\n", | ||
" }\n", | ||
"}\n", | ||
"\"#;\n", | ||
"use std::collections::BTreeMap;\n", | ||
"use stationeers_data::templates::ObjectTemplate;\n", | ||
"let parsed_db: BTreeMap<i32, ObjectTemplate> =\n", | ||
" parse_value(&mut serde_json::Deserializer::from_str(entries))?;\n", | ||
"println!(\"{parsed_db:?}\");" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Rust", | ||
"language": "rust", | ||
"name": "rust" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": "rust", | ||
"file_extension": ".rs", | ||
"mimetype": "text/rust", | ||
"name": "rust", | ||
"pygment_lexer": "rust", | ||
"version": "" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.