mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 05:24:06 +09:00
pickaxe working as intended
This commit is contained in:
@@ -79,6 +79,11 @@ object AVKey {
|
||||
const val MAGICREGENRATE = "magicregenrate"
|
||||
const val MAGICREGENRATEBUFF = "$MAGICREGENRATE$BUFF"
|
||||
|
||||
/** Double
|
||||
*
|
||||
*/
|
||||
const val ACTION_INTERVAL = "actioninterval"
|
||||
|
||||
|
||||
/** String
|
||||
* UUID for certain fixtures
|
||||
@@ -91,4 +96,9 @@ object AVKey {
|
||||
/** SYNOPSIS: __qsitem1 .. __qsitem10
|
||||
* contains tem ID; they are supposed to be unique. Indices must be ONE-BASED! */
|
||||
const val __PLAYER_QSPREFIX = "__qsitem" // __qsitem1 .. __qsitem10 (NOT ZERO BASED!)
|
||||
/** Double
|
||||
* When using tool/arm/etc. how long action button is held, in milliseconds (Int)
|
||||
* Or for NPCs, how long it has been waiting for next move
|
||||
*/
|
||||
const val __ACTION_TIMER = "__actiontimer"
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.Millisec
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.faction.Faction
|
||||
import net.torvald.terrarum.gamecontroller.EnumKeyFunc
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.InventoryItem
|
||||
import net.torvald.terrarum.realestate.RealEstateUtility
|
||||
import org.newdawn.slick.GameContainer
|
||||
import org.newdawn.slick.Input
|
||||
@@ -22,6 +23,7 @@ open class ActorHumanoid(birth: GameDate, death: GameDate? = null)
|
||||
var vehicleRiding: Controllable? = null // usually player only
|
||||
|
||||
|
||||
|
||||
/** Must be set by PlayerFactory */
|
||||
override var inventory: ActorInventory = ActorInventory(this, 2000, ActorInventory.CAPACITY_MODE_WEIGHT) // default constructor
|
||||
|
||||
@@ -77,6 +79,8 @@ open class ActorHumanoid(birth: GameDate, death: GameDate? = null)
|
||||
@Transient internal const val WALK_ACCEL_BASE: Double = 0.67
|
||||
|
||||
@Transient const val BASE_HEIGHT = 40
|
||||
// 333.33 miliseconds
|
||||
@Transient const val BASE_ACTION_INTERVAL = 1000.0 / 3.0
|
||||
|
||||
@Transient const val SPRITE_ROW_IDLE = 0
|
||||
@Transient const val SPRITE_ROW_WALK = 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.ui.UIInventory
|
||||
import java.util.*
|
||||
|
||||
@@ -1329,6 +1329,7 @@ fun Float.roundInt(): Int = Math.round(this)
|
||||
fun Double.abs() = Math.abs(this)
|
||||
fun Double.sqr() = this * this
|
||||
fun Double.sqrt() = Math.sqrt(this)
|
||||
fun Float.sqrt() = FastMath.sqrt(this)
|
||||
fun Int.abs() = if (this < 0) -this else this
|
||||
fun Double.bipolarClamp(limit: Double) =
|
||||
if (this > 0 && this > limit) limit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.InventoryItem
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-31.
|
||||
|
||||
@@ -22,6 +22,9 @@ object CreatureBuilder {
|
||||
val actor = ActorWithSprite(Actor.RenderOrder.MIDDLE)
|
||||
InjectCreatureRaw(actor.actorValue, module, jsonFileName)
|
||||
|
||||
|
||||
actor.actorValue[AVKey.__ACTION_TIMER] = 0.0
|
||||
|
||||
return actor
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.torvald.terrarum.gameactors.ai.ActorAI
|
||||
import net.torvald.terrarum.gameactors.ai.LuaAIWrapper
|
||||
import net.torvald.terrarum.gamecontroller.mouseX
|
||||
import net.torvald.terrarum.gamecontroller.mouseY
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.InventoryItem
|
||||
import org.luaj.vm2.*
|
||||
import org.luaj.vm2.compiler.LuaC
|
||||
import org.luaj.vm2.lib.*
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.torvald.random.Fudge3
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import com.google.gson.JsonObject
|
||||
import net.torvald.terrarum.ActorValue
|
||||
import net.torvald.terrarum.ModuleManager
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.gameactors.ActorHumanoid
|
||||
import org.newdawn.slick.SlickException
|
||||
import java.io.IOException
|
||||
@@ -25,7 +25,7 @@ object InjectCreatureRaw {
|
||||
* @param jsonFileName with extension
|
||||
*/
|
||||
operator fun invoke(actorValueRef: ActorValue, module: String, jsonFileName: String) {
|
||||
val jsonObj = JsonFetcher(ModuleManager.getPath(module, "creatures/$jsonFileName"))
|
||||
val jsonObj = JsonFetcher(ModMgr.getPath(module, "creatures/$jsonFileName"))
|
||||
|
||||
val elementsInt = arrayOf(AVKey.BASEHEIGHT, AVKey.TOOLSIZE, AVKey.ENCUMBRANCE)
|
||||
val elementsString = arrayOf(AVKey.RACENAME, AVKey.RACENAMEPLURAL)
|
||||
|
||||
@@ -19,6 +19,8 @@ object PlayerBuilder {
|
||||
|
||||
// do etc.
|
||||
p.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] = 0
|
||||
p.actorValue[AVKey.__ACTION_TIMER] = 0.0
|
||||
p.actorValue[AVKey.ACTION_INTERVAL] = ActorHumanoid.BASE_ACTION_INTERVAL
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import net.torvald.terrarum.ModuleManager
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.gameactors.ai.LuaAIWrapper
|
||||
import net.torvald.terrarum.mapdrawer.FeaturesDrawer
|
||||
@@ -20,10 +20,12 @@ object PlayerBuilderCynthia {
|
||||
|
||||
|
||||
p.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] = 0
|
||||
p.actorValue[AVKey.__ACTION_TIMER] = 0.0
|
||||
p.actorValue[AVKey.ACTION_INTERVAL] = ActorHumanoid.BASE_ACTION_INTERVAL
|
||||
p.actorValue[AVKey.NAME] = "Cynthia"
|
||||
|
||||
|
||||
p.makeNewSprite(26, 42, ModuleManager.getPath("basegame", "sprites/test_player_2.tga"))
|
||||
p.makeNewSprite(26, 42, ModMgr.getPath("basegame", "sprites/test_player_2.tga"))
|
||||
p.sprite!!.delay = 200
|
||||
p.sprite!!.setRowsAndFrames(1, 1)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.torvald.terrarum.gameactors.faction.Faction
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import com.google.gson.JsonObject
|
||||
import net.torvald.terrarum.ActorValue
|
||||
import net.torvald.terrarum.ModuleManager
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.gameactors.faction.FactionFactory
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
@@ -28,11 +28,11 @@ object PlayerBuilderSigrid {
|
||||
|
||||
p.referenceID = 0x51621D // the only constant of this procedural universe
|
||||
|
||||
p.makeNewSprite(28, 51, ModuleManager.getPath("basegame", "sprites/test_player.tga"))
|
||||
p.makeNewSprite(28, 51, ModMgr.getPath("basegame", "sprites/test_player.tga"))
|
||||
p.sprite!!.delay = 200
|
||||
p.sprite!!.setRowsAndFrames(1, 1)
|
||||
|
||||
p.makeNewSpriteGlow(28, 51, ModuleManager.getPath("basegame", "sprites/test_player_glow.tga"))
|
||||
p.makeNewSpriteGlow(28, 51, ModMgr.getPath("basegame", "sprites/test_player_glow.tga"))
|
||||
p.spriteGlow!!.delay = 200
|
||||
p.spriteGlow!!.setRowsAndFrames(1, 1)
|
||||
|
||||
@@ -64,7 +64,8 @@ object PlayerBuilderSigrid {
|
||||
p.actorValue[AVKey.BASEDEFENCE] = 141
|
||||
|
||||
p.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] = 0
|
||||
//p.actorValue["__selectedtile"] = 147 // test code; replace with <tile_item>.primaryUse(gc, delta)
|
||||
p.actorValue[AVKey.__ACTION_TIMER] = 0.0
|
||||
p.actorValue[AVKey.ACTION_INTERVAL] = ActorHumanoid.BASE_ACTION_INTERVAL
|
||||
p.actorValue["__aimhelper"] = true // TODO when you'll gonna implement it?
|
||||
|
||||
p.setHitboxDimension(15, p.actorValue.getAsInt(AVKey.BASEHEIGHT)!!, 11, 0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.ModuleManager
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.gameactors.ai.LuaAIWrapper
|
||||
import net.torvald.terrarum.mapdrawer.FeaturesDrawer
|
||||
|
||||
@@ -14,10 +14,12 @@ object PlayerBuilderTestSubject1 {
|
||||
|
||||
|
||||
p.actorValue[AVKey.__PLAYER_QUICKSLOTSEL] = 0
|
||||
p.actorValue[AVKey.__ACTION_TIMER] = 0.0
|
||||
p.actorValue[AVKey.ACTION_INTERVAL] = ActorHumanoid.BASE_ACTION_INTERVAL
|
||||
p.actorValue[AVKey.NAME] = "Test Subject 1"
|
||||
|
||||
|
||||
p.makeNewSprite(48, 52, ModuleManager.getPath("basegame", "sprites/npc_template_anim_prototype.tga"))
|
||||
p.makeNewSprite(48, 52, ModMgr.getPath("basegame", "sprites/npc_template_anim_prototype.tga"))
|
||||
p.sprite!!.delay = 200
|
||||
p.sprite!!.setRowsAndFrames(2, 4)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.gameactors.faction
|
||||
|
||||
import net.torvald.JsonFetcher
|
||||
import com.google.gson.JsonObject
|
||||
import net.torvald.terrarum.ModuleManager
|
||||
import net.torvald.terrarum.ModMgr
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
@@ -16,7 +16,7 @@ object FactionFactory {
|
||||
*/
|
||||
@Throws(IOException::class)
|
||||
fun create(module: String, path: String): Faction {
|
||||
val jsonObj = JsonFetcher(ModuleManager.getPath(module, path))
|
||||
val jsonObj = JsonFetcher(ModMgr.getPath(module, path))
|
||||
val factionObj = Faction(jsonObj.get("factionname").asString)
|
||||
|
||||
jsonObj.get("factionamicable").asJsonArray.forEach { factionObj.addFactionAmicable(it.asString) }
|
||||
|
||||
Reference in New Issue
Block a user