Is your feature request related to a problem? Please describe.
The getItemActionCost function in skill.nut allows skills to implement discounts for moving or swapping items. It returns an unsigned number, representing the Action Point cost required for swapping the passed array of Items, caused by this skill.nut.
From that point of view you, an a modder, would expect that its parameter array always contains at least one valid item.
However that behavior is not enforced by MSU.
Describe the solution you'd like
Implement the following guarantees for getItemActionCost from skill.nut
- Never pass something other than an array into
getItemActionCost
- Never pass an empty array into the
getItemActionCost
- Never pass an array that only consists of
null elements into getItemActionCost
- Never pass an array into
getItemActionCost, in which the first element is null
All of these situations do not make logical sense for someone implementing logic for getItemActionCost.
And it should not be the task of the implementer to check against all those situations and filter them out.
These guarantees can be applied either by
- checking for those cases in the
getItemActionCost of SkillContainer.nut or isActionAffordable from item_container.nut and filtering them out or correcting them accordingly.
or
- by adding documentation for the vanilla
isActionAffordable function (which was overwritten by MSU) making it clear, that its argument must align with the rules above
Additional context
This whole issue arose from an incompatibility with my mod Hardened and Hackflows mod Autopilot New.
In Hardened I implement getItemActionCost expecting it to contain at least one actual item.
I even already checked against mods breaking the order-convention, which I can hopefully remove soon.

But in Autopilot New, Hackflow calls isActionAffordable with an empty array, presumably for optimization reasons.

Is your feature request related to a problem? Please describe.
The
getItemActionCostfunction inskill.nutallows skills to implement discounts for moving or swapping items. It returns an unsigned number, representing the Action Point cost required for swapping the passed array of Items, caused bythisskill.nut.From that point of view you, an a modder, would expect that its parameter array always contains at least one valid item.
However that behavior is not enforced by MSU.
Describe the solution you'd like
Implement the following guarantees for
getItemActionCostfromskill.nutgetItemActionCostgetItemActionCostnullelements intogetItemActionCostgetItemActionCost, in which the first element isnullAll of these situations do not make logical sense for someone implementing logic for
getItemActionCost.And it should not be the task of the implementer to check against all those situations and filter them out.
These guarantees can be applied either by
getItemActionCostofSkillContainer.nutorisActionAffordablefromitem_container.nutand filtering them out or correcting them accordingly.or
isActionAffordablefunction (which was overwritten by MSU) making it clear, that its argument must align with the rules aboveAdditional context
This whole issue arose from an incompatibility with my mod Hardened and Hackflows mod Autopilot New.
In Hardened I implement

getItemActionCostexpecting it to contain at least one actual item.I even already checked against mods breaking the order-convention, which I can hopefully remove soon.
But in Autopilot New, Hackflow calls

isActionAffordablewith an empty array, presumably for optimization reasons.