W3: the Cove (bay, pond, pier for sea fishing), mackerel and cod (cod only in deep water), non-start worldlets offered for testing when run from source
This commit is contained in:
@@ -15,6 +15,7 @@ const BITE_WINDOW := 1.5
|
||||
const LINE_LENGTH := 26.0
|
||||
|
||||
var water_type := "" ## "lake", "sea"... (world.water_at)
|
||||
var water_depth := 0.0 ## how deep it is where the float came down
|
||||
var table: Dictionary = {} ## that water's fishing table (ItemDB.water_fishing)
|
||||
|
||||
var world: Node3D
|
||||
@@ -91,8 +92,9 @@ func _next_wait() -> float:
|
||||
return rng.randf_range(w[0], w[1]) * k
|
||||
|
||||
## A weighted pick from this water's fish (dawn/dusk weights when they apply).
|
||||
## (A fish with its own "min_depth" only bites in water that deep: cod.)
|
||||
func _pick_fish() -> String:
|
||||
var fish: Array = table.get("fish", [])
|
||||
var fish: Array = table.get("fish", []).filter(func(f): return water_depth >= float(f.get("min_depth", 0.0)))
|
||||
var key := "dawn_dusk" if _dawn_dusk() else "weight"
|
||||
var total := 0.0
|
||||
for f in fish:
|
||||
@@ -120,6 +122,7 @@ func step(dt: float) -> void:
|
||||
if not water.is_empty() and p.y <= float(water.surface):
|
||||
p.y = water.surface
|
||||
water_type = water.type
|
||||
water_depth = float(water.depth)
|
||||
table = ItemDB.water_fishing(water_type)
|
||||
if table.is_empty() or table.fish.is_empty():
|
||||
state = "landed"
|
||||
|
||||
Reference in New Issue
Block a user