Skip to content

feat: homunculus walks ahead of owner#14

Open
tidre wants to merge 2 commits intomaxmx03:mainfrom
tidre:feat/follow-ahead
Open

feat: homunculus walks ahead of owner#14
tidre wants to merge 2 commits intomaxmx03:mainfrom
tidre:feat/follow-ahead

Conversation

@tidre
Copy link
Copy Markdown
Contributor

@tidre tidre commented Apr 15, 2026

Summary

  • The homunculus now moves ahead of the biochemist instead of trailing behind
  • Movement direction is computed from the owner's position delta between frames (`ownerLastX/Y`)
  • Target point is projected `followDistance` cells ahead in the same direction
  • Falls back to `MoveToOwner` on teleport (jump > 15 cells) or when no direction is available
  • Behavior is configurable via `followAhead` flag in `config.lua`

Usage

-- config.lua
followAhead = true, -- homunculus walks ahead of owner
followAhead = false, -- default behavior (trails behind/beside)

Changed files

File Change
`BT/init.lua` Added `ownerLastX/Y` to blackboard, updated after `tree()` each frame
`BT/nodes/homun.lua` New `followAhead` node using direction vector from position delta
`BT/nodes/owner.lua` New `isOwnerMoving` condition (no minimum distance requirement)
`UTIL/Homun.lua` Conditionally uses `followAhead` or `follow` based on config
`config.lua` New `followAhead = true` flag

Test plan

  • Verify homunculus positions itself ahead when walking in a straight line
  • Verify it correctly adjusts direction when the owner turns
  • Verify correct fallback behavior on teleport
  • Verify `followAhead = false` restores the original trailing behavior
  • Verify combat behavior is not affected

tidre added 2 commits April 15, 2026 08:28
- commands: use OR logic in executePatrol and executeSkillGround so movement triggers when either X or Y coordinate differs

- enemy: check alive status of iterated enemy (not bb.myEnemy) in hasEnemyGroup to avoid dead enemies entering AoE group calculation

- service: check alive status of iterated enemy (not bb.myEnemy) in checkIsAttackingOwner so owner-threat detection scans correctly
Track owner's position delta each frame to compute movement direction,
then project a target point followDistance cells ahead and call Move().
Falls back to MoveToOwner on teleport (delta > 15 cells) or when no
direction is available. Behavior is toggled via followAhead in config.lua.

- blackboard: add ownerLastX/ownerLastY, updated after tree() each frame
- homun: add followAhead node using direction vector from position delta
- owner: add isOwnerMoving condition (no minimum distance requirement)
- Homun: conditionally use followAhead or follow based on userConfig
- config: add followAhead flag (default true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant