Shove toward the station at the start of each batch craft.
Co-authored-by: Cursor <cursoragent@cursor.com>
@@ -534,12 +534,25 @@ export function stepCrafting (world, now)
534
534
finishesAt: now + durationMs
535
535
});
536
536
continuing = true;
537
if (blockType)
538
{
539
const shove = tileShoveTowardBlock(world, handle, entityId, blockType);
540
if (shove)
541
{ events.push(shove); }
542
}
537
543
events.push({
538
544
type: "item-bubble",
539
545
entityId,
540
546
itemId: outSpec.itemId,
541
547
quantity: outQty
542
548
});
549
events.push({
550
type: "craft-started",
551
sessionId: session.sessionId,
552
characterId,
553
recipeId: session.recipeId,
554
durationMs
555
});
543
556
}
544
557
events.push({
545
558
type: "craft-result",
@@ -534,12 +534,25 @@ export function stepCrafting (world, now)534
finishesAt: now + durationMs534
finishesAt: now + durationMs535
});535
});536
continuing = true;536
continuing = true;537
if (blockType)538
{539
const shove = tileShoveTowardBlock(world, handle, entityId, blockType);540
if (shove)541
{ events.push(shove); }542
}537
events.push({543
events.push({538
type: "item-bubble",544
type: "item-bubble",539
entityId,545
entityId,540
itemId: outSpec.itemId,546
itemId: outSpec.itemId,541
quantity: outQty547
quantity: outQty542
});548
});549
events.push({550
type: "craft-started",551
sessionId: session.sessionId,552
characterId,553
recipeId: session.recipeId,554
durationMs555
});543
}556
}544
events.push({557
events.push({545
type: "craft-result",558
type: "craft-result",@@ -547,7 +547,19 @@ test("anvil accepts Craft x batchCount like the crafting bench", () =>
547
547
batchCount: 3
548
548
});
549
549
const one = craftDurationMs(recipeDefinition("pickaxe-head-bronze"), CRAFT_DURATION_MS);
550
advanceMs(harness, one * 3 + 200);
550
const shoveEvents = [];
551
const start = harness.simulation.step();
552
shoveEvents.push(...start.events.filter((event) => event.type === "tile-shove"));
553
assert.equal(shoveEvents.length, 1, "first craft should shove toward the station");
554
555
const ticks = Math.ceil((one * 3 + 200) / 50) + 3;
556
for (let i = 0; i < ticks; i++)
557
{
558
harness.advance(50);
559
const step = harness.simulation.step();
560
shoveEvents.push(...step.events.filter((event) => event.type === "tile-shove"));
561
}
562
assert.equal(shoveEvents.length, 3, "each batch craft start should shove toward the station");
551
563
const bag = harness.simulation.bagOf(playerId);
552
564
assert.equal(countItem(bag.inventory, ItemId.bronzePickaxeHead), 3);
553
565
assert.equal(countItem(bag.inventory, ItemId.bronzeBar), 0);
@@ -547,7 +547,19 @@ test("anvil accepts Craft x batchCount like the crafting bench", () =>547
batchCount: 3547
batchCount: 3548
});548
});549
const one = craftDurationMs(recipeDefinition("pickaxe-head-bronze"), CRAFT_DURATION_MS);549
const one = craftDurationMs(recipeDefinition("pickaxe-head-bronze"), CRAFT_DURATION_MS);550
advanceMs(harness, one * 3 + 200);550
const shoveEvents = [];551
const start = harness.simulation.step();552
shoveEvents.push(...start.events.filter((event) => event.type === "tile-shove"));553
assert.equal(shoveEvents.length, 1, "first craft should shove toward the station");554
555
const ticks = Math.ceil((one * 3 + 200) / 50) + 3;556
for (let i = 0; i < ticks; i++)557
{558
harness.advance(50);559
const step = harness.simulation.step();560
shoveEvents.push(...step.events.filter((event) => event.type === "tile-shove"));561
}562
assert.equal(shoveEvents.length, 3, "each batch craft start should shove toward the station");551
const bag = harness.simulation.bagOf(playerId);563
const bag = harness.simulation.bagOf(playerId);552
assert.equal(countItem(bag.inventory, ItemId.bronzePickaxeHead), 3);564
assert.equal(countItem(bag.inventory, ItemId.bronzePickaxeHead), 3);553
assert.equal(countItem(bag.inventory, ItemId.bronzeBar), 0);565
assert.equal(countItem(bag.inventory, ItemId.bronzeBar), 0);