mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
reading material from the module; pixaxes use it
But "dynamic item" created from the pickaxe class is not right
This commit is contained in:
@@ -119,7 +119,7 @@
|
||||
#
|
||||
# vscs: viscosity, (velocity) / (1 + (n/16)), 16 halves movement speed, can be used to non-fluid tiles (sticky hazard, tarmac road in Terraria)
|
||||
#
|
||||
# str: strength
|
||||
# str: strength. Only useful for pickaxes
|
||||
#
|
||||
# dsty: density. As we are putting water an 1000, it is identical to specific gravity. [g/l]
|
||||
#
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
"id";"classname"
|
||||
"8448";"net.torvald.terrarum.modulebasegame.items.PickaxeGeneric"
|
||||
"8449";"net.torvald.terrarum.modulebasegame.items.WirePieceSignalWire"
|
||||
"8448";"net.torvald.terrarum.modulebasegame.items.PickaxeCopper"
|
||||
"8449";"net.torvald.terrarum.modulebasegame.items.PickaxeIron"
|
||||
"8450";"net.torvald.terrarum.modulebasegame.items.PickaxeSteel"
|
||||
"8466";"net.torvald.terrarum.modulebasegame.items.WirePieceSignalWire"
|
||||
|
||||
|
@@ -1,19 +1,35 @@
|
||||
"idst";"dsty";"forcemod";"endurance";"comments"
|
||||
"ROCK";"2400"; "1"; "0.42";
|
||||
"CUPR";"1000"; "2"; "1.00";"copper"
|
||||
"EGLS";"2500"; "4"; "0.82";"elven glass"
|
||||
"IRON";"1000"; "5"; "1.42";
|
||||
"ARGN";"1000"; "9"; "0.91";"argentum/silver"
|
||||
"STAL";"1000"; "14"; "1.73";"steel"
|
||||
"EAUR";"1000"; "21"; "1.36";"elven aurichalcum"
|
||||
"TIAL";"1000"; "33"; "2.16";"titanium alloy (Ti6Al4V)"
|
||||
"ADMT";"1000"; "71"; "3.42";"adamant"
|
||||
"idst";"tens";"impf";"dsty";"fmod";"endurance";"tcond";"comments"
|
||||
"ROCK"; "15"; "210";"3000"; "1"; "0.42"; "10";
|
||||
"CUPR"; "210"; "770";"8960"; "2"; "1.00"; "401";"copper"
|
||||
"EGLS"; "33";"1000";"2325"; "4"; "0.82"; "10";"elven glass/moldavite"
|
||||
"IRON"; "350";"1085";"7874"; "5"; "1.42"; "10";
|
||||
"ARGN"; "170"; "595";"10490"; "9"; "0.91"; "10";"argentum/silver"
|
||||
"STAL"; "531";"2520";"7874"; "14"; "1.73"; "10";"steel"
|
||||
"EAUR"; "768"; "0";"8192"; "21"; "1.36"; "10";"elven aurichalcum"
|
||||
"TIAL"; "900"; "0";"4420"; "33"; "2.16"; "10";"titanium alloy (Ti6Al4V)"
|
||||
"ADMT";"2000";"4090";"2700"; "71"; "3.42"; "10";"adamant"
|
||||
|
||||
# idst: ID_STRING
|
||||
"OOZE"; "0";"genetic ooze"
|
||||
|
||||
# forcemod: related to attack points
|
||||
# idst: ID_STRING, ALL CAPS
|
||||
|
||||
# tens: tensile strength (= ultimate stringth)
|
||||
ultimate stringth is technically a tensile strength, but I'm using it anyway because it's easiest to get the value from
|
||||
that, or DF's tensile fracture divided by 1000 (I think Toady and I are both using values posted on Wikipedia, e.g. Silver)
|
||||
|
||||
# impf: Dwarf Fortress impact fracture divided by 1000 (likely not being used)
|
||||
|
||||
# dsty: density (grams per litre)
|
||||
|
||||
# fmod: forcemod -- related to attack points
|
||||
# Attack points = `4 * forcemod.sqrt()` for each strike
|
||||
|
||||
# endurance: multiplier, using copper as reference; determines durability of tools/weapons/armours/etc.
|
||||
the base value for endurance differes to tool to tool. When integer is used, resulting value must be ROUNDED.
|
||||
|
||||
# tcond: thermal conductivity
|
||||
|
||||
# Comments: do nothing; do not parse
|
||||
|
||||
|
||||
## These values are being used by the phys simulator (blocks) and for attack power calculation (items)
|
||||
|
||||
|
@@ -8,6 +8,7 @@ import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemID
|
||||
import net.torvald.terrarum.itemproperties.MaterialCodex
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.utils.CSVFetcher
|
||||
import net.torvald.terrarum.utils.JsonFetcher
|
||||
@@ -249,4 +250,12 @@ object ModMgr {
|
||||
Lang.load(getPath(module, langPath))
|
||||
}
|
||||
}
|
||||
|
||||
object GameMaterialLoader {
|
||||
val matePath = "materials/"
|
||||
|
||||
@JvmStatic operator fun invoke(module: String) {
|
||||
MaterialCodex(module, matePath + "materials.csv")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,45 +139,45 @@ object BlockCodex {
|
||||
print("${intVal(record, "id")}")
|
||||
println("\t" + prop.nameKey)
|
||||
}
|
||||
|
||||
private fun str16ToInt(rec: CSVRecord, s: String): Int {
|
||||
var ret = 0
|
||||
try {
|
||||
ret = rec.get(s).toLong(16).toInt()
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
}
|
||||
catch (e1: IllegalStateException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
private fun intVal(rec: CSVRecord, s: String): Int {
|
||||
var ret = -1
|
||||
try {
|
||||
ret = rec.get(s).toInt()
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
}
|
||||
catch (e1: IllegalStateException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
private fun floatVal(rec: CSVRecord, s: String): Float {
|
||||
var ret = -1f
|
||||
try {
|
||||
ret = rec.get(s).toFloat()
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
}
|
||||
catch (e1: IllegalStateException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
private fun boolVal(rec: CSVRecord, s: String) = intVal(rec, s) != 0
|
||||
}
|
||||
|
||||
fun str16ToInt(rec: CSVRecord, s: String): Int {
|
||||
var ret = 0
|
||||
try {
|
||||
ret = rec.get(s).toLong(16).toInt()
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
}
|
||||
catch (e1: IllegalStateException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
fun intVal(rec: CSVRecord, s: String): Int {
|
||||
var ret = -1
|
||||
try {
|
||||
ret = rec.get(s).toInt()
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
}
|
||||
catch (e1: IllegalStateException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
fun floatVal(rec: CSVRecord, s: String): Float {
|
||||
var ret = -1f
|
||||
try {
|
||||
ret = rec.get(s).toFloat()
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
}
|
||||
catch (e1: IllegalStateException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
fun boolVal(rec: CSVRecord, s: String) = intVal(rec, s) != 0
|
||||
@@ -298,8 +298,6 @@ abstract class GameItem : Comparable<GameItem>, Cloneable {
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
val NULL_MATERIAL = Material(0,0,0,0,0,0,0,0,1,0.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ object ItemCodex {
|
||||
override var stackable: Boolean = false
|
||||
|
||||
override val isDynamic: Boolean = false
|
||||
override val material: Material = Material(1,1,1,1,1,1,1,1,1,1.0)
|
||||
override val material: Material = Material()
|
||||
|
||||
init {
|
||||
equipPosition = EquipPosition.HAND_GRIP
|
||||
@@ -217,7 +217,7 @@ object ItemCodex {
|
||||
override var stackable: Boolean = false
|
||||
|
||||
override val isDynamic: Boolean = false
|
||||
override val material: Material = Material(1,1,1,1,1,1,1,1,1,1.0)
|
||||
override val material: Material = Material()
|
||||
|
||||
init {
|
||||
equipPosition = EquipPosition.HAND_GRIP
|
||||
|
||||
@@ -1,36 +1,56 @@
|
||||
package net.torvald.terrarum.itemproperties
|
||||
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.blockproperties.floatVal
|
||||
import net.torvald.terrarum.blockproperties.intVal
|
||||
import net.torvald.terrarum.utils.CSVFetcher
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* To be used with items AND TILES (electricity resistance, thermal conductivity)
|
||||
*
|
||||
* Created by minjaesong on 2016-03-18.
|
||||
*/
|
||||
data class Material (
|
||||
//var maxEdge: Int, // i think weapSharpnessMod would cut it // arbitrary unit
|
||||
var hardness: Int, // arbitrary unit
|
||||
var density: Int, // grams per litre
|
||||
class Material {
|
||||
var strength: Int = 1 // actually tensile strength
|
||||
var density: Int = 1000 // grams per litre
|
||||
|
||||
// impact force: force applied by sudden strike, e.g. hammer/axe/sword strike
|
||||
var impactRigidness: Int, // arbitrary unit (rigid <-> soft) a weapon made of soft material will inflict less damage
|
||||
var impactFractureForce: Int, // pascal (N/m^2); if the item (e.g. sword) receives a force that exceeds this value, the item will be destroyed
|
||||
var thermalConductivity: Float = 10f // watts per metre-kelven
|
||||
|
||||
// compressive force: force applied by exerting pressure on an object, e.g. sword/spear stab
|
||||
var compressiveRigidness: Int, // arbitrary unit (rigid <-> soft) a weapon made of soft material will inflict less damage
|
||||
var compressiveFractureForce: Int, // pascal (N/m^2); if the item (e.g. sword) receives a force that exceeds this value, the item will be destroyed
|
||||
var forceMod: Int = 1 // arbitrary unit. See Pickaxe_Power.xlsx
|
||||
var enduranceMod: Float = 1f // multiplier. Copper as 1.0
|
||||
//var armourMod: Float // multiplier. Copper as 1.0
|
||||
|
||||
// remarks:
|
||||
// we won't need elasticity, even if we have glass
|
||||
// some examples:
|
||||
// - glass sword works as the material has high compressive fracture, but prone to shatter
|
||||
// (hit mobs 5-6 times and it's gone) as it shatters easily as it has low impact fracture
|
||||
var durability: Int = 0 // tools only
|
||||
}
|
||||
|
||||
object MaterialCodex {
|
||||
|
||||
private var materialProps = HashMap<String, Material>()
|
||||
private val nullMaterial = Material()
|
||||
|
||||
var electricityResistance: Int, // ohm
|
||||
var thermalConductivity: Int, // pascal (N/m^2); if the item (e.g. sword) receives a force that exceeds this value, the item will be destroyed
|
||||
operator fun invoke(module: String, path: String) {
|
||||
try {
|
||||
val records = CSVFetcher.readFromModule(module, path)
|
||||
|
||||
printdbg(this, "Building materials table")
|
||||
|
||||
records.forEach {
|
||||
val prop = Material()
|
||||
prop.strength = intVal(it, "tens")
|
||||
prop.density = intVal(it, "dsty")
|
||||
prop.forceMod = intVal(it, "forcemod")
|
||||
prop.enduranceMod = floatVal(it, "endurance")
|
||||
prop.thermalConductivity = floatVal(it, "tcond")
|
||||
|
||||
var forceMod: Int, // arbitrary unit. See Pickaxe_Power.xlsx
|
||||
var armourMod: Double // multiplier
|
||||
)
|
||||
materialProps[it.get("idst").toUpperCase()] = prop
|
||||
}
|
||||
}
|
||||
catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
operator fun get(identifier: String) = materialProps[identifier.toUpperCase()] ?: nullMaterial
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package net.torvald.terrarum.itemproperties
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-03-18.
|
||||
*/
|
||||
object MaterialCodex {
|
||||
val CSV_PATH = "./src/com/torvald/terrarum/itemproperties/materialprop.csv"
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.itemproperties.MaterialCodex
|
||||
import net.torvald.terrarum.modulebasegame.imagefont.WatchFont
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
@@ -18,22 +18,27 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
*/
|
||||
class EntryPoint : ModuleEntryPoint() {
|
||||
|
||||
private val moduleName = "basegame"
|
||||
|
||||
override fun invoke() {
|
||||
|
||||
ModMgr.GameBlockLoader.invoke("basegame")
|
||||
ModMgr.GameItemLoader.invoke("basegame")
|
||||
ModMgr.GameLanguageLoader.invoke("basegame")
|
||||
// the order of invocation is important! Material should be the first as blocks and items are depend on it.
|
||||
ModMgr.GameMaterialLoader.invoke(moduleName)
|
||||
ModMgr.GameBlockLoader.invoke(moduleName)
|
||||
ModMgr.GameItemLoader.invoke(moduleName)
|
||||
ModMgr.GameLanguageLoader.invoke(moduleName)
|
||||
|
||||
|
||||
|
||||
// load common resources to the AssetsManager
|
||||
AppLoader.resourcePool.addToLoadingList("basegame.items16", TextureRegionPack.javaClass) {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "items/items.tga"), 16, 16)
|
||||
AppLoader.resourcePool.addToLoadingList("$moduleName.items16", TextureRegionPack.javaClass) {
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items.tga"), 16, 16)
|
||||
}
|
||||
AppLoader.resourcePool.addToLoadingList("basegame.items24", TextureRegionPack.javaClass) {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "items/items24.tga"), 24, 24)
|
||||
AppLoader.resourcePool.addToLoadingList("$moduleName.items24", TextureRegionPack.javaClass) {
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items24.tga"), 24, 24)
|
||||
}
|
||||
AppLoader.resourcePool.addToLoadingList("basegame.items48", TextureRegionPack.javaClass) {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "items/items48.tga"), 48, 48)
|
||||
AppLoader.resourcePool.addToLoadingList("$moduleName.items48", TextureRegionPack.javaClass) {
|
||||
TextureRegionPack(ModMgr.getGdxFile(moduleName, "items/items48.tga"), 48, 48)
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +64,7 @@ class EntryPoint : ModuleEntryPoint() {
|
||||
override var stackable = true
|
||||
override var inventoryCategory = if (i in ItemCodex.ITEM_TILES) Category.BLOCK else Category.WALL
|
||||
override var isDynamic = false
|
||||
override val material = Material(0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0)
|
||||
override val material = MaterialCodex[blockProp.material]
|
||||
|
||||
init {
|
||||
equipPosition = EquipPosition.HAND_GRIP
|
||||
|
||||
@@ -164,7 +164,7 @@ open class ActorHumanoid(
|
||||
override val originalName: String = actorValue.getAsString(AVKey.NAME) ?: "(no name)"
|
||||
override var stackable = false
|
||||
override val isDynamic = false
|
||||
override val material = Material(0,0,0,0,0,0,0,0,0,0.0)
|
||||
override val material = Material()
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
@@ -46,7 +46,7 @@ open class HumanoidNPC(
|
||||
override val originalName: String = actorValue.getAsString(AVKey.NAME) ?: "NPC"
|
||||
override var stackable = true
|
||||
override val isDynamic = false
|
||||
override val material = Material(0,0,0,0,0,0,0,0,0,0.0)
|
||||
override val material = Material()
|
||||
|
||||
override fun startPrimaryUse(delta: Float): Boolean {
|
||||
try {
|
||||
|
||||
@@ -4,7 +4,6 @@ import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.faction.FactionFactory
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
/**
|
||||
@@ -96,8 +95,11 @@ object PlayerBuilderSigrid {
|
||||
)
|
||||
blocks.forEach { inventory.add(it, 9995) }
|
||||
walls.forEach { inventory.add(it + 4096, 9995) }
|
||||
inventory.add(ItemCodex.ITEM_STATIC.first)
|
||||
inventory.add(9000)
|
||||
inventory.add(9001)
|
||||
inventory.add(8448) // copper pick
|
||||
inventory.add(8449) // iron pick
|
||||
inventory.add(8450) // steel pick
|
||||
inventory.add(8466) // wire piece
|
||||
inventory.add(9000) // TEST water bucket
|
||||
inventory.add(9001) // TEST lava bucket
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,35 +10,18 @@ import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||
import net.torvald.terrarum.itemproperties.Calculate
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemID
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.itemproperties.MaterialCodex
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.modulebasegame.items.PickaxeCore.BASE_MASS_AND_SIZE
|
||||
import net.torvald.terrarum.modulebasegame.items.PickaxeCore.TOOL_DURABILITY_BASE
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-07-17.
|
||||
* Created by minjaesong on 2019-03-10.
|
||||
*/
|
||||
class PickaxeGeneric(override val originalID: ItemID) : GameItem() {
|
||||
|
||||
override var dynamicID: ItemID = originalID
|
||||
override val originalName = "PACKAGED_PICK"
|
||||
override var baseMass = 10.0
|
||||
override var baseToolSize: Double? = 10.0
|
||||
override var stackable = true
|
||||
override var inventoryCategory = Category.TOOL
|
||||
override val isUnique = false
|
||||
override val isDynamic = true
|
||||
override var material = Material(0,0,0,0,0,0,0,0,1,0.0)
|
||||
override val itemImage: TextureRegion?
|
||||
get() = (AppLoader.resourcePool["basegame.items24"] as TextureRegionPack).get(2,0)
|
||||
|
||||
init {
|
||||
super.equipPosition = GameItem.EquipPosition.HAND_GRIP
|
||||
super.maxDurability = 147
|
||||
super.durability = maxDurability.toFloat()
|
||||
super.name = "Builtin Pickaxe"
|
||||
}
|
||||
|
||||
override fun startPrimaryUse(delta: Float): Boolean {
|
||||
object PickaxeCore {
|
||||
fun startPrimaryUse(delta: Float, item: GameItem): Boolean {
|
||||
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||
if (player == null) return false
|
||||
|
||||
@@ -48,7 +31,7 @@ class PickaxeGeneric(override val originalID: ItemID) : GameItem() {
|
||||
val mousePoint = Point2d(mouseTileX.toDouble(), mouseTileY.toDouble())
|
||||
val actorvalue = player.actorValue
|
||||
|
||||
using = true
|
||||
item.using = true
|
||||
|
||||
// linear search filter (check for intersection with tilewise mouse point and tilewise hitbox)
|
||||
// return false if hitting actors
|
||||
@@ -66,19 +49,106 @@ class PickaxeGeneric(override val originalID: ItemID) : GameItem() {
|
||||
|
||||
(Terrarum.ingame!!.world).inflictTerrainDamage(
|
||||
mouseTileX, mouseTileY,
|
||||
Calculate.pickaxePower(player, material) * swingDmgToFrameDmg
|
||||
Calculate.pickaxePower(player, item.material) * swingDmgToFrameDmg
|
||||
)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun endPrimaryUse(delta: Float): Boolean {
|
||||
fun endPrimaryUse(delta: Float, item: GameItem): Boolean {
|
||||
val player = (Terrarum.ingame!! as Ingame).actorNowPlaying
|
||||
if (player == null) return false
|
||||
|
||||
using = false
|
||||
item.using = false
|
||||
// reset action timer to zero
|
||||
player.actorValue.set(AVKey.__ACTION_TIMER, 0.0)
|
||||
return true
|
||||
}
|
||||
|
||||
const val BASE_MASS_AND_SIZE = 10.0 // of iron pick
|
||||
const val TOOL_DURABILITY_BASE = 350 // of iron pick
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-07-17.
|
||||
*/
|
||||
class PickaxeCopper(override val originalID: ItemID) : GameItem() {
|
||||
|
||||
override var dynamicID: ItemID = originalID
|
||||
override val originalName = "PACKAGED_PICK"
|
||||
override var baseToolSize: Double? = BASE_MASS_AND_SIZE
|
||||
override var stackable = true
|
||||
override var inventoryCategory = Category.TOOL
|
||||
override val isUnique = false
|
||||
override val isDynamic = true
|
||||
override var material = MaterialCodex["CUPR"]
|
||||
override var baseMass = material.density.toDouble() / MaterialCodex["IRON"].density * BASE_MASS_AND_SIZE
|
||||
override val itemImage: TextureRegion?
|
||||
get() = (AppLoader.resourcePool["basegame.items24"] as TextureRegionPack).get(0,0)
|
||||
|
||||
init {
|
||||
super.equipPosition = GameItem.EquipPosition.HAND_GRIP
|
||||
super.maxDurability = (TOOL_DURABILITY_BASE * material.enduranceMod).roundToInt()
|
||||
super.durability = maxDurability.toFloat()
|
||||
super.name = "Copper Pickaxe"
|
||||
}
|
||||
|
||||
override fun startPrimaryUse(delta: Float) = PickaxeCore.startPrimaryUse(delta, this)
|
||||
override fun endPrimaryUse(delta: Float) = PickaxeCore.endPrimaryUse(delta, this)
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2019-03-10.
|
||||
*/
|
||||
class PickaxeIron(override val originalID: ItemID) : GameItem() {
|
||||
|
||||
override var dynamicID: ItemID = originalID
|
||||
override val originalName = "PACKAGED_PICK"
|
||||
override var baseToolSize: Double? = BASE_MASS_AND_SIZE
|
||||
override var stackable = true
|
||||
override var inventoryCategory = Category.TOOL
|
||||
override val isUnique = false
|
||||
override val isDynamic = true
|
||||
override var material = MaterialCodex["IRON"]
|
||||
override var baseMass = material.density.toDouble() / MaterialCodex["IRON"].density * BASE_MASS_AND_SIZE
|
||||
override val itemImage: TextureRegion?
|
||||
get() = (AppLoader.resourcePool["basegame.items24"] as TextureRegionPack).get(1,0)
|
||||
|
||||
init {
|
||||
super.equipPosition = GameItem.EquipPosition.HAND_GRIP
|
||||
super.maxDurability = (TOOL_DURABILITY_BASE * material.enduranceMod).roundToInt()
|
||||
super.durability = maxDurability.toFloat()
|
||||
super.name = "Iron Pickaxe"
|
||||
}
|
||||
|
||||
override fun startPrimaryUse(delta: Float) = PickaxeCore.startPrimaryUse(delta, this)
|
||||
override fun endPrimaryUse(delta: Float) = PickaxeCore.endPrimaryUse(delta, this)
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2019-03-10.
|
||||
*/
|
||||
class PickaxeSteel(override val originalID: ItemID) : GameItem() {
|
||||
|
||||
override var dynamicID: ItemID = originalID
|
||||
override val originalName = "PACKAGED_PICK"
|
||||
override var baseToolSize: Double? = BASE_MASS_AND_SIZE
|
||||
override var stackable = true
|
||||
override var inventoryCategory = Category.TOOL
|
||||
override val isUnique = false
|
||||
override val isDynamic = true
|
||||
override var material = MaterialCodex["STAL"]
|
||||
override var baseMass = material.density.toDouble() / MaterialCodex["IRON"].density * BASE_MASS_AND_SIZE
|
||||
override val itemImage: TextureRegion?
|
||||
get() = (AppLoader.resourcePool["basegame.items24"] as TextureRegionPack).get(2,0)
|
||||
|
||||
init {
|
||||
super.equipPosition = GameItem.EquipPosition.HAND_GRIP
|
||||
super.maxDurability = (TOOL_DURABILITY_BASE * material.enduranceMod).roundToInt()
|
||||
super.durability = maxDurability.toFloat()
|
||||
super.name = "Steel Pickaxe"
|
||||
}
|
||||
|
||||
override fun startPrimaryUse(delta: Float) = PickaxeCore.startPrimaryUse(delta, this)
|
||||
override fun endPrimaryUse(delta: Float) = PickaxeCore.endPrimaryUse(delta, this)
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemID
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
@@ -20,7 +21,7 @@ class WirePieceSignalWire(override val originalID: ItemID) : GameItem() {
|
||||
override var inventoryCategory = Category.WIRE
|
||||
override val isUnique = false
|
||||
override val isDynamic = false
|
||||
override val material = GameItem.NULL_MATERIAL
|
||||
override val material = Material()
|
||||
override val itemImage: TextureRegion?
|
||||
get() = (AppLoader.resourcePool["basegame.items16"] as TextureRegionPack).get(1,9)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user