Skip to content

Commit

Permalink
[AssetStore] Rename tag "script" to "unique" in LDtk level loading (#33)
Browse files Browse the repository at this point in the history
- EntityConfig can be marked as unique which means
  that the game object can only exist once per level
- Fix adding new levelData to levelDataMaps in AssetStore
  • Loading branch information
jobe-m authored Nov 7, 2024
1 parent fe0ee8f commit 5e125c4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class AssetStore {
// Sanity check - entity needs to have a field 'entityConfig'
if (entity.fieldInstances.firstOrNull { it.identifier == "entityConfig" } != null) {

if (entity.tags.firstOrNull { it == "script" } != null) {
if (entity.tags.firstOrNull { it == "unique" } != null) {
// Add scripts without unique count value - they are unique by name because they exist only once
yamlString.append("name: ${levelName}_${entity.identifier}\n")
}
Expand Down Expand Up @@ -232,7 +232,7 @@ class AssetStore {

// Create new level data if it does not exist yet
if (!levelDataMaps.contains(levelName)) {
val levelData = LevelData(
levelDataMaps[levelName] = LevelData(
type = type,
gridSize = gridSize,
width = (ldtkLayer.cWid * gridSize).toFloat(),
Expand Down

0 comments on commit 5e125c4

Please sign in to comment.