chore: add plan
This commit is contained in:
parent
36f1b8d68f
commit
9626182cb1
144
.plans/goo-plan.md
Normal file
144
.plans/goo-plan.md
Normal file
@ -0,0 +1,144 @@
|
||||
# Goo Program Plan
|
||||
|
||||
## Goal
|
||||
|
||||
Add a turtle program named `goo` for automating Just Dire Things goo block processing.
|
||||
|
||||
The turtle is placed directly below the goo block. It should run forever, adapt to its inventory, feed the goo when it is not alive, place supported process blocks around the goo, and mine the resulting crystal blocks.
|
||||
|
||||
## Command
|
||||
|
||||
- `goo start` starts the automation loop.
|
||||
- `goo help` / `goo --help` prints usage.
|
||||
- `goo version` / `goo --version` prints the version.
|
||||
|
||||
## Starting Position
|
||||
|
||||
The turtle must start directly below the goo block:
|
||||
|
||||
```text
|
||||
[goo]
|
||||
[turtle]
|
||||
[ground]
|
||||
```
|
||||
|
||||
The turtle cannot move down because of the ground. The block below the goo is the turtle's starting cell, so the bottom side must be handled last and from an adjacent position.
|
||||
|
||||
## Goo Detection
|
||||
|
||||
Use `turtle.inspectUp()` from the starting position.
|
||||
|
||||
Supported goo blocks:
|
||||
|
||||
- `justdirethings:gooblock_tier1`
|
||||
- `justdirethings:gooblock_tier2`
|
||||
- `justdirethings:gooblock_tier3`
|
||||
- `justdirethings:gooblock_tier4`
|
||||
|
||||
Parse the tier from the block name. Re-inspect regularly so the program adapts if the goo tier changes.
|
||||
|
||||
## Alive Handling
|
||||
|
||||
The goo is ready when:
|
||||
|
||||
```lua
|
||||
inspected.state and inspected.state.alive == true
|
||||
```
|
||||
|
||||
If `alive` is false or nil, the turtle should use the appropriate feeding item directly on the goo with `turtle.placeUp()`.
|
||||
|
||||
Feeding items are ordered arrays so preference is data-driven:
|
||||
|
||||
```lua
|
||||
local FEEDING_ITEMS_BY_TIER = {
|
||||
[1] = { 'minecraft:sugar', 'minecraft:rotten_flesh' },
|
||||
[2] = { 'minecraft:nether_wart' },
|
||||
[3] = { 'minecraft:chorus_fruit' },
|
||||
[4] = { 'minecraft:sculk' },
|
||||
};
|
||||
```
|
||||
|
||||
Tier 1 naturally prefers sugar because it appears first.
|
||||
|
||||
If no valid feeding item is present, log a useful message and wait forever for the player to add one.
|
||||
|
||||
## Process Blocks
|
||||
|
||||
Supported process blocks and required goo tiers:
|
||||
|
||||
```lua
|
||||
local PROCESS_ITEMS = {
|
||||
['minecraft:iron_block'] = { tier = 1, label = 'iron' },
|
||||
['minecraft:coal_block'] = { tier = 1, label = 'coal' },
|
||||
['mekanism:block_charcoal'] = { tier = 1, label = 'charcoal' },
|
||||
['minecraft:gold_block'] = { tier = 2, label = 'gold' },
|
||||
['minecraft:diamond_block'] = { tier = 3, label = 'diamond' },
|
||||
['minecraft:netherite_block'] = { tier = 4, label = 'netherite' },
|
||||
};
|
||||
```
|
||||
|
||||
Rules:
|
||||
|
||||
- A goo tier can process items whose required tier is less than or equal to the goo tier.
|
||||
- Lower-tier goo skips higher-tier items and logs the required tier.
|
||||
- Tier 4 goo can process every supported item.
|
||||
- Materials may be mixed; a full six-block batch of one material is not required.
|
||||
- The program should continue forever, even if no eligible process blocks are currently present.
|
||||
|
||||
## Six-Side Handling
|
||||
|
||||
The program should work all six sides of the goo:
|
||||
|
||||
- top
|
||||
- north
|
||||
- south
|
||||
- east
|
||||
- west
|
||||
- bottom
|
||||
|
||||
Horizontal sides:
|
||||
|
||||
- Move from center to adjacent floor position.
|
||||
- Use `inspectUp`, `digUp`, and `placeUp` to work the side target.
|
||||
- Return to center.
|
||||
|
||||
Top side:
|
||||
|
||||
- Move to an adjacent floor position.
|
||||
- Climb up twice when the side path allows it.
|
||||
- Face the top target.
|
||||
- Use `inspect`, `dig`, and `place`.
|
||||
- Return to center.
|
||||
|
||||
Bottom side:
|
||||
|
||||
- Ensure the goo is alive before leaving the center.
|
||||
- Move to an adjacent floor position and face the original center cell.
|
||||
- Work the original center cell with `inspect`, `dig`, and `place`.
|
||||
- If a process block was placed in the bottom position, wait outside until it is consumed or transformed.
|
||||
- Mine the resulting crystal block, then return under the goo when the center is clear.
|
||||
|
||||
## Crystal Mining Rule
|
||||
|
||||
After placement, the goo transforms process blocks into crystal blocks that should be mined with a pickaxe-equipped turtle.
|
||||
|
||||
No tag or exact crystal ID check is required. For any goo target position:
|
||||
|
||||
- Empty means available for placement.
|
||||
- Known process material means already placed and still processing; do not dig.
|
||||
- Goo block means protected; do not dig.
|
||||
- Any other block means processed result/crystal; use the appropriate `turtle.dig*` call.
|
||||
|
||||
## First-Iteration Assumptions
|
||||
|
||||
- The area around the turtle has clear walking space.
|
||||
- The program does not dig movement-path obstacles.
|
||||
- The turtle has a suitable pickaxe equipped for crystal mining.
|
||||
- Runtime validation must happen in CC:Tweaked/CraftOS-PC or in-game; local Lua execution is not available for this repo.
|
||||
|
||||
## Integration Notes
|
||||
|
||||
- Ship `programs/goo.lua` via `install.lua` `LIST_FILES`.
|
||||
- Document `goo` in `README.md`.
|
||||
- Add `turtle` to `.luacheckrc` globals.
|
||||
- Run `just check` after Lua edits.
|
||||
Loading…
Reference in New Issue
Block a user