Fish per water type in data/fish.json; worldlets design
- data/fish.json: fish, weights, dawn/dusk odds, bite timing and minimum depth per water type; ItemDB.define_water() registers them - world.water_at(x, z) answers lake / sea / dry land; the float uses it, so a worldlet with a sea only needs a "sea" entry - Clear messages for shallow water and water with nothing to catch - Lake fish: more of them, bigger, nearer the shore, jumping with splash rings - docs/WORLDLETS_DESIGN.md: proposal for data-defined world types
This commit is contained in:
@@ -487,6 +487,17 @@ func _update_grass_cuts() -> void:
|
||||
xfs.append(p.global_transform)
|
||||
props.set_grass_cuts(xfs, 1.02)
|
||||
|
||||
## What water is at (x, z): {"type": "lake"|"sea", "surface": y, "depth": m},
|
||||
## or {} on dry land. The one place that knows this island's water bodies, so
|
||||
## fishing (and later swimming, boats) work on any world that answers it.
|
||||
func water_at(x: float, z: float) -> Dictionary:
|
||||
var ground: float = terrain.sample_height(x, z)
|
||||
if terrain.inside_boundary(x, z, -2.0) and ground < terrain.water_level:
|
||||
return {"type": "lake", "surface": terrain.water_level, "depth": terrain.water_level - ground}
|
||||
if terrain.sea_weight(x, z) > 0.5 and ground < terrain.sea_level:
|
||||
return {"type": "sea", "surface": terrain.sea_level, "depth": terrain.sea_level - ground}
|
||||
return {}
|
||||
|
||||
## Leaves `count` of an item lying in the world at `xf` (an arrow stuck in a
|
||||
## tree, a thrown spear, meat that didn't fit). Saved with the world.
|
||||
func drop_item(id: String, count: int, xf: Transform3D) -> Node3D:
|
||||
|
||||
Reference in New Issue
Block a user