Add inventory and logbook player menu
This commit is contained in:
parent
bd2768b676
commit
ad89c22cca
12 changed files with 719 additions and 50 deletions
|
|
@ -5,14 +5,26 @@ const FishDataType = preload("res://fish/fish_data.gd")
|
|||
|
||||
@export var fish: FishDataType
|
||||
@export var fish_id: StringName
|
||||
@export var catch_id: StringName
|
||||
@export var catch_sequence: int = 0
|
||||
@export var weight_lb: float = 0.0
|
||||
@export var display_scale: float = 1.0
|
||||
|
||||
|
||||
func ensure_identity() -> void:
|
||||
if not catch_id.is_empty():
|
||||
return
|
||||
catch_id = StringName(
|
||||
"%s:%d:%d"
|
||||
% [fish_id, Time.get_ticks_usec(), get_instance_id()]
|
||||
)
|
||||
|
||||
|
||||
func is_valid() -> bool:
|
||||
return (
|
||||
fish != null
|
||||
and not fish_id.is_empty()
|
||||
and not catch_id.is_empty()
|
||||
and fish.id == fish_id
|
||||
and weight_lb >= fish.get_minimum_weight()
|
||||
and weight_lb <= fish.get_maximum_weight()
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ func create_catch(fish: FishDataType) -> FishCatchType:
|
|||
var caught_fish := FishCatchType.new()
|
||||
caught_fish.fish = fish
|
||||
caught_fish.fish_id = fish.id
|
||||
caught_fish.ensure_identity()
|
||||
caught_fish.weight_lb = _rng.randf_range(
|
||||
fish.get_minimum_weight(),
|
||||
fish.get_maximum_weight()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue