AI and pathfinding nodes#1231
Open
Stranger1992 wants to merge 17 commits into
Open
Conversation
And guarding against moveables not being active.
Accidently deleted on branch.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds TEN node catalog support for creature AI/pathfinding controls and queries, expanding scripting options for level designers.
Changes:
- Adds new Creature AI nodes for mood, target, friendliness, poison, hurt-by-player, jumping, monkey-swinging, goal, and AI location state.
- Adds a
_System.luahelper to map mood enumeration indices to TEN mood constants. - Updates installer changelog with the new creature AI node category.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua |
Adds new Creature AI node definitions and Lua implementations. |
TombLib/TombLib/Catalogs/TEN Node Catalogs/_System.lua |
Adds helper mapping UI mood enum values to TEN mood constants. |
Installer/Changes.txt |
Documents the new creature AI nodes. |
Comments suppressed due to low confidence (2)
TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua:286
- This log message says "location status" even though the node is setting the creature's goal-reached status. That makes failures from this node harder to diagnose in scripts that also use the location node.
if mov:GetStatus() ~= 1 then
TEN.Util.PrintLog("moveable [ " .. moveable .. " ] is not active. Cannot set location status.",TEN.Util.LogLevel.ERROR)
TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua:97
- This inactive-object error says "No target set" even though this node is checking the current target. The message should match the check operation so users can distinguish it from failures in the set-target node.
if mov:GetStatus() ~= 1 then
TEN.Util.PrintLog("moveable [ " .. moveable .. " ] is not active. No target set.",TEN.Util.LogLevel.ERROR)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| local mov = TEN.Objects.GetMoveableByName(moveable) | ||
|
|
||
| if mov:GetStatus() ~= 1 then | ||
| TEN.Util.PrintLog("moveable [ " .. moveable .. " ] is not active. No mood set.",TEN.Util.LogLevel.ERROR) |
| local mov = TEN.Objects.GetMoveableByName(moveable) | ||
|
|
||
| if mov:GetStatus() ~= 1 then | ||
| TEN.Util.PrintLog("moveable [ " .. moveable .. " ] is not active. No target set.",TEN.Util.LogLevel.ERROR) |
Comment on lines
+81
to
+82
| local targetMovAI = Objects.Creature(targetMov) | ||
| targetMovAI:SetTarget(mov) |
TrainWrack
requested changes
May 21, 2026
| -- !Arguments "Boolean, 20, {false}, Debug to console." | ||
| LevelFuncs.Engine.Node.SetCreatureLocation = function(objectId, location, debug) | ||
| local moveables = TEN.Objects.GetMoveableByName(objectId) | ||
| if moveables:GetStatus() ~= 1 then |
Collaborator
There was a problem hiding this comment.
Add enum here rather than magic number of 1. For all nodes.
The mood condition node logged "No mood set." (copied from the set node); use "Cannot check mood." to match the other check nodes. Also correct the goal nodes, which said "location status" instead of "goal status".
The target argument is an unrestricted Moveables pick and Retaliate defaults to true, so an active non-creature target would be wrapped via Objects.Creature and crash at runtime. Guard that wrap with pcall, skipping retaliation and logging when the target is not a creature.
Replace the GetStatus() ~= 1 / == 1 active-status checks across all creature AI nodes with TEN.Objects.MoveableStatus.ACTIVE for readability.
MontyTRC89
approved these changes
Jun 18, 2026
| -- !Arguments "Boolean, 20, {false}, Debug to console." | ||
| LevelFuncs.Engine.Node.SetCreatureLocation = function(objectId, location, debug) | ||
| local moveables = TEN.Objects.GetMoveableByName(objectId) | ||
| if moveables:GetStatus() ~= 1 then |
| local mov = TEN.Objects.GetMoveableByName(moveable) | ||
|
|
||
| if mov:GetStatus() ~= 1 then | ||
| TEN.Util.PrintLog("moveable [ " .. moveable .. " ] is not active. No mood set.",TEN.Util.LogLevel.ERROR) |
| local mov = TEN.Objects.GetMoveableByName(moveable) | ||
|
|
||
| if mov:GetStatus() ~= 1 then | ||
| TEN.Util.PrintLog("moveable [ " .. moveable .. " ] is not active. No target set.",TEN.Util.LogLevel.ERROR) |
Collaborator
|
Suggestion: merge new nodes into Creatures.lua, do not create separate file Creature Mood.lua |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a comprehensive set of new nodes for controlling and querying various aspects of creature AI in the TombEngine Node system. These additions allow level designers to set and check creature moods, targets, friendliness, poison status, "hurt by player" status, jumping/monkey-swinging state, and goal-reaching status, as well as to set intelligent creature locations. The changes significantly expand the scripting capabilities for creature behavior in custom levels.
New Creature AI Node Functionality:
TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua)TombLib/TombLib/Catalogs/TEN Node Catalogs/_System.lua)Documentation and Catalog Updates:
Installer/Changes.txtto document the addition of nodes for checking and setting various aspects of creature AI.