rename bag and trigger to silo and button

This commit is contained in:
Crispy 2024-12-12 22:56:01 +01:00
parent 6dcb6c9dd7
commit 611a02c3b4
3 changed files with 21 additions and 21 deletions

View file

@ -637,7 +637,7 @@ impl Editor {
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.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);
if simple_button(d, 600, 20, 35, 15) {

View file

@ -117,7 +117,7 @@ impl Machine {
continue;
}
}
Some(Tile::Trigger(true)) => (),
Some(Tile::Button(true)) => (),
_ => continue,
}
let Some(front_tile) = self.board.get_mut(front_pos) else {
@ -151,7 +151,7 @@ impl Machine {
new_marbles.push((front_pos, value, dir));
}
}
PTile::Bag => {
PTile::Silo => {
if front_tile == &Tile::BLANK {
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)) => (),
_ => unreachable!(),
};
@ -202,7 +202,7 @@ impl Machine {
// so they can figure out which directions they are powered from
for &p in &self.powered {
match self.board.get_mut(p) {
Some(Tile::Trigger(state)) => *state = false,
Some(Tile::Button(state)) => *state = false,
Some(Tile::Wire(_, state)) => *state = false,
_ => (),
}
@ -298,7 +298,7 @@ impl Machine {
let target_pos = match front_tile {
Tile::Arrow(d) => d.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,
};
let Some(target_tile) = self.board.get_mut(target_pos) else {
@ -357,7 +357,7 @@ impl Machine {
}
} else {
let target_pos;
let mut is_trigger = false;
let mut is_button = false;
let mut new_dir = dir;
match front_tile {
Tile::Arrow(d) => {
@ -368,11 +368,11 @@ impl Machine {
new_dir = m.new_dir(dir);
target_pos = new_dir.step(front_pos);
}
Tile::Trigger(_) => {
is_trigger = true;
Tile::Button(_) => {
is_button = true;
target_pos = dir.step(front_pos);
}
Tile::Powerable(PTile::Bag, _) => {
Tile::Powerable(PTile::Silo, _) => {
removed_marbles.push(i);
continue;
}
@ -388,7 +388,7 @@ impl Machine {
};
if let Tile::Open(space_type, Claim::ClaimedIndirect) = target_tile {
move_to(*space_type, target_pos, new_dir, &mut self.board);
if is_trigger {
if is_button {
self.powered.push(front_pos);
}
}
@ -415,7 +415,7 @@ impl Machine {
unreachable!()
};
match tile {
Tile::Trigger(state) => {
Tile::Button(state) => {
*state = true;
for dir in Direction::ALL {
let target_pos = dir.step(pos);
@ -471,7 +471,7 @@ impl Machine {
continue;
}
}
Some(Tile::Trigger(true)) => (),
Some(Tile::Button(true)) => (),
_ => continue,
}
let Some(front_tile) = self.board.get_mut(front_pos) else {

View file

@ -9,7 +9,7 @@ pub enum Tile {
Marble { value: MarbleValue, dir: Direction },
Mirror(MirrorType),
Arrow(Direction),
Trigger(bool),
Button(bool),
Wire(WireType, bool),
Powerable(PTile, bool),
}
@ -33,7 +33,7 @@ pub enum OpenTile {
pub enum PTile {
Gate(GateType),
Math(MathOp),
Bag,
Silo,
Flipper,
IO,
}
@ -84,7 +84,7 @@ impl Tile {
value: 0,
dir: Direction::Down,
},
'*' => Tile::Trigger(false),
'*' => Tile::Button(false),
'-' => Tile::Wire(WireType::Horizontal, false),
'|' => Tile::Wire(WireType::Vertical, false),
'+' => Tile::Wire(WireType::Cross, false),
@ -105,7 +105,7 @@ impl Tile {
'M' => Tile::Powerable(PTile::Math(MathOp::Mul), false),
'D' => Tile::Powerable(PTile::Math(MathOp::Div), 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),
'#' => Tile::Block,
_ => Tile::Open(OpenTile::Blank, Claim::Free),
@ -128,7 +128,7 @@ impl Tile {
Direction::Left => '<',
Direction::Right => '>',
},
Tile::Trigger(_) => '*',
Tile::Button(_) => '*',
Tile::Wire(wire, _) => match wire {
WireType::Vertical => '|',
WireType::Horizontal => '-',
@ -148,7 +148,7 @@ impl Tile {
MathOp::Div => 'D',
MathOp::Rem => 'R',
},
PTile::Bag => 'B',
PTile::Silo => 'B',
PTile::Flipper => 'F',
PTile::IO => 'I',
},
@ -175,7 +175,7 @@ impl Tile {
Tile::Open(OpenTile::Digit(n), _) => return format!("tile_digit_{n}"),
Tile::Mirror(mirror) => mirror.texture_name(),
Tile::Arrow(dir) => dir.arrow_tile_texture_name(),
Tile::Trigger(state) => {
Tile::Button(state) => {
if *state {
"trigger_on"
} else {
@ -193,7 +193,7 @@ impl Tile {
let root = match tile {
PTile::Gate(gate) => gate.texture_name(),
PTile::Math(math_op) => math_op.texture_name(),
PTile::Bag => "bag",
PTile::Silo => "bag",
PTile::Flipper => "flipper",
PTile::IO => "io_tile",
};