wip 3 hvcrate

This commit is contained in:
2026-08-11 01:13:04 -05:00
parent 38c58a2c5f
commit 1872db340c
4 changed files with 29 additions and 9 deletions
+4 -6
View File
@@ -640,8 +640,7 @@ pub(crate) mod tests {
/// (or must share a cell) has to live off-grid in [`Board::sensors`].
pub(crate) fn sensor_at(board: &mut Board, x: usize, y: usize, script: &str) -> ObjectId {
let sensor = SensorSpec {
x,
y,
location: (x, y).into(),
script: Some(script.to_string()),
glyph: Glyph::transparent(),
optics: Optics::default(),
@@ -662,8 +661,7 @@ pub(crate) mod tests {
pub(crate) fn lamp_at(board: &mut Board, x: usize, y: usize) {
let lamp = Sensor {
x,
y,
location: (x, y).into(),
draw_layer: DrawLayer::Above,
scripting: ScriptAttributes {
id: board.next_object_id,
@@ -798,7 +796,7 @@ pub(crate) mod tests {
// apply_shift validates all cells upfront; any out-of-bounds cell causes immediate failure.
let mut board = open_board(3, 1, (2, 0));
crate_at(&mut board, 0, 0);
let errs = board.apply_shift(&[(0, 0), (9, 0)]);
let errs = board.apply_shift(&[(0, 0).into(), (9, 0).into()]);
assert!(errs.is_err());
assert!(is_builtin(&board, 0, 0, "crate")); // unchanged
}
@@ -822,7 +820,7 @@ pub(crate) mod tests {
// blocked = {2}; Crate at (0,0) is NOT blocked
// Result: Crate(0,0)→(1,0), empty→no-op, Wall stays at (2,0),
// Crate(3,0)→(4,0), Crate(4,0)→(0,0) wrap
let _errs = board.apply_shift(&[(0, 0), (1, 0), (2, 0), (3, 0), (4, 0)]);
let _errs = board.apply_shift(&[(0, 0), (1, 0), (2, 0), (3, 0), (4, 0)].map(Into::into));
assert!(is_builtin(&board, 0, 0, "crate")); // wrapped from (4,0)
assert!(is_builtin(&board, 1, 0, "crate")); // moved from (0,0)