Forums » Bugs
API: InventoryItemPrototype:GetMass() problem with ships
At least on the current Windows client, the :GetMass() method of the InventoryItemPrototype of a ship returns the sum of the prototype's mass + the mass of the player's active ship.
This has implications not only for the prototype API directly but also for functions that use it, like GetInventoryItemMass/GetStationMerchInfo/GetStationMerchInfoByID.
The workaround for now is to substract GetActiveShipMass() from the mass returned by these functions for any item of type "ship", with the added caveat that only the mass of the active ship at the time of entering the station counts - changing the ship while in station does not change the return value.
This has implications not only for the prototype API directly but also for functions that use it, like GetInventoryItemMass/GetStationMerchInfo/GetStationMerchInfoByID.
The workaround for now is to substract GetActiveShipMass() from the mass returned by these functions for any item of type "ship", with the added caveat that only the mass of the active ship at the time of entering the station counts - changing the ship while in station does not change the return value.