-
Notifications
You must be signed in to change notification settings - Fork 6
Description
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
nullelements intogetItemActionCost - Never pass an array into
getItemActionCost, in which the first element isnull
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
getItemActionCostofSkillContainer.nutorisActionAffordablefromitem_container.nutand filtering them out or correcting them accordingly.
or
- by adding documentation for the vanilla
isActionAffordablefunction (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.
