feat(packages): ludic.jobs - written jobs gated by standing and story, boards of posts rolled by the day on their own dice, progress counted from events and read back from state, handing in, rewards through a port, facts, a save section per scope

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 07:35:45 +03:00
parent e146c7a337
commit 411206e45a
14 changed files with 984 additions and 0 deletions

View file

@ -0,0 +1,51 @@
# posts.ludic - what is on a board, slot by slot, and a board as the host says it
export function jobs_post_kind(b: int, s: int) -> int { return jobs__pk[jobs__at(b, s)] }
export function jobs_post_param(b: int, s: int) -> int { return jobs__pp[jobs__at(b, s)] }
export function jobs_post_need(b: int, s: int) -> int { return jobs__pn[jobs__at(b, s)] }
export function jobs_post_have(b: int, s: int) -> int { return jobs__ph[jobs__at(b, s)] }
export function jobs_post_money(b: int, s: int) -> int { return jobs__pm[jobs__at(b, s)] }
export function jobs_post_rep(b: int, s: int) -> int { return jobs__pr[jobs__at(b, s)] }
export function jobs_post_state(b: int, s: int) -> int { return jobs__ps[jobs__at(b, s)] }
export function jobs_post_day(b: int, s: int) -> int { return jobs__pd[jobs__at(b, s)] }
export function jobs_slots(b: int) -> int {
if not jobs_board_ok(b) { return 0 }
return JobBoards[b].slots
}
# the slots with something posted, in order
export function jobs_posted(b: int) -> []int {
let out = new []int
for s in 0 .. jobs_slots(b) { if jobs_post_kind(b, s) >= 0 { push(out, s) } }
return out
}
# how many of a board's posts are paid
export function jobs_posts_done(b: int) -> int {
var n = 0
for s in 0 .. jobs_slots(b) { if jobs_post_kind(b, s) >= 0 and jobs_post_state(b, s) == JOBS_DONE { n += 1 } }
return n
}
export function jobs_total(b: int) -> int {
jobs__ensure()
return jobs__total[b]
}
# a slot outright: the host's board on a guest, a test
export function jobs_post_set(b: int, s: int, kind: int, param: int, need: int, have: int, money: int, rep: int, state: int, day: int) -> void {
let k = jobs__at(b, s)
jobs__pk[k] = kind
jobs__pp[k] = param
jobs__pn[k] = need
jobs__ph[k] = have
jobs__pm[k] = money
jobs__pr[k] = rep
jobs__ps[k] = state
jobs__pd[k] = day
}
export function jobs_set_total(b: int, n: int) -> void {
jobs__ensure()
jobs__total[b] = n
}