fix hash autocomplete
- begin device from template
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -32,14 +32,14 @@ pub enum VMError {
|
||||
InvalidNetwork(u16),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum FieldType {
|
||||
Read,
|
||||
Write,
|
||||
ReadWrite,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct LogicField {
|
||||
pub field_type: FieldType,
|
||||
pub value: f64,
|
||||
@@ -47,6 +47,7 @@ pub struct LogicField {
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
||||
pub struct Slot {
|
||||
pub typ: SlotType,
|
||||
pub fields: HashMap<grammar::SlotLogicType, LogicField>,
|
||||
}
|
||||
|
||||
@@ -57,6 +58,79 @@ pub enum Connection {
|
||||
Other,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||
pub struct DeviceTemplate {
|
||||
pub name: Option<String>,
|
||||
pub hash: Option<i32>,
|
||||
pub logic: HashMap<grammar::LogicType, LogicField>,
|
||||
pub slots: Vec<SlotTemplate>,
|
||||
pub slotlogic: HashMap<grammar::LogicType, usize>,
|
||||
pub conn: HashMap<u32, Connection>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum ConnectionType {
|
||||
Chute,
|
||||
Pipe,
|
||||
Power,
|
||||
PowerData,
|
||||
#[default]
|
||||
Data,
|
||||
}
|
||||
|
||||
impl From<ConnectionType> for Connection {
|
||||
fn from(value: ConnectionType) -> Self {
|
||||
match value {
|
||||
ConnectionType::Chute | ConnectionType::Pipe | ConnectionType::Power => Self::Other,
|
||||
_ => Self::CableNetwork(None),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum SlotType {
|
||||
AccessCard,
|
||||
Appliance,
|
||||
Back,
|
||||
Battery,
|
||||
Blocked,
|
||||
Bottle,
|
||||
Cartridge,
|
||||
Circuitboard,
|
||||
CreditCard,
|
||||
DataDisk,
|
||||
DrillHead,
|
||||
Egg,
|
||||
Entity,
|
||||
Flare,
|
||||
GasCanister,
|
||||
GasFilter,
|
||||
Helmet,
|
||||
Ingot,
|
||||
LiquidBottle,
|
||||
LiquidCanister,
|
||||
Magazine,
|
||||
Ore,
|
||||
Organ,
|
||||
Plant,
|
||||
ProgramableChip,
|
||||
ScanningHead,
|
||||
SensorProcessingUnit,
|
||||
SoundCartridge,
|
||||
Suit,
|
||||
Tool,
|
||||
Torpedo,
|
||||
#[default]
|
||||
#[serde(other)]
|
||||
None,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||
pub struct SlotTemplate {
|
||||
pub name: String,
|
||||
pub typ: SlotType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Device {
|
||||
pub id: u16,
|
||||
|
||||
4
ic10lsp_wasm/Cargo.lock
generated
4
ic10lsp_wasm/Cargo.lock
generated
@@ -395,7 +395,7 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
[[package]]
|
||||
name = "ic10lsp"
|
||||
version = "0.7.4"
|
||||
source = "git+https://github.com/Ryex/ic10lsp.git?branch=wasm#425541dea0423778b1bdd0785d81b85ac26ba383"
|
||||
source = "git+https://github.com/Ryex/ic10lsp.git?branch=wasm#cda35bfe161caa8e782f9190572bcf3f7ee89be5"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"const-crc32",
|
||||
@@ -1043,7 +1043,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tree-sitter-ic10"
|
||||
version = "0.5.2"
|
||||
source = "git+https://github.com/Ryex/tree-sitter-ic10.git?branch=wasm#bc0a4398725e68ec8258b70ee929aaa17e032be2"
|
||||
source = "git+https://github.com/Ryex/tree-sitter-ic10.git?branch=wasm#0476a0ce5a73b52b2662f177d2e32b5ed48e7136"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"tree-sitter",
|
||||
|
||||
@@ -22,6 +22,7 @@ wasm-bindgen-futures = { version = "0.4.30", features = ["futures-core-03-stream
|
||||
wasm-streams = "0.4"
|
||||
# web-tree-sitter-sys = "1.3"
|
||||
ic10lsp = { git = "https://github.com/Ryex/ic10lsp.git", branch = "wasm" }
|
||||
# ic10lsp = { path = "../../ic10lsp" }
|
||||
|
||||
[profile.release]
|
||||
# Tell `rustc` to optimize for small code size.
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
"jetpack",
|
||||
"Keybind",
|
||||
"lbns",
|
||||
"logicable",
|
||||
"logictype",
|
||||
"logictypes",
|
||||
"Mineables",
|
||||
@@ -71,6 +72,7 @@
|
||||
"offcanvas",
|
||||
"overcolumn",
|
||||
"Overlength",
|
||||
"pedia",
|
||||
"popperjs",
|
||||
"preproc",
|
||||
"putd",
|
||||
@@ -87,6 +89,8 @@
|
||||
"sgez",
|
||||
"sgtz",
|
||||
"slez",
|
||||
"slotlogic",
|
||||
"slotlogicable",
|
||||
"slotlogictype",
|
||||
"slotlogictypes",
|
||||
"slottype",
|
||||
|
||||
1
www/data/database.json
Normal file
1
www/data/database.json
Normal file
File diff suppressed because one or more lines are too long
@@ -5,8 +5,17 @@ body {
|
||||
}
|
||||
|
||||
.ace_tooltip {
|
||||
background-color: #343a40;
|
||||
color: #dee2e6;
|
||||
background: #282c34;
|
||||
color: #c1c1c1;
|
||||
border: 1px #484747 solid;
|
||||
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);
|
||||
}
|
||||
|
||||
.ace_tooltip.ace_dark {
|
||||
background: #282c34;
|
||||
color: #c1c1c1;
|
||||
border: 1px #484747 solid;
|
||||
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);
|
||||
}
|
||||
|
||||
.ace_status-indicator {
|
||||
@@ -285,7 +294,13 @@ body {
|
||||
* --------------- */
|
||||
|
||||
code {
|
||||
color: #e685b5
|
||||
// color: #e685b5
|
||||
color: #c678dd;
|
||||
}
|
||||
|
||||
.ace_tooltip code {
|
||||
font-style: italic;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.navbar-default .navbar-nav>li>a {
|
||||
|
||||
@@ -5,24 +5,11 @@ from collections import defaultdict
|
||||
import re
|
||||
import json
|
||||
|
||||
|
||||
def extract_logicable():
|
||||
logicable = []
|
||||
pedia = {}
|
||||
with Path("./Stationpedia.json").open("r") as f:
|
||||
pedia.update(json.load(f))
|
||||
for page in pedia["pages"]:
|
||||
if page["LogicInsert"] or page["LogicSlotInsert"]:
|
||||
logicable.append(page)
|
||||
# print(f"{len(logicable)} of {len(pedia["pages"])} are logicable")
|
||||
return logicable
|
||||
|
||||
|
||||
def extract_all():
|
||||
items = {}
|
||||
pedia = {}
|
||||
linkPat = re.compile(r"<link=\w+><color=[\w#]+>(.+?)</color></link>")
|
||||
with Path("./Stationpedia.json").open("r") as f:
|
||||
with (Path("data") / "Stationpedia.json").open("r") as f:
|
||||
pedia.update(json.load(f))
|
||||
for page in pedia["pages"]:
|
||||
item = defaultdict(list)
|
||||
@@ -110,7 +97,7 @@ def extract_all():
|
||||
if item["logic"] is not None and item["conn"] is not None
|
||||
]
|
||||
|
||||
with open("database.json", "w") as f:
|
||||
with open("data/database.json", "w") as f:
|
||||
json.encoder
|
||||
json.dump(
|
||||
{
|
||||
Reference in New Issue
Block a user