-
Notifications
You must be signed in to change notification settings - Fork 239
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
Conversation
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. |
Actually you can't even use ModBlueprints from |
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.
ce15dc7
to
7b554d6
Compare
7b554d6
to
b05df60
Compare
Closing in favor of #6669 |
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