mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 21:44:05 +09:00
com.torvald → net.torvald
Former-commit-id: 375604da8a20a6ba7cd0a8d05a44add02b2d04f4 Former-commit-id: 287287c5920b07618174d7a7573f049d350ded66
This commit is contained in:
66
src/net/torvald/terrarum/gameitem/InventoryItem.kt
Normal file
66
src/net/torvald/terrarum/gameitem/InventoryItem.kt
Normal file
@@ -0,0 +1,66 @@
|
||||
package net.torvald.terrarum.gameitem
|
||||
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-16.
|
||||
*/
|
||||
interface InventoryItem {
|
||||
/**
|
||||
* Internal ID of an Item, Long
|
||||
* 0-4096: Tiles
|
||||
* 4097-32767: Various items
|
||||
* >=32768: Actor RefID
|
||||
*/
|
||||
var itemID: Long
|
||||
|
||||
/**
|
||||
* Weight of the item, Float
|
||||
*/
|
||||
var mass: Float
|
||||
|
||||
/**
|
||||
* Scale of the item. Real mass: mass * (scale^3)
|
||||
*/
|
||||
var scale: Float
|
||||
|
||||
/**
|
||||
* Effects applied while in pocket
|
||||
* @param gc
|
||||
* *
|
||||
* @param delta_t
|
||||
*/
|
||||
fun effectWhileInPocket(gc: GameContainer, delta_t: Int)
|
||||
|
||||
/**
|
||||
* Effects applied immediately only once if picked up
|
||||
* @param gc
|
||||
* *
|
||||
* @param delta_t
|
||||
*/
|
||||
fun effectWhenPickedUp(gc: GameContainer, delta_t: Int)
|
||||
|
||||
/**
|
||||
* Effects applied while primary button (usually left mouse button) is down
|
||||
* @param gc
|
||||
* *
|
||||
* @param delta_t
|
||||
*/
|
||||
fun primaryUse(gc: GameContainer, delta_t: Int)
|
||||
|
||||
/**
|
||||
* Effects applied while secondary button (usually right mouse button) is down
|
||||
* @param gc
|
||||
* *
|
||||
* @param delta_t
|
||||
*/
|
||||
fun secondaryUse(gc: GameContainer, delta_t: Int)
|
||||
|
||||
/**
|
||||
* Effects applied immediately only once if thrown from pocket
|
||||
* @param gc
|
||||
* *
|
||||
* @param delta_t
|
||||
*/
|
||||
fun effectWhenThrownAway(gc: GameContainer, delta_t: Int)
|
||||
}
|
||||
39
src/net/torvald/terrarum/gameitem/TileAsItem.kt
Normal file
39
src/net/torvald/terrarum/gameitem/TileAsItem.kt
Normal file
@@ -0,0 +1,39 @@
|
||||
package net.torvald.terrarum.gameitem
|
||||
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-15.
|
||||
*/
|
||||
class TileAsItem(tileNum: Int) : InventoryItem {
|
||||
|
||||
override var itemID: Long = -1
|
||||
override var mass: Float = 0f
|
||||
override var scale: Float = 1f
|
||||
|
||||
init {
|
||||
itemID = tileNum.toLong()
|
||||
mass = TilePropCodex.getProp(tileNum).density / 1000f
|
||||
}
|
||||
|
||||
override fun effectWhileInPocket(gc: GameContainer, delta_t: Int) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun effectWhenPickedUp(gc: GameContainer, delta_t: Int) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun primaryUse(gc: GameContainer, delta_t: Int) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun secondaryUse(gc: GameContainer, delta_t: Int) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun effectWhenThrownAway(gc: GameContainer, delta_t: Int) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user