Merge remote-tracking branch 'origin/yu/ames-fixes' into philip/tomb

This commit is contained in:
Philip Monk 2022-05-17 14:07:05 -07:00
commit 7e4ad62a51

View File

@ -788,6 +788,13 @@
|= [now=@da eny=@ rof=roof] |= [now=@da eny=@ rof=roof]
=* larval-gate . =* larval-gate .
=* adult-core (adult-gate +<) =* adult-core (adult-gate +<)
=< |%
++ call ^call
++ load ^load
++ scry ^scry
++ stay ^stay
++ take ^take
--
|% |%
:: +call: handle request $task :: +call: handle request $task
:: ::
@ -800,17 +807,8 @@
?^ dud ?^ dud
~|(%ames-larval-call-dud (mean tang.u.dud)) ~|(%ames-larval-call-dud (mean tang.u.dud))
:: ::
=/ update-ready=? ?: &(?=(^ cached-state) ?=(~ queued-events))
?& ?=(^ cached-state) (molt ~)
?=(~ queued-events)
==
?: update-ready
=. ames-state.adult-gate
?> ?=(^ cached-state)
(state-5-to-6:load:adult-core +.u.cached-state)
=. cached-state ~
~> %slog.0^leaf/"ames: metamorphosis reload"
[~ adult-gate]
:: %born: set .unix-duct and start draining .queued-events :: %born: set .unix-duct and start draining .queued-events
:: ::
?: ?=(%born -.task) ?: ?=(%born -.task)
@ -840,11 +838,17 @@
~|(%ames-larval-take-dud (mean tang.u.dud)) ~|(%ames-larval-take-dud (mean tang.u.dud))
:: enqueue event if not a larval drainage timer :: enqueue event if not a larval drainage timer
:: ::
=? queued-events !=(/larva wire)
(~(put to queued-events) %take wire duct sign)
:: start drainage timer if have regressed from adult ames
::
?: ?& !=(/larva wire)
?=(^ cached-state)
==
[[duct %pass /larva %b %wait now]~ larval-gate]
:: XX what to do with errors? :: XX what to do with errors?
:: ::
?. =(/larva wire) ?. =(/larva wire) [~ larval-gate]
=. queued-events (~(put to queued-events) %take wire duct sign)
[~ larval-gate]
:: larval event drainage timer; pop and process a queued event :: larval event drainage timer; pop and process a queued event
:: ::
?. ?=([%behn %wake *] sign) ?. ?=([%behn %wake *] sign)
@ -883,20 +887,10 @@
%call (call:adult-core [duct ~ wrapped-task]:+.first-event) %call (call:adult-core [duct ~ wrapped-task]:+.first-event)
%take (take:adult-core [wire duct ~ sign]:+.first-event) %take (take:adult-core [wire duct ~ sign]:+.first-event)
== ==
=/ update-ready=?
?& ?=(^ cached-state)
?=(~ queued-events)
==
?: update-ready
=. ames-state.adult-gate
?> ?=(^ cached-state)
(state-5-to-6:load:adult-core +.u.cached-state)
=. cached-state ~
~> %slog.0^leaf/"ames: metamorphosis reload"
[moves adult-gate]
:: .queued-events has been cleared; metamorphose :: .queued-events has been cleared; metamorphose
:: ::
?~ queued-events ?~ queued-events
?: ?=(^ cached-state) (molt moves)
~> %slog.0^leaf/"ames: metamorphosis" ~> %slog.0^leaf/"ames: metamorphosis"
[moves adult-gate] [moves adult-gate]
:: set timer to drain next event :: set timer to drain next event
@ -956,6 +950,17 @@
=. adult-gate (load:adult-core %6 state.old) =. adult-gate (load:adult-core %6 state.old)
larval-gate larval-gate
== ==
:: +molt: re-evolve to adult-ames
::
++ molt
|= moves=(list move)
^- (quip move _adult-gate)
=. ames-state.adult-gate
?> ?=(^ cached-state)
(state-5-to-6:load:adult-core +.u.cached-state)
=. cached-state ~
~> %slog.0^leaf/"ames: metamorphosis reload"
[~ adult-gate]
-- --
:: adult ames, after metamorphosis from larva :: adult ames, after metamorphosis from larva
:: ::