rename bag and trigger to silo and button
This commit is contained in:
parent
6dcb6c9dd7
commit
611a02c3b4
3 changed files with 21 additions and 21 deletions
|
@ -637,7 +637,7 @@ impl Editor {
|
||||||
draw_usize(d, textures, self.machine.step_count(), 420, 4, 9, 2);
|
draw_usize(d, textures, self.machine.step_count(), 420, 4, 9, 2);
|
||||||
|
|
||||||
draw_usize(d, textures, self.step_time as usize, 540, 42, 9, 1);
|
draw_usize(d, textures, self.step_time as usize, 540, 42, 9, 1);
|
||||||
draw_usize(d, textures, self.max_step_time as usize, 540, 58, 9, 1);
|
draw_usize(d, textures, self.max_step_time as usize, 540, 60, 9, 1);
|
||||||
|
|
||||||
d.draw_text("input:", 603, 8, 10, Color::WHITE);
|
d.draw_text("input:", 603, 8, 10, Color::WHITE);
|
||||||
if simple_button(d, 600, 20, 35, 15) {
|
if simple_button(d, 600, 20, 35, 15) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ impl Machine {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(Tile::Trigger(true)) => (),
|
Some(Tile::Button(true)) => (),
|
||||||
_ => continue,
|
_ => continue,
|
||||||
}
|
}
|
||||||
let Some(front_tile) = self.board.get_mut(front_pos) else {
|
let Some(front_tile) = self.board.get_mut(front_pos) else {
|
||||||
|
@ -151,7 +151,7 @@ impl Machine {
|
||||||
new_marbles.push((front_pos, value, dir));
|
new_marbles.push((front_pos, value, dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PTile::Bag => {
|
PTile::Silo => {
|
||||||
if front_tile == &Tile::BLANK {
|
if front_tile == &Tile::BLANK {
|
||||||
new_marbles.push((front_pos, 0, dir));
|
new_marbles.push((front_pos, 0, dir));
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ impl Machine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(Tile::Trigger(_state)) => (),
|
Some(Tile::Button(_state)) => (),
|
||||||
Some(Tile::Wire(_, _state)) => (),
|
Some(Tile::Wire(_, _state)) => (),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
@ -202,7 +202,7 @@ impl Machine {
|
||||||
// so they can figure out which directions they are powered from
|
// so they can figure out which directions they are powered from
|
||||||
for &p in &self.powered {
|
for &p in &self.powered {
|
||||||
match self.board.get_mut(p) {
|
match self.board.get_mut(p) {
|
||||||
Some(Tile::Trigger(state)) => *state = false,
|
Some(Tile::Button(state)) => *state = false,
|
||||||
Some(Tile::Wire(_, state)) => *state = false,
|
Some(Tile::Wire(_, state)) => *state = false,
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ impl Machine {
|
||||||
let target_pos = match front_tile {
|
let target_pos = match front_tile {
|
||||||
Tile::Arrow(d) => d.step(front_pos),
|
Tile::Arrow(d) => d.step(front_pos),
|
||||||
Tile::Mirror(m) => m.new_dir(dir).step(front_pos),
|
Tile::Mirror(m) => m.new_dir(dir).step(front_pos),
|
||||||
Tile::Trigger(_) => dir.step(front_pos),
|
Tile::Button(_) => dir.step(front_pos),
|
||||||
_ => continue,
|
_ => continue,
|
||||||
};
|
};
|
||||||
let Some(target_tile) = self.board.get_mut(target_pos) else {
|
let Some(target_tile) = self.board.get_mut(target_pos) else {
|
||||||
|
@ -357,7 +357,7 @@ impl Machine {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let target_pos;
|
let target_pos;
|
||||||
let mut is_trigger = false;
|
let mut is_button = false;
|
||||||
let mut new_dir = dir;
|
let mut new_dir = dir;
|
||||||
match front_tile {
|
match front_tile {
|
||||||
Tile::Arrow(d) => {
|
Tile::Arrow(d) => {
|
||||||
|
@ -368,11 +368,11 @@ impl Machine {
|
||||||
new_dir = m.new_dir(dir);
|
new_dir = m.new_dir(dir);
|
||||||
target_pos = new_dir.step(front_pos);
|
target_pos = new_dir.step(front_pos);
|
||||||
}
|
}
|
||||||
Tile::Trigger(_) => {
|
Tile::Button(_) => {
|
||||||
is_trigger = true;
|
is_button = true;
|
||||||
target_pos = dir.step(front_pos);
|
target_pos = dir.step(front_pos);
|
||||||
}
|
}
|
||||||
Tile::Powerable(PTile::Bag, _) => {
|
Tile::Powerable(PTile::Silo, _) => {
|
||||||
removed_marbles.push(i);
|
removed_marbles.push(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ impl Machine {
|
||||||
};
|
};
|
||||||
if let Tile::Open(space_type, Claim::ClaimedIndirect) = target_tile {
|
if let Tile::Open(space_type, Claim::ClaimedIndirect) = target_tile {
|
||||||
move_to(*space_type, target_pos, new_dir, &mut self.board);
|
move_to(*space_type, target_pos, new_dir, &mut self.board);
|
||||||
if is_trigger {
|
if is_button {
|
||||||
self.powered.push(front_pos);
|
self.powered.push(front_pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,7 +415,7 @@ impl Machine {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
};
|
};
|
||||||
match tile {
|
match tile {
|
||||||
Tile::Trigger(state) => {
|
Tile::Button(state) => {
|
||||||
*state = true;
|
*state = true;
|
||||||
for dir in Direction::ALL {
|
for dir in Direction::ALL {
|
||||||
let target_pos = dir.step(pos);
|
let target_pos = dir.step(pos);
|
||||||
|
@ -471,7 +471,7 @@ impl Machine {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(Tile::Trigger(true)) => (),
|
Some(Tile::Button(true)) => (),
|
||||||
_ => continue,
|
_ => continue,
|
||||||
}
|
}
|
||||||
let Some(front_tile) = self.board.get_mut(front_pos) else {
|
let Some(front_tile) = self.board.get_mut(front_pos) else {
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub enum Tile {
|
||||||
Marble { value: MarbleValue, dir: Direction },
|
Marble { value: MarbleValue, dir: Direction },
|
||||||
Mirror(MirrorType),
|
Mirror(MirrorType),
|
||||||
Arrow(Direction),
|
Arrow(Direction),
|
||||||
Trigger(bool),
|
Button(bool),
|
||||||
Wire(WireType, bool),
|
Wire(WireType, bool),
|
||||||
Powerable(PTile, bool),
|
Powerable(PTile, bool),
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ pub enum OpenTile {
|
||||||
pub enum PTile {
|
pub enum PTile {
|
||||||
Gate(GateType),
|
Gate(GateType),
|
||||||
Math(MathOp),
|
Math(MathOp),
|
||||||
Bag,
|
Silo,
|
||||||
Flipper,
|
Flipper,
|
||||||
IO,
|
IO,
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ impl Tile {
|
||||||
value: 0,
|
value: 0,
|
||||||
dir: Direction::Down,
|
dir: Direction::Down,
|
||||||
},
|
},
|
||||||
'*' => Tile::Trigger(false),
|
'*' => Tile::Button(false),
|
||||||
'-' => Tile::Wire(WireType::Horizontal, false),
|
'-' => Tile::Wire(WireType::Horizontal, false),
|
||||||
'|' => Tile::Wire(WireType::Vertical, false),
|
'|' => Tile::Wire(WireType::Vertical, false),
|
||||||
'+' => Tile::Wire(WireType::Cross, false),
|
'+' => Tile::Wire(WireType::Cross, false),
|
||||||
|
@ -105,7 +105,7 @@ impl Tile {
|
||||||
'M' => Tile::Powerable(PTile::Math(MathOp::Mul), false),
|
'M' => Tile::Powerable(PTile::Math(MathOp::Mul), false),
|
||||||
'D' => Tile::Powerable(PTile::Math(MathOp::Div), false),
|
'D' => Tile::Powerable(PTile::Math(MathOp::Div), false),
|
||||||
'R' => Tile::Powerable(PTile::Math(MathOp::Rem), false),
|
'R' => Tile::Powerable(PTile::Math(MathOp::Rem), false),
|
||||||
'B' => Tile::Powerable(PTile::Bag, false),
|
'B' => Tile::Powerable(PTile::Silo, false),
|
||||||
d @ '0'..='9' => Tile::Open(OpenTile::Digit(d as u8 - b'0'), Claim::Free),
|
d @ '0'..='9' => Tile::Open(OpenTile::Digit(d as u8 - b'0'), Claim::Free),
|
||||||
'#' => Tile::Block,
|
'#' => Tile::Block,
|
||||||
_ => Tile::Open(OpenTile::Blank, Claim::Free),
|
_ => Tile::Open(OpenTile::Blank, Claim::Free),
|
||||||
|
@ -128,7 +128,7 @@ impl Tile {
|
||||||
Direction::Left => '<',
|
Direction::Left => '<',
|
||||||
Direction::Right => '>',
|
Direction::Right => '>',
|
||||||
},
|
},
|
||||||
Tile::Trigger(_) => '*',
|
Tile::Button(_) => '*',
|
||||||
Tile::Wire(wire, _) => match wire {
|
Tile::Wire(wire, _) => match wire {
|
||||||
WireType::Vertical => '|',
|
WireType::Vertical => '|',
|
||||||
WireType::Horizontal => '-',
|
WireType::Horizontal => '-',
|
||||||
|
@ -148,7 +148,7 @@ impl Tile {
|
||||||
MathOp::Div => 'D',
|
MathOp::Div => 'D',
|
||||||
MathOp::Rem => 'R',
|
MathOp::Rem => 'R',
|
||||||
},
|
},
|
||||||
PTile::Bag => 'B',
|
PTile::Silo => 'B',
|
||||||
PTile::Flipper => 'F',
|
PTile::Flipper => 'F',
|
||||||
PTile::IO => 'I',
|
PTile::IO => 'I',
|
||||||
},
|
},
|
||||||
|
@ -175,7 +175,7 @@ impl Tile {
|
||||||
Tile::Open(OpenTile::Digit(n), _) => return format!("tile_digit_{n}"),
|
Tile::Open(OpenTile::Digit(n), _) => return format!("tile_digit_{n}"),
|
||||||
Tile::Mirror(mirror) => mirror.texture_name(),
|
Tile::Mirror(mirror) => mirror.texture_name(),
|
||||||
Tile::Arrow(dir) => dir.arrow_tile_texture_name(),
|
Tile::Arrow(dir) => dir.arrow_tile_texture_name(),
|
||||||
Tile::Trigger(state) => {
|
Tile::Button(state) => {
|
||||||
if *state {
|
if *state {
|
||||||
"trigger_on"
|
"trigger_on"
|
||||||
} else {
|
} else {
|
||||||
|
@ -193,7 +193,7 @@ impl Tile {
|
||||||
let root = match tile {
|
let root = match tile {
|
||||||
PTile::Gate(gate) => gate.texture_name(),
|
PTile::Gate(gate) => gate.texture_name(),
|
||||||
PTile::Math(math_op) => math_op.texture_name(),
|
PTile::Math(math_op) => math_op.texture_name(),
|
||||||
PTile::Bag => "bag",
|
PTile::Silo => "bag",
|
||||||
PTile::Flipper => "flipper",
|
PTile::Flipper => "flipper",
|
||||||
PTile::IO => "io_tile",
|
PTile::IO => "io_tile",
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue