mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-18 06:24:06 +09:00
WIP inventory implementation
Former-commit-id: ce7d2125209c2c4f49b7d755b068ce72387f5e8f Former-commit-id: f413b2699ee7448f3d3b70775ca7b679ade66475
This commit is contained in:
@@ -8,20 +8,21 @@ import org.newdawn.slick.GameContainer
|
||||
interface InventoryItem {
|
||||
/**
|
||||
* Internal ID of an Item, Long
|
||||
* 0-4096: Tiles
|
||||
* 4097-32767: Static items
|
||||
* 0-4095: Tiles
|
||||
* 4096-32767: Static items
|
||||
* 32768-16777215: Dynamic items
|
||||
* >= 16777216: Actor RefID
|
||||
*/
|
||||
val itemID: Int
|
||||
|
||||
/**
|
||||
* Weight of the item
|
||||
* Base mass of the item. Real mass must be calculated from
|
||||
* mass * scale^3
|
||||
*/
|
||||
var mass: Double
|
||||
|
||||
/**
|
||||
* Scale of the item. Real mass: mass * (scale^3)
|
||||
* Scale of the item.
|
||||
*
|
||||
* For static item, it must be 1.0. If you tinkered the item to be bigger,
|
||||
* it must be re-assigned as Dynamic Item
|
||||
@@ -57,10 +58,4 @@ interface InventoryItem {
|
||||
* Effects applied (continuously or not) while thrown to the world
|
||||
*/
|
||||
fun effectWhenTakenOut(gc: GameContainer, delta: Int)
|
||||
|
||||
/**
|
||||
* Effects applied (continuously or not) while thrown to the world,
|
||||
* called by the proxy Actor
|
||||
*/
|
||||
fun worldActorEffect(gc: GameContainer, delta: Int)
|
||||
}
|
||||
30
src/net/torvald/terrarum/gameitem/InventoryItemAdapter.kt
Normal file
30
src/net/torvald/terrarum/gameitem/InventoryItemAdapter.kt
Normal file
@@ -0,0 +1,30 @@
|
||||
package net.torvald.terrarum.gameitem
|
||||
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
/**
|
||||
* Created by SKYHi14 on 2016-12-12.
|
||||
*/
|
||||
abstract class InventoryItemAdapter : InventoryItem {
|
||||
override abstract val itemID: Int
|
||||
override abstract var mass: Double
|
||||
override abstract var scale: Double
|
||||
|
||||
override fun effectWhileInPocket(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
|
||||
override fun effectWhenPickedUp(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
|
||||
override fun primaryUse(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
|
||||
override fun secondaryUse(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
|
||||
override fun effectWhenThrown(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
|
||||
override fun effectWhenTakenOut(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user