forked from unimatrix/web
Project released Home Blocks as absent for native registration
This commit is contained in:
parent
46d13ea03e
commit
e94131d237
1 changed files with 9 additions and 2 deletions
|
|
@ -17,6 +17,7 @@ import {projectMilitaryClans} from './war-military-projection.mjs';
|
|||
const digest=value=>createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
||||
const bounded=(rows,max)=>{if(rows.length>max)throw Error('Native inventory exceeds supported batch');return rows;};
|
||||
export function nativeClanControllerIds(deed,authority){return [...new Set([deed.owner?.id,...(deed.root===deed.clan.id?[deed.heir?.id]:[]),...(authority.parentControllerIds||[])].filter(Boolean))].sort();}
|
||||
export function nativeHomeBlock(snapshot,revision){return snapshot?.source==='minecraft'&&snapshot.homeBlock?{...snapshot.homeBlock,revision:Number(revision),source:'minecraft'}:null;}
|
||||
// A consumer view of current deeds/keys, not a new organisation or permission store.
|
||||
// Initial creation and later edits/deletions use this same projection.
|
||||
export async function readGameNativeState(db,{clock=Date.now}={}){
|
||||
|
|
@ -74,7 +75,7 @@ export async function readGameNativeState(db,{clock=Date.now}={}){
|
|||
const snapshot=claim?JSON.parse(claim.snapshot_json):null;
|
||||
record.claimRevision=Number(claim?.revision||0);
|
||||
record.homeServer??=nativeServer(snapshot?.homeBlock?.worldName);
|
||||
record.homeBlock=snapshot?.source==='minecraft'?{...snapshot.homeBlock,revision:Number(claim.revision),source:'minecraft'}:null;
|
||||
record.homeBlock=nativeHomeBlock(snapshot,claim?.revision);
|
||||
record.claimTier=snapshot?.tier||null;record.claimedChunks=registeredClaimChunks(snapshot);record.usedChunks=record.claimedChunks.length;
|
||||
const relocation=snapshot?.relocation;
|
||||
if(relocation&&['cleanup','ready'].includes(relocation.phase)){
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff