1. Welcome to the Starbound support forums. Please check the support FAQs before posting: http://playstarbound.com/support

Bug/Issue player.consumeItemWithParameters() consumes too many / wrong items

Discussion in 'Starbound Support' started by Tobias1595, Jul 19, 2019.

  1. Tobias1595

    Tobias1595 Big Damn Hero

    The method player.consumeItemWithParameters() has two ways to limit if items are consumed: By parameters and by count. Both limitations can be bypassed.

    I wrote a mini-mod to help with reproducing the bug. Of the two items in the mod, one is for preparing, the other is for actually triggering the bug. Their item IDs are "preparationbag" and "reproductionbag".
    The preparationbag equips the player with two t-shirts, a blue one without any parameters in the regular chest slot, and a red one with parameters for its color and simulation of custom parameters in the cosmetic chest slot.
    The reproductionbag simply runs the command player.consumeItemWithParameters(), targeting the custom parameter of the red shirt.

    Steps to reproduce:
    1. Install the attached mini-mod
    2. Start the game and load a character
    (3. Take off chest and cosmetic chest equipment)
    4. Via /spawnitem, get one each of "preparationbag" and "reproductionbag"
    5. Use the Preparation Bag
    6. Observe 2 t-shirts appearing in the chest and cosmetic chest slots
    7. Use the Reproduction Bag
    8. Observe both t-shirts vanishing

    Alternatively, the t-shirts can be taken off and placed in the inventory, possibly collecting multiple copies. In that case, as long as there are red t-shirts, only one t-shirt vanishes at a time, but blue t-shirts are still consumed aswell.

    To summarize: This method will consume items without the specified parameters, if items of the same type with these parameters exist aswell, and will consume more than the specified amount if only consuming from equipment slots.
     

    Attached Files:

Share This Page