mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
extra fields for something-props
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -46,8 +46,6 @@ open class KVHashMap {
|
||||
|
||||
if (value == null) return null
|
||||
|
||||
// if (value is JsonPrimitive) return value.asInt
|
||||
|
||||
return value as Int
|
||||
}
|
||||
|
||||
@@ -58,12 +56,17 @@ open class KVHashMap {
|
||||
|
||||
if (value is Int)
|
||||
return value.toDouble()
|
||||
// else if (value is JsonPrimitive) return value.asDouble
|
||||
|
||||
return value as Double
|
||||
}
|
||||
|
||||
fun getAsFloat(key: String): Float? {
|
||||
val value = get(key)
|
||||
|
||||
if (value == null) return null
|
||||
|
||||
if (value is Float) return value as Float
|
||||
|
||||
return getAsDouble(key)?.toFloat()
|
||||
}
|
||||
|
||||
@@ -72,8 +75,6 @@ open class KVHashMap {
|
||||
|
||||
if (value == null) return null
|
||||
|
||||
// if (value is JsonPrimitive) return value.asString
|
||||
|
||||
return value as String
|
||||
}
|
||||
|
||||
@@ -82,8 +83,6 @@ open class KVHashMap {
|
||||
|
||||
if (value == null) return null
|
||||
|
||||
// if (value is JsonPrimitive) return value.asBoolean
|
||||
|
||||
return value as Boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.UnsafeHelper
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.AppLoader.*
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
@@ -654,4 +655,16 @@ val MaterialCodex: MaterialCodex
|
||||
val FactionCodex: FactionCodex
|
||||
get() = Terrarum.factionCodex
|
||||
val Apocryphas: HashMap<String, Any>
|
||||
get() = Terrarum.apocryphas
|
||||
get() = Terrarum.apocryphas
|
||||
|
||||
class Codex : KVHashMap() {
|
||||
|
||||
fun getAsCvec(key: String): Cvec? {
|
||||
val value = get(key)
|
||||
|
||||
if (value == null) return null
|
||||
|
||||
return value as Cvec
|
||||
}
|
||||
|
||||
}
|
||||
@@ -95,4 +95,9 @@ class BlockProp {
|
||||
@Transient var rngBase0 = Math.random().toFloat() // initial cycle phase (xxxxFuncX)
|
||||
@Transient var rngBase1 = Math.random().toFloat() // flicker P0, etc
|
||||
@Transient var rngBase2 = Math.random().toFloat() // flicker P1, etc
|
||||
|
||||
/**
|
||||
* Mainly intended to be used by third-party modules
|
||||
*/
|
||||
val extra = Codex()
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.blockproperties
|
||||
|
||||
import net.torvald.terrarum.Codex
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
|
||||
/**
|
||||
@@ -19,4 +20,8 @@ class WireProp {
|
||||
|
||||
var canBranch: Boolean = true
|
||||
|
||||
/**
|
||||
* Mainly intended to be used by third-party modules
|
||||
*/
|
||||
val extra = Codex()
|
||||
}
|
||||
@@ -18,6 +18,11 @@ class Faction(name: String) : Comparable<Faction> {
|
||||
lateinit var factionFearful: HashSet<String>
|
||||
var referenceID: FactionID = generateUniqueID()
|
||||
|
||||
/**
|
||||
* Mainly intended to be used by third-party modules
|
||||
*/
|
||||
val extra = Codex()
|
||||
|
||||
init {
|
||||
factionAmicable = HashSet<String>()
|
||||
factionNeutral = HashSet<String>()
|
||||
|
||||
@@ -143,6 +143,11 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
|
||||
|
||||
@Transient var using = false // Always false when loaded from savegame
|
||||
|
||||
/**
|
||||
* Mainly intended to be used by third-party modules
|
||||
*/
|
||||
open val extra = Codex()
|
||||
|
||||
/**
|
||||
* Effects applied continuously while in pocket
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.itemproperties
|
||||
|
||||
import net.torvald.terrarum.AppLoader.printmsg
|
||||
import net.torvald.terrarum.Codex
|
||||
import net.torvald.terrarum.blockproperties.floatVal
|
||||
import net.torvald.terrarum.blockproperties.intVal
|
||||
import net.torvald.terrarum.utils.CSVFetcher
|
||||
@@ -24,6 +25,11 @@ class Material {
|
||||
var durability: Int = 0 // tools only
|
||||
|
||||
var identifier: String = "Name not set"
|
||||
|
||||
/**
|
||||
* Mainly intended to be used by third-party modules
|
||||
*/
|
||||
val extra = Codex()
|
||||
}
|
||||
|
||||
class MaterialCodex {
|
||||
|
||||
Reference in New Issue
Block a user