mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-20 07:24:06 +09:00
new item type, "Dynamic Item"; working text terminal
Former-commit-id: 81e6d836f5f1e6490027d38146a32d404cf9ce3e Former-commit-id: af6557340f9cd0ea0b67eb7a8825aeffe75f9d82
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
@@ -8,22 +9,24 @@ import org.newdawn.slick.Graphics
|
||||
/**
|
||||
* Created by minjaesong on 16-03-15.
|
||||
*/
|
||||
class DroppedItem constructor(itemID: Int) : ActorWithBody() {
|
||||
class DroppedItem(private val item: InventoryItem) : ActorWithBody() {
|
||||
|
||||
init {
|
||||
if (itemID >= ItemPropCodex.ITEM_UNIQUE_MAX)
|
||||
if (item.itemID >= ItemPropCodex.ITEM_COUNT_MAX)
|
||||
throw RuntimeException("Attempted to create DroppedItem actor of a real actor; the real actor must be dropped instead.")
|
||||
|
||||
isVisible = true
|
||||
|
||||
mass = if (itemID < TilePropCodex.TILE_UNIQUE_MAX)
|
||||
TilePropCodex.getProp(itemID).density / 1000.0
|
||||
mass = if (item.itemID < TilePropCodex.TILE_UNIQUE_MAX)
|
||||
TilePropCodex.getProp(item.itemID).density / 1000.0
|
||||
else
|
||||
ItemPropCodex.getProp(itemID).mass
|
||||
ItemPropCodex.getProp(item.itemID).mass
|
||||
|
||||
scale = ItemPropCodex.getProp(item.itemID).scale
|
||||
}
|
||||
|
||||
override fun update(gc: GameContainer, delta: Int) {
|
||||
|
||||
item.worldActorEffect(gc, delta)
|
||||
}
|
||||
|
||||
override fun drawBody(gc: GameContainer, g: Graphics) {
|
||||
|
||||
Reference in New Issue
Block a user