send customparams to unit scripts on unit creation#7961
Open
efrec wants to merge 19 commits into
Open
Conversation
added 2 commits
June 15, 2026 12:08
These have years-old notes to remove them, and here we are today. I'll at least maintain what is not broken. There are also duplicate headers -- entirely, straightforwardly defeating the purpose of a header file. Very frustrating repository to look at or ever think about.
Contributor
sprunk
reviewed
Jun 15, 2026
| local lusEnv = Spring.UnitScript.GetScriptEnv(unitID) | ||
| return lusEnv | ||
| and function(unitID, funcName, ...) | ||
| callLUS(unitID, lusEnv[funcName], ...) -- Hold `env` in a temporary closure. |
Collaborator
There was a problem hiding this comment.
lus doesn't really need this. it can read customparams on its own
Collaborator
Author
There was a problem hiding this comment.
It would need to share the load/conversion code which I'd rather avoid. A common set of callins between COB and LUS seems like a net good, as well.
added 8 commits
June 15, 2026 13:40
We might not want this at all. But too bad: That's a separate PR.
Collaborator
Author
sprunk
reviewed
Jun 16, 2026
added 7 commits
June 16, 2026 11:14
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.



Work done
Adds generic handling for unitdef and weapondef customparam values to be sent to unit scripts at unit creation.
Adds sweepfire customparams so these properties can go in unitdefs where they are visible as data.
Removed the turret turn speeds gadget. It was marked as unwanted in multiple places. However, turn rates are a prereq to satisfy the GDT ruling that turret turn speeds must compensate for unit speed. I ported that functionality to this code and updated the script headers that use it.
Addresses issue(s)
Legion has many values hardcoded into unit scripts to support some of its unique mechanics. Sweepfire heat rays are the main culprit. These hardcode both the beam duration and reload time in the unit script. We display inaccurate summary statistics for these units in the GUI (namely the Telchine which shows about 2.5x the DPS of a Razorback).
However, many other units in Armada and Cortex do the same without the justification of any unique mechanics. Many units have fixed reload times or restore times which means they cannot be modified through their def files alone.
Some considerations
We are still not scaling these values with XP. The veterancy rework can address this once it is up and running.
Related to #7531.