ludic.anim: a transition may name a via one-shot - a request from from (the state last asked, or "*") to to goes by it when the rig carries its clip, and the one-shot's next hands on. The game's hiker picked sit_down / stand_up / board_boat / leave_boat in code; the set says it now. A via edge is not an edge for a request's own fade. animset_test holds it, with a via the rig has and one it has not.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
986fba3586
commit
96798c0fbb
5 changed files with 45 additions and 4 deletions
|
|
@ -11,8 +11,22 @@ export function animset_request(pl: AnimPlayer, key: string) -> void {
|
|||
if pl.set < 0 or key == pl.asked { return }
|
||||
let i = as_state(AnimSets[pl.set], key)
|
||||
if i < 0 { return }
|
||||
let v = as_via(pl, key)
|
||||
pl.asked = key
|
||||
pl.want = i
|
||||
if v >= 0 { pl.want = v }
|
||||
}
|
||||
|
||||
# the one-shot a request goes by: a `via` edge from where the code last asked (or "*") to this state,
|
||||
# whose clip the rig carries; -1 for none
|
||||
function as_via(pl: AnimPlayer, key: string) -> int {
|
||||
let s = AnimSets[pl.set]
|
||||
if s.transitions == null { return -1 }
|
||||
for i in 0 .. len(s.transitions) {
|
||||
let tr = s.transitions[i]
|
||||
if tr.via != "" and tr.to == key and (tr.from == "*" or tr.from == pl.asked) and animset_can(pl, tr.via) { return as_state(s, tr.via) }
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
# the state is in the set and the rig carries one of its clips: a one-shot with none is not asked for
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue