Tilemaps are a new placeable asset type that is painted with autotiles in the scene view, with layers, brush, eraser and rectangle, and is drawn at runtime and in the export (#128)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0607221423
commit
33a7b1b63e
30 files changed
+2060
-20
No files matched your search
@@ -1,7 +1,16 @@
|
||||
/** Lookups that throw a `CommandError` when the target does not exist. */
|
||||
import { findNode, type Graph, type GraphEdge, type GraphNode } from '../graph/Graph';
|
||||
import { type NodeDef, nodeDef } from '../graph/NodeRegistry';
|
||||
import type { Asset, AutotileAsset, BehaviorAsset, StateMachineAsset, VariablesAsset } from '../model/Asset';
|
||||
import type {
|
||||
Asset,
|
||||
AutotileAsset,
|
||||
BehaviorAsset,
|
||||
StateMachineAsset,
|
||||
TilemapAsset,
|
||||
TilemapLayer,
|
||||
VariablesAsset,
|
||||
} from '../model/Asset';
|
||||
import { findLayer } from '../model/tilemap';
|
||||
import { findObject, type ObjectTree } from '../model/hierarchy';
|
||||
import { isTemplateContent, objectRef, type ObjectRef } from '../model/instance';
|
||||
import {
|
||||
@@ -85,6 +94,18 @@ export function requireAutotile(project: Project, assetId: string): AutotileAsse
|
||||
return asset;
|
||||
}
|
||||
|
||||
export function requireTilemap(project: Project, assetId: string): TilemapAsset {
|
||||
const asset = findAssetOf(project, assetId, 'tilemap');
|
||||
if (!asset) throw new CommandError(`Tilemap ${assetId} not found`);
|
||||
return asset;
|
||||
}
|
||||
|
||||
export function requireTilemapLayer(project: Project, assetId: string, layerId: string): TilemapLayer {
|
||||
const layer = findLayer(requireTilemap(project, assetId), layerId);
|
||||
if (!layer) throw new CommandError(`Layer ${layerId} not found`);
|
||||
return layer;
|
||||
}
|
||||
|
||||
export function requireStateMachine(project: Project, assetId: string): StateMachineAsset {
|
||||
const asset = findAssetOf(project, assetId, 'statemachine');
|
||||
if (!asset) throw new CommandError(`State machine ${assetId} not found`);
|
||||
|
||||
Reference in new issue
Block a user