Skip to content

Commit 67fa601

Browse files
committed
upgrade to artemis 2.1.0
1 parent 4dabe6b commit 67fa601

File tree

8 files changed

+14
-15
lines changed

8 files changed

+14
-15
lines changed

build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77

88
aiVersion = '1.8.1'
99

10-
artemisVersion = '1.4.0'
10+
artemisVersion = '2.1.0'
1111
artemisContribVersion = '1.2.1'
1212
kryonetVersion = '2.22.0-RC1'
1313

@@ -309,9 +309,6 @@ project(":desktop") {
309309

310310
// Artemis-odb bonus functionality (systems, events, components).
311311
compile "net.mostlyoriginal.artemis-odb:contrib-core:$artemisContribVersion"
312-
compile "net.mostlyoriginal.artemis-odb:contrib-jam:$artemisContribVersion"
313-
compile "net.mostlyoriginal.artemis-odb:contrib-eventbus:$artemisContribVersion"
314-
compile "net.mostlyoriginal.artemis-odb:contrib-plugin-operations:$artemisContribVersion"
315312

316313
// jcommander for command line parsing
317314
compile "com.beust:jcommander:$jcommanderVersion"

core/src/com/ore/infinium/Inventory.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ open class Inventory
6363
}
6464

6565
class InventorySlot(var entityId: Int,
66-
val slotType: InventorySlotType) {
67-
}
66+
val slotType: InventorySlotType)
6867

6968
var slots = mutableListOf<InventorySlot>()
7069
private set
@@ -197,6 +196,9 @@ open class Inventory
197196
private fun canCombineItems(itemId: Int, itemInSlotId: Int): Boolean {
198197
val itemComp1 = mItem.get(itemId)
199198
val itemComp2 = mItem.get(itemInSlotId)
199+
if (itemComp2 == null) {
200+
println()
201+
}
200202
if (!itemComp1.canCombineWith(itemComp2)) {
201203
return false
202204
}

core/src/com/ore/infinium/systems/GameLoopSystemInvocationStrategy.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class GameLoopSystemInvocationStrategy
110110
profiler.counter.tick()
111111
}
112112

113-
override fun process(systems: Bag<BaseSystem>) {
113+
override fun process() {
114114
if (!isServer) {
115115
// frameProfiler.start()
116116
}

core/src/com/ore/infinium/systems/SpatialSystem.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class SpatialSystem(private val oreWorld: OreWorld) : IteratingSystem(Aspect.all
5858
var quadTree: QuadTree
5959

6060
init {
61-
6261
quadTree = QuadTree(0f, 0f, oreWorld.worldSize.width.toFloat(), oreWorld.worldSize.height.toFloat())
6362
}
6463

core/src/com/ore/infinium/systems/client/ClientNetworkSystem.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ class ClientNetworkSystem(private val oreWorld: OreWorld) : BaseSystem() {
366366

367367
val cItem = mItem.get(spawnedItemEntityId)
368368

369+
require(cItem.inventoryIndex != -1) { "told to spawn item at invalid index" }
370+
369371
//fixme this indirection isn't so hot...
370372
inventory.setSlot(cItem.inventoryIndex, spawnedItemEntityId)
371373
}
@@ -470,7 +472,7 @@ class ClientNetworkSystem(private val oreWorld: OreWorld) : BaseSystem() {
470472
sprite.setPosition(spawn.pos.x, spawn.pos.y)
471473
}
472474

473-
val cGenerator = mGenerator.getSafe(localEntityId)?.let {
475+
val cGenerator = mGenerator.opt(localEntityId)?.let {
474476
//recreate this on our end. since it is transient
475477
it.fuelSources = GeneratorInventory(GeneratorInventory.MAX_SLOTS)
476478
}

core/src/com/ore/infinium/systems/server/ServerNetworkSystem.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,16 @@ class ServerNetworkSystem(private val oreWorld: OreWorld, private val oreServer:
368368
owningPlayerEntityId: Int,
369369
inventoryType: Network.Shared.InventoryType,
370370
causedByPickedUpItem: Boolean = false) {
371-
//assert(entityIdsToSpawn.size > 0) { "entities to spawn in inventory should be non 0" }
371+
require(entityIdsToSpawn.isNotEmpty()) { "entities to spawn in inventory should be non 0" }
372372

373373
val spawn = Network.Server.SpawnInventoryItems()
374374
spawn.causedByPickedUpItem = causedByPickedUpItem
375375
spawn.typeOfInventory = inventoryType
376376

377377
for (entityId in entityIdsToSpawn) {
378+
val cItem = mItem.get(entityId)
379+
require(cItem.inventoryIndex != -1) { "attempting to send invalid inventory index item spawn" }
380+
378381
val entitySpawn = serializeInventoryEntitySpawn(entityId)
379382

380383
spawn.entitiesToSpawn.add(entitySpawn)

core/src/com/ore/infinium/systems/server/ServerPowerSystem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class ServerPowerSystem(private val oreWorld: OreWorld) : IteratingSystem(anyOf(
9696
}
9797

9898
private fun updateDevice(entityId: Int) {
99-
val cGen = mPowerGenerator.getSafe(entityId)
99+
val cGen = mPowerGenerator.opt(entityId)
100100

101101
cGen?.let {
102102
when (cGen.type) {

core/src/com/ore/infinium/util/ArtemisExtensions.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ interface CopyableComponent<T : CopyableComponent<T>> {
9191
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER)
9292
annotation class DoNotPrint
9393

94-
fun TagManager.getEntityId(tag: String): Int {
95-
return this.getEntity(tag)!!.id
96-
}
97-
9894
fun World.entities(aspect: Aspect.Builder): IntBag =
9995
this.aspectSubscriptionManager.get(aspect).entities
10096

0 commit comments

Comments
 (0)