Add minimal Bluegill fishing loop
This commit is contained in:
parent
dd2563c0d8
commit
bba93eb3e5
16 changed files with 461 additions and 3 deletions
21
inventory/fish_inventory.gd
Normal file
21
inventory/fish_inventory.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
class_name FishInventory
|
||||
extends Node
|
||||
|
||||
const FishDataType = preload("res://fish/fish_data.gd")
|
||||
|
||||
signal contents_changed(fish_id: StringName, count: int)
|
||||
|
||||
var _fish_counts: Dictionary[StringName, int] = {}
|
||||
|
||||
|
||||
func add_fish(fish: FishDataType, amount: int = 1) -> void:
|
||||
if fish == null or fish.id.is_empty() or amount <= 0:
|
||||
return
|
||||
|
||||
var new_count: int = get_count(fish.id) + amount
|
||||
_fish_counts[fish.id] = new_count
|
||||
contents_changed.emit(fish.id, new_count)
|
||||
|
||||
|
||||
func get_count(fish_id: StringName) -> int:
|
||||
return _fish_counts.get(fish_id, 0)
|
||||
1
inventory/fish_inventory.gd.uid
Normal file
1
inventory/fish_inventory.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://t4q3l16td1yw
|
||||
Loading…
Add table
Add a link
Reference in a new issue