Skip to content

Commit a69a5e9

Browse files
authored
Rename entityConfig to entityBlueprint in Korge-fleks gradle task (#2358)
* Rename entityConfig to entityBlueprint in Korge-fleks gradle task
1 parent d84cff5 commit a69a5e9

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

korge-gradle-plugin/src/main/kotlin/korlibs/korge/gradle/korgefleks/AssetLevelMapExporter.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,12 @@ class AssetLevelMapExporter(
379379
when {
380380
entityInstances.isNotEmpty() -> {
381381
entityInstances.forEach { ldtkEntity ->
382-
// Put all entity configs into one JSON file per chunk as list with local game object counter
382+
// Put all entity blueprints into one JSON file per chunk as list with local game object counter
383383
val entityName = ldtkEntity["__identifier"]?.let { it as String } ?: "undefined_entity"
384-
// Load all entity configs by first checking if field 'entityConfig' exists
384+
// Load all entity blueprints by first checking if field 'entityBlueprint' exists
385385
val ldtkEntities = ldtkEntity["fieldInstances"] as List<Map<String, Any?>>
386386

387-
if (ldtkEntities.firstOrNull { it["__identifier"] == "entityConfig" } != null) {
387+
if (ldtkEntities.firstOrNull { it["__identifier"] == "entityBlueprint" } != null) {
388388
val gameObjectName: String =
389389
if ((ldtkEntity["__tags"] as List<String>).firstOrNull { it == "unique" } != null) {
390390
// Add scripts without unique count value - they are unique by name because they exist only once
@@ -393,13 +393,13 @@ class AssetLevelMapExporter(
393393
// Add other game objects with a unique name as identifier
394394
"${chunkName}_${entityName}_${gameObjectCnt++}"
395395
}
396-
// Add entity config type
397-
val entityConfigField = ldtkEntities.first { it["__identifier"] == "entityConfig" }
398-
val entityConfigType = entityConfigField["__value"]?.let { it as String } ?: error("Entity config field '__value' is null for entity '$entityName' in chunk '$chunkName'!")
396+
// Add entity blueprint type
397+
val entityBlueprintField = ldtkEntities.first { it["__identifier"] == "entityBlueprint" }
398+
val entityBlueprintType = entityBlueprintField["__value"]?.let { it as String } ?: error("Entity blueprint field '__value' is null for entity '$entityName' in chunk '$chunkName'!")
399399

400400
val chunkEntity = mutableMapOf<String, Any>()
401401
chunkEntities.add(chunkEntity)
402-
chunkEntity["type"] = entityConfigType
402+
chunkEntity["type"] = entityBlueprintType
403403
chunkEntity["name"] = gameObjectName
404404

405405
// Add position of entity = (chunk position in the level) + (position within the chunk) + (pivot point)
@@ -421,15 +421,15 @@ class AssetLevelMapExporter(
421421
// Add all other fields of entity
422422
ldtkEntities.forEach { field ->
423423
val fieldName = field["__identifier"] as String
424-
if (fieldName != "entityConfig") {
424+
if (fieldName != "entityBlueprint") {
425425
chunkEntity[fieldName] = field["__value"] ?: error("Entity field '__value' is null for field '$fieldName' in entity '$entityName' of chunk '$chunkName'!")
426426
}
427427
}
428428
// Add entity to list of game objects which are spawned automatically by the WorldChunkSystem
429429
if ((ldtkEntity["__tags"] as List<String>).firstOrNull { it == "gameobject" } != null) {
430430
chunkSpawnEntities.add(gameObjectName)
431431
}
432-
} else println("ERROR: Game object with name '${entityName}' has no field 'entityConfig'!")
432+
} else println("ERROR: Game object with name '${entityName}' has no field 'entityBlueprint'!")
433433
}
434434
}
435435

0 commit comments

Comments
 (0)