I'm going to add an additional line of code to the pile! (This one has actually been tested in the editor - so I can confirm it definitely works).
Code: Select all
mine_alcove_3.surface:addItem(spawn("water_flask").item);
So, from my testing, you need to add an "item component" to a surface. The item component has to belong to a game object that actually exists, so you can either link to one that's already in the game (and it will move to the surface) or you can spawn a new item and place it in the alcove (which I assume is what you want to do).
The above script will...
1. Spawn a new water flask with the bit of code: spawn("water_flask").
2. Take the item component of that water flask using .item.
3. Get the surface component of the mine alcove and add the item component of the flask to the surface component of the alcove.
Sounds a bit convoluted, but it just requires understanding that a "component" is like like a "part" of a game object and you need to use the components for a lot of things now instead of just simple game components.