Skip to content

AI and pathfinding nodes#1231

Open
Stranger1992 wants to merge 13 commits into
developfrom
AI-and-pathfinding-nodes
Open

AI and pathfinding nodes#1231
Stranger1992 wants to merge 13 commits into
developfrom
AI-and-pathfinding-nodes

Conversation

@Stranger1992
Copy link
Copy Markdown
Member

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:

  • Added nodes to set and check creature mood, target, friendliness, poison status, hurt-by-player status, jumping, monkey-swinging, and goal-reaching status, as well as to set intelligent creature locations. These nodes enable more granular and dynamic control over enemy and NPC behaviors in levels. (TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua)
  • Added a helper function to map mood enumeration indices to internal mood types for use in the new mood-related nodes. (TombLib/TombLib/Catalogs/TEN Node Catalogs/_System.lua)

Documentation and Catalog Updates:

  • Updated the Installer/Changes.txt to document the addition of nodes for checking and setting various aspects of creature AI.

@Stranger1992 Stranger1992 added this to the Version 2.0 milestone May 18, 2026
Copilot AI review requested due to automatic review settings May 18, 2026 08:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.lua helper 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.

Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua
Stranger1992 and others added 3 commits May 18, 2026 09:52
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>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

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)
-- !Section "Creature AI"
-- !Description "Checks if the creature is currently jumping. Only works for creatures that can jump."
-- !Conditional "True"
-- !Arguments "Newline, Moveables, [ baddy | enemy_jeep | mafia | raptor | scientist | skeleton | swat_ | von_croy ], Moveable to check jumping status for."
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua
-- !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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add enum here rather than magic number of 1. For all nodes.

Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Creature Mood.lua
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.

3 participants