Modding Discussion Is a Ender Chest possible? In Starbound

Discussion in 'Starbound Modding' started by Noah Nebula, Sep 20, 2018.

  1. Noah Nebula

    Noah Nebula Sandwich Man

    I notice he uses "player.consumeItem" does the key need to be a consumable?
     
  2. The Avelon

    The Avelon Phantasmal Quasar

    .consumeItem means 'remove from inventory' and there is a version of the same command for containers. Items are instanced and when you automatically move them to another place with a script, you are saving the item data to a variable, cloning it to its destination, and then deleting the source.

    The general method without getting too deep into lua is:

    On update, check the table of data stored in the key that is consumed and populate the chest with items matching the data in the key

    On uninit, consume the items in the chest and write them to a table of data, then give the player the new key with the data table stored as a parameter.
     
    Noah Nebula likes this.
  3. Sock_Bunny

    Sock_Bunny Existential Complex

Share This Page