RuleLayerDef

ldtk.rules.RuleLayerDef (Class)

The layer definition data needed to run rules, built from ldtk.Json.LayerDefJson. Used by runtime consumers and tests; the LDtk editor uses its own layer definition class.

Static Members

Name Type
json ldtk.LayerDefJson
Returns
RuleLayerDef

Instance Members

uid: Int

identifier: String

isIntGrid: Bool

isAutoLayer: Bool

gridSize: Int

tilePivotX: Float

tilePivotY: Float

tilesetDefUid: Null<Int>

autoSourceLayerDefUid: Null<Int>

biomeFieldUid: Null<Int>

autoTilesKilledByOtherLayerUid: Null<Int>


valueGroupUids: haxe.ds.Vector<Int>

valueGroupUids[intGridValue] = group uid, or -1


getGroupUidOfValue(v: Int): Int
Name Type
v Int
Returns
Int

rulesCanBeUsed(): Bool

Same gate as the LDtk editor: rules only run if the layer has a tileset (and a source layer for AutoLayer types)

Returns
Bool

rulesInEvalOrder(biomeValues: Null<Array<String>>, optionalRules: Map, ?out: Array<RuleDef>): Array<RuleDef>

Active rules of applied groups, in evaluation order (groups first to last, rules first to last). out is reused when given.

Name Type Default
biomeValues Null<Array<String>>
optionalRules Map
out Array<RuleDef> (optional)
Returns
Array<RuleDef>

rulesInDisplayOrder(biomeValues: Null<Array<String>>, optionalRules: Map, ?out: Array<RuleDef>): Array<RuleDef>

Same rules in display order: the exact reverse of the evaluation order (first evaluated rule is rendered on top)

Name Type Default
biomeValues Null<Array<String>>
optionalRules Map
out Array<RuleDef> (optional)
Returns
Array<RuleDef>

new(uid: Int): Void
Name Type
uid Int