urbit/pkg/arvo/ted/ph/group-rejoin.hoon

73 lines
2.0 KiB
Plaintext
Raw Normal View History

2020-05-15 01:50:04 +03:00
/- spider
/+ *ph-io
=>
|%
++ wait-for-agent-start
|= [=ship agent=term]
=/ m (strand:spider ,~)
^- form:m
=* loop $
;< [her=^ship =unix-effect] bind:m take-unix-effect
2020-05-25 08:52:54 +03:00
?: (is-dojo-output:util ship her unix-effect "activated app home/{(trip agent)}")
2020-05-15 01:50:04 +03:00
(pure:m ~)
loop
::
++ start-agent
|= [=ship agent=term]
=/ m (strand:spider ,~)
^- form:m
=* loop $
;< ~ bind:m (dojo ship "|start {<agent>}")
;< ~ bind:m (wait-for-agent-start ship agent)
(pure:m ~)
::
++ wait-for-goad
|= =ship
=/ m (strand:spider ,~)
^- form:m
=* loop $
;< [her=^ship =unix-effect] bind:m take-unix-effect
?: (is-dojo-output:util ship her unix-effect "p=%hood q=%bump")
(pure:m ~)
loop
::
++ start-group-agents
|= =ship
=/ m (strand:spider ,~)
^- form:m
;< ~ bind:m (start-agent ship %group-store)
2020-05-25 08:52:54 +03:00
;< ~ bind:m (start-agent ship %group-hook)
2020-05-15 01:50:04 +03:00
(pure:m ~)
--
=, strand=strand:spider
^- thread:spider
|= args=vase
=/ m (strand ,vase)
;< az=tid:spider
bind:m start-azimuth
;< ~ bind:m (spawn az ~bud)
2020-05-25 08:52:54 +03:00
;< ~ bind:m (spawn az ~marbud)
2020-05-15 01:50:04 +03:00
;< ~ bind:m (spawn az ~zod)
2020-05-25 08:52:54 +03:00
;< ~ bind:m (spawn az ~marzod)
2020-05-15 01:50:04 +03:00
;< ~ bind:m (real-ship az ~bud)
2020-05-25 08:52:54 +03:00
;< ~ bind:m (real-ship az ~marbud)
;< ~ bind:m (wait-for-goad ~marbud)
2020-05-15 01:50:04 +03:00
;< ~ bind:m (real-ship az ~zod)
2020-05-25 08:52:54 +03:00
;< ~ bind:m (real-ship az ~marzod)
;< ~ bind:m (wait-for-goad ~marzod)
;< ~ bind:m (start-group-agents ~marbud)
;< ~ bind:m (start-group-agents ~marzod)
;< ~ bind:m (dojo ~marbud ":group-store|create 'test-group'")
;< ~ bind:m (wait-for-output ~marbud ">=")
;< ~ bind:m (dojo ~marzod ":group-hook|add ~marbud 'test-group'")
;< ~ bind:m (wait-for-output ~marzod ">=")
;< ~ bind:m (sleep ~s1)
;< ~ bind:m (breach-and-hear az ~marzod ~marbud)
;< ~ bind:m (real-ship az ~marzod)
;< ~ bind:m (wait-for-goad ~marzod)
;< ~ bind:m (start-group-agents ~marzod)
;< ~ bind:m (dojo ~marzod ":group-hook|add ~marbud 'test-group'")
;< ~ bind:m (sleep ~s3)
;< ~ bind:m end-azimuth
2020-05-15 01:50:04 +03:00
(pure:m *vase)