Add portable RV homes and decor prototype
This commit is contained in:
parent
81decf2b71
commit
fe099f47dd
56 changed files with 5459 additions and 112 deletions
|
|
@ -60,6 +60,28 @@ func add_item(item_id: StringName, quantity: int = 1) -> bool:
|
|||
return true
|
||||
|
||||
|
||||
func add_item_to_storage(item_id: StringName, quantity: int = 1) -> bool:
|
||||
var existing: OwnedItemType = get_owned_item(item_id)
|
||||
if existing != null:
|
||||
return add_item(item_id, quantity)
|
||||
var item: ItemDataType = _resolve_available_item(item_id)
|
||||
if (
|
||||
item == null
|
||||
or quantity <= 0
|
||||
or quantity > (item.max_stack if item.stackable else 1)
|
||||
or _inventory_layout == null
|
||||
or not _inventory_layout.can_accept_item_in_storage(item_id)
|
||||
):
|
||||
return false
|
||||
var owned := OwnedItemType.new()
|
||||
owned.item_id = item_id
|
||||
owned.quantity = quantity
|
||||
owned.storage_slot = _first_available_storage_slot(item, _items)
|
||||
_items.append(owned)
|
||||
contents_changed.emit()
|
||||
return true
|
||||
|
||||
|
||||
func can_add_item(item_id: StringName, quantity: int = 1) -> bool:
|
||||
var item: ItemDataType = _resolve_available_item(item_id)
|
||||
if item == null or quantity <= 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue