NPCIntelligentBase -> HumanoidNPC, modified HumanoidNPC accordingly

Former-commit-id: 0645b78df018cfd4c10e2b2956985412bee536e6
Former-commit-id: 8578954077c68de4d47a19cd72927c79aa8c07d8
This commit is contained in:
Song Minjae
2016-10-24 12:23:51 +09:00
parent 53c82a34d5
commit 0837d23cb6
2 changed files with 12 additions and 26 deletions

View File

@@ -6,6 +6,7 @@ import net.torvald.terrarum.gameactors.*
import net.torvald.terrarum.gameactors.faction.Faction import net.torvald.terrarum.gameactors.faction.Faction
import net.torvald.terrarum.gamecontroller.EnumKeyFunc import net.torvald.terrarum.gamecontroller.EnumKeyFunc
import net.torvald.terrarum.gamecontroller.KeyMap import net.torvald.terrarum.gamecontroller.KeyMap
import net.torvald.terrarum.realestate.RealEstateUtility
import org.dyn4j.geometry.Vector2 import org.dyn4j.geometry.Vector2
import org.lwjgl.input.Controller import org.lwjgl.input.Controller
import org.lwjgl.input.Controllers import org.lwjgl.input.Controllers
@@ -30,18 +31,18 @@ open class ActorHumanoid(birth: GameDate, death: GameDate? = null)
* Absolute tile index. index(x, y) = y * map.width + x * Absolute tile index. index(x, y) = y * map.width + x
* The arraylist will be saved in JSON format with GSON. * The arraylist will be saved in JSON format with GSON.
*/ */
override var houseDesignation: ArrayList<Long>? = null override var houseDesignation: ArrayList<Long>? = ArrayList()
override fun addHouseTile(x: Int, y: Int) { override fun addHouseTile(x: Int, y: Int) {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. if (houseDesignation != null) houseDesignation!!.add(RealEstateUtility.getAbsoluteTileNumber(x, y))
} }
override fun removeHouseTile(x: Int, y: Int) { override fun removeHouseTile(x: Int, y: Int) {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. if (houseDesignation != null) houseDesignation!!.remove(RealEstateUtility.getAbsoluteTileNumber(x, y))
} }
override fun clearHouseDesignation() { override fun clearHouseDesignation() {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. if (houseDesignation != null) houseDesignation!!.clear()
} }
/** /**

View File

@@ -1,5 +1,6 @@
package net.torvald.terrarum.gameactors package net.torvald.terrarum.gameactors
import net.torvald.terrarum.console.ActorHumanoid
import net.torvald.terrarum.gameactors.ai.ActorAI import net.torvald.terrarum.gameactors.ai.ActorAI
import net.torvald.terrarum.gameactors.faction.Faction import net.torvald.terrarum.gameactors.faction.Faction
import net.torvald.terrarum.gameitem.InventoryItem import net.torvald.terrarum.gameitem.InventoryItem
@@ -10,15 +11,11 @@ import java.util.*
/** /**
* Created by minjaesong on 16-03-14. * Created by minjaesong on 16-03-14.
*/ */
open class NPCIntelligentBase(born: GameDate) : HistoricalFigure(born) open class HumanoidNPC(born: GameDate) : ActorHumanoid(born), AIControlled, CanBeAnItem {
, AIControlled, Pocketed, CanBeAnItem, Factionable, LandHolder {
override var actorAI: ActorAI = object : ActorAI { override var actorAI: ActorAI = object : ActorAI {
// TODO fully establish ActorAI so that I can implement AI here // TODO fully establish ActorAI so that I can implement AI here
} }
override var inventory: ActorInventory = ActorInventory()
override var faction: HashSet<Faction> = HashSet()
override var houseDesignation: ArrayList<Long>? = null
// we're having InventoryItem data so that this class could be somewhat universal // we're having InventoryItem data so that this class could be somewhat universal
override var itemData: InventoryItem = object : InventoryItem { override var itemData: InventoryItem = object : InventoryItem {
@@ -36,23 +33,23 @@ open class NPCIntelligentBase(born: GameDate) : HistoricalFigure(born)
actorValue[AVKey.SCALE] = value actorValue[AVKey.SCALE] = value
} }
override fun effectWhileInPocket(gc: GameContainer, delta_t: Int) { override fun effectWhileInPocket(gc: GameContainer, delta: Int) {
} }
override fun effectWhenPickedUp(gc: GameContainer, delta_t: Int) { override fun effectWhenPickedUp(gc: GameContainer, delta: Int) {
} }
override fun primaryUse(gc: GameContainer, delta_t: Int) { override fun primaryUse(gc: GameContainer, delta: Int) {
// TODO do not allow primary_use // TODO do not allow primary_use
} }
override fun secondaryUse(gc: GameContainer, delta_t: Int) { override fun secondaryUse(gc: GameContainer, delta: Int) {
// TODO place this Actor to the world // TODO place this Actor to the world
} }
override fun effectWhenThrown(gc: GameContainer, delta_t: Int) { override fun effectWhenThrown(gc: GameContainer, delta: Int) {
} }
override fun effectWhenTakenOut(gc: GameContainer, delta: Int) { override fun effectWhenTakenOut(gc: GameContainer, delta: Int) {
@@ -66,18 +63,6 @@ open class NPCIntelligentBase(born: GameDate) : HistoricalFigure(born)
return mass return mass
} }
override fun addHouseTile(x: Int, y: Int) {
if (houseDesignation != null) houseDesignation!!.add(getAbsoluteTileNumber(x, y))
}
override fun removeHouseTile(x: Int, y: Int) {
if (houseDesignation != null) houseDesignation!!.remove(getAbsoluteTileNumber(x, y))
}
override fun clearHouseDesignation() {
if (houseDesignation != null) houseDesignation!!.clear()
}
override fun stopUpdateAndDraw() { override fun stopUpdateAndDraw() {
isUpdate = false isUpdate = false
isVisible = false isVisible = false