File tree Expand file tree Collapse file tree
addons/geary-prefabs/src/com/mineinabyss/geary/prefabs
geary-core/src/com/mineinabyss/geary/datatypes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ import com.mineinabyss.geary.prefabs.serializers.PrefabKeySerializer
66import kotlinx.serialization.Serializable
77
88/* *
9- * An inline class which represents a key build from a [namespace] and [key], separated
9+ * Represents a key build from a [namespace] and [key], separated
1010 * by a '`:`' symbol.
1111 */
1212@ConsistentCopyVisibility
1313@Serializable(with = PrefabKeySerializer ::class )
14- // We don't make this a value class since calculating substring is pretty expensive compared to one new object instantiation
14+ // Note: We don't make this a value class since calculating substring is pretty expensive compared to one new object instantiation
1515data class PrefabKey private constructor(val namespace : String , val key : String ) {
1616 val full get() = " $namespace :$key "
1717
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package com.mineinabyss.geary.datatypes
33import com.mineinabyss.geary.annotations.optin.DangerousComponentOperation
44import com.mineinabyss.geary.components.EntityName
55import com.mineinabyss.geary.datatypes.family.family
6- import com.mineinabyss.geary.engine.Engine
76import com.mineinabyss.geary.helpers.NO_COMPONENT
87import com.mineinabyss.geary.helpers.component
98import com.mineinabyss.geary.helpers.componentId
@@ -28,11 +27,12 @@ import kotlin.reflect.KClass
2827typealias GearyEntity = Entity
2928
3029/* *
31- * A wrapper around [EntityId] that gets inlined to just a long (no performance degradation since no boxing occurs) .
30+ * A combination of [EntityId] with a [world] it belongs to .
3231 *
33- * Provides some useful functions, so we aren't forced to go through [Engine] every time we want to do some things.
32+ * Provides some useful functions for reading and writing data associated with this entity, as well as validating
33+ * matching [world] instances when multiple entities are involved (see [requireSameWorldAs]).
3434 */
35- // TODO add require checks for entities across different worlds
35+ // TODO call requireSameWorldAs for all functions involving other Entity instances.
3636class Entity (val id : EntityId , val world : Geary ) {
3737 val comp get() = world.components
3838
Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ fun MutableLongList.toEntityArray(world: Geary): EntityArray {
1313 return EntityArray (world, ULongArray (size) { get(it).toULong() })
1414}
1515
16+ /* *
17+ * An array of [EntityId]s with an associated [world].
18+ * Avoids string boxed [GearyEntity] instances for each entity, with helpers to completely avoid boxing like [forEachId].
19+ */
1620class EntityArray (
1721 val world : Geary ,
1822 val ids : EntityIdArray ,
Original file line number Diff line number Diff line change @@ -4,13 +4,13 @@ import com.mineinabyss.geary.helpers.readableString
44
55
66/* *
7- * An inlined class used for tracking the components an entity/archetype has .
7+ * Immutable array of [ComponentId]s used to represent the 'type' of an [com.mineinabyss.geary.engine.archetypes.Archetype] .
88 *
99 * It provides fast (no boxing) functions backed by FastUtil sorted sets to do operations with [ComponentId]s.
1010 */
1111class EntityType private constructor(
1212 @PublishedApi
13- internal val inner : ULongArray
13+ internal val inner : ULongArray ,
1414) {
1515 constructor () : this (ULongArray (0 ))
1616
You can’t perform that action at this time.
0 commit comments