Uses for every material (clay jar, bedroll, pelt rug, fang necklace, bear cloak, pemmican, bait), Q to drop, K/M bag rows on 1-8, help pages; protocol 14
This commit is contained in:
@@ -49,10 +49,26 @@ func held_item_id() -> String:
|
||||
var s = inventory.get_slot(selected)
|
||||
return s.id if s != null else ""
|
||||
|
||||
## Holds the item in bag slot `i` (any slot: 1-8 pick from the current row,
|
||||
## K and M move between rows of 8).
|
||||
func select(i: int) -> void:
|
||||
selected = wrapi(i, 0, HOTBAR)
|
||||
selected = wrapi(i, 0, inventory.size())
|
||||
selected_changed.emit()
|
||||
|
||||
## The bag row (0 = the top) the 1-8 keys and the hotbar show.
|
||||
func row() -> int:
|
||||
return selected / HOTBAR
|
||||
|
||||
func rows() -> int:
|
||||
return inventory.size() / HOTBAR
|
||||
|
||||
## Column `col` of the current row; and the same column a row up or down.
|
||||
func select_in_row(col: int) -> void:
|
||||
select(row() * HOTBAR + wrapi(col, 0, HOTBAR))
|
||||
|
||||
func change_row(by: int) -> void:
|
||||
select(wrapi(row() + by, 0, rows()) * HOTBAR + selected % HOTBAR)
|
||||
|
||||
## Called by workbenches and chests (container = null for plain crafting).
|
||||
func open_inventory(container: Node) -> void:
|
||||
inventory_requested.emit(container)
|
||||
|
||||
Reference in New Issue
Block a user