From b1ff1eb3ffa4220f9de8da638ba53551f8bf7384 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Fri, 27 Aug 2021 12:24:59 +1000 Subject: [PATCH] treaty: fix allied treaties query --- pkg/garden/app/treaty.hoon | 49 +++++++++++++++++---------------- pkg/garden/gen/treaty/ally.hoon | 7 +++++ 2 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 pkg/garden/gen/treaty/ally.hoon diff --git a/pkg/garden/app/treaty.hoon b/pkg/garden/app/treaty.hoon index fa44eb69b6..26a218ac2d 100644 --- a/pkg/garden/app/treaty.hoon +++ b/pkg/garden/app/treaty.hoon @@ -37,8 +37,8 @@ ?> (team:title [our src]:bowl) |^ ?+ mark (on-poke:def mark vase) - %ally-update-0 (ally-diff !<(diff:ally vase)) - %alliance-update-0 (alliance-diff !<(diff:alliance vase)) + %ally-update-0 (ally-update !<(update:ally vase)) + %alliance-update-0 (alliance-update !<(update:alliance vase)) :: %noun =+ ;;([%add =desk] q.vase) @@ -48,27 +48,27 @@ `this == :: - ++ ally-diff - |= =diff:ally + ++ ally-update + |= =update:ally ^- (quip card _this) - =/ upd=card (ally-update:ca:cc diff) - =* ship ship.diff + =- [[(ally-update:ca:cc update) -.-] +.-] + ?< ?=(?(%ini %new) -.update) + =* ship ship.update ?< =(ship our.bowl) - =* al ~(. al:cc ship.diff) - ?- -.diff - %add [~[watch:al upd] this(allies (~(put by allies) ship *alliance))] - %del [~[leave:al upd] this(allies (~(del by allies) ship))] + =* al ~(. al:cc ship.update) + ?- -.update + %add [~[watch:al] this(allies (~(put by allies) ship *alliance))] + %del [~[leave:al] this(allies (~(del by allies) ship))] == :: - ++ alliance-diff - |= =diff:alliance + ++ alliance-update + |= =update:alliance ^- (quip card _this) - =- [[(alliance-update:ca:cc diff) -.-] +.-] - ^- (quip card _this) - =, diff - ?- -.diff + =- [[(alliance-update:ca:cc update) -.-] +.-] + ?+ -.update !! :: %add + =, update =. entente (~(put in entente) [ship desk]) ?. =(our.bowl ship) `this =* so ~(. so:cc desk) @@ -79,10 +79,11 @@ ~[publish warp give]:so :: %del + =, update =. entente (~(del in entente) [ship desk]) - ?. =(our.bowl ship) `this - =. sovereign (~(del by sovereign) desk) - :_(this ~(kick so:cc desk)^~) + ?. =(our.bowl ship) `this + =. sovereign (~(del by sovereign) desk) + :_(this ~(kick so:cc desk)^~) == -- :: @@ -121,12 +122,12 @@ :: [%x %treaties @ ~] =/ =ship (slav %p i.t.t.path) - =/ allied + =/ alliance (~(get ju allies) ship) + =/ allied %- ~(gas by *(map [^ship desk] treaty)) - %+ murn ~(tap by treaties) - |= [[s=^ship =desk] =treaty] - ?. =(s ship) ~ - `[[s desk] treaty] + %+ skim ~(tap by treaties) + |= [ref=[^ship desk] =treaty] + (~(has in alliance) ref) ``(treaty-update:cg:ca %ini allied) :: [%x %treaty @ @ ~] diff --git a/pkg/garden/gen/treaty/ally.hoon b/pkg/garden/gen/treaty/ally.hoon new file mode 100644 index 0000000000..896b8ec9d6 --- /dev/null +++ b/pkg/garden/gen/treaty/ally.hoon @@ -0,0 +1,7 @@ +:: :treaty|ally: Sync treaty data from ship +:: +:- %say +|= $: [now=@da eny=@uvJ bec=beak] + [[=ship ~] ~] + == +[%ally-update-0 %add desk]