mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-19 06:54:05 +09:00
new item type, "Dynamic Item"; working text terminal
Former-commit-id: 81e6d836f5f1e6490027d38146a32d404cf9ce3e Former-commit-id: af6557340f9cd0ea0b67eb7a8825aeffe75f9d82
This commit is contained in:
@@ -78,6 +78,12 @@ object AVKey {
|
||||
const val MAGICREGENRATEMULT = "$MAGICREGENRATE$MULT"
|
||||
|
||||
|
||||
/** String
|
||||
* UUID for certain fixtures
|
||||
*/
|
||||
const val UUID = "uuid"
|
||||
|
||||
|
||||
|
||||
const val __PLAYER_QUICKBARSEL = "__quickbarselection"
|
||||
}
|
||||
@@ -13,8 +13,8 @@ abstract class Actor : Comparable<Actor>, Runnable {
|
||||
abstract fun update(gc: GameContainer, delta: Int)
|
||||
|
||||
/**
|
||||
* Valid RefID is equal to or greater than 32768.
|
||||
* @return Reference ID. (32768-0x7FFF_FFFF)
|
||||
* Valid RefID is equal to or greater than 16777216.
|
||||
* @return Reference ID. (16777216-0x7FFF_FFFF)
|
||||
*/
|
||||
abstract var referenceID: Int
|
||||
abstract var actorValue: ActorValue
|
||||
@@ -40,7 +40,7 @@ abstract class Actor : Comparable<Actor>, Runnable {
|
||||
var ret: Int
|
||||
do {
|
||||
ret = HQRNG().nextInt().and(0x7FFFFFFF) // set new ID
|
||||
} while (Terrarum.ingame.hasActor(ret) || ret < ItemPropCodex.ITEM_UNIQUE_MAX) // check for collision
|
||||
} while (Terrarum.ingame.hasActor(ret) || ret < ItemPropCodex.ITEM_COUNT_MAX) // check for collision
|
||||
return ret
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.gameactors
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.point.Point2d
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.gamemap.GameWorld
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
@@ -162,7 +162,7 @@ open class ActorWithBody : Actor(), Visible {
|
||||
*/
|
||||
@Transient private val SI_TO_GAME_VEL = METER / Terrarum.TARGET_FPS
|
||||
/**
|
||||
* Gravitational Constant G. Load from gamemap.
|
||||
* Gravitational Constant G. Load from gameworld.
|
||||
* [m / s^2]
|
||||
* s^2 = 1/FPS = 1/60 if FPS is targeted to 60
|
||||
* meter to pixel : 24/FPS
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -6,21 +6,29 @@ import net.torvald.spriteanimation.SpriteAnimation
|
||||
* Created by minjaesong on 16-06-17.
|
||||
*/
|
||||
open class FixturesBase : ActorWithBody() {
|
||||
/** Binary flags. Indicates that other actor (player) can pass in the direction.
|
||||
* - (0: No collision)
|
||||
* - 1: Top
|
||||
* - 2: Right
|
||||
* - 4: Bottom
|
||||
* - 8: Left
|
||||
/**
|
||||
* 0: Open
|
||||
* 1: Blocked
|
||||
* 2: Platform; can be stood on, press DOWN to go down. Also allows other blocks can be places on top of it (e.g. torch)
|
||||
* 3: Wall_left; blocks rightward movement
|
||||
* 4: Wall_right: blocks leftward movement
|
||||
* For example, flag of 4 is good for tables; player can stand on, which means
|
||||
* downward movement is blocked within the fixtures' AABB.
|
||||
*/
|
||||
var collisionFlag: Int = 0
|
||||
|
||||
/**
|
||||
* Normally if player is standing on the fixtures (with flag 4), pressing DOWN wiil allow
|
||||
* player to get down. Setting this flag TRUE will block such movement (player cannot get down)
|
||||
* Normally if player is standing on the fixtures (with flag 2 -- COLLISION_PLATFORM),
|
||||
* pressing DOWN wiil allow player to get down.
|
||||
* Setting this flag TRUE will block such movement (player cannot get down)
|
||||
*/
|
||||
var cannotPassThru = false
|
||||
|
||||
companion object {
|
||||
val COLLISION_OPEN = 0
|
||||
val COLLISION_BLOCKED = 1
|
||||
val COLLISION_PLATFORM = 2
|
||||
val COLLISION_WALL_LEFT = 3
|
||||
val COLLISION_WALL_RIGHT = 4
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,12 @@ open class NPCIntelligentBase : ActorWithBody()
|
||||
}
|
||||
|
||||
override fun effectWhenThrown(gc: GameContainer, delta_t: Int) {
|
||||
}
|
||||
|
||||
override fun effectWhenTakenOut(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
|
||||
override fun worldActorEffect(gc: GameContainer, delta: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user