diff --git a/build.gradle b/build.gradle index 1669e84..bc72a58 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { aiVersion = '1.8.1' - artemisVersion = '1.4.0' + artemisVersion = '2.1.0' artemisContribVersion = '1.2.1' kryonetVersion = '2.22.0-RC1' @@ -309,9 +309,6 @@ project(":desktop") { // Artemis-odb bonus functionality (systems, events, components). compile "net.mostlyoriginal.artemis-odb:contrib-core:$artemisContribVersion" - compile "net.mostlyoriginal.artemis-odb:contrib-jam:$artemisContribVersion" - compile "net.mostlyoriginal.artemis-odb:contrib-eventbus:$artemisContribVersion" - compile "net.mostlyoriginal.artemis-odb:contrib-plugin-operations:$artemisContribVersion" // jcommander for command line parsing compile "com.beust:jcommander:$jcommanderVersion" diff --git a/core/src/com/ore/infinium/Inventory.kt b/core/src/com/ore/infinium/Inventory.kt index f435530..746a304 100644 --- a/core/src/com/ore/infinium/Inventory.kt +++ b/core/src/com/ore/infinium/Inventory.kt @@ -63,8 +63,7 @@ open class Inventory } class InventorySlot(var entityId: Int, - val slotType: InventorySlotType) { - } + val slotType: InventorySlotType) var slots = mutableListOf() private set @@ -197,6 +196,9 @@ open class Inventory private fun canCombineItems(itemId: Int, itemInSlotId: Int): Boolean { val itemComp1 = mItem.get(itemId) val itemComp2 = mItem.get(itemInSlotId) + if (itemComp2 == null) { + println() + } if (!itemComp1.canCombineWith(itemComp2)) { return false } diff --git a/core/src/com/ore/infinium/systems/GameLoopSystemInvocationStrategy.kt b/core/src/com/ore/infinium/systems/GameLoopSystemInvocationStrategy.kt index 4459380..76f9aad 100644 --- a/core/src/com/ore/infinium/systems/GameLoopSystemInvocationStrategy.kt +++ b/core/src/com/ore/infinium/systems/GameLoopSystemInvocationStrategy.kt @@ -110,7 +110,7 @@ class GameLoopSystemInvocationStrategy profiler.counter.tick() } - override fun process(systems: Bag) { + override fun process() { if (!isServer) { // frameProfiler.start() } diff --git a/core/src/com/ore/infinium/systems/SpatialSystem.kt b/core/src/com/ore/infinium/systems/SpatialSystem.kt index c44f805..7c4d7e3 100644 --- a/core/src/com/ore/infinium/systems/SpatialSystem.kt +++ b/core/src/com/ore/infinium/systems/SpatialSystem.kt @@ -58,7 +58,6 @@ class SpatialSystem(private val oreWorld: OreWorld) : IteratingSystem(Aspect.all var quadTree: QuadTree init { - quadTree = QuadTree(0f, 0f, oreWorld.worldSize.width.toFloat(), oreWorld.worldSize.height.toFloat()) } diff --git a/core/src/com/ore/infinium/systems/client/ClientNetworkSystem.kt b/core/src/com/ore/infinium/systems/client/ClientNetworkSystem.kt index a4f442b..e8b20ea 100644 --- a/core/src/com/ore/infinium/systems/client/ClientNetworkSystem.kt +++ b/core/src/com/ore/infinium/systems/client/ClientNetworkSystem.kt @@ -366,6 +366,8 @@ class ClientNetworkSystem(private val oreWorld: OreWorld) : BaseSystem() { val cItem = mItem.get(spawnedItemEntityId) + require(cItem.inventoryIndex != -1) { "told to spawn item at invalid index" } + //fixme this indirection isn't so hot... inventory.setSlot(cItem.inventoryIndex, spawnedItemEntityId) } @@ -470,7 +472,7 @@ class ClientNetworkSystem(private val oreWorld: OreWorld) : BaseSystem() { sprite.setPosition(spawn.pos.x, spawn.pos.y) } - val cGenerator = mGenerator.getSafe(localEntityId)?.let { + val cGenerator = mGenerator.opt(localEntityId)?.let { //recreate this on our end. since it is transient it.fuelSources = GeneratorInventory(GeneratorInventory.MAX_SLOTS) } diff --git a/core/src/com/ore/infinium/systems/server/ServerNetworkSystem.kt b/core/src/com/ore/infinium/systems/server/ServerNetworkSystem.kt index 1bbfb8b..10e515d 100644 --- a/core/src/com/ore/infinium/systems/server/ServerNetworkSystem.kt +++ b/core/src/com/ore/infinium/systems/server/ServerNetworkSystem.kt @@ -368,13 +368,16 @@ class ServerNetworkSystem(private val oreWorld: OreWorld, private val oreServer: owningPlayerEntityId: Int, inventoryType: Network.Shared.InventoryType, causedByPickedUpItem: Boolean = false) { - //assert(entityIdsToSpawn.size > 0) { "entities to spawn in inventory should be non 0" } + require(entityIdsToSpawn.isNotEmpty()) { "entities to spawn in inventory should be non 0" } val spawn = Network.Server.SpawnInventoryItems() spawn.causedByPickedUpItem = causedByPickedUpItem spawn.typeOfInventory = inventoryType for (entityId in entityIdsToSpawn) { + val cItem = mItem.get(entityId) + require(cItem.inventoryIndex != -1) { "attempting to send invalid inventory index item spawn" } + val entitySpawn = serializeInventoryEntitySpawn(entityId) spawn.entitiesToSpawn.add(entitySpawn) diff --git a/core/src/com/ore/infinium/systems/server/ServerPowerSystem.kt b/core/src/com/ore/infinium/systems/server/ServerPowerSystem.kt index 4d792d8..83fe9ad 100644 --- a/core/src/com/ore/infinium/systems/server/ServerPowerSystem.kt +++ b/core/src/com/ore/infinium/systems/server/ServerPowerSystem.kt @@ -96,7 +96,7 @@ class ServerPowerSystem(private val oreWorld: OreWorld) : IteratingSystem(anyOf( } private fun updateDevice(entityId: Int) { - val cGen = mPowerGenerator.getSafe(entityId) + val cGen = mPowerGenerator.opt(entityId) cGen?.let { when (cGen.type) { diff --git a/core/src/com/ore/infinium/util/ArtemisExtensions.kt b/core/src/com/ore/infinium/util/ArtemisExtensions.kt index fe6ce0c..dba006d 100644 --- a/core/src/com/ore/infinium/util/ArtemisExtensions.kt +++ b/core/src/com/ore/infinium/util/ArtemisExtensions.kt @@ -91,10 +91,6 @@ interface CopyableComponent> { @Target(AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER) annotation class DoNotPrint -fun TagManager.getEntityId(tag: String): Int { - return this.getEntity(tag)!!.id -} - fun World.entities(aspect: Aspect.Builder): IntBag = this.aspectSubscriptionManager.get(aspect).entities