W0: terrain from worldlet building blocks (Valley in data/worldlets, identical heights), WorldInfo API, worldlet in saves and servers; the cliff tunnel plan
This commit is contained in:
@@ -895,6 +895,44 @@ func water_at(x: float, z: float) -> Dictionary:
|
||||
return {"type": "sea", "surface": terrain.sea_level, "depth": terrain.sea_level - ground}
|
||||
return {}
|
||||
|
||||
# --- the worldlet (docs/WORLDLETS_DESIGN.md: the WorldInfo API) --------------------
|
||||
# What a system outside the terrain should ask about this place, rather than
|
||||
# reading the terrain's numbers: which worldlet it is, its water, its climate,
|
||||
# and its ways out. (W0 adds these; systems move over to them as each worldlet
|
||||
# needs them to be different.)
|
||||
|
||||
## This worldlet's id ("valley") and its whole definition.
|
||||
func worldlet_id() -> String:
|
||||
return terrain.worldlet_id
|
||||
|
||||
func worldlet() -> Dictionary:
|
||||
return terrain.worldlet
|
||||
|
||||
## Its bodies of water: [{"type", "surface", "center" (x, z; the sea's is a
|
||||
## point on its coast), "radius" (a lake's; the sea's is 0)}].
|
||||
func water_bodies() -> Array:
|
||||
var out: Array = []
|
||||
for b in terrain._blocks:
|
||||
match String(b.type):
|
||||
"lake":
|
||||
out.append({"type": "lake", "surface": terrain.water_level,
|
||||
"center": terrain.lake_center, "radius": terrain.lake_radius})
|
||||
"sea_cliff":
|
||||
out.append({"type": "sea", "surface": terrain.sea_level,
|
||||
"center": terrain.coast_point(terrain.sea_angle_deg, 20.0), "radius": 0.0})
|
||||
return out
|
||||
|
||||
## Its climate: {"snowline": m, ...} (more as worldlets differ).
|
||||
func climate() -> Dictionary:
|
||||
var c: Dictionary = terrain.worldlet.get("climate", {}).duplicate()
|
||||
c["snowline"] = terrain.snow_height
|
||||
return c
|
||||
|
||||
## Its ways on to other worldlets (the journey): [{"to", "by", "where"}].
|
||||
## Planned in the definition; travel comes with J1.
|
||||
func crossings() -> Array:
|
||||
return terrain.worldlet.get("next", [])
|
||||
|
||||
# --- multiplayer -----------------------------------------------------------------
|
||||
|
||||
## Joined a server: start where it says, follow its clock, show the others.
|
||||
|
||||
Reference in New Issue
Block a user