Allow proposers to commit their own travel
Verify and publish checkpoint container / container (push) Successful in 11m23s
Verify and publish checkpoint container / container (push) Successful in 11m23s
This commit is contained in:
1 parent
235696263a
commit
13c337a24a
11 files changed
+456
-27
No files matched your search
+9
-3
@@ -6067,6 +6067,11 @@ function publicDealImmediateSignature(deal: PublicDeal): string {
|
||||
function publicDealSettlementSignature(deal: PublicDeal, frame: NonNullable<Game['pendingPublicDealSettlement']>): string {
|
||||
return JSON.stringify([publicDealImmediateSignature(deal),frame.next,frame.initiator,frame.turn,frame.phase]);
|
||||
}
|
||||
/** Travel ledgers need another participant as the originating party. Older
|
||||
* recipient-travel deals continue to identify their original proposer. */
|
||||
function publicDealTravelAsker(deal: PublicDeal): string {
|
||||
return publicDealTravelActor(deal) === deal.from ? deal.to : deal.from;
|
||||
}
|
||||
function publicDealIntegrity(g: Game, internalSettlement?: string): void {
|
||||
if (g.deals !== undefined) publicDealRule(() => validatePublicDeals(g.deals, g.players));
|
||||
const history = g.publicDealSettlementHistory ?? [];
|
||||
@@ -6103,7 +6108,7 @@ function publicDealIntegrity(g: Game, internalSettlement?: string): void {
|
||||
const deal = g.deals?.find(entry => entry.id === row.sourceDeal);
|
||||
const term = deal?.travel;
|
||||
requireRule(deal && term && ['active', 'released'].includes(deal.status) &&
|
||||
row.player === publicDealTravelActor(deal) && row.asker === deal.from && row.turn === publicDealTravelDueTurn(deal) &&
|
||||
row.player === publicDealTravelActor(deal) && row.asker === publicDealTravelAsker(deal) && row.turn === publicDealTravelDueTurn(deal) &&
|
||||
row.answer === term.answer && row.mixed.kind === 'action' &&
|
||||
row.mixed.action.kind === term.kind && row.mixed.action.territory === term.territory &&
|
||||
row.mixed.action.minimum === term.minimum && row.mixed.action.sector === undefined &&
|
||||
@@ -24467,7 +24472,7 @@ function bindPublicDealTravel(g: Game, deal: PublicDeal) {
|
||||
}
|
||||
initializeTravelOrder(g);
|
||||
(g.travelPromises ??= []).push({ ...claim, event: crypto.randomUUID(), sourceDeal: deal.id,
|
||||
player: player.id, asker: deal.from, answer: term.answer, compiled: { kind: 'action', action },
|
||||
player: player.id, asker: publicDealTravelAsker(deal), answer: term.answer, compiled: { kind: 'action', action },
|
||||
shipment: { pending: due > g.turn || g.phase < 5 || shipmentAvailable(g, player), event: null },
|
||||
progress: [], movementClosed: false, fulfilled: false, released: false });
|
||||
appendTravelOrder(g, 'travel', g.travelPromises.length - 1);
|
||||
@@ -43888,7 +43893,8 @@ function applyActionWithInitiator(state: Game, id: string, action: Action, initi
|
||||
next = publicDealRule(() => releasePublicDeal(current, g.players, id, action.agree as boolean));
|
||||
} else next = publicDealRule(() => withdrawPublicDeal(current, g.players, id));
|
||||
if (current.status === 'offered' && next.status === 'active' && next.travel) {
|
||||
requireRule(id === publicDealTravelActor(next), 'The traveler must give the final consent.');
|
||||
requireRule(publicDealTravelActor(next) === next.from || id === publicDealTravelActor(next),
|
||||
'The traveler must give the final consent.');
|
||||
bindPublicDealTravel(g, next);
|
||||
}
|
||||
if (current.status === 'active' && next.status === 'released' && next.travel) {
|
||||
|
||||
Reference in new issue
Block a user