Skip to content

Commit dbf79a3

Browse files
committed
Implement processor links
1 parent 951504a commit dbf79a3

File tree

12 files changed

+828
-312
lines changed

12 files changed

+828
-312
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"files.associations": {
3+
"**/mimex-*.txt": "csv",
4+
},
5+
}

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ noise = "0.9.0"
1717
num-traits = "0.2.19"
1818
rand = "0.9.2"
1919
regex = "1.11.1"
20+
replace_with = "0.1.8"
2021
seekable_reader = "0.1.2"
2122
serde = { version = "1.0.219", features = ["derive"] }
2223
serde_json = "1.0.141"

src/logic/vm/buildings.rs

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{cell::RefCell, rc::Rc};
33
use strum_macros::IntoStaticStr;
44

55
use super::{
6-
LogicVM, VMLoadError, VMLoadResult,
6+
LogicVMBuilder, VMLoadError, VMLoadResult,
77
processor::{Processor, ProcessorBuilder, ProcessorState},
88
};
99
use crate::types::{
@@ -52,15 +52,15 @@ impl Building {
5252
name: &str,
5353
position: Point2,
5454
config: &Object,
55-
vm: &LogicVM,
55+
builder: &LogicVMBuilder,
5656
) -> VMLoadResult<Self> {
5757
let data = match name {
5858
MICRO_PROCESSOR | LOGIC_PROCESSOR | HYPER_PROCESSOR | WORLD_PROCESSOR => {
5959
return Self::from_processor_config(
6060
name,
6161
position,
6262
&ProcessorBuilder::parse_config(config)?,
63-
vm,
63+
builder,
6464
);
6565
}
6666

@@ -103,17 +103,15 @@ impl Building {
103103
name: &str,
104104
position: Point2,
105105
config: &ProcessorConfig,
106-
vm: &LogicVM,
106+
builder: &LogicVMBuilder,
107107
) -> VMLoadResult<Self> {
108108
let data = match name {
109109
MICRO_PROCESSOR => BuildingData::Processor(
110110
ProcessorBuilder {
111111
ipt: 2,
112-
range: 8. * 10.,
113112
privileged: false,
114-
running_processors: Rc::clone(&vm.running_processors),
115-
time: Rc::clone(&vm.time),
116-
globals: &vm.globals,
113+
running_processors: Rc::clone(&builder.vm.running_processors),
114+
time: Rc::clone(&builder.vm.time),
117115
position,
118116
config,
119117
}
@@ -122,11 +120,9 @@ impl Building {
122120
LOGIC_PROCESSOR => BuildingData::Processor(
123121
ProcessorBuilder {
124122
ipt: 8,
125-
range: 8. * 22.,
126123
privileged: false,
127-
running_processors: Rc::clone(&vm.running_processors),
128-
time: Rc::clone(&vm.time),
129-
globals: &vm.globals,
124+
running_processors: Rc::clone(&builder.vm.running_processors),
125+
time: Rc::clone(&builder.vm.time),
130126
position,
131127
config,
132128
}
@@ -135,11 +131,9 @@ impl Building {
135131
HYPER_PROCESSOR => BuildingData::Processor(
136132
ProcessorBuilder {
137133
ipt: 25,
138-
range: 8. * 42.,
139134
privileged: false,
140-
running_processors: Rc::clone(&vm.running_processors),
141-
time: Rc::clone(&vm.time),
142-
globals: &vm.globals,
135+
running_processors: Rc::clone(&builder.vm.running_processors),
136+
time: Rc::clone(&builder.vm.time),
143137
position,
144138
config,
145139
}
@@ -148,11 +142,9 @@ impl Building {
148142
WORLD_PROCESSOR => BuildingData::Processor(
149143
ProcessorBuilder {
150144
ipt: 8,
151-
range: f32::MAX,
152145
privileged: true,
153-
running_processors: Rc::clone(&vm.running_processors),
154-
time: Rc::clone(&vm.time),
155-
globals: &vm.globals,
146+
running_processors: Rc::clone(&builder.vm.running_processors),
147+
time: Rc::clone(&builder.vm.time),
156148
position,
157149
config,
158150
}
@@ -176,9 +168,9 @@ impl Building {
176168
config,
177169
..
178170
}: &SchematicTile,
179-
vm: &LogicVM,
171+
builder: &LogicVMBuilder,
180172
) -> VMLoadResult<Self> {
181-
Self::from_config(name, (*position).into(), config, vm)
173+
Self::from_config(name, (*position).into(), config, builder)
182174
}
183175
}
184176

0 commit comments

Comments
 (0)