-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve merge bp compatibility with removing fields #6637
base: develop
Are you sure you want to change the base?
Conversation
The enh name can not exist because a mod modifies the preset by setting the enhancement to `false`, as required for a merge bp to work.
If a merge bp sets an enhancement to `false` then it should not error for presets to work. It also does not make sense to error and then return `false` afterwards, since the error stops execution.
- clear damage table cache only when the buff is successfully enabled (error would stop it anyway though) - remove irrelevant comments - remove `ERROR:` since the log will already make it apparent
Another pain I encountered while modding is the local oldModBp = ModBlueprints
---@param all_bps BlueprintsTable
ModBlueprints = function(all_bps)
local origBp = all_bps.Unit['url0301']--[[@as UnitBlueprint]]
local origWeapon = origBp.Weapon --[[@as WeaponBlueprint[] ]]
table.insert(origWeapon, 1, { ... })
oldModBp(all_bps)
end |
Also there is a bug with reloading merge bps in that the mesh gets deleted due to how mesh bps are extracted and defaulted, ignoring |
Has to be table assignment and not table.insert or else you get infinite copies. |
Issue
Merge blueprints cannot set fields in the base bp to
nil
since lua does not allow storing table keys with a value of nil. The alternative to doing that is to set those keys tofalse
, but not all code works well with that.Description of the proposed changes
Fix errors/bugs I encountered when modding SACUs, so code using blueprints and related to enhancements, enhancement presets, and weapons.
Testing done on the proposed changes
false
value do not error and the enhancements work properly.false
does not error.false
doesn't break it.Additional context
An alternative could be to create a special value like
"__nil"
thattable.merged
treats as setting a field tonil
.Checklist