wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic 1804 vars into 126 states, 64 into lets; 23498 edits in 460 files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5ffe50ed02
commit
19fcf60599
459 changed files with 17862 additions and 17603 deletions
|
|
@ -1,7 +1,5 @@
|
|||
# habitat.ludic - the right kind of ground for a species, asked of the port's ground, water, slope
|
||||
# and forest; and a spot of it at a distance from a point, off the package's dice
|
||||
var wl_px: float = 0.0
|
||||
var wl_pz: float = 0.0
|
||||
|
||||
function wl_wet(x: float, z: float, depth: float) -> bool {
|
||||
return WildlifeWorld.ground(x, z) < WildlifeWorld.water(x, z) - depth
|
||||
|
|
@ -19,20 +17,20 @@ export function wildlife_habitat_ok(hab: int, x: float, z: float) -> bool {
|
|||
}
|
||||
|
||||
# a spot of `hab` d0..d1 metres from (x0, z0); where it is, is wildlife_spot_x / _z
|
||||
export function wildlife_find_spot(hab: int, x0: float, z0: float, d0: float, d1: float) -> bool {
|
||||
export function wildlife_find_spot(wildlife_st: mut WildlifeState, hab: int, x0: float, z0: float, d0: float, d1: float) -> bool {
|
||||
for t in 0 .. 60 {
|
||||
let ang = wl_rnd() * WL_TAU
|
||||
let d = d0 + wl_rnd() * (d1 - d0)
|
||||
let ang = wl_rnd(wildlife_st) * WL_TAU
|
||||
let d = d0 + wl_rnd(wildlife_st) * (d1 - d0)
|
||||
let x = x0 + Math.cos(ang) * d
|
||||
let z = z0 + Math.sin(ang) * d
|
||||
if wildlife_habitat_ok(hab, x, z) {
|
||||
wl_px = x
|
||||
wl_pz = z
|
||||
wildlife_st.wl_px = x
|
||||
wildlife_st.wl_pz = z
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function wildlife_spot_x() -> float { return wl_px }
|
||||
export function wildlife_spot_z() -> float { return wl_pz }
|
||||
export function wildlife_spot_x(wildlife_st: WildlifeState) -> float { return wildlife_st.wl_px }
|
||||
export function wildlife_spot_z(wildlife_st: WildlifeState) -> float { return wildlife_st.wl_pz }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue