Skip to content

Add lua api for the new music system#572

Open
Kolfering wants to merge 5 commits intomasterfrom
new-lua-api-music-system
Open

Add lua api for the new music system#572
Kolfering wants to merge 5 commits intomasterfrom
new-lua-api-music-system

Conversation

@Kolfering
Copy link
Copy Markdown
Member

This PR basically adds 2 subtables to the Music lua table, Sequence & Segment. It also adds a new MusicFadeType enumeration to provide different fading functions even if for now only 2 are available (or 3 if we count the seamless transition)

Here is a music plugin using the new multiple lua plugins feature to demonstrate a simple case with the new api in use and how it behaves in game. Which will probably be easier to review than the PR to see how it works.

In it, only one music channel is used with 4 sequences:

  • one sequence for the "normal track" composed of a single segment (default or triggered when the last time the player created a projectile was some time ago)
  • one sequence for the "fight track" composed of 2 segments (triggered when the player creates projectiles)
  • one sequence for the "hard fight track" of a single segment (triggered when the player creates projectiles and with hp < 75)
  • one sequence for the "dead track" composed of a single segment that doesn't loop (triggered when the player hp <= 0)

All segment transitions are seamless transitions except the ones that lead to the dead sequence which use crossfades transition.
SegmentedMusic.zip

I also updated the xslt because I wanted the "new" functions for the subtables to be placed first in the documentation and sorting by name as it does now, was preventing that.

@Kolfering Kolfering requested a review from treellama February 7, 2026 15:00
This reverts commit 058bc4f.
the html will be regenerated before the next A1 release
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