mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
new wire property: branching
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
"id";"drop";"name";"renderclass";"accept";"inputcount";"inputtype";"outputtype";"javaclass";"inventoryimg"
|
"id";"drop";"name";"renderclass";"accept";"inputcount";"inputtype";"outputtype";"javaclass";"inventoryimg";"branching"
|
||||||
"8192";"8192";"WIRE_RED";"signal";"digital_bit";"3";"N/A";"N/A";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire";"basegame.items16,1,9"
|
"8192";"8192";"WIRE_RED";"signal";"digital_bit";"3";"N/A";"N/A";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire";"basegame.items16,1,9";"1"
|
||||||
"8193";"8193";"WIRE_GREEN";"signal";"digital_bit";"3";"N/A";"N/A";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire";"basegame.items16,1,10"
|
"8193";"8193";"WIRE_GREEN";"signal";"digital_bit";"3";"N/A";"N/A";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire";"basegame.items16,1,10";"1"
|
||||||
"8194";"8194";"WIRE_BLUE";"signal";"digital_bit";"3";"N/A";"N/A";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire";"basegame.items16,1,11"
|
"8194";"8194";"WIRE_BLUE";"signal";"digital_bit";"3";"N/A";"N/A";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire";"basegame.items16,1,11";"1"
|
||||||
#"8195";"8195";"WIRE_BUNDLE";"signal";"digital_3bits";"3";"N/A";"N/A";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire";"basegame.items16,1,2"
|
#"8195";"8195";"WIRE_BUNDLE";"signal";"digital_3bits";"3";"N/A";"N/A";"net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire";"basegame.items16,1,2";"1"
|
||||||
|
|
||||||
|
|
||||||
# accept: which wiretype (defined elsewhere) the wires acceps. Use comma to separate multiple. N/A for electronic components (aka "not wires")
|
# accept: which wiretype (defined elsewhere) the wires acceps. Use comma to separate multiple. N/A for electronic components (aka "not wires")
|
||||||
# inputcount: how many sides are input (outputcount is deduced from the inputcount). N/A for wires
|
# inputcount: how many sides are input (outputcount is deduced from the inputcount). N/A for wires
|
||||||
# inputtype: which wiretype it accepts. N/A for wires
|
# inputtype: which wiretype it accepts. N/A for wires
|
||||||
# outputtype: which wiretype it emits. N/A for wires
|
# outputtype: which wiretype it emits. N/A for wires
|
||||||
|
# branching: if this wire can have branches. Something like a thicknet can't have branches
|
||||||
#
|
#
|
||||||
# comments
|
# comments
|
||||||
# "digital_3bits" must come right after three wires it bundles
|
# "digital_3bits" must come right after three wires it bundles
|
||||||
|
|||||||
|
Can't render this file because it contains an unexpected character in line 5 and column 2.
|
@@ -56,15 +56,15 @@ object BlockCodex {
|
|||||||
AppLoader.printmsg(this, "Building block properties table")
|
AppLoader.printmsg(this, "Building block properties table")
|
||||||
|
|
||||||
records.forEach {
|
records.forEach {
|
||||||
/*if (intVal(it, "id") == -1) {
|
/*if (it.intVal("id") == -1) {
|
||||||
setProp(nullProp, it)
|
setProp(nullProp, it)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setProp(blockProps[intVal(it, "id")], it)
|
setProp(blockProps[it.intVal("id")], it)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
setProp(module, intVal(it, "id"), it)
|
setProp(module, it.intVal("id"), it)
|
||||||
val tileId = "$module:${intVal(it, "id")}"
|
val tileId = "$module:${it.intVal("id")}"
|
||||||
|
|
||||||
// register tiles with dynamic light
|
// register tiles with dynamic light
|
||||||
if ((blockProps[tileId]?.dynamicLuminosityFunction ?: 0) != 0) {
|
if ((blockProps[tileId]?.dynamicLuminosityFunction ?: 0) != 0) {
|
||||||
@@ -157,36 +157,36 @@ object BlockCodex {
|
|||||||
|
|
||||||
prop.id = "$modname:$key"
|
prop.id = "$modname:$key"
|
||||||
prop.numericID = key
|
prop.numericID = key
|
||||||
prop.drop = "$modname:${intVal(record, "drop")}"
|
prop.drop = "$modname:${record.intVal("drop")}"
|
||||||
|
|
||||||
prop.shadeColR = floatVal(record, "shdr")
|
prop.shadeColR = record.floatVal("shdr")
|
||||||
prop.shadeColG = floatVal(record, "shdg")
|
prop.shadeColG = record.floatVal("shdg")
|
||||||
prop.shadeColB = floatVal(record, "shdb")
|
prop.shadeColB = record.floatVal("shdb")
|
||||||
prop.shadeColA = floatVal(record, "shduv")
|
prop.shadeColA = record.floatVal("shduv")
|
||||||
prop.opacity = Cvec(prop.shadeColR, prop.shadeColG, prop.shadeColB, prop.shadeColA)
|
prop.opacity = Cvec(prop.shadeColR, prop.shadeColG, prop.shadeColB, prop.shadeColA)
|
||||||
|
|
||||||
prop.strength = intVal(record, "str")
|
prop.strength = record.intVal("str")
|
||||||
prop.density = intVal(record, "dsty")
|
prop.density = record.intVal("dsty")
|
||||||
|
|
||||||
prop.baseLumColR = floatVal(record, "lumr")
|
prop.baseLumColR = record.floatVal("lumr")
|
||||||
prop.baseLumColG = floatVal(record, "lumg")
|
prop.baseLumColG = record.floatVal("lumg")
|
||||||
prop.baseLumColB = floatVal(record, "lumb")
|
prop.baseLumColB = record.floatVal("lumb")
|
||||||
prop.baseLumColA = floatVal(record, "lumuv")
|
prop.baseLumColA = record.floatVal("lumuv")
|
||||||
prop.baseLumCol.set(prop.baseLumColR, prop.baseLumColG, prop.baseLumColB, prop.baseLumColA)
|
prop.baseLumCol.set(prop.baseLumColR, prop.baseLumColG, prop.baseLumColB, prop.baseLumColA)
|
||||||
|
|
||||||
prop.friction = intVal(record, "fr")
|
prop.friction = record.intVal("fr")
|
||||||
prop.viscosity = intVal(record, "vscs")
|
prop.viscosity = record.intVal("vscs")
|
||||||
prop.colour = str16ToInt(record, "colour")
|
prop.colour = record.str16ToInt("colour")
|
||||||
|
|
||||||
//prop.isFluid = boolVal(record, "fluid")
|
//prop.isFluid = record.boolVal("fluid")
|
||||||
prop.isSolid = boolVal(record, "solid")
|
prop.isSolid = record.boolVal("solid")
|
||||||
//prop.isClear = boolVal(record, "clear")
|
//prop.isClear = record.boolVal("clear")
|
||||||
prop.isPlatform = boolVal(record, "plat")
|
prop.isPlatform = record.boolVal("plat")
|
||||||
prop.isWallable = boolVal(record, "wall")
|
prop.isWallable = record.boolVal("wall")
|
||||||
prop.maxSupport = intVal(record, "grav")
|
prop.maxSupport = record.intVal("grav")
|
||||||
prop.isVertFriction = boolVal(record, "fv")
|
prop.isVertFriction = record.boolVal("fv")
|
||||||
|
|
||||||
prop.dynamicLuminosityFunction = intVal(record, "dlfn")
|
prop.dynamicLuminosityFunction = record.intVal("dlfn")
|
||||||
|
|
||||||
blockProps[prop.id] = prop
|
blockProps[prop.id] = prop
|
||||||
|
|
||||||
@@ -194,10 +194,10 @@ object BlockCodex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun str16ToInt(rec: CSVRecord, s: String): Int {
|
fun CSVRecord.str16ToInt(s: String): Int {
|
||||||
var ret = 0
|
var ret = 0
|
||||||
try {
|
try {
|
||||||
ret = rec.get(s).toLong(16).toInt()
|
ret = this.get(s).toLong(16).toInt()
|
||||||
}
|
}
|
||||||
catch (e: NumberFormatException) {
|
catch (e: NumberFormatException) {
|
||||||
}
|
}
|
||||||
@@ -209,10 +209,10 @@ fun str16ToInt(rec: CSVRecord, s: String): Int {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
fun intVal(rec: CSVRecord, s: String): Int {
|
fun CSVRecord.intVal(s: String): Int {
|
||||||
var ret = -1
|
var ret = -1
|
||||||
try {
|
try {
|
||||||
ret = rec.get(s).toInt()
|
ret = this.get(s).toInt()
|
||||||
}
|
}
|
||||||
catch (e: NumberFormatException) {
|
catch (e: NumberFormatException) {
|
||||||
}
|
}
|
||||||
@@ -224,10 +224,10 @@ fun intVal(rec: CSVRecord, s: String): Int {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
fun floatVal(rec: CSVRecord, s: String): Float {
|
fun CSVRecord.floatVal(s: String): Float {
|
||||||
var ret = -1f
|
var ret = -1f
|
||||||
try {
|
try {
|
||||||
ret = rec.get(s).toFloat()
|
ret = this.get(s).toFloat()
|
||||||
}
|
}
|
||||||
catch (e: NumberFormatException) {
|
catch (e: NumberFormatException) {
|
||||||
}
|
}
|
||||||
@@ -239,4 +239,4 @@ fun floatVal(rec: CSVRecord, s: String): Float {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
fun boolVal(rec: CSVRecord, s: String) = intVal(rec, s) != 0
|
fun CSVRecord.boolVal(s: String) = this.intVal(s) != 0
|
||||||
@@ -35,7 +35,7 @@ object WireCodex {
|
|||||||
|
|
||||||
|
|
||||||
records.forEach {
|
records.forEach {
|
||||||
WireCodex.setProp(module, intVal(it, "id"), it)
|
WireCodex.setProp(module, it.intVal("id"), it)
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLoader.printmsg(this, "Registering wire textures into the resource pool")
|
AppLoader.printmsg(this, "Registering wire textures into the resource pool")
|
||||||
@@ -107,9 +107,10 @@ object WireCodex {
|
|||||||
prop.numericID = key
|
prop.numericID = key
|
||||||
prop.renderClass = record.get("renderclass")
|
prop.renderClass = record.get("renderclass")
|
||||||
prop.accepts = record.get("accept")
|
prop.accepts = record.get("accept")
|
||||||
prop.inputCount = intVal(record, "inputcount")
|
prop.inputCount = record.intVal("inputcount")
|
||||||
prop.inputType = record.get("inputtype") ?: prop.accepts
|
prop.inputType = record.get("inputtype") ?: prop.accepts
|
||||||
prop.outputType = record.get("outputtype") ?: prop.accepts
|
prop.outputType = record.get("outputtype") ?: prop.accepts
|
||||||
|
prop.canBranch = record.boolVal("branching")
|
||||||
|
|
||||||
WireCodex.wireProps[prop.id] = prop
|
WireCodex.wireProps[prop.id] = prop
|
||||||
|
|
||||||
|
|||||||
@@ -17,4 +17,6 @@ class WireProp {
|
|||||||
var inputType: String = ""
|
var inputType: String = ""
|
||||||
var outputType: String = ""
|
var outputType: String = ""
|
||||||
|
|
||||||
|
var canBranch: Boolean = true
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -39,11 +39,11 @@ object MaterialCodex {
|
|||||||
|
|
||||||
records.forEach {
|
records.forEach {
|
||||||
val prop = Material()
|
val prop = Material()
|
||||||
prop.strength = intVal(it, "tens")
|
prop.strength = it.intVal("tens")
|
||||||
prop.density = intVal(it, "dsty")
|
prop.density = it.intVal("dsty")
|
||||||
prop.forceMod = intVal(it, "fmod")
|
prop.forceMod = it.intVal("fmod")
|
||||||
prop.enduranceMod = floatVal(it, "endurance")
|
prop.enduranceMod = it.floatVal("endurance")
|
||||||
prop.thermalConductivity = floatVal(it, "tcond")
|
prop.thermalConductivity = it.floatVal("tcond")
|
||||||
prop.identifier = it.get("idst").toUpperCase()
|
prop.identifier = it.get("idst").toUpperCase()
|
||||||
|
|
||||||
materialProps[prop.identifier] = prop
|
materialProps[prop.identifier] = prop
|
||||||
|
|||||||
Reference in New Issue
Block a user