radar reading rcs from materials

This commit is contained in:
minjaesong
2023-11-02 00:15:08 +09:00
parent 1aa00d564d
commit 47a7e55910
5 changed files with 39 additions and 41 deletions

View File

@@ -1,6 +1,6 @@
"id";"drop";"spawn";"name";"shdr";"shdg";"shdb";"shduv";"str";"dsty";"mate";"solid";"wall";"grav";"dlfn";"fv";"fr";"lumr";"lumg";"lumb";"lumuv";"colour";"vscs";"refl";"tags"
"0";"0";"0";"BLOCK_AIR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"INCONSEQUENTIAL,AIR"
"1";"0";"0";"BLOCK_UPDATE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"INTERNAL"
"0";"0";"0";"BLOCK_AIR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"AIIR";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"INCONSEQUENTIAL,AIR"
"1";"0";"0";"BLOCK_UPDATE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"AIIR";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"INTERNAL"
"16";"17";"17";"BLOCK_STONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"ROCK,NATURAL"
"17";"17";"17";"BLOCK_STONE_QUARRIED";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"ROCK,NATURAL"
"18";"18";"18";"BLOCK_STONE_TILE_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.18";"STONE"
1 id drop spawn name shdr shdg shdb shduv str dsty mate solid wall grav dlfn fv fr lumr lumg lumb lumuv colour vscs refl tags
2 0 0 0 BLOCK_AIR 0.0312 0.0312 0.0312 0.0312 1 1 NULL AIIR 0 1 N/A 0 0 4 0.0000 0.0000 0.0000 0.0000 N/A N/A 0.0 INCONSEQUENTIAL,AIR
3 1 0 0 BLOCK_UPDATE 0.0312 0.0312 0.0312 0.0312 1 1 NULL AIIR 0 1 N/A 0 0 4 0.0000 0.0000 0.0000 0.0000 N/A N/A 0.0 INTERNAL
4 16 17 17 BLOCK_STONE 0.1252 0.1252 0.1252 0.1252 48 2400 ROCK 1 1 N/A 0 4 16 0.0000 0.0000 0.0000 0.0000 N/A N/A 0.0 ROCK,NATURAL
5 17 17 17 BLOCK_STONE_QUARRIED 0.1252 0.1252 0.1252 0.1252 48 2400 ROCK 1 1 N/A 0 4 16 0.0000 0.0000 0.0000 0.0000 N/A N/A 0.0 ROCK,NATURAL
6 18 18 18 BLOCK_STONE_TILE_WHITE 0.1252 0.1252 0.1252 0.1252 48 2400 ROCK 1 1 N/A 0 4 16 0.0000 0.0000 0.0000 0.0000 N/A N/A 0.18 STONE

View File

@@ -1,23 +1,26 @@
idst;tens;impf;dsty;fmod;endurance;tcond;reach;comments
WOOD;10;10;800;1;0.173;0.17;5;just a generic wood
ROCK;15;210;3000;1;0.42;2.9;5;data is that of marble
OORE;15;210;3000;1;0.42;2.9;5;data is that of marble
OGEM;15;210;3000;1;0.42;2.9;5;data is that of marble
CUPR;210;770;8960;2;1.00;401.0;5;copper
EGLS;33;1000;2325;4;0.82;1.0;6;elven glass/moldavite
IRON;350;1085;7874;5;1.42;80.4;6;not wrought iron,just natural iron
ARGN;170;595;10490;9;0.91;429.0;6;argentum/silver
AURM;120;350;19300;9;0.88;318.0;6;aurum/gold
STAL;531;2520;7874;14;1.73;26.0;7;steel
EAUR;768;0;8192;21;1.36;1.0;7;elven aurichalcum
TIAL;900;0;4420;33;2.16;1.0;8;titanium alloy (Ti6Al4V)
ADMT;2000;4090;2700;71;3.42;1.0;8;adamant
OOZE;20;0;1000;1;0.08;0.5;0;genetic ooze,data is about human skin
BONE;130;0;2000;1;0.23;0.55;4;data is that of bovine bone
BRAS;315;1015;8530;3;1.00;120;5;brass
BRNZ;310;843;8770;3;1.20;75;5;bronze
TINN;220;350;7310;2;1.00;69;5;tin
ZINC;90;525;7140;2;1.00;116;5;zinc
idst;tens;impf;dsty;fmod;endurance;tcond;reach;rcs;comments
WOOD;10;10;800;1;0.173;0.17;5;18;just a generic wood
ROCK;15;210;3000;1;0.42;2.9;5;48;data is that of marble
OORE;15;210;3000;1;0.42;2.9;5;100;data is that of marble
OGEM;15;210;3000;1;0.42;2.9;5;80;data is that of marble
CUPR;210;770;8960;2;1.00;401.0;5;120;copper
EGLS;33;1000;2325;4;0.82;1.0;6;10;elven glass/moldavite
IRON;350;1085;7874;5;1.42;80.4;6;120;not wrought iron,just natural iron
ARGN;170;595;10490;9;0.91;429.0;6;120;argentum/silver
AURM;120;350;19300;9;0.88;318.0;6;120;aurum/gold
STAL;531;2520;7874;14;1.73;26.0;7;120;steel
EAUR;768;0;8192;21;1.36;1.0;7;120;elven aurichalcum
TIAL;900;0;4420;33;2.16;1.0;8;120;titanium alloy (Ti6Al4V)
ADMT;2000;4090;2700;71;3.42;1.0;8;120;adamant
OOZE;20;0;1000;1;0.08;0.5;0;10;genetic ooze,data is about human skin
BONE;130;0;2000;1;0.23;0.55;4;10;data is that of bovine bone
BRAS;315;1015;8530;3;1.00;120;5;120;brass
BRNZ;310;843;8770;3;1.20;75;5;120;bronze
TINN;220;350;7310;2;1.00;69;5;120;tin
ZINC;90;525;7140;2;1.00;116;5;120;zinc
DIRT;1;1;1400;0.0;0.0;36;0;10;dirt
PLST;1;1;1400;0.0;0.0;36;0;16;TODO plastic (polyethylene)
AIIR;1;1;0;0.0;0.0;36;0;1;air
# idst: ID_STRING, ALL CAPS
#
1 idst tens impf dsty fmod endurance tcond reach rcs comments
2 WOOD 10 10 800 1 0.173 0.17 5 18 just a generic wood
3 ROCK 15 210 3000 1 0.42 2.9 5 48 data is that of marble
4 OORE 15 210 3000 1 0.42 2.9 5 100 data is that of marble
5 OGEM 15 210 3000 1 0.42 2.9 5 80 data is that of marble
6 CUPR 210 770 8960 2 1.00 401.0 5 120 copper
7 EGLS 33 1000 2325 4 0.82 1.0 6 10 elven glass/moldavite
8 IRON 350 1085 7874 5 1.42 80.4 6 120 not wrought iron,just natural iron
9 ARGN 170 595 10490 9 0.91 429.0 6 120 argentum/silver
10 AURM 120 350 19300 9 0.88 318.0 6 120 aurum/gold
11 STAL 531 2520 7874 14 1.73 26.0 7 120 steel
12 EAUR 768 0 8192 21 1.36 1.0 7 120 elven aurichalcum
13 TIAL 900 0 4420 33 2.16 1.0 8 120 titanium alloy (Ti6Al4V)
14 ADMT 2000 4090 2700 71 3.42 1.0 8 120 adamant
15 OOZE 20 0 1000 1 0.08 0.5 0 10 genetic ooze,data is about human skin
16 BONE 130 0 2000 1 0.23 0.55 4 10 data is that of bovine bone
17 BRAS 315 1015 8530 3 1.00 120 5 120 brass
18 BRNZ 310 843 8770 3 1.20 75 5 120 bronze
19 TINN 220 350 7310 2 1.00 69 5 120 tin
20 ZINC 90 525 7140 2 1.00 116 5 120 zinc
21 DIRT 1 1 1400 0.0 0.0 36 0 10 dirt
22 PLST 1 1 1400 0.0 0.0 36 0 16 TODO plastic (polyethylene)
23 AIIR 1 1 0 0.0 0.0 36 0 1 air
24 # idst: ID_STRING, ALL CAPS
25 #
26 # tens: tensile strength (= ultimate stringth)

View File

@@ -29,6 +29,8 @@ class Material {
var toolReach: Int = 6
var rcs: Int = 10
/**
* Mainly intended to be used by third-party modules
*/
@@ -70,6 +72,7 @@ class MaterialCodex {
prop.thermalConductivity = it.floatVal("tcond")
prop.identifier = it.get("idst").toUpperCase()
prop.toolReach = it.intVal("reach")
prop.rcs = it.intVal("rcs")
materialProps[prop.identifier] = prop
@@ -86,6 +89,6 @@ class MaterialCodex {
throw NullPointerException("Material with id $identifier does not exist.")
}
fun getOrDefault(identifier: String) = materialProps[identifier.toUpperCase()] ?: nullMaterial
fun getOrDefault(identifier: String?) = materialProps[identifier?.toUpperCase()] ?: nullMaterial
}

View File

@@ -2,13 +2,12 @@ package net.torvald.terrarum.modulebasegame.console
import com.jme3.math.FastMath
import net.torvald.gdx.graphics.Cvec
import net.torvald.terrarum.App
import net.torvald.terrarum.BlockCodex
import net.torvald.terrarum.INGAME
import net.torvald.terrarum.*
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.console.ConsoleCommand
import net.torvald.terrarum.console.Echo
import net.torvald.terrarum.console.EchoError
import net.torvald.terrarum.gameitems.ItemID
import net.torvald.terrarum.gameworld.fmod
import net.torvald.terrarum.serialise.toUint
import net.torvald.terrarum.utils.RasterWriter
@@ -27,17 +26,12 @@ import kotlin.math.sign
*/
internal object ExportMap2 : ConsoleCommand {
//private var mapData: ByteArray? = null
// private var mapDataPointer = 0
private fun getOreRCS(ore: ItemID) =
ItemCodex[OreCodex.oreProps.getOrElse(ore) { null }?.item]?.material?.rcs ?: MaterialCodex.nullMaterial.rcs
private fun getBlockRCS(block: ItemID) =
MaterialCodex.getOrDefault(BlockCodex.getOrNull(block)?.material).rcs
private val oreColourMap = hashMapOf(
Block.AIR to 0,
"ores@basegame:1" to 160,
"ores@basegame:2" to 128,
"ores@basegame:3" to 96,
)
private fun triangularRand(amp: Float) = (((Math.random() + Math.random()) - 1.0) * amp).toFloat()
private fun strToRandAmp(str: Float) = FastMath.log(str.absoluteValue.coerceAtLeast(4f), 2f).coerceAtLeast(0f)
@@ -52,6 +46,9 @@ internal object ExportMap2 : ConsoleCommand {
}
override fun execute(args: Array<String>) {
println("Air RCS: ${getBlockRCS(Block.AIR)}")
val world = (INGAME.world)
if (args.size == 2) {
@@ -69,9 +66,7 @@ internal object ExportMap2 : ConsoleCommand {
val terr = world.getTileFromTerrain(x, y)
val ore = world.getTileFromOre(x, y).item
val colOre = (oreColourMap.get(ore) ?: throw NullPointerException("nullore $ore"))
val colFore = (BlockCodex.getOrNull(terr)?.strength ?: throw NullPointerException("nullterr $terr"))
val reflection0 = maxOf(colOre, colFore)
val reflection0 = maxOf(getOreRCS(ore), getBlockRCS(terr))
val reflection = reflection0 + triangularRand(strToRandAmp(reflection0.toFloat()))
val delta = (reflection - akku).coerceAtLeast(0f)

View File

@@ -44,19 +44,16 @@ class OreStick(originalID: ItemID) : OreItemBase(originalID) {
}
class OreCopper(originalID: ItemID) : OreItemBase(originalID) {
override var originalName = "ITEM_ORE_MALACHITE"
override val materialId = "ROCK"
override val itemImage: TextureRegion
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(2,6)
}
class OreIron(originalID: ItemID) : OreItemBase(originalID) {
override var originalName = "ITEM_ORE_HAEMATITE"
override val materialId = "ROCK"
override val itemImage: TextureRegion
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(3,6)
}
class OreCoal(originalID: ItemID) : OreItemBase(originalID) {
override var originalName = "ITEM_ORE_COAL"
override val materialId = "ROCK"
override val itemImage: TextureRegion
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(4,6)
}