[quote=“BorkBorkGoesTheCode, post:8, topic:14228”][quote=“Zhilkin, post:7, topic:14228”]You can actually store items inside other items - here is the LUA code:
local container_id = "30gal_barrel"
local container = item(container_id, 1)
local item_id = "hamburger"
local item = item(item_id, 1)
local item_id2 = "water"
local item2 = item(item_id2, 1)
local item_id3 = "bottle_plastic"
local item3 = item(item_id3, 1)
container:put_in(item)
container:put_in(item2)
container:put_in(item3)
player:i_add(container)
After running this code via LUA console (I prefer put this code to 1.lua in cataclysm folder and execute dofile('./1.lua')) you will get 30 gallon barrel, full item and when you unload it you will get all of the contents.[/quote]
Can you stack that lot inside another 30gal drum etc.?[/quote]
Sure. With a little more code. After you created container and put all items to it, you just create another container and put first container with items to the second container.
local container_id = "30gal_barrel"
local container = item(container_id, 1)
local item_id = "hamburger"
local item = item(item_id, 1)
local item_id2 = "water"
local item2 = item(item_id2, 1)
local item_id3 = "bottle_plastic"
local item3 = item(item_id3, 1)
container:put_in(item)
container:put_in(item)
container:put_in(item)
container:put_in(item)
container:put_in(item2)
container:put_in(item2)
container:put_in(item3)
container:put_in(item3)
container:put_in(item3)
local container_id2 = "30gal_barrel"
local container2 = item(container_id2, 1)
container2:put_in(container)
player:i_add(container2)
LUA is used just for quick example. C++ functions are working in the very same manner.
LUA lacks support of GUI elements, so it will be hard (but not impossible) to implement container interaction. Actually there is only text popup wihtout callbacks and menu with callbacks (you know which menu item was selected), so something could be implemented through text menus like in classic console RPGs - you highlight item from inventory, select one of possible actions (“put to container”, “remove from container”, “move to another container” etc) then select new container to put the item in (from the list of possible containers).
And through the C++ you can do anything with the GUI.