treaty: fix allied treaties query

This commit is contained in:
Liam Fitzgerald 2021-08-27 12:24:59 +10:00
parent 54eea393b6
commit b1ff1eb3ff
2 changed files with 32 additions and 24 deletions

View File

@ -37,8 +37,8 @@
?> (team:title [our src]:bowl) ?> (team:title [our src]:bowl)
|^ |^
?+ mark (on-poke:def mark vase) ?+ mark (on-poke:def mark vase)
%ally-update-0 (ally-diff !<(diff:ally vase)) %ally-update-0 (ally-update !<(update:ally vase))
%alliance-update-0 (alliance-diff !<(diff:alliance vase)) %alliance-update-0 (alliance-update !<(update:alliance vase))
:: ::
%noun %noun
=+ ;;([%add =desk] q.vase) =+ ;;([%add =desk] q.vase)
@ -48,27 +48,27 @@
`this `this
== ==
:: ::
++ ally-diff ++ ally-update
|= =diff:ally |= =update:ally
^- (quip card _this) ^- (quip card _this)
=/ upd=card (ally-update:ca:cc diff) =- [[(ally-update:ca:cc update) -.-] +.-]
=* ship ship.diff ?< ?=(?(%ini %new) -.update)
=* ship ship.update
?< =(ship our.bowl) ?< =(ship our.bowl)
=* al ~(. al:cc ship.diff) =* al ~(. al:cc ship.update)
?- -.diff ?- -.update
%add [~[watch:al upd] this(allies (~(put by allies) ship *alliance))] %add [~[watch:al] this(allies (~(put by allies) ship *alliance))]
%del [~[leave:al upd] this(allies (~(del by allies) ship))] %del [~[leave:al] this(allies (~(del by allies) ship))]
== ==
:: ::
++ alliance-diff ++ alliance-update
|= =diff:alliance |= =update:alliance
^- (quip card _this) ^- (quip card _this)
=- [[(alliance-update:ca:cc diff) -.-] +.-] =- [[(alliance-update:ca:cc update) -.-] +.-]
^- (quip card _this) ?+ -.update !!
=, diff
?- -.diff
:: ::
%add %add
=, update
=. entente (~(put in entente) [ship desk]) =. entente (~(put in entente) [ship desk])
?. =(our.bowl ship) `this ?. =(our.bowl ship) `this
=* so ~(. so:cc desk) =* so ~(. so:cc desk)
@ -79,10 +79,11 @@
~[publish warp give]:so ~[publish warp give]:so
:: ::
%del %del
=, update
=. entente (~(del in entente) [ship desk]) =. entente (~(del in entente) [ship desk])
?. =(our.bowl ship) `this ?. =(our.bowl ship) `this
=. sovereign (~(del by sovereign) desk) =. sovereign (~(del by sovereign) desk)
:_(this ~(kick so:cc desk)^~) :_(this ~(kick so:cc desk)^~)
== ==
-- --
:: ::
@ -121,12 +122,12 @@
:: ::
[%x %treaties @ ~] [%x %treaties @ ~]
=/ =ship (slav %p i.t.t.path) =/ =ship (slav %p i.t.t.path)
=/ alliance (~(get ju allies) ship)
=/ allied =/ allied
%- ~(gas by *(map [^ship desk] treaty)) %- ~(gas by *(map [^ship desk] treaty))
%+ murn ~(tap by treaties) %+ skim ~(tap by treaties)
|= [[s=^ship =desk] =treaty] |= [ref=[^ship desk] =treaty]
?. =(s ship) ~ (~(has in alliance) ref)
`[[s desk] treaty]
``(treaty-update:cg:ca %ini allied) ``(treaty-update:cg:ca %ini allied)
:: ::
[%x %treaty @ @ ~] [%x %treaty @ @ ~]

View File

@ -0,0 +1,7 @@
:: :treaty|ally: Sync treaty data from ship
::
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[[=ship ~] ~]
==
[%ally-update-0 %add desk]