@tora-editor/tora 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/bin/tora.mjs +255 -29
- package/crates/packer/trusted/native-3d-meta.json +3 -3
- package/crates/packer/trusted/native-3d.js +180 -180
- package/crates/packer/trusted/native-meta.json +3 -3
- package/crates/packer/trusted/native.js +5 -5
- package/crates/packer/trusted/release-manifest.json +17 -17
- package/crates/packer/trusted/review-runtime-meta.json +3 -3
- package/crates/packer/trusted/review-runtime.js +182 -182
- package/docs/MIGRATION_0_3.md +39 -0
- package/docs/NATIVE_AGENT_TOOLS.md +12 -363
- package/docs/TORA_AGENT_SETUP.md +24 -106
- package/docs/TORA_CREATION_API.md +63 -365
- package/docs/reference/CORE_AUTHORING.md +8 -2
- package/docs/reference/PLAYABLE_STARTERS.md +1 -1
- package/docs/reference/packs/3d.md +2 -0
- package/package.json +6 -6
- package/packages/creative-project/project-v21.schema.json +108 -1
- package/scripts/lean/editor/entry.js +11 -6
- package/scripts/lean/editor/project-launcher.js +116 -0
- package/scripts/lean/editor/quick-edit-panel.js +479 -0
- package/scripts/lean/editor/review-editor.css +246 -68
- package/scripts/lean/editor/review-editor.js +1731 -1099
- package/scripts/lean/editor-state.mjs +6 -0
- package/scripts/lean/editor.mjs +6 -3
- package/scripts/lean/matrix.mjs +5 -0
- package/scripts/lean/native/agent-tools.mjs +35 -58
- package/scripts/lean/native/api.mjs +148 -134
- package/scripts/lean/native/audio-assets.mjs +30 -0
- package/scripts/lean/native/browser-pool.mjs +34 -0
- package/scripts/lean/native/build-cache.mjs +36 -5
- package/scripts/lean/native/contracts.mjs +8 -6
- package/scripts/lean/native/creative-qa.mjs +66 -12
- package/scripts/lean/native/demos.mjs +11 -20
- package/scripts/lean/native/document.mjs +14 -2
- package/scripts/lean/native/local-bundle.mjs +4 -2
- package/scripts/lean/native/mcp-server.mjs +16 -35
- package/scripts/lean/native/modules/harvest-restore.mjs +3 -284
- package/scripts/lean/native/modules/sort-puzzle.mjs +51 -0
- package/scripts/lean/native/modules/star-salvage.mjs +3 -368
- package/scripts/lean/native/project-bundle.mjs +3 -2
- package/scripts/lean/native/project-index.mjs +0 -2
- package/scripts/lean/native/qa-adapters.mjs +10 -0
- package/scripts/lean/native/quick-edit.mjs +328 -0
- package/scripts/lean/native/review.mjs +203 -572
- package/scripts/lean/native/schema-vocabulary.mjs +10 -0
- package/scripts/lean/native/schema.mjs +1 -1
- package/scripts/lean/native/scope.mjs +45 -0
- package/scripts/lean/native/service.mjs +242 -70
- package/scripts/lean/native/starters.mjs +135 -8
- package/scripts/lean/native/variant-adapters.mjs +8 -0
- package/scripts/lean/native/variants-core.mjs +186 -0
- package/scripts/lean/native/variants.mjs +63 -0
- package/scripts/lean/native/win-cues.mjs +1 -1
- package/skills/tora-playables/SKILL.md +1 -1
- package/scripts/lean/editor/review-intake.js +0 -837
- package/scripts/lean/model-client.mjs +0 -119
- package/scripts/lean/native/author-expansion-proofs.mjs +0 -143
- package/scripts/lean/native/author-fps.mjs +0 -545
- package/scripts/lean/native/author-games.mjs +0 -160
- package/scripts/lean/native/author-harvest.mjs +0 -74
- package/scripts/lean/native/author-primitive-proofs.mjs +0 -875
- package/scripts/lean/native/author-salvage.mjs +0 -71
- package/scripts/lean/native/chat-compose.mjs +0 -287
- package/scripts/lean/native/check-harvest-outcome-audio.mjs +0 -190
- package/scripts/lean/native/check-salvage.mjs +0 -200
- package/scripts/lean/native/compatibility.mjs +0 -34
- package/scripts/lean/native/concept.mjs +0 -633
- package/scripts/lean/native/draw-stroke.mjs +0 -26
- package/scripts/lean/native/erase-mask.mjs +0 -18
- package/scripts/lean/native/glb-loader.mjs +0 -468
- package/scripts/lean/native/harvest-recipe.mjs +0 -21
- package/scripts/lean/native/instance-steering.mjs +0 -24
- package/scripts/lean/native/intake-creator-agent.mjs +0 -98
- package/scripts/lean/native/intake-creator-tools.mjs +0 -218
- package/scripts/lean/native/interaction-gestures.mjs +0 -45
- package/scripts/lean/native/match-board.mjs +0 -138
- package/scripts/lean/native/modules/index.mjs +0 -54
- package/scripts/lean/native/modules/tap-collect.mjs +0 -54
- package/scripts/lean/native/path-network.mjs +0 -132
- package/scripts/lean/native/physics-2d.mjs +0 -154
- package/scripts/lean/native/physics-3d.mjs +0 -259
- package/scripts/lean/native/prepare-audio-collections.mjs +0 -112
- package/scripts/lean/native/prepare-fps-assets.mjs +0 -330
- package/scripts/lean/native/prepare-game-audio.mjs +0 -372
- package/scripts/lean/native/prepare-golf-3d-assets.py +0 -177
- package/scripts/lean/native/prepare-golf-assets.py +0 -211
- package/scripts/lean/native/prepare-harvest-audio.mjs +0 -83
- package/scripts/lean/native/prepare-harvest-images.mjs +0 -31
- package/scripts/lean/native/prepare-primitive-images.py +0 -25
- package/scripts/lean/native/prepare-space-salvage-images.mjs +0 -89
- package/scripts/lean/native/prepare-traffic-assets.py +0 -329
- package/scripts/lean/native/presentation.mjs +0 -335
- package/scripts/lean/native/review-agent-tools.mjs +0 -561
- package/scripts/lean/native/review-connection.mjs +0 -303
- package/scripts/lean/native/review-fields.mjs +0 -24
- package/scripts/lean/native/review-intake.mjs +0 -385
- package/scripts/lean/native/review-intents.mjs +0 -217
- package/scripts/lean/native/review-provider.mjs +0 -580
- package/scripts/lean/native/review-receipts.mjs +0 -76
- package/scripts/lean/native/review-resolver.mjs +0 -429
- package/scripts/lean/native/review-targets.mjs +0 -35
- package/scripts/lean/native/runtime.mjs +0 -1809
- package/scripts/lean/native/salvage-recipe.mjs +0 -20
- package/scripts/lean/native/stage-3d.mjs +0 -1121
- package/scripts/lean/native/verify.mjs +0 -4
- package/scripts/lean/scene-document.mjs +0 -48
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/** Bounded chat-completions transport. Does not execute tools or log credentials. */
|
|
2
|
-
import {Buffer} from 'node:buffer';
|
|
3
|
-
import {URL} from 'node:url';
|
|
4
|
-
export class PlanError extends Error{constructor(code){super(code);this.code=code;}}
|
|
5
|
-
function secretIn(value,key){if(typeof value==='string')return value.includes(key);if(value&&typeof value==='object')return Object.values(value).some(v=>secretIn(v,key));return false;}
|
|
6
|
-
function reject(code){throw new PlanError(code);}
|
|
7
|
-
async function boundedJson(response,limit,secret){
|
|
8
|
-
if(Number(response.headers.get('content-length'))>limit){await response.body?.cancel();reject('E_MODEL_RESPONSE_LIMIT');}
|
|
9
|
-
const reader=response.body?.getReader();if(!reader)reject('E_MODEL_RESPONSE');let size=0;const chunks=[];
|
|
10
|
-
try{for(;;){const {done,value}=await reader.read();if(done)break;size+=value.length;if(size>limit)reject('E_MODEL_RESPONSE_LIMIT');chunks.push(value);}}
|
|
11
|
-
finally{await reader.cancel().catch(()=>{});reader.releaseLock();}
|
|
12
|
-
let raw;try{raw=new globalThis.TextDecoder('utf-8',{fatal:true}).decode(Buffer.concat(chunks));}catch{reject('E_MODEL_RESPONSE');}
|
|
13
|
-
if(raw.includes(secret))reject('E_MODEL_SECRET_IN_RESPONSE');
|
|
14
|
-
let value;try{value=JSON.parse(raw);}catch{reject('E_MODEL_RESPONSE');}if(secretIn(value,secret))reject('E_MODEL_SECRET_IN_RESPONSE');return value;
|
|
15
|
-
}
|
|
16
|
-
function usageOf(value,config){
|
|
17
|
-
if(!value||typeof value!=='object')return null;
|
|
18
|
-
const input=value.prompt_tokens,output=value.completion_tokens,cacheReported=value.prompt_cache_hit_tokens??value.prompt_tokens_details?.cached_tokens,cached=cacheReported??0;
|
|
19
|
-
if(![input,output,cached].every(x=>Number.isSafeInteger(x)&&x>=0)||cached>input)return null;
|
|
20
|
-
return {inputTokens:input,outputTokens:output,cachedInputTokens:cacheReported===undefined?null:cached,estimatedUsd:((input-cached)*config.inputUsdPerMillion+cached*config.cachedInputUsdPerMillion+output*config.outputUsdPerMillion)/1e6,costBasis:cacheReported===undefined?'cache usage not reported; all input conservatively priced as uncached':config.cachePriceConfigured?'configured-input-cache-output-rates':'configured-input-output-rates; cached input conservatively priced as uncached'};
|
|
21
|
-
}
|
|
22
|
-
const notRetryable=new Set(['E_PLAN_UNSUPPORTED','E_MODEL_TOOLS','E_MODEL_SECRET_IN_RESPONSE','E_MODEL_RESPONSE_LIMIT','E_MODEL_USAGE_LIMIT']);
|
|
23
|
-
async function httpFailure(response,config,call){
|
|
24
|
-
const {status}=response;
|
|
25
|
-
call.httpStatus=status;
|
|
26
|
-
call.retryable=status===429||status>=500;
|
|
27
|
-
if(!config.orcaFreeTier){
|
|
28
|
-
await response.body?.cancel();
|
|
29
|
-
return 'E_MODEL_HTTP';
|
|
30
|
-
}
|
|
31
|
-
if(status===501)call.retryable=false;
|
|
32
|
-
if(status===400||status===429){
|
|
33
|
-
const payload=await boundedJson(response,8192,config.apiKey).catch(()=>undefined);
|
|
34
|
-
const error=payload?.error;
|
|
35
|
-
const details=error?.code==='free_rate_limited'?error.metadata:undefined;
|
|
36
|
-
if(status===400&&details?.reason==='err_free_prompt_cap')return 'E_MODEL_FREE_PROMPT_LIMIT';
|
|
37
|
-
if(status===429&&details?.reason==='err_free_access_denied'){
|
|
38
|
-
call.retryable=false;
|
|
39
|
-
return 'E_MODEL_FREE_ACCESS';
|
|
40
|
-
}
|
|
41
|
-
if(status===429){
|
|
42
|
-
const retryAfter=response.headers.get('Retry-After');
|
|
43
|
-
const seconds=details?.retry_after_seconds??(/^\d+$/.test(retryAfter??'')?Number(retryAfter):undefined);
|
|
44
|
-
if(Number.isSafeInteger(seconds)&&seconds>=0)call.retryAfterSeconds=seconds;
|
|
45
|
-
if(details?.reason==='err_free_rate'&&call.retryAfterSeconds===undefined)return 'E_MODEL_FREE_CAPACITY';
|
|
46
|
-
}
|
|
47
|
-
}else{
|
|
48
|
-
await response.body?.cancel().catch(()=>{});
|
|
49
|
-
}
|
|
50
|
-
if(status===401)return 'E_MODEL_AUTH';
|
|
51
|
-
if(status===403)return 'E_MODEL_FORBIDDEN';
|
|
52
|
-
if(status===402)return 'E_MODEL_QUOTA';
|
|
53
|
-
if(status===404||status===410)return 'E_MODEL_UNAVAILABLE';
|
|
54
|
-
if(status===429)return 'E_MODEL_RATE_LIMIT';
|
|
55
|
-
if(status===408||status===504)return 'E_MODEL_TIMEOUT';
|
|
56
|
-
return status>=500&&status!==501?'E_MODEL_UPSTREAM':'E_MODEL_REQUEST';
|
|
57
|
-
}
|
|
58
|
-
export async function requestChatCompletion({config,request,fetchImpl=globalThis.fetch,call={}}){
|
|
59
|
-
if(secretIn(request,config.apiKey))reject('E_MODEL_SECRET_IN_PROMPT');
|
|
60
|
-
let response;
|
|
61
|
-
try{
|
|
62
|
-
response=await fetchImpl(config.endpoint,{method:'POST',redirect:'error',signal:globalThis.AbortSignal.timeout(config.timeoutMs),
|
|
63
|
-
headers:{'Content-Type':'application/json',Authorization:'Bearer '+config.apiKey},body:JSON.stringify(request)});
|
|
64
|
-
}catch(error){reject(error.name==='TimeoutError'||error.name==='AbortError'?'E_MODEL_TIMEOUT':'E_MODEL_TRANSPORT');}
|
|
65
|
-
if(!response.ok){
|
|
66
|
-
const failure=new PlanError(await httpFailure(response,config,call));
|
|
67
|
-
if(call.retryAfterSeconds!==undefined)failure.retryAfterSeconds=call.retryAfterSeconds;
|
|
68
|
-
throw failure;
|
|
69
|
-
}
|
|
70
|
-
let envelope;
|
|
71
|
-
try{envelope=await boundedJson(response,config.maximumResponseBytes,config.apiKey);}
|
|
72
|
-
catch(error){
|
|
73
|
-
if(error.name==='TimeoutError'||error.name==='AbortError')reject('E_MODEL_TIMEOUT');
|
|
74
|
-
if(error instanceof TypeError)reject('E_MODEL_TRANSPORT');
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
if(!envelope||typeof envelope!=='object'||Array.isArray(envelope))reject('E_MODEL_RESPONSE');
|
|
78
|
-
if(config.orcaFreeTier&&envelope.error)reject('E_MODEL_UPSTREAM');
|
|
79
|
-
return envelope;
|
|
80
|
-
}
|
|
81
|
-
export async function requestCreativePlan({config,messages,projectId,ownedAssetIds=[],telemetry,fetchImpl=globalThis.fetch,validateResponse}){
|
|
82
|
-
if(typeof validateResponse!=='function')reject('E_MODEL_RESPONSE');
|
|
83
|
-
if(config.mode!=='live'||!config.billableCallsEnabled)reject('E_MODEL_NOT_CONFIGURED');
|
|
84
|
-
if(!Number.isInteger(config.maximumAttempts)||config.maximumAttempts<1||config.maximumAttempts>2||!Number.isInteger(config.maximumRetries)||config.maximumRetries<0||config.maximumRetries>1||config.maximumAttempts!==config.maximumRetries+1)reject('E_MODEL_LIMIT_CONFIG');
|
|
85
|
-
for(const [value,min,max]of [[config.maximumInputTokens,8192,131072],[config.maximumOutputTokens,512,8192],[config.maximumResponseBytes,1024,262144],[config.timeoutMs,100,120000]])if(!Number.isInteger(value)||value<min||value>max)reject('E_MODEL_LIMIT_CONFIG');
|
|
86
|
-
for(const value of [config.inputUsdPerMillion,config.outputUsdPerMillion,config.cachedInputUsdPerMillion])if(!Number.isFinite(value)||value<0||value>1000)reject('E_MODEL_LIMIT_CONFIG');
|
|
87
|
-
if(!Number.isFinite(config.maximumSpendUsd)||config.maximumSpendUsd<=0||config.maximumSpendUsd>100)reject('E_MODEL_LIMIT_CONFIG');
|
|
88
|
-
const reserve=(config.maximumInputTokens*config.inputUsdPerMillion+config.maximumOutputTokens*config.outputUsdPerMillion)/1e6;
|
|
89
|
-
telemetry.providerOrigin=new URL(config.endpoint).origin;telemetry.requestedModel=config.model;telemetry.pricing={inputUsdPerMillion:config.inputUsdPerMillion,outputUsdPerMillion:config.outputUsdPerMillion,cachedInputUsdPerMillion:config.cachedInputUsdPerMillion,basis:'Configured rates, not verified provider billing'};telemetry.limits={inputTokens:config.maximumInputTokens,outputTokens:config.maximumOutputTokens,responseBytes:config.maximumResponseBytes,timeoutMs:config.timeoutMs};telemetry.endpointClass=config.endpointClass;telemetry.protocol=config.protocol;telemetry.calls=[];telemetry.maximumSpendUsd=config.maximumSpendUsd;telemetry.maximumRetries=config.maximumRetries;telemetry.reservedUpperBoundUsd=0;telemetry.estimatedReportedUsageUsd=null;
|
|
90
|
-
if(secretIn(messages,config.apiKey))reject('E_MODEL_SECRET_IN_PROMPT');
|
|
91
|
-
const deadline=Date.now()+config.timeoutMs;
|
|
92
|
-
for(let attempt=0;attempt<config.maximumAttempts;attempt++){
|
|
93
|
-
// UTF-8 message bytes upper-bound byte-tokenizers, with 4096 reserved for framing.
|
|
94
|
-
// Provider-hidden/system overhead and configured rates remain provider trust assumptions.
|
|
95
|
-
if(Buffer.byteLength(JSON.stringify(messages),'utf8')+4096>config.maximumInputTokens)reject('E_MODEL_INPUT_LIMIT');
|
|
96
|
-
if(telemetry.reservedUpperBoundUsd+reserve>config.maximumSpendUsd+1e-12)reject('E_MODEL_BUDGET');
|
|
97
|
-
const remaining=deadline-Date.now();if(remaining<=0)reject('E_MODEL_TIMEOUT');
|
|
98
|
-
const started=Date.now(),call={attempt:attempt+1,status:'STARTED',usage:null};telemetry.calls.push(call);telemetry.reservedUpperBoundUsd+=reserve;
|
|
99
|
-
try{
|
|
100
|
-
const request={model:config.model,messages,max_tokens:config.maximumOutputTokens,response_format:{type:'json_object'},stream:false,
|
|
101
|
-
...(config.disableThinking?{thinking:{type:'disabled'}}:{})};
|
|
102
|
-
const envelope=await requestChatCompletion({config:{...config,timeoutMs:remaining},request,fetchImpl,call});
|
|
103
|
-
call.usage=usageOf(envelope.usage,config);if(call.usage)telemetry.estimatedReportedUsageUsd=(telemetry.estimatedReportedUsageUsd??0)+call.usage.estimatedUsd;
|
|
104
|
-
if(call.usage&&(call.usage.inputTokens>config.maximumInputTokens||call.usage.outputTokens>config.maximumOutputTokens))reject('E_MODEL_USAGE_LIMIT');
|
|
105
|
-
if(typeof envelope.model==='string'&&envelope.model.length<=128&&Array.from(envelope.model).every(c=>c.codePointAt(0)>=32&&c.codePointAt(0)!==127))call.reportedModel=envelope.model;
|
|
106
|
-
const choice=envelope.choices?.[0];if(choice?.message?.tool_calls?.length||choice?.finish_reason==='tool_calls')reject('E_MODEL_TOOLS');
|
|
107
|
-
if(choice?.finish_reason!=='stop'||typeof choice?.message?.content!=='string'||!choice.message.content.trim())reject('E_MODEL_INCOMPLETE');
|
|
108
|
-
const plan=validateResponse(choice.message.content,{projectId,ownedAssetIds});if(secretIn(plan,config.apiKey))reject('E_MODEL_SECRET_IN_RESPONSE');call.status='VALIDATED';return plan;
|
|
109
|
-
}catch(error){
|
|
110
|
-
const code=error instanceof PlanError?error.code:error.name==='AbortError'||error.name==='TimeoutError'?'E_MODEL_TIMEOUT':'E_MODEL_RESPONSE';call.status='REJECTED';call.error=code;
|
|
111
|
-
if(attempt+1>=config.maximumAttempts||notRetryable.has(code)||call.retryable===false||Date.now()>=deadline){
|
|
112
|
-
const failure=new PlanError(code);
|
|
113
|
-
if(call.retryAfterSeconds!==undefined)failure.retryAfterSeconds=call.retryAfterSeconds;
|
|
114
|
-
throw failure;
|
|
115
|
-
}
|
|
116
|
-
}finally{call.durationMs=Date.now()-started;}
|
|
117
|
-
}
|
|
118
|
-
reject('E_MODEL_ATTEMPTS');
|
|
119
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
|
-
import {resolve,dirname} from 'node:path';
|
|
3
|
-
import {fileURLToPath} from 'node:url';
|
|
4
|
-
import {mkdir,writeFile} from 'node:fs/promises';
|
|
5
|
-
import {AssetCatalog} from './asset-catalog.mjs';
|
|
6
|
-
import {emptyProject,applyOperations} from './document.mjs';
|
|
7
|
-
import {compileNative} from './compiler.mjs';
|
|
8
|
-
import {createSkyBlasterProject} from './author-fps.mjs';
|
|
9
|
-
|
|
10
|
-
async function proofAssets(requests){
|
|
11
|
-
const catalog=new AssetCatalog();await catalog.load();const assets=[],records=[];
|
|
12
|
-
for(const [id,sourceId,name,collection] of requests){
|
|
13
|
-
const entry=[...catalog.entries.values()].find(asset=>asset.sourceId===sourceId&&asset.name===name&&(!collection||asset.tags.includes(collection)));if(!entry)throw Error('Missing proof asset '+sourceId+'/'+name);
|
|
14
|
-
const bytes=await catalog.bytes(entry.id),record={id,hash:entry.sha256,mime:entry.mime,bytes:bytes.length,rights:entry.rights,provenance:JSON.stringify(entry.provenance)};records.push(record);assets.push({...record,data:bytes.toString('base64')});
|
|
15
|
-
}
|
|
16
|
-
return {assets,records};
|
|
17
|
-
}
|
|
18
|
-
const component=(id,contract,parameters={},extra={})=>({kind:'createComponent',component:{id,contract,parameters,...extra}});
|
|
19
|
-
const behavior=(id,componentId,kind,parameters)=>({kind:'putBehavior',behavior:{id,componentId,kind,parameters}});
|
|
20
|
-
const binding=(id,event,actions,condition)=>({kind:'putBinding',binding:{id,event,actions,...(condition?{condition}:{})}});
|
|
21
|
-
const image=(id,assetId,x,y,width=64,height=64,extra={})=>component(id,'native.image.v1',{width,height,fit:'contain',smoothing:false},{transform:[1,0,0,1,x,y],assetSlots:[{slotId:'source',assetId}],...extra});
|
|
22
|
-
const text=(id,value,x,y,width,height,fontSize=24,extra={})=>component(id,'native.text.v1',{text:value,width,height,fontSize,fontFamily:'pixel',color:'#fff0bd',align:'center'}, {transform:[1,0,0,1,x,y],...extra});
|
|
23
|
-
const group=(id,x=0,y=0,width=390,height=700,extra={})=>component(id,'native.group.v1',{width,height},{transform:[1,0,0,1,x,y],...extra});
|
|
24
|
-
const layout=(id,x,y,scaleX=1,scaleY=scaleX,anchor='none')=>behavior(id+'.layout',id,'responsive-layout',{x,y,scaleX,scaleY,anchor,respectSafeArea:false,marginX:16,marginY:16});
|
|
25
|
-
const drag=(id,tag='crop')=>behavior(id+'.drag',id,'drag',{axis:'both',snapBack:true,snapBackSeconds:.16,bringToFront:true,tag});
|
|
26
|
-
const zone=(id,onOccupied='emit',acceptTags=['crop'])=>behavior(id+'.zone',id,'drop-zone',{acceptTags,snapMode:'center',capacity:1,onOccupied,radiusPx:0,highlightColor:'#ffe66d'});
|
|
27
|
-
const emitter=(id,componentId,coverage='local')=>behavior(id,componentId,'emitter',{count:32,color:'#ffe66d',color2:'#95bf48',color3:'#fff0bd',speed:150,lifetime:.8,gravity:220,spread:360,shape:'pixel-confetti',coverage,origin:'center',direction:-90});
|
|
28
|
-
const audio=(id,componentId,role,bus='sfx',loop=false,volume=.3)=>behavior(id,componentId,'audio',{bus,loop,volume,frequency:660,seconds:.15,cooldownMs:45,pitchJitter:0,pitchStep:0,role,allowSynthFallback:false});
|
|
29
|
-
|
|
30
|
-
export async function createFarmMergeProof(){
|
|
31
|
-
const {assets,records}=await proofAssets([
|
|
32
|
-
['farm.crop.1','kenney-tiny-farm','tile_0029.png'],['farm.crop.2','kenney-tiny-farm','tile_0020.png'],['farm.crop.3','kenney-tiny-farm','tile_0030.png'],['farm.crate.art','kenney-tiny-farm','tile_0047.png'],
|
|
33
|
-
['farm.ambient','tarush-singhal-happy-ukelele','ambient.wav','casual'],['farm.match','kenney-interface-sounds','match.wav','casual'],['farm.win','kenney-music-jingles','win.wav','casual'],
|
|
34
|
-
]);
|
|
35
|
-
const ops=[group('farm.hud',0,0),group('farm.board',25,225,340,220),group('farm.end.hero',95,130,200,200,{sceneId:'scene.win'}),group('farm.end.ui',0,370,390,260,{sceneId:'scene.win'}),group('farm.audio',0,0,1,1,{parameters:{width:1,height:1,visible:false}}),
|
|
36
|
-
layout('farm.hud',345,70,.85),layout('farm.board',44,102,.85),layout('farm.end.hero',75,95,1),layout('farm.end.ui',320,95,.82),
|
|
37
|
-
group('farm.background',0,0,390,700,{order:-10}),layout('farm.background',0,0,700/390,390/700),component('farm.background.fill','native.rectangle.v1',{width:390,height:700,fill:'#254b3c',strokeWidth:0},{parentId:'farm.background'}),
|
|
38
|
-
text('farm.title','FARM MERGE',60,52,270,52,32,{parentId:'farm.hud'}),text('farm.prompt','DRAG TO MERGE',75,110,240,34,18,{parentId:'farm.hud'}),text('farm.score','0 / 3',135,152,120,34,20,{parentId:'farm.hud'}),
|
|
39
|
-
group('farm.end.back',0,0,390,700,{sceneId:'scene.win',order:-10}),layout('farm.end.back',0,0,700/390,390/700),component('farm.end.back.fill','native.rectangle.v1',{width:390,height:700,fill:'#254b3c',strokeWidth:0},{sceneId:'scene.win',parentId:'farm.end.back'}),
|
|
40
|
-
image('farm.end.crop','farm.crop.3',0,0,200,200,{parentId:'farm.end.hero',sceneId:'scene.win'}),text('farm.end.title','BUMPER CROP',20,0,350,54,32,{parentId:'farm.end.ui',sceneId:'scene.win'}),
|
|
41
|
-
component('farm.end.cta','native.button.v1',{width:260,height:78,fill:'#f2b544',hoverFill:'#ffe66d',pressedFill:'#d88b32',stroke:'#3c2933',strokeWidth:4,radius:8,presentation:'shiny-cta'},{parentId:'farm.end.ui',sceneId:'scene.win',transform:[1,0,0,1,65,92]}),
|
|
42
|
-
text('farm.end.cta.label','GROW NOW',10,8,240,58,26,{parentId:'farm.end.cta',sceneId:'scene.win'}),
|
|
43
|
-
behavior('farm.end.cta.float','farm.end.cta','animation',{property:'y',from:92,to:84,seconds:.8,loop:true,fromCurrent:false,delay:0,easing:'ease-in-out'}),
|
|
44
|
-
behavior('farm.end.hero.bob','farm.end.hero','animation',{property:'y',from:130,to:118,seconds:1.1,loop:true,fromCurrent:false,delay:0,easing:'ease-in-out'}),
|
|
45
|
-
binding('farm.end.enter',{kind:'sceneEnter',sceneId:'scene.win'},[{kind:'animate',behaviorId:'farm.end.hero.bob'},{kind:'animate',behaviorId:'farm.end.cta.float'},{kind:'emit',behaviorId:'farm.end.confetti'},{kind:'playAudio',behaviorId:'farm.win.sound'}]),
|
|
46
|
-
binding('farm.end.store',{kind:'click',componentId:'farm.end.cta'},[{kind:'store'}]),emitter('farm.end.confetti','farm.end.hero','screen'),
|
|
47
|
-
];
|
|
48
|
-
ops.push({kind:'createScene',scene:{id:'scene.win',label:'Harvest complete',role:'end-card'}});
|
|
49
|
-
const slots=[];for(let row=0;row<2;row++)for(let column=0;column<3;column++){
|
|
50
|
-
const id=`farm.slot.${row}.${column}`,x=column*120,y=row*120;slots.push(id);ops.push(component(id,'native.rectangle.v1',{width:100,height:100,fill:'#3c5d42',stroke:'#8ba35c',strokeWidth:4,radius:10},{parentId:'farm.board',transform:[1,0,0,1,x,y]}),zone(id,'swap',[]));
|
|
51
|
-
}
|
|
52
|
-
const cropIds=['farm.crop.a','farm.crop.b','farm.crop.c','farm.crop.d'];cropIds.forEach((id,index)=>{const slot=slots[index],slotComponent=ops.find(op=>op.component?.id===slot).component,[x,y]=[slotComponent.transform[4]+18,slotComponent.transform[5]+18];ops.push(image(id,'farm.crop.1',x,y,64,64,{parentId:'farm.board',order:2}),drag(id),zone(id,'emit'),emitter(id+'.burst',id));});
|
|
53
|
-
ops.push(image('farm.crate','farm.crate.art',138,138,64,64,{parentId:'farm.board',order:2}),drag('farm.crate','crate'));
|
|
54
|
-
ops.push(image('farm.tier2','farm.crop.2',0,0,64,64,{prototype:true}),drag('farm.tier2'),zone('farm.tier2','emit'),emitter('farm.tier2.burst','farm.tier2'),image('farm.tier3','farm.crop.3',0,0,64,64,{prototype:true}));
|
|
55
|
-
for(let first=0;first<cropIds.length;first++)for(let second=0;second<cropIds.length;second++){
|
|
56
|
-
if(first===second)continue;
|
|
57
|
-
const a=cropIds[first],b=cropIds[second];ops.push(binding(`farm.merge.${first}.${second}`,{kind:'dragDrop',componentId:a,otherId:b},[{kind:'add',variableId:'farm.merges',value:1},{kind:'spawnAt',prototypeId:'farm.tier2',targetComponentId:a,offsetX:0,offsetY:0,at:'midpoint'},{kind:'setComponent',componentId:a,key:'visible',value:false},{kind:'setComponent',componentId:b,key:'visible',value:false},{kind:'emit',behaviorId:a+'.burst'},{kind:'playAudio',behaviorId:'farm.match.sound'}]));
|
|
58
|
-
}
|
|
59
|
-
ops.push(binding('farm.merge.final',{kind:'dragDrop',componentId:'farm.tier2',otherId:'farm.tier2'},[{kind:'add',variableId:'farm.merges',value:1},{kind:'spawnAt',prototypeId:'farm.tier3',targetComponentId:'farm.tier2',offsetX:0,offsetY:0,at:'midpoint'},{kind:'despawn',target:'both'},{kind:'emit',behaviorId:'farm.tier2.burst'},{kind:'changeScene',sceneId:'scene.win'}]));
|
|
60
|
-
for(const [id,assetId,role,bus,loop,volume] of [['ambient','farm.ambient','ambient','music',true,.12],['match','farm.match','match','sfx',false,.35],['win','farm.win','win','stinger',false,.45]])ops.push(component('farm.audio.'+id,'native.group.v1',{width:1,height:1,visible:false},{parentId:'farm.audio',assetSlots:[{slotId:'source',assetId}]}),audio('farm.'+id+'.sound','farm.audio.'+id,role,bus,loop,volume));
|
|
61
|
-
ops.push({kind:'putVariable',variable:{id:'farm.merges',label:'Merges',type:'number',initial:0}});
|
|
62
|
-
for(const dragId of [...cropIds,'farm.crate'])ops.push(binding('farm.music.'+dragId,{kind:'dragStart',componentId:dragId},[{kind:'playAudio',behaviorId:'farm.ambient.sound'}]));
|
|
63
|
-
const project=applyOperations(emptyProject({id:'farm-merge-proof',name:'Farm Merge',androidUrl:'https://play.google.com/store/apps/details?id=com.tora.farmmerge'}),[...records.map(asset=>({kind:'registerAsset',asset})),...ops]).project;
|
|
64
|
-
project.components.find(c=>c.id==='farm.score').parameters.text='{{farm.merges}} / 3';
|
|
65
|
-
return {project,assets};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export async function createStarBastionProof(){
|
|
69
|
-
const {assets,records}=await proofAssets([
|
|
70
|
-
['star.background.art','kenney-space-shooter-redux','darkPurple.png'],['star.player.art','kenney-space-shooter-redux','playerShip1_blue.png'],['star.bolt.art','kenney-space-shooter-redux','fire03.png'],['star.enemy.art','kenney-space-shooter-redux','meteorBrown_med1.png'],['star.pickup.art','kenney-space-shooter-redux','powerupYellow_star.png'],
|
|
71
|
-
['star.ambient','3xblast-pop-punk-chiptune','ambient.wav','arcade'],['star.match','kenney-interface-sounds','match.wav','arcade'],['star.win','kenney-music-jingles','win.wav','arcade'],
|
|
72
|
-
]);
|
|
73
|
-
const ops=[group('star.world',0,0),group('star.hud',0,0),group('star.fire.group',0,0),group('star.end.hero',135,120,120,160,{sceneId:'scene.win'}),group('star.end.ui',0,350,390,280,{sceneId:'scene.win'}),group('star.audio',0,0,1,1,{parameters:{width:1,height:1,visible:false}}),
|
|
74
|
-
layout('star.world',25,0,.58),layout('star.hud',400,45,.8),layout('star.fire.group',352,-210,.8),layout('star.end.hero',75,95,1.2),layout('star.end.ui',330,90,.8),
|
|
75
|
-
group('star.background',0,0,390,700,{order:-10}),layout('star.background',0,0,700/390,390/700),
|
|
76
|
-
component('star.background.fill','native.rectangle.v1',{width:390,height:700,fill:'#3a2e3f',strokeWidth:0},{parentId:'star.background',order:-1}),
|
|
77
|
-
image('star.background.image','star.background.art',0,0,390,700,{parentId:'star.background',order:0,parameters:{width:390,height:700,fit:'cover',smoothing:false}}),
|
|
78
|
-
text('star.title','STAR BASTION',65,42,260,52,30,{parentId:'star.hud'}),text('star.prompt','TAP TO FIRE',85,102,220,34,18,{parentId:'star.hud'}),text('star.kills.label','{{star.kills}} / 1',135,142,120,34,20,{parentId:'star.hud'}),
|
|
79
|
-
component('star.fire','native.button.v1',{width:170,height:64,fill:'#f2b544',hoverFill:'#ffe66d',pressedFill:'#d88b32',stroke:'#241b38',strokeWidth:4,radius:8,presentation:'shiny-cta'},{parentId:'star.fire.group',transform:[1,0,0,1,110,580]}),text('star.fire.label','FIRE',10,8,150,46,24,{parentId:'star.fire'}),
|
|
80
|
-
group('star.spawner',145,235,100,40,{parentId:'star.world',parameters:{width:100,height:40,visible:false}}),image('star.player','star.player.art',145,490,90,90,{parentId:'star.world'}),
|
|
81
|
-
behavior('star.player.state','star.player','instance-state',{hp:1,maxHp:1,value:0,tag:'player',team:'player'}),behavior('star.player.collider','star.player','collider',{shape:'circle'}),
|
|
82
|
-
component('star.input','native.rectangle.v1',{width:350,height:300,fill:'#3a2e3f',strokeWidth:0,opacity:.01},{parentId:'star.world',transform:[1,0,0,1,20,200],order:-1}),behavior('star.world.timer','star.world','timer',{seconds:1.2,repeat:true}),
|
|
83
|
-
image('star.bolt.prototype','star.bolt.art',0,0,28,28,{prototype:true}),behavior('star.bolt.body','star.bolt.prototype','physics-body',{mode:'dynamic',shape:'circle',restitution:0,friction:0,linearDamping:0,gravity:0,maxSpeed:900,restSpeed:1,restDelaySeconds:.1,wallBounce:false,spinToRotation:true}),behavior('star.bolt.collider','star.bolt.prototype','collider',{shape:'circle'}),
|
|
84
|
-
component('star.enemy.prototype','native.group.v1',{width:80,height:80},{prototype:true}),image('star.enemy.image','star.enemy.art',0,0,80,80,{parentId:'star.enemy.prototype'}),component('star.enemy.hp','native.rectangle.v1',{width:80,height:8,fill:'#70e087',strokeWidth:0},{parentId:'star.enemy.prototype',transform:[1,0,0,1,0,-14]}),
|
|
85
|
-
behavior('star.enemy.state','star.enemy.prototype','instance-state',{hp:2,maxHp:2,value:0,tag:'meteor',team:'enemy'}),behavior('star.enemy.meter','star.enemy.hp','value-meter',{instanceField:'hp',min:0,max:1,axis:'x',direction:'positive',smoothingSeconds:.05}),behavior('star.enemy.collider','star.enemy.prototype','collider',{shape:'circle'}),behavior('star.enemy.steer','star.enemy.prototype','steer',{mode:'chase',targetMode:'nearest-team',team:'player',speed:24,turnRateDegPerSec:180,maxRangePx:0,orientToVelocity:false}),
|
|
86
|
-
image('star.pickup.prototype','star.pickup.art',0,0,44,44,{prototype:true}),behavior('star.pickup.state','star.pickup.prototype','instance-state',{hp:1,maxHp:1,value:0,tag:'pickup',team:'pickup'}),behavior('star.pickup.collider','star.pickup.prototype','collider',{shape:'circle'}),behavior('star.pickup.steer','star.pickup.prototype','steer',{mode:'chase',targetMode:'nearest-team',team:'player',speed:170,turnRateDegPerSec:720,maxRangePx:0,orientToVelocity:false}),
|
|
87
|
-
binding('star.opening',{kind:'sceneEnter',sceneId:'scene.play'},[{kind:'spawnAt',prototypeId:'star.enemy.prototype',targetComponentId:'star.spawner',offsetX:0,offsetY:0,count:1,jitterX:45,jitterY:0},{kind:'playAudio',behaviorId:'star.ambient.sound'}]),
|
|
88
|
-
binding('star.auto',{kind:'timer',behaviorId:'star.world.timer'},[{kind:'spawnAt',prototypeId:'star.bolt.prototype',targetComponentId:'star.player',offsetX:0,offsetY:0},{kind:'launchToward',componentId:'star.bolt.prototype',targetMode:'nearest-team',team:'enemy',speed:360}]),
|
|
89
|
-
binding('star.fire.action',{kind:'click',componentId:'star.fire'},[{kind:'spawnAt',prototypeId:'star.bolt.prototype',targetComponentId:'star.player',offsetX:0,offsetY:0},{kind:'launchToward',componentId:'star.bolt.prototype',targetMode:'nearest-team',team:'enemy',speed:420},{kind:'playAudio',behaviorId:'star.match.sound'}]),
|
|
90
|
-
binding('star.pointer.fire',{kind:'click',componentId:'star.input'},[{kind:'spawnAt',prototypeId:'star.bolt.prototype',targetComponentId:'star.player',offsetX:0,offsetY:0},{kind:'launchToward',componentId:'star.bolt.prototype',targetMode:'pointer',speed:420},{kind:'playAudio',behaviorId:'star.match.sound'}]),
|
|
91
|
-
binding('star.hit',{kind:'contactBegin',componentId:'star.bolt.prototype',otherId:'star.enemy.prototype'},[{kind:'modifyInstanceState',target:'other',componentId:'star.enemy.prototype',field:'hp',op:'sub',value:1},{kind:'despawn',target:'self'},{kind:'playAudio',behaviorId:'star.match.sound'}],{instanceTarget:'other',instanceField:'hp',op:'gt',value:0}),
|
|
92
|
-
binding('star.depleted',{kind:'instanceDepleted',componentId:'star.enemy.prototype'},[{kind:'add',variableId:'star.kills',value:1},{kind:'spawnAt',prototypeId:'star.pickup.prototype',targetComponentId:'star.enemy.prototype',offsetX:0,offsetY:0},{kind:'despawn',target:'self'}]),
|
|
93
|
-
binding('star.collect',{kind:'contactBegin',componentId:'star.pickup.prototype',otherId:'star.player'},[{kind:'despawn',target:'self'},{kind:'changeScene',sceneId:'scene.win'}]),
|
|
94
|
-
{kind:'createScene',scene:{id:'scene.win',label:'Sector saved',role:'end-card'}},
|
|
95
|
-
group('star.end.back',0,0,390,700,{sceneId:'scene.win',order:-10}),layout('star.end.back',0,0,700/390,390/700),
|
|
96
|
-
component('star.end.back.fill','native.rectangle.v1',{width:390,height:700,fill:'#3a2e3f',strokeWidth:0},{sceneId:'scene.win',parentId:'star.end.back',order:-1}),
|
|
97
|
-
image('star.end.back.image','star.background.art',0,0,390,700,{sceneId:'scene.win',parentId:'star.end.back',order:0,parameters:{width:390,height:700,fit:'cover',smoothing:false}}),
|
|
98
|
-
image('star.end.ship','star.player.art',0,0,120,120,{parentId:'star.end.hero',sceneId:'scene.win'}),text('star.end.title','SECTOR SAVED',20,0,350,54,30,{parentId:'star.end.ui',sceneId:'scene.win'}),
|
|
99
|
-
component('star.end.cta','native.button.v1',{width:260,height:78,fill:'#f2b544',hoverFill:'#ffe66d',pressedFill:'#d88b32',stroke:'#241b38',strokeWidth:4,radius:8,presentation:'shiny-cta'},{parentId:'star.end.ui',sceneId:'scene.win',transform:[1,0,0,1,65,92]}),text('star.end.cta.label','LAUNCH NOW',10,8,240,58,24,{parentId:'star.end.cta',sceneId:'scene.win'}),
|
|
100
|
-
behavior('star.end.hero.bob','star.end.hero','animation',{property:'y',from:120,to:105,seconds:1,loop:true,fromCurrent:false,delay:0,easing:'ease-in-out'}),behavior('star.end.cta.float','star.end.cta','animation',{property:'y',from:92,to:84,seconds:.8,loop:true,fromCurrent:false,delay:0,easing:'ease-in-out'}),emitter('star.end.confetti','star.end.hero','screen'),
|
|
101
|
-
binding('star.end.enter',{kind:'sceneEnter',sceneId:'scene.win'},[{kind:'animate',behaviorId:'star.end.hero.bob'},{kind:'animate',behaviorId:'star.end.cta.float'},{kind:'emit',behaviorId:'star.end.confetti'},{kind:'playAudio',behaviorId:'star.win.sound'}]),binding('star.end.store',{kind:'click',componentId:'star.end.cta'},[{kind:'store'}]),
|
|
102
|
-
{kind:'putVariable',variable:{id:'star.kills',label:'Kills',type:'number',initial:0}},
|
|
103
|
-
];
|
|
104
|
-
for(const [id,assetId,role,bus,loop,volume] of [['ambient','star.ambient','ambient','music',true,.12],['match','star.match','match','sfx',false,.35],['win','star.win','win','stinger',false,.45]])ops.push(component('star.audio.'+id,'native.group.v1',{width:1,height:1,visible:false},{parentId:'star.audio',assetSlots:[{slotId:'source',assetId}]}),audio('star.'+id+'.sound','star.audio.'+id,role,bus,loop,volume));
|
|
105
|
-
const project=applyOperations(emptyProject({id:'star-bastion-proof',name:'Star Bastion',androidUrl:'https://play.google.com/store/apps/details?id=com.tora.starbastion'}),[...records.map(asset=>({kind:'registerAsset',asset})),...ops]).project;return {project,assets};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export async function createFrostCleanProof(){
|
|
109
|
-
const {assets,records}=await proofAssets([
|
|
110
|
-
['frost.crop','kenney-tiny-farm','tile_0020.png'],['frost.hero','kenney-tiny-farm','tile_0030.png'],['frost.ambient','tarush-singhal-happy-ukelele','ambient.wav','casual'],['frost.match','kenney-interface-sounds','match.wav','casual'],['frost.win','mintodog-cozy-puzzle-jingle','victory.mp3'],
|
|
111
|
-
]);
|
|
112
|
-
const ops=[group('frost.world',0,0),group('frost.hud',0,0),group('frost.end.hero',95,130,200,200,{sceneId:'scene.win'}),group('frost.end.ui',0,370,390,260,{sceneId:'scene.win'}),group('frost.audio',0,0,1,1,{parameters:{width:1,height:1,visible:false}}),
|
|
113
|
-
layout('frost.world',45,-80,.72),layout('frost.hud',330,75,.85),layout('frost.end.hero',75,95,1),layout('frost.end.ui',320,95,.82),
|
|
114
|
-
group('frost.background',0,0,390,700,{order:-10}),layout('frost.background',0,0,700/390,390/700),component('frost.background.fill','native.rectangle.v1',{width:390,height:700,fill:'#254b3c',strokeWidth:0},{parentId:'frost.background'}),
|
|
115
|
-
text('frost.title','FROST HARVEST',60,42,270,52,30,{parentId:'frost.hud'}),text('frost.prompt','CLEAN THE CROP',75,102,240,34,18,{parentId:'frost.hud'}),
|
|
116
|
-
component('frost.frame','native.rectangle.v1',{width:240,height:240,fill:'#3c5d42',stroke:'#fff0bd',strokeWidth:5,radius:12},{parentId:'frost.world',transform:[1,0,0,1,75,230],order:0}),
|
|
117
|
-
image('frost.crop.image','frost.crop',95,250,200,200,{parentId:'frost.world',order:1}),
|
|
118
|
-
component('frost.cover','native.rectangle.v1',{width:200,height:200,fill:'#d7f2f0',stroke:'#8fc7c5',strokeWidth:4,radius:8},{parentId:'frost.world',transform:[1,0,0,1,95,250],order:2}),behavior('frost.cover.mask','frost.cover','erase-mask',{mode:'erase',brushRadiusPx:36,gridSize:24,targetPercent:65,progressVariableId:'frost.progress',maskColor:'#d7f2f0'}),
|
|
119
|
-
{kind:'putVariable',variable:{id:'frost.progress',label:'Cleaned',type:'number',initial:0}},text('frost.progress.label','{{frost.progress}} / 65',115,490,160,38,22,{parentId:'frost.world'}),
|
|
120
|
-
binding('frost.cleaned',{kind:'maskComplete',componentId:'frost.cover'},[{kind:'playAudio',behaviorId:'frost.match.sound'},{kind:'changeScene',sceneId:'scene.win'}]),
|
|
121
|
-
{kind:'createScene',scene:{id:'scene.win',label:'Frost cleared',role:'end-card'}},
|
|
122
|
-
group('frost.end.back',0,0,390,700,{sceneId:'scene.win',order:-10}),layout('frost.end.back',0,0,700/390,390/700),component('frost.end.back.fill','native.rectangle.v1',{width:390,height:700,fill:'#254b3c',strokeWidth:0},{sceneId:'scene.win',parentId:'frost.end.back'}),
|
|
123
|
-
image('frost.end.crop','frost.hero',0,0,200,200,{parentId:'frost.end.hero',sceneId:'scene.win'}),text('frost.end.title','FRESH PICK',20,0,350,54,32,{parentId:'frost.end.ui',sceneId:'scene.win'}),
|
|
124
|
-
component('frost.end.cta','native.button.v1',{width:260,height:78,fill:'#f2b544',hoverFill:'#ffe66d',pressedFill:'#d88b32',stroke:'#3c2933',strokeWidth:4,radius:8,presentation:'shiny-cta'},{parentId:'frost.end.ui',sceneId:'scene.win',transform:[1,0,0,1,65,92]}),text('frost.end.cta.label','HARVEST NOW',10,8,240,58,24,{parentId:'frost.end.cta',sceneId:'scene.win'}),
|
|
125
|
-
behavior('frost.end.hero.bob','frost.end.hero','animation',{property:'y',from:130,to:118,seconds:1.1,loop:true,fromCurrent:false,delay:0,easing:'ease-in-out'}),behavior('frost.end.cta.float','frost.end.cta','animation',{property:'y',from:92,to:84,seconds:.8,loop:true,fromCurrent:false,delay:0,easing:'ease-in-out'}),emitter('frost.end.confetti','frost.end.hero','screen'),
|
|
126
|
-
binding('frost.end.enter',{kind:'sceneEnter',sceneId:'scene.win'},[{kind:'animate',behaviorId:'frost.end.hero.bob'},{kind:'animate',behaviorId:'frost.end.cta.float'},{kind:'emit',behaviorId:'frost.end.confetti'},{kind:'playAudio',behaviorId:'frost.win.sound'}]),binding('frost.end.store',{kind:'click',componentId:'frost.end.cta'},[{kind:'store'}]),
|
|
127
|
-
];
|
|
128
|
-
for(const [id,assetId,role,bus,loop,volume] of [['ambient','frost.ambient','ambient','music',true,.12],['match','frost.match','match','sfx',false,.35],['win','frost.win','win','stinger',false,.45]])ops.push(component('frost.audio.'+id,'native.group.v1',{width:1,height:1,visible:false},{parentId:'frost.audio',assetSlots:[{slotId:'source',assetId}]}),audio('frost.'+id+'.sound','frost.audio.'+id,role,bus,loop,volume));
|
|
129
|
-
ops.push(binding('frost.music',{kind:'maskProgress',componentId:'frost.cover'},[{kind:'playAudio',behaviorId:'frost.ambient.sound'}]));
|
|
130
|
-
const project=applyOperations(emptyProject({id:'frost-clean-proof',name:'Frost Harvest',androidUrl:'https://play.google.com/store/apps/details?id=com.tora.frostharvest'}),[...records.map(asset=>({kind:'registerAsset',asset})),...ops]).project;return {project,assets};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export async function createFpsArenaProof(){
|
|
134
|
-
return createSkyBlasterProject('fps-arena-proof');
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
async function main(){
|
|
138
|
-
const kind=process.argv[2]??'farm',output=resolve(process.argv[3]??'reports/native-expansion/'+kind);if(!['farm','star','frost','fps'].includes(kind))throw Error('Unknown proof '+kind);
|
|
139
|
-
const {project,assets}=await (kind==='farm'?createFarmMergeProof():kind==='star'?createStarBastionProof():kind==='frost'?createFrostCleanProof():createFpsArenaProof());await mkdir(output,{recursive:true});
|
|
140
|
-
for(const target of ['standalone-browser-draft','unity-ads-ua-playable','applovin-growth-playable']){const artifact=await compileNative(project,{assets,target}),file=target==='standalone-browser-draft'?resolve(output,'standalone.html'):resolve(output,target,'index.html');await mkdir(dirname(file),{recursive:true});await writeFile(file,artifact.html);await writeFile(file.replace(/\.html$/,'.manifest.json'),JSON.stringify(artifact.manifest,null,2));}
|
|
141
|
-
await writeFile(resolve(output,'project.json'),JSON.stringify(project,null,2));globalThis.console.log(output);
|
|
142
|
-
}
|
|
143
|
-
if(process.argv[1]&&resolve(process.argv[1])===fileURLToPath(import.meta.url))await main();
|