fixes, bits and pieces, changes in ID referencing, terrain and wall takes damage, working test pickaxe, and a new issue

This commit is contained in:
Song Minjae
2017-04-17 02:18:52 +09:00
parent 8d4b803ef5
commit 4c928f2772
40 changed files with 502 additions and 249 deletions

View File

@@ -1,9 +1,12 @@
package net.torvald.terrarum.gameactors
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.ActorHumanoid
import net.torvald.terrarum.gameactors.ai.AILuaAPI
import net.torvald.terrarum.gameactors.ai.ActorAI
import net.torvald.terrarum.gameactors.ai.LuaAIWrapper
import net.torvald.terrarum.gamecontroller.mouseX
import net.torvald.terrarum.gamecontroller.mouseY
import net.torvald.terrarum.gameitem.InventoryItem
import org.luaj.vm2.*
import org.luaj.vm2.compiler.LuaC
@@ -51,13 +54,22 @@ open class HumanoidNPC(
set(value) {
actorValue[AVKey.SCALE] = value
}
override var category = "npc"
override var inventoryCategory = "npc"
override val originalName: String = actorValue.getAsString(AVKey.NAME) ?: "NPC"
override var consumable = false
override var consumable = true
override fun secondaryUse(gc: GameContainer, delta: Int): Boolean {
return false
// TODO place this Actor to the world
try {
// place the actor to the world
this@HumanoidNPC.setPosition(gc.mouseX, gc.mouseY)
Terrarum.ingame!!.addNewActor(this@HumanoidNPC)
// successful
return true
}
catch (e: Exception) {
e.printStackTrace()
return false
}
}
}