feat(packages): ludic.npc - the other people in a place: kinds, spots, acts, names and lines as open registries (a kind's routine is steps by the hour - a spot, an act, how long - with its own start and plan as function values, readable from .lres), a census on the half hour by weight (after dark only who stays out) with an extra the place asks for, walking round what is in the way and never into the water or up a scramble, no act where the place says nobody stops, facing a player within notice and back to the errand, leaving only out of every player's sight, unique names, posts that never walk (a vendor), lines by prio and chance with the story's words through a port and choices, a guest's copy of a host's people; greeted, talked and arrived as facts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
73a376ac6c
commit
029a1ebba2
23 changed files with 1664 additions and 0 deletions
61
packages/ludic.npc/tests/fake/index.ludic
Normal file
61
packages/ludic.npc/tests/fake/index.ludic
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# fake - a place for the people: dry flat ground east of x = -50 and a lake west of it, a camp at
|
||||
# (40, 0) nobody may stop in, two players, and what the port was asked to draw
|
||||
numbers float
|
||||
var fk_hour: float = 12.0
|
||||
var fk_day: int = 1
|
||||
var fk_want: int = 0
|
||||
var fk_extra: int = -1
|
||||
var fk_px: []float = null
|
||||
var fk_pz: []float = null
|
||||
var fk_on: []bool = null
|
||||
var fk_born: int = 0
|
||||
var fk_gone: int = 0
|
||||
|
||||
function fk_setup() -> void {
|
||||
fk_hour = 12.0
|
||||
fk_day = 1
|
||||
fk_want = 0
|
||||
fk_extra = -1
|
||||
fk_px = [500.0, 900.0]
|
||||
fk_pz = [500.0, 900.0]
|
||||
fk_on = [true, false]
|
||||
fk_born = 0
|
||||
fk_gone = 0
|
||||
npc_clear()
|
||||
npc_reset()
|
||||
npc_seed(7)
|
||||
npc_config(10)
|
||||
}
|
||||
|
||||
function fk_ground(x: float, z: float) -> float { return 0.0 }
|
||||
function fk_water(x: float, z: float) -> float {
|
||||
if x < -50.0 { return 1.0 }
|
||||
return -100.0
|
||||
}
|
||||
function fk_allowed(x: float, z: float) -> bool { return npc_d(x, z, 40.0, 0.0) > 15.0 }
|
||||
function fk_hour_now() -> float { return fk_hour }
|
||||
function fk_day_now() -> int { return fk_day }
|
||||
function fk_players() -> int { return 2 }
|
||||
function fk_player_on(i: int) -> bool { return fk_on[i] }
|
||||
function fk_x(i: int) -> float { return fk_px[i] }
|
||||
function fk_z(i: int) -> float { return fk_pz[i] }
|
||||
function fk_wanted() -> int { return fk_want }
|
||||
function fk_extra_kind() -> int { return fk_extra }
|
||||
function fk_taken(n: string) -> bool { return n == "Ada" }
|
||||
function fk_on_born(p: NpcPerson) -> void { fk_born += 1 }
|
||||
function fk_on_gone(p: NpcPerson) -> void { fk_gone += 1 }
|
||||
|
||||
function fk_player_at(x: float, z: float) -> void {
|
||||
fk_px[0] = x
|
||||
fk_pz[0] = z
|
||||
}
|
||||
|
||||
# seconds of the place, in twentieths
|
||||
function fk_run(secs: float) -> void { for k in 0 .. int(secs * 20.0) { npc_tick(0.05) } }
|
||||
|
||||
function fk_count(what: int) -> int {
|
||||
let fs = q_drain(npc_facts())
|
||||
var n = 0
|
||||
for i in 0 .. len(fs) { if fs[i].what == what { n += 1 } }
|
||||
return n
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue