Beginings of Devices UI

- device summary
- start of offcanvas

Signed-off-by: Rachel <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel
2024-03-31 21:49:54 -07:00
parent 41cdf863c4
commit a62643092a
11 changed files with 209 additions and 432 deletions

View File

@@ -1,130 +1 @@
{
"version": "0.2",
"language": "en",
"flagWords": [],
"words": [
"Astroloy",
"Autolathe",
"bapal",
"bapz",
"bapzal",
"batchmode",
"batchmodes",
"bdns",
"bdnsal",
"bdse",
"bdseal",
"beqal",
"beqz",
"beqzal",
"bgeal",
"bgez",
"bgezal",
"bgtal",
"bgtz",
"bgtzal",
"bindgen",
"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",
"conv",
"cstyle",
"endpos",
"getd",
"Hardsuit",
"hashables",
"inext",
"inextp",
"infile",
"itertools",
"jetpack",
"kbshortcutmenu",
"Keybind",
"lbns",
"logicable",
"logictype",
"logictypes",
"lzma",
"Mineables",
"mscorlib",
"MSEED",
"ninf",
"nomatch",
"oprs",
"overcolumn",
"Overlength",
"pedia",
"peekable",
"prec",
"preproc",
"putd",
"QUICKFIX",
"reagentmode",
"reagentmodes",
"repr",
"retval",
"rocketstation",
"sapz",
"sattellite",
"sdns",
"sdse",
"searchbox",
"searchbtn",
"seqz",
"serde",
"settingsmenu",
"sgez",
"sgtz",
"slez",
"slotlogic",
"slotlogicable",
"slotlogictype",
"slotlogictypes",
"slottype",
"sltz",
"snan",
"snanz",
"snaz",
"snez",
"splitn",
"Stationeers",
"stationpedia",
"stdweb",
"thiserror",
"tokentype",
"trunc",
"Tsify",
"whos"
]
}
{"language":"en","flagWords":[],"version":"0.2","words":["Astroloy","Autolathe","bapal","bapz","bapzal","batchmode","batchmodes","bdns","bdnsal","bdse","bdseal","beqal","beqz","beqzal","bgeal","bgez","bgezal","bgtal","bgtz","bgtzal","bindgen","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","conv","cstyle","endpos","getd","Hardsuit","hashables","inext","inextp","infile","itertools","jetpack","kbshortcutmenu","Keybind","lbns","logicable","logictype","logictypes","lzma","Mineables","mscorlib","MSEED","ninf","nomatch","oprs","overcolumn","Overlength","pedia","peekable","prec","preproc","putd","QUICKFIX","reagentmode","reagentmodes","repr","retval","rocketstation","sapz","sattellite","sdns","sdse","searchbox","searchbtn","seqz","serde","settingsmenu","sgez","sgtz","slez","slotlogic","slotlogicable","slotlogictype","slotlogictypes","slottype","sltz","snan","snanz","snaz","snez","splitn","Stationeers","stationpedia","stdweb","thiserror","tokentype","trunc","Tsify","whos","Depressurising","Pressurising","logicslottypes","lparen","rparen","hstack","dylib"]}

View File

@@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
crate-type = ["lib"]
crate-type = ["lib", "cdylib"]
[dependencies]

View File

@@ -164,6 +164,8 @@ pub struct Device {
pub name: Option<String>,
pub name_hash: Option<f64>,
pub fields: HashMap<grammar::LogicType, LogicField>,
pub prefab_name: Option<String>,
pub prefab_hash: Option<i32>,
pub slots: Vec<Slot>,
pub reagents: HashMap<ReagentMode, HashMap<i32, f64>>,
pub ic: Option<u16>,
@@ -253,6 +255,8 @@ impl Device {
id,
name: None,
name_hash: None,
prefab_name: None,
prefab_hash: None,
fields: HashMap::new(),
slots: Vec::new(),
reagents: HashMap::new(),
@@ -273,6 +277,7 @@ impl Device {
value: 0.0,
},
);
device.prefab_name = Some("StructureCircuitHousing".to_owned());
device.fields.insert(
LogicType::Error,
LogicField {
@@ -280,6 +285,7 @@ impl Device {
value: 0.0,
},
);
device.prefab_hash = Some(-128473777);
device.fields.insert(
LogicType::PrefabHash,
LogicField {

View File

@@ -43,6 +43,16 @@ impl DeviceRef {
self.device.borrow().name_hash
}
#[wasm_bindgen(getter, js_name = "prefabName")]
pub fn prefab_name(&self) -> Option<String> {
self.device.borrow().prefab_name.clone()
}
#[wasm_bindgen(getter, js_name = "prefabHash")]
pub fn prefab_hash(&self) -> Option<i32> {
self.device.borrow().prefab_hash
}
#[wasm_bindgen(getter, skip_typescript)]
pub fn fields(&self) -> JsValue {
serde_wasm_bindgen::to_value(&self.device.borrow().fields).unwrap()

View File

@@ -26,11 +26,11 @@ type Defines = Map<string, number>;
type Pins = (number | undefined)[]
export interface DeviceRef {
readonly fields: Fields | undefined;
readonly slots: Slot[] | undefined;
readonly reagents: Reagents | undefined;
readonly connections: Connection[] | undefined;
readonly aliases: Aliases | undefined;
readonly defines: Defines | undefined;
readonly pins: Pins;
readonly fields: Fields;
readonly slots: Slot[];
readonly reagents: Reagents;
readonly connections: Connection[];
readonly aliases?: Aliases | undefined;
readonly defines?: Defines | undefined;
readonly pins?: Pins;
}

View File

@@ -1,120 +1 @@
{
"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",
"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"
],
"version": "0.2",
"language": "en",
"flagWords": []
}
{"flagWords":[],"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"],"language":"en","version":"0.2"}

View File

@@ -199,7 +199,7 @@
<button id="vmControlReset" type="button" class="btn btn-warning">Reset</button>
</div>
</div>
<div id="vmActiveICState" class="mt-2 col-2 col-sm-4 col-md-10">
<div id="vmActiveICState" class="mt-2 col-9 g-4">
<div class="hstack g-0">
<div>Instruction Pointer</div>
@@ -218,12 +218,34 @@
</div>
</div>
<div class="row mt-2 p2">
<button type="button" class="btn btn-outline-secondary">View Devices <span
id="vmViewDeviceCount"></span></button>
<div class="row mt-1 ms-1 me-1">
<button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="offcanvas"
data-bs-target="#vmDevices" aria-expanded="false"
aria-controls="vmDevices">View All Devices <span id="vmViewDeviceCount"></span></button>
</div>
<div class="row p2">
<div class="collapse mt-1" id=vmDeviceSummaryCollapse>
</div>
</div>
<div class="row mt-2">
<div class="accordion" id="vmActiveIC">
<div class="accordion vm_accordion" id="vmActiveIC">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseDeviceSummary" aria-expanded="false"
aria-controls="collapseDeviceSummary">
Device Summary
</button>
</h2>
<div id="collapseDeviceSummary" class="accordion-collapse collapse">
<div class="accordion-body">
<div id="vmDeviceSummary" class="card card-body vm_device_summary">
</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse"
@@ -268,7 +290,7 @@
</script>
<div class="offcanvas offcanvas-start" tabindex="-1" id="vmDevices" aria-labelledby="vmDevicesLabel"
<div class="offcanvas offcanvas-bottom" tabindex="-1" id="vmDevices" aria-labelledby="vmDevicesLabel"
data-bs-scroll="true" data-bs-backdrop="false">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="vmDevicesLabel">Devices</h5>
@@ -280,4 +302,4 @@
</div>
</body>
</html>
</html>

View File

@@ -1,6 +1,6 @@
var ops = (
const ops = (
"abs|acos|add|alias|and|asin|atan|atan2|bap|bapal|bapz|bapzal|bdns|" +
"bdnsal|bdse|bdseal|beq|beqal|beqz|beqzal|bge|bgeal|bgez|bgezal|bgt|" +
"bgtal|bgtz|bgtzal|ble|bleal|blez|blezal|blt|bltal|bltz|bltzal|bna|" +
@@ -14,7 +14,7 @@ var ops = (
"xor|yield"
);
var enums = (
const enums = (
"AirCon\\.Cold|AirCon\\.Hot|AirControl\\.Draught|AirControl\\.None|" +
"AirControl\\.Offline|AirControl\\.Pressure|Color\\.Black|Color\\.Blue|" +
"Color\\.Brown|Color\\.Gray|Color\\.Green|Color\\.Khaki|Color\\.Orange|" +
@@ -186,157 +186,66 @@ var enums = (
"Sound\\.TemperatureHigh|Sound\\.TemperatureLow|Sound\\.Three|" +
"Sound\\.TraderIncoming|Sound\\.TraderLanded|Sound\\.Two|" +
"Sound\\.Warning|Sound\\.Welcome|TransmitterMode\\.Active|" +
"TransmitterMode\\.Passive|Vent\\.Inward|Vent\\.Outward");
var logictypes = (
"Acceleration|Activate|AirRelease|AlignmentError|Apex|AutoLand|" +
"AutoShutOff|Bpm|BurnTimeRemaining|CelestialHash|CelestialParentHash|" +
"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|MineablesInQueue|MineablesInVicinity|MinedQuantity|" +
"MinimumWattsToContact|Mode|NavPoints|NextWeatherEventTime|None|" +
"On|Open|OperationalTemperatureEfficiency|OrbitPeriod|Orientation|" +
"Output|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|SettingOutput|" +
"SignalID|SignalStrength|Sites|Size|SizeX|SizeY|SizeZ|SolarAngle|" +
"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|" +
"VelocityMagnitude|VelocityRelativeX|VelocityRelativeY|VelocityRelativeZ|" +
"VelocityX|VelocityY|VelocityZ|Vertical|VerticalRatio|Volume|VolumeOfLiquid|" +
"WattsReachingContact|Weight|WorkingGasEfficiency");
var logictypes = (
"Acceleration|Activate|AirRelease|AlignmentError|Apex|AutoLand|" +
"AutoShutOff|Average|Bpm|BurnTimeRemaining|Bypass|CelestialHash|" +
"CelestialParentHash|Channel|Channel0|Channel1|Channel2|Channel3|" +
"Channel4|Channel5|Channel6|Channel7|Charge|ChargeRatio|Class|" +
"ClearMemory|CollectableGoods|Color|Combustion|CombustionInput|" +
"CombustionInput2|CombustionLimiter|CombustionOutput|CombustionOutput2|" +
"CompletionRatio|ContactTypeId|Contents|CurrentResearchPodType|Damage|" +
"DestinationCode|DistanceAu|DistanceKm|DrillCondition|DryMass|" +
"Eccentricity|Efficiency|ElevatorLevel|ElevatorSpeed|EntityState|" +
"EnvironmentEfficiency|Error|ExhaustVelocity|ExportCount|" +
"ExportQuantity|ExportSlotHash|ExportSlotOccupant|FilterType|" +
"Filtration|FlightControlRule|Flush|ForceWrite|ForwardX|ForwardY|" +
"ForwardZ|Fuel|Growth|Harvest|Health|Horizontal|HorizontalRatio|" +
"Idle|ImportCount|ImportQuantity|ImportSlotHash|ImportSlotOccupant|" +
"Inclination|Index|InterrogationProgress|LineNumber|Lock|" +
"ManualResearchRequiredPod|Mass|Mature|MaxQuantity|Maximum|" +
"MinWattsToContact|MineablesInQueue|MineablesInVicinity|Minimum|" +
"MinimumWattsToContact|Mode|NextWeatherEventTime|None|OccupantHash|" +
"Occupied|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|PressureAir|PressureEfficiency|PressureExternal|" +
"PressureInput|PressureInput2|PressureInternal|PressureOutput|" +
"PressureOutput2|PressureSetting|PressureWaste|Progress|Quantity|" +
"Ratio|RatioCarbonDioxide|RatioCarbonDioxideInput|" +
"RatioCarbonDioxideInput2|RatioCarbonDioxideOutput|" +
"RatioCarbonDioxideOutput2|RatioLiquidCarbonDioxide|" +
"RatioLiquidCarbonDioxideInput|RatioLiquidCarbonDioxideInput2|" +
"RatioLiquidCarbonDioxideOutput|RatioLiquidCarbonDioxideOutput2|" +
"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|" +
"RatioSteam|RatioSteamInput|RatioSteamInput2|RatioSteamOutput|" +
"RatioSteamOutput2|RatioVolatiles|RatioVolatilesInput|" +
"RatioVolatilesInput2|RatioVolatilesOutput|RatioVolatilesOutput2|" +
"RatioWater|RatioWaterInput|RatioWaterInput2|RatioWaterOutput|" +
"RatioWaterOutput2|ReEntryAltitude|Reagents|Recipe|RecipeHash|" +
"ReferenceId|RequestHash|Required|RequiredPower|ReturnFuelCost|Rpm|" +
"Seeding|SemiMajorAxis|Setting|SettingInput|SettingInputHash|" +
"SettingOutput|SettingOutputHash|SignalID|SignalStrength|SizeX|SizeY|" +
"SizeZ|SolarAngle|SolarConstant|SolarIrradiance|SortingClass|" +
"SoundAlert|Stress|Sum|TargetPadIndex|TargetX|TargetY|TargetZ|" +
"Temperature|TemperatureDifferentialEfficiency|TemperatureExternal|" +
"TemperatureInput|TemperatureInput2|TemperatureOutput|" +
"TemperatureOutput2|TemperatureSetting|Throttle|Thrust|ThrustToWeight|" +
"Time|TimeToDestination|TotalMoles|TotalMolesInput|TotalMolesInput2|" +
"TotalMolesOutput|TotalMolesOutput2|TrueAnomaly|Unknown|" +
"VelocityMagnitude|VelocityRelativeX|VelocityRelativeY|" +
"VelocityRelativeZ|VelocityX|VelocityY|VelocityZ|Vertical|" +
"VerticalRatio|Volume|VolumeOfLiquid|WattsReachingContact|Weight" +
"|WorkingGasEfficiency"
"TransmitterMode\\.Passive|Vent\\.Inward|Vent\\.Outward"
);
var logicslottypes = (
const logictypes = (
"Acceleration|Activate|AirRelease|AlignmentError|Apex|AutoLand|AutoShutOff|Bpm|" +
"BurnTimeRemaining|CelestialHash|CelestialParentHash|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|MineablesInQueue|MineablesInVicinity|MinedQuantity|" +
"MinimumWattsToContact|Mode|NavPoints|NextWeatherEventTime|None|On|Open|OperationalTemperatureEfficiency|" +
"OrbitPeriod|Orientation|Output|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|SettingOutput|" +
"SignalID|SignalStrength|Sites|Size|SizeX|SizeY|SizeZ|SolarAngle|" +
"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|VelocityMagnitude|VelocityRelativeX|VelocityRelativeY|VelocityRelativeZ|" +
"VelocityX|VelocityY|VelocityZ|Vertical|VerticalRatio|Volume|VolumeOfLiquid|WattsReachingContact|" +
"Weight|WorkingGasEfficiency"
);
const logicslottypes = (
"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"
);
var batchmodes = ("Average|Maximum|Minimum|Sum");
const batchmodes = ("Average|Maximum|Minimum|Sum");
var reagentmodes = ("Contents|Recipe|Required|TotalContents");
const reagentmodes = ("Contents|Recipe|Required|TotalContents");
var constants = ("nan|pinf|ninf|pi|deg2rad|rad2deg|epsilon");
const constants = ("nan|pinf|ninf|pi|deg2rad|rad2deg|epsilon");
var deprecated = (
const deprecated = (
"ExportSlotHash|ExportSlotOccupant|ImportSlotHash|ImportSlotOccupant|" +
"LogicType.ExportSlotHash|LogicType.ExportSlotOccupant|LogicType.ImportSlotHash|" +
"LogicType.ImportSlotOccupant|LogicType.PlantEfficiency1|LogicType.PlantEfficiency2|" +
@@ -349,9 +258,10 @@ var deprecated = (
"PlantHash3|PlantHash4|PlantHealth1|PlantHealth2|PlantHealth3|PlantHealth4"
);
// https://regex101.com/r/XWgqpN/1 << potentially useful regex for labeling jumps
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
var rules = {
const rules = {
start: [{
token: "comment.line.number-sign",
regex: /#.*$/,
@@ -372,14 +282,13 @@ var rules = {
}, {
token: "variable.language",
regex: /\b(?:d(?:b|[0-5]|r*(?:[0-9]|1[0-7]))(?::[0-9]+)?)\b/,
}, {
token: "invalid.deprecated",
regex: "\\b(?:" + deprecated + ")\\b",
}, {
token: "support.type",
regex: "\\b(?:" + logictypes + "|" + logicslottypes + "|" + batchmodes + "|" + reagentmodes + ")\\b",
}, {
token: "invalid.deprecated",
regex: "\\b(?:" + deprecated + ")\\b",
},
{
token: "constant.language",
regex: "\\b(?:" + constants + ")\\b",
}, {
@@ -398,4 +307,4 @@ var rules = {
}]
};
export { rules };
export { rules };

View File

@@ -1,29 +1,35 @@
import { Offcanvas } from 'bootstrap';
import { VirtualMachine, VirtualMachineUI } from '.';
import { DeviceRef } from 'ic10emu_wasm';
import { DeviceRef, VM } from 'ic10emu_wasm';
class VMDeviceUI {
ui: VirtualMachineUI;
root: HTMLDivElement;
canvasEl: HTMLElement;
summary: HTMLDivElement;
canvasEl: HTMLDivElement;
deviceCountEl: HTMLElement;
canvas: Offcanvas;
private _deviceCards: Map<number, VMDeviceCard>;
constructor(ui: VirtualMachineUI) {
const that = this;
that.ui = ui;
this.root = document.createElement('div');
this.canvasEl = document.getElementById('vmDevicesOCBody');
this.deviceCountEl = document.getElementById('vmDViewDeviceCount');
this.canvas = new Offcanvas(this.canvasEl)
this.summary = document.getElementById('vmDeviceSummary') as HTMLDivElement;
this.canvasEl = document.getElementById('vmDevicesOCBody') as HTMLDivElement;
this.deviceCountEl = document.getElementById('vmViewDeviceCount');
this.canvas = new Offcanvas(this.canvasEl);
this._deviceCards = new Map();
}
update(active_ic: DeviceRef) {
const devices = window.VM.devices;
this.deviceCountEl.innerText = `(${devices.size})`
for (const [id, device] of devices) {
if (!this._deviceCards.has(id)) {
this._deviceCards.set(id, new VMDeviceCard(this, device));
}
}
this._deviceCards.forEach((card, _id) => { card.update(active_ic)});
}
}
@@ -33,17 +39,68 @@ class VMDeviceCard {
viewBtn: HTMLButtonElement;
deviceUI: VMDeviceUI;
device: DeviceRef;
badges: HTMLSpanElement[];
constructor(deviceUI: VMDeviceUI, device: DeviceRef) {
const that = this;
// const that = this;
this.deviceUI = deviceUI;
this.device = device;
this.root = document.createElement('div');
this.root.classList.add("hstack", "gap-2");
this.root.classList.add("hstack", "gap-2", "bg-light-subtle", "border", "border-secondary-subtle", "rounded");
this.viewBtn = document.createElement('button');
this.viewBtn.type = "button";
this.viewBtn.classList.add("btn", "btn-secondary");
const btnTxt = document.createTextNode(device.name)
this.deviceUI.root.appendChild(this.root);
this.viewBtn.classList.add("btn", "btn-success" );
this.root.appendChild(this.viewBtn);
this.deviceUI.summary.appendChild(this.root);
this.badges = [];
this.update(window.VM.activeIC);
}
update (active_ic: DeviceRef) {
const that = this;
// clear previous badges
this.badges.forEach(badge => badge.remove());
this.badges = []
//update name
var deviceName = this.device.name ?? this.device.prefabName ?? "";
if (deviceName) {
deviceName = `: ${deviceName}`
}
const btnTxt = `Device ${this.device.id}${deviceName}`
this.viewBtn.innerText = btnTxt;
// regen badges
this.device.connections.forEach((conn, index) => {
if ( typeof conn === "object") {
var badge = document.createElement('span');
badge.classList.add("badge", "text-bg-light");
badge.innerText = `Net ${index}:${conn.CableNetwork}`;
that.badges.push(badge);
that.root.appendChild(badge);
}
});
if (this.device.id === active_ic.id) {
var badge = document.createElement('span');
badge.classList.add("badge", "text-bg-success");
badge.innerText = "db";
that.badges.push(badge);
that.root.appendChild(badge);
}
active_ic.pins?.forEach((id, index) => {
if (that.device.id === id) {
var badge = document.createElement('span');
badge.classList.add("badge", "text-bg-success");
badge.innerText = `d${index}`;
that.badges.push(badge);
that.root.appendChild(badge);
}
});
}
destroy() {
@@ -52,4 +109,4 @@ class VMDeviceCard {
}
export { VMDeviceUI }
export { VMDeviceUI }

View File

@@ -28,7 +28,7 @@ class VirtualMachine {
ui: VirtualMachineUI;
_devices: Map<number, DeviceRef>;
_ics: Map<number, DeviceRef>;
db: any;
db: DeviceDB;
constructor() {
const vm = init();
@@ -69,6 +69,7 @@ class VirtualMachine {
}
for (const id of this._devices.keys()) {
if (!device_ids.includes(id)) {
this._devices.get(id).free();
this._devices.delete(id);
}
}
@@ -81,6 +82,7 @@ class VirtualMachine {
}
for (const id of this._ics.keys()) {
if (!ics.includes(id)) {
this._ics.get(id).free();
this._ics.delete(id);
}
}
@@ -412,4 +414,4 @@ class VMStackUI {
}
export { VirtualMachine, VirtualMachineUI , DeviceDB };
export { VirtualMachine, VirtualMachineUI , DeviceDB };

View File

@@ -400,6 +400,15 @@ code {
z-index: 20;
}
.vm_accordion .accordion-button {
padding-top: 0.2rem;
padding-bottom: 0.2rem;
}
.vm_accordion .accordion-header {
line-height: 0.75rem;
}
.vm_reg {
overflow-x: auto;
overflow-y: auto;
@@ -483,4 +492,14 @@ code {
.vm_stack_cel span.stack_pointer {
background-color: var(--bs-success);
}
}
.vm_device_summary button.btn {
line-height: 0.75rem;
}
.vm_device_summary span.badge {
line-height: 0.5rem;
font-size: 0.65rem;
}