Skip to content

Lara Traversal Check Node#1232

Open
Stranger1992 wants to merge 16 commits into
developfrom
lara-traversal-check-nodes
Open

Lara Traversal Check Node#1232
Stranger1992 wants to merge 16 commits into
developfrom
lara-traversal-check-nodes

Conversation

@Stranger1992
Copy link
Copy Markdown
Member

This pull request introduces a new traversal state detection system for Lara in the Lara Traversal.lua catalog, providing a structured way to check Lara's movement modes. It adds enumerations and state lists for various traversal types, as well as utility functions to test Lara's current state. Additionally, a minor whitespace cleanup was made in _System.lua.

Traversal State Detection System:

  • Added enumerations (LaraTraversalMode) and corresponding state lists for different traversal types (e.g., climb, crawl, swim, rope swing, etc.) to Lara Traversal.lua.
  • Implemented TestLaraTraversalMode and TestLaraTraversalState functions to allow checking if Lara is in a specific traversal state, based on her current animation state.
  • Registered a new node (TestLaraTraversalState) with documentation for use in the node system, enabling easy integration into gameplay logic.

Minor Cleanup:

  • Removed extraneous whitespace from the end of the SetInteractionHighlightType function in _System.lua.

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

This PR adds a new TEN node-catalog script (Lara Traversal.lua) to detect Lara traversal modes by mapping animation state IDs into categorized state lists, plus small whitespace cleanups in existing node-catalog files.

Changes:

  • Added traversal-mode state lists and traversal test helpers, plus a new conditional node TestLaraTraversalState in Lara Traversal.lua.
  • Minor whitespace-only adjustments in Lara.lua and _System.lua.

Reviewed changes

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

File Description
TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara.lua Whitespace-only change at EOF.
TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Adds traversal state detection tables, helper test function, and a new traversal-state conditional node.
TombLib/TombLib/Catalogs/TEN Node Catalogs/_System.lua Whitespace-only cleanup at EOF.
Comments suppressed due to low confidence (1)

TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua:87

  • Typo in comment: "swim intertia" should be "swim inertia".
	13, -- swimming idle
	17, -- swim forward
	18, -- swim intertia
	35, -- dive

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Stranger1992 and others added 4 commits May 21, 2026 00:20
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 2 out of 3 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua:160

  • The LaraTraversalMode table and the SWIM traversal test contain inconsistent indentation (spaces vs tabs) and trailing whitespace (e.g., after TIGHTROPE = 7,). Please normalize formatting to match surrounding catalog files and avoid introducing new trailing whitespace.
local LaraTraversalMode = 
{
	CLIMB = 0,
	CRAWL = 1,
	HORIZONTAL_BAR = 2,
	MONKEY_SWING = 3,
	POLE_VAULT = 4,
    ROPE_SWING = 5,
	SWIM = 6,
	TIGHTROPE = 7,	
}

local traversalModeTests = 
{
	[LaraTraversalMode.CLIMB] = function(state)
		return IsStateInList(state, ladderStates)
	end,

	[LaraTraversalMode.CRAWL] = function(state)
		return IsStateInList(state, crawlingStates)
	end,

	[LaraTraversalMode.HORIZONTAL_BAR] = function(state)
		return IsStateInList(state, horizontalBarStates)
	end,

	[LaraTraversalMode.MONKEY_SWING] = function(state)
		return IsStateInList(state, monkeySwingStates)
	end,

	[LaraTraversalMode.POLE_VAULT] = function(state)
		return IsStateInList(state, poleVaultStates)
	end,

	[LaraTraversalMode.ROPE_SWING] = function(state)
		return IsStateInList(state, ropeSwingStates)
	end,
	
	[LaraTraversalMode.SWIM] = function(state)
        return IsStateInList(state, swimStates)
    end,

Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
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 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua:127

  • LaraTraversalMode has inconsistent indentation and includes trailing whitespace (e.g., ROPE_SWING is indented differently and TIGHTROPE = 7, has extra whitespace at line end). Please normalize indentation and strip trailing whitespace so the enum table is clean and consistent.
	HORIZONTAL_BAR = 2,
	MONKEY_SWING = 3,
	POLE_VAULT = 4,
    ROPE_SWING = 5,
	SWIM = 6,
	TIGHTROPE = 7,	
}

Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
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 4 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Collaborator

@TrainWrack TrainWrack left a comment

Choose a reason for hiding this comment

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

Comments added

Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Lara Traversal.lua Outdated
@Stranger1992 Stranger1992 requested a review from TrainWrack May 21, 2026 00:27
@davidmarr
Copy link
Copy Markdown
Collaborator

davidmarr commented May 30, 2026

The node works correctly. But the code can be drastically optimized while leaving the behavior unchanged. I suggest reviewing the code.
This is a suggested modified optimized version. It can be tested alongside the current version to verify that the behavior is identical.

local TRAVERSAL_STATES = {
	[0] = { -- CLIMB
		[10]=true,  -- hang state
		[19]=true,  -- grabbing (pulling up)
		[55]=true,  -- climbing up
		[56]=true,  -- idle on ladder
		[57]=true,  -- ladder up
		[58]=true,  -- ladder left
		[59]=true,  -- ladder down
		[60]=true,  -- ladder right
		[61]=true,  -- climbing down
		[88]=true,  -- climb off ladder
		[107]=true, -- shimmy outer left
		[108]=true, -- shimmy outer right
		[109]=true, -- shimmy inner left
		[110]=true, -- shimmy inner right
		[138]=true  -- ladder to crouch
	},
	[1] = { -- CRAWL
		[71]=true,  -- crouch idle
		[72]=true,  -- crouch roll
		[80]=true,  -- crawling idle
		[81]=true,  -- crawl forward
		[84]=true,  -- crawling turn left
		[85]=true,  -- crawling turn right
		[86]=true,  -- crawling backwards
		[105]=true, -- crouch turn left
		[106]=true, -- crouch turn right
		[160]=true, -- crawl step up
		[161]=true, -- crawl step down
		[167]=true, -- 1 step crouch vault
		[168]=true, -- 2 step crouch vault
		[169]=true, -- 3 step crouch vault
		[171]=true, -- crouch turn 180
		[172]=true  -- crawl turn 180
	},
	[2] = { -- HORIZONTAL_BAR
		[128]=true, -- horizontal bar swing
		[129]=true  -- horizontal bar leap
	},
	[3] = { -- MONKEY_SWING
		[75]=true,  -- monkey swing idle
		[76]=true,  -- monkey swing forward
		[77]=true,  -- monkey swing shimmy left
		[78]=true,  -- monkey swing shimmy right
		[79]=true,  -- monkey swing turn 180
		[82]=true,  -- monkey turn left
		[83]=true   -- monkey turn right
	},
	[4] = { -- POLE_VAULT
		[99]=true,  -- pole idle
		[100]=true, -- pole up
		[101]=true, -- pole down
		[102]=true, -- pole turn clockwise
		[103]=true  -- pole turn counterclockwise
	},
	[5] = { -- ROPE_SWING
		[90]=true,  -- rope turn clockwise
		[91]=true,  -- rope turn counterclockwise
		[111]=true, -- rope idle
		[112]=true, -- rope up
		[113]=true, -- rope down
		[114]=true, -- rope swing
		[115]=true  -- rope unknown
	},
	[6] = { -- SWIM
		[13]=true,  -- swimming idle
		[17]=true,  -- swim forward
		[18]=true,  -- swim inertia
		[35]=true,  -- dive
		[40]=true,  -- use switch
		[42]=true,  -- use key
		[43]=true,  -- use puzzle
		[44]=true,  -- underwater death
		[66]=true,  -- underwater roll
		[67]=true,  -- pickup flare
		[89]=true,  -- misc control (opening door, trapdoor, kick)
		[93]=true,  -- trapdoor floor open
		[104]=true, -- using pulley
		[189]=true, -- remove puzzle
		[198]=true  -- ungrab pulley
	},
	[7] = { -- TIGHTROPE
		[119]=true, -- Tightrope idle
		[120]=true, -- Tightrope turn 180
		[121]=true, -- Tightrope walk
		[122]=true, -- Tightrope unbalance left
		[123]=true, -- Tightrope unbalance right
		[124]=true, -- Tightrope enter
		[125]=true  -- Tightrope dismount
	}
}

-- !Name "If Lara traversal state is...(mod)"
-- !Section "Lara state"
-- !Conditional "True"
-- !Description "Checks Lara's current traversal state."
-- !Arguments "Enumeration, [ Climb | Crawl | Horizontal Bar | Monkey Swing | Pole Vault | Rope Swing | Swim | Tightrope ], 30, Traversal state to test."

LevelFuncs.Engine.Node.TestLaraTraversalState_mod = function(mode)
	return TRAVERSAL_STATES[mode][TEN.Objects.Lara:GetState()] or false
end

Lara Traversal-mod.zip

image

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.

4 participants