refactor(packages): 0.R5 - a question no longer starts its state - 64 lazy starts ('if st.x == null { st.x = ... }' inside a getter) are the state's defaults, gear__ensure is gone, and ludic migrate state --tighten took mut off 208 package parameters: things_all, thing_find, gear_charge, gear_level, jobs_state and the rest read
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
54f5efb23f
commit
9862ec82e3
102 changed files with 320 additions and 351 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# migrate.ludic - each morning the ranges slide toward where the season wants them, and the animals
|
||||
# that live in them are dragged along rather than teleported; an animal keeps inside its own
|
||||
export function wildlife_ranges_migrate(wildlife_st: mut WildlifeState) -> void {
|
||||
export function wildlife_ranges_migrate(wildlife_st: WildlifeState) -> void {
|
||||
let rs = wildlife_ranges(wildlife_st)
|
||||
let w = WildlifeWorld.winterness()
|
||||
for i in 0 .. len(rs) {
|
||||
|
|
@ -24,7 +24,7 @@ export function wildlife_ranges_migrate(wildlife_st: mut WildlifeState) -> void
|
|||
}
|
||||
|
||||
# its home kept inside its range
|
||||
function wl_clamp(wildlife_st: mut WildlifeState, a: WildAnimal) -> void {
|
||||
function wl_clamp(wildlife_st: WildlifeState, a: WildAnimal) -> void {
|
||||
let r = wildlife_range(wildlife_st, a.rg)
|
||||
if r == null { return }
|
||||
let d = wildlife_range_dist(r, a.home_x, a.home_z)
|
||||
|
|
@ -34,7 +34,7 @@ function wl_clamp(wildlife_st: mut WildlifeState, a: WildAnimal) -> void {
|
|||
}
|
||||
|
||||
# how many live in range `i`, legends apart
|
||||
export function wildlife_range_alive(wildlife_st: mut WildlifeState, i: int) -> int {
|
||||
export function wildlife_range_alive(wildlife_st: WildlifeState, i: int) -> int {
|
||||
var n = 0
|
||||
let all = wildlife_all(wildlife_st)
|
||||
for k in 0 .. len(all) { if all[k].alive and not all[k].legend and all[k].rg == i { n += 1 } }
|
||||
|
|
@ -42,7 +42,7 @@ export function wildlife_range_alive(wildlife_st: mut WildlifeState, i: int) ->
|
|||
}
|
||||
|
||||
# how many are alive in the whole valley, legends apart
|
||||
export function wildlife_total(wildlife_st: mut WildlifeState) -> int {
|
||||
export function wildlife_total(wildlife_st: WildlifeState) -> int {
|
||||
var n = 0
|
||||
let all = wildlife_all(wildlife_st)
|
||||
for k in 0 .. len(all) { if all[k].alive and not all[k].legend { n += 1 } }
|
||||
|
|
@ -50,7 +50,7 @@ export function wildlife_total(wildlife_st: mut WildlifeState) -> int {
|
|||
}
|
||||
|
||||
# the nearest range of `sp` a player has found, to (x, z), or -1
|
||||
export function wildlife_range_found_near(wildlife_st: mut WildlifeState, sp: int, x: float, z: float) -> int {
|
||||
export function wildlife_range_found_near(wildlife_st: WildlifeState, sp: int, x: float, z: float) -> int {
|
||||
var best = -1
|
||||
var bd = 99999.0
|
||||
let rs = wildlife_ranges(wildlife_st)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue