Skip to content

Support pure-Godot custom energy counters in BaseLib without requiring vanilla game scripts#62

Open
MLT5419 wants to merge 2 commits intoAlchyr:developfrom
MLT5419:develop
Open

Support pure-Godot custom energy counters in BaseLib without requiring vanilla game scripts#62
MLT5419 wants to merge 2 commits intoAlchyr:developfrom
MLT5419:develop

Conversation

@MLT5419
Copy link
Contributor

@MLT5419 MLT5419 commented Mar 23, 2026

This PR adds a new runtime conversion path for custom character energy counters in BaseLib.

Before this change, custom energy counters still effectively depended on NEnergyCounter-style scenes, or on BaseLib patching the vanilla Ironclad counter and swapping a few textures. That approach was limited, brittle across game updates, and not practical for standalone mod projects because Godot scenes in those projects cannot directly reference scripts from the game's assembly.

This PR changes the workflow so mod authors can provide a pure Godot scene and let BaseLib convert it into a working NEnergyCounter instance at runtime.

Key points:

  • Adds CustomCharacterModel.CustomEnergyCounterScenePath as the preferred API for custom energy counters.
  • Introduces a runtime factory that converts a pure Godot scene into a valid NEnergyCounter.
  • The custom scene only needs built-in Godot nodes such as Control, Label, TextureRect, Node2D, and GpuParticles2D.
  • Preserves vanilla NEnergyCounter behavior for energy text updates, zero-energy dimming, gain-energy VFX restarts, rotation layers, and combat UI animations.
  • Keeps the old CustomEnergyCounter API as a legacy compatibility path.
  • Adds optional StarAnchor support so custom counters can define where the star counter should be attached.
  • Updates CharacterModel.EnergyCounterPath patching so custom energy counter assets can still participate in normal asset loading.

In practice, this means BaseLib now handles the script boundary for energy counters in the same spirit that it already handles other custom content hooks: mod authors define data/scenes with normal Godot nodes, and BaseLib adapts them to the runtime structures expected by the game.

My current personal test conclusion is that it can be used normally.

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