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>
31 lines
1.5 KiB
Text
31 lines
1.5 KiB
Text
# record.ludic - what this player has met: the species seen up close and the species fed, as masks
|
|
# by species number, and whether anything has been fed at all
|
|
|
|
export function wildlife_seen(wildlife_st: WildlifeState, sp: int) -> bool { return (wildlife_st.wl_seen & (1 << sp)) != 0 }
|
|
export function wildlife_seen_mask(wildlife_st: WildlifeState) -> int { return wildlife_st.wl_seen }
|
|
export function wildlife_fed_mask(wildlife_st: WildlifeState) -> int { return wildlife_st.wl_fed }
|
|
export function wildlife_fed_any(wildlife_st: WildlifeState) -> bool { return wildlife_st.wl_fed_any }
|
|
|
|
# seen up close (a guest's own pass, droppings read, a sighting here); true the first time
|
|
export function wildlife_saw(wildlife_st: mut WildlifeState, sp: int) -> bool {
|
|
if wildlife_seen(wildlife_st, sp) { return false }
|
|
wildlife_st.wl_seen = wildlife_st.wl_seen | (1 << sp)
|
|
return true
|
|
}
|
|
|
|
export function wildlife_set_seen(wildlife_st: mut WildlifeState, mask: int) -> void { wildlife_st.wl_seen = mask }
|
|
|
|
# a species fed, credited to this player
|
|
export function wildlife_mark_fed(wildlife_st: mut WildlifeState, sp: int) -> void {
|
|
wildlife_st.wl_fed = wildlife_st.wl_fed | (1 << sp)
|
|
wildlife_st.wl_fed_any = true
|
|
}
|
|
|
|
# nothing fed yet (a test that feeds again), or the flag as given
|
|
export function wildlife_set_fed_any(wildlife_st: mut WildlifeState, on: bool) -> void { wildlife_st.wl_fed_any = on }
|
|
|
|
function wl_record_reset(wildlife_st: mut WildlifeState) -> void {
|
|
wildlife_st.wl_seen = 0
|
|
wildlife_st.wl_fed = 0
|
|
wildlife_st.wl_fed_any = false
|
|
}
|