mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-07 00:54:05 +09:00
Compare commits
5 Commits
world-chun
...
v0.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d460447331 | ||
|
|
63fe28eee2 | ||
|
|
2d7ef6e9ff | ||
|
|
fa3a129991 | ||
|
|
4cc74a85d1 |
@@ -132,8 +132,8 @@ id;classname;tags
|
|||||||
320;net.torvald.terrarum.modulebasegame.gameitems.ItemWorldPortal;FIXTURE,STATION
|
320;net.torvald.terrarum.modulebasegame.gameitems.ItemWorldPortal;FIXTURE,STATION
|
||||||
|
|
||||||
# industrial
|
# industrial
|
||||||
2048;net.torvald.terrarum.modulebasegame.gameitems.ItemInductionMotor;FIXTURE,POWER,KINETIC
|
#2048;net.torvald.terrarum.modulebasegame.gameitems.ItemInductionMotor;FIXTURE,POWER,KINETIC
|
||||||
2049;net.torvald.terrarum.modulebasegame.gameitems.ItemGearbox;FIXTURE,POWER,KINETIC
|
#2049;net.torvald.terrarum.modulebasegame.gameitems.ItemGearbox;FIXTURE,POWER,KINETIC
|
||||||
|
|
||||||
# data storage (discs; 256)
|
# data storage (discs; 256)
|
||||||
# 32768 is a reserved number for a blank disc
|
# 32768 is a reserved number for a blank disc
|
||||||
@@ -179,5 +179,5 @@ id;classname;tags
|
|||||||
1048835;net.torvald.terrarum.modulebasegame.gameitems.ItemBucketIron03;FLUIDSTORAGE,OPENSTORAGE
|
1048835;net.torvald.terrarum.modulebasegame.gameitems.ItemBucketIron03;FLUIDSTORAGE,OPENSTORAGE
|
||||||
|
|
||||||
# reserved for debug items
|
# reserved for debug items
|
||||||
16777216;net.torvald.terrarum.modulebasegame.gameitems.ItemBottomlessWaterBucket;DEBUG,TOOL
|
#16777216;net.torvald.terrarum.modulebasegame.gameitems.ItemBottomlessWaterBucket;DEBUG,TOOL
|
||||||
16777217;net.torvald.terrarum.modulebasegame.gameitems.ItemBottomlessLavaBucket;DEBUG,TOOL
|
#16777217;net.torvald.terrarum.modulebasegame.gameitems.ItemBottomlessLavaBucket;DEBUG,TOOL
|
||||||
|
|||||||
|
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ITEM_ALLOYING_FURNACE": "Alloying Furnace",
|
"ITEM_ALLOYING_FURNACE": "Alloying Furnace",
|
||||||
|
"ITEM_AXLE": "Axle",
|
||||||
"ITEM_BRICK_SINGULAR": "Brick", /* always singular */
|
"ITEM_BRICK_SINGULAR": "Brick", /* always singular */
|
||||||
"ITEM_BUCKET_IRON": "Iron Bucket %1$s",
|
"ITEM_BUCKET_IRON": "Iron Bucket %1$s",
|
||||||
"ITEM_BUCKET_WOODEN": "Wooden Bucket %1$s",
|
"ITEM_BUCKET_WOODEN": "Wooden Bucket %1$s",
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
"ITEM_ELECTRIC_WORKBENCH": "Electric Workbench",
|
"ITEM_ELECTRIC_WORKBENCH": "Electric Workbench",
|
||||||
"ITEM_ENGRAVING_WORKBENCH": "Engraving Workbench",
|
"ITEM_ENGRAVING_WORKBENCH": "Engraving Workbench",
|
||||||
"ITEM_FURNACE_AND_ANVIL": "Furnace and Anvil",
|
"ITEM_FURNACE_AND_ANVIL": "Furnace and Anvil",
|
||||||
|
"ITEM_GEARBOX": "Gearbox",
|
||||||
"ITEM_GEM_RUBY": "Raw Ruby",
|
"ITEM_GEM_RUBY": "Raw Ruby",
|
||||||
"ITEM_GEM_EMERALD": "Raw Emerald",
|
"ITEM_GEM_EMERALD": "Raw Emerald",
|
||||||
"ITEM_GEM_SAPPHIRE": "Raw Sapphire",
|
"ITEM_GEM_SAPPHIRE": "Raw Sapphire",
|
||||||
@@ -30,6 +32,7 @@
|
|||||||
"ITEM_HATCHET_STEEL": "Steel Axe",
|
"ITEM_HATCHET_STEEL": "Steel Axe",
|
||||||
"ITEM_HATCHET_STONE": "Stone Axe",
|
"ITEM_HATCHET_STONE": "Stone Axe",
|
||||||
"ITEM_HATCHET_WOODEN": "Wooden Axe",
|
"ITEM_HATCHET_WOODEN": "Wooden Axe",
|
||||||
|
"ITEM_INDUCTION_MOTOR": "Induction Motor",
|
||||||
"ITEM_INGOT_BRASS": "Brass Ingot",
|
"ITEM_INGOT_BRASS": "Brass Ingot",
|
||||||
"ITEM_INGOT_BRONZE": "Bronze Ingot",
|
"ITEM_INGOT_BRONZE": "Bronze Ingot",
|
||||||
"ITEM_INGOT_COPPER": "Copper Ingot",
|
"ITEM_INGOT_COPPER": "Copper Ingot",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ id;drop;name;renderclass;accept;inputcount;inputtype;outputtype;javaclass;invent
|
|||||||
2;2;WIRE_POWER_HIGH;power;power_high;3;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire;basegame.items,6,4;1;"POWERWIRE_HIGH"
|
2;2;WIRE_POWER_HIGH;power;power_high;3;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire;basegame.items,6,4;1;"POWERWIRE_HIGH"
|
||||||
16;16;WIRE_ETHERNET;network;10base2;3;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire;basegame.items,7,4;1;"ETHERNETWIRE"
|
16;16;WIRE_ETHERNET;network;10base2;3;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire;basegame.items,7,4;1;"ETHERNETWIRE"
|
||||||
|
|
||||||
256;256;AXLE;axle;axle;1;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceAxle;basegame.items,1,5;0;"AXLE"
|
#256;256;AXLE;axle;axle;1;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceAxle;basegame.items,1,5;0;"AXLE"
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
|
@@ -33,7 +33,7 @@ object CheckUpdate {
|
|||||||
private val checkUpdateURL = setOf(
|
private val checkUpdateURL = setOf(
|
||||||
"https://github.com/curioustorvald/Terrarum/releases/tag/v$versionNumOnly",
|
"https://github.com/curioustorvald/Terrarum/releases/tag/v$versionNumOnly",
|
||||||
"https://github.com/curioustorvald/Terrarum/releases/tag/v$versionNumFull",
|
"https://github.com/curioustorvald/Terrarum/releases/tag/v$versionNumFull",
|
||||||
).toList()
|
).map { it.replace(' ', '_') }
|
||||||
|
|
||||||
private fun wget(url: String): String? {
|
private fun wget(url: String): String? {
|
||||||
printdbg(this, "wget $url")
|
printdbg(this, "wget $url")
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ basegame
|
|||||||
* e.g. 0x02010034 will be translated as 2.1.52
|
* e.g. 0x02010034 will be translated as 2.1.52
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const val VERSION_RAW: Long = 0x0000_000004_000004
|
const val VERSION_RAW: Long = 0x0000_000005_000000
|
||||||
// Commit counts up to the Release 0.3.0: 2259
|
// Commit counts up to the Release 0.3.0: 2259
|
||||||
// Commit counts up to the Release 0.3.1: 2278
|
// Commit counts up to the Release 0.3.1: 2278
|
||||||
// Commit counts up to the Release 0.3.2: 2732
|
// Commit counts up to the Release 0.3.2: 2732
|
||||||
@@ -77,6 +77,7 @@ basegame
|
|||||||
// Commit counts up to the Release 0.4.0: 3631
|
// Commit counts up to the Release 0.4.0: 3631
|
||||||
// Commit counts up to the Release 0.4.1: 3678
|
// Commit counts up to the Release 0.4.1: 3678
|
||||||
// Commit counts up to the Release 0.4.2: 3762
|
// Commit counts up to the Release 0.4.2: 3762
|
||||||
|
// Commit counts up to the Release 0.5.0: 4090
|
||||||
|
|
||||||
val DEV_CYCLE: Map<String, Long> = mapOf(
|
val DEV_CYCLE: Map<String, Long> = mapOf(
|
||||||
"Alpha" to 0x0000_000004_000000,
|
"Alpha" to 0x0000_000004_000000,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const val FLUID_MIN_MASS = 1f / 1024f //Ignore cells that are almost dry (smalle
|
|||||||
*
|
*
|
||||||
* Created by minjaesong on 2023-10-10.
|
* Created by minjaesong on 2023-10-10.
|
||||||
*/
|
*/
|
||||||
class BlockLayerI16F16(override val width: Int, override val height: Int) : BlockLayer {
|
class BlockLayerFluidI16F16(override val width: Int, override val height: Int) : BlockLayer {
|
||||||
override val bytesPerBlock = BYTES_PER_BLOCK
|
override val bytesPerBlock = BYTES_PER_BLOCK
|
||||||
|
|
||||||
// for some reason, all the efforts of saving the memory space were futile.
|
// for some reason, all the efforts of saving the memory space were futile.
|
||||||
|
|||||||
@@ -21,19 +21,10 @@ import net.torvald.unsafe.UnsafePtr
|
|||||||
*
|
*
|
||||||
* Note to self: refrain from using shorts--just do away with two bytes: different system have different endianness
|
* Note to self: refrain from using shorts--just do away with two bytes: different system have different endianness
|
||||||
*/
|
*/
|
||||||
class BlockLayerI16(
|
class BlockLayerGenericI16(
|
||||||
override val width: Int,
|
override val width: Int,
|
||||||
override val height: Int,
|
override val height: Int,
|
||||||
disk: ClusteredFormatDOM,
|
): BlockLayer {
|
||||||
layerNum: Int,
|
|
||||||
world: GameWorld
|
|
||||||
): BlockLayer() {
|
|
||||||
|
|
||||||
override val chunkPool = ChunkPool(disk, layerNum, BYTES_PER_BLOCK, world, when (layerNum) {
|
|
||||||
TERRAIN -> ChunkPool.getRenameFunTerrain(world)
|
|
||||||
WALL -> ChunkPool.getRenameFunTerrain(world)
|
|
||||||
else -> throw IllegalArgumentException("Unknown layer number for I16: $layerNum")
|
|
||||||
})
|
|
||||||
|
|
||||||
override val bytesPerBlock = BYTES_PER_BLOCK
|
override val bytesPerBlock = BYTES_PER_BLOCK
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.gameactors
|
package net.torvald.terrarum.modulebasegame.gameactors
|
||||||
|
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
|
import net.torvald.terrarum.App.printdbg
|
||||||
import net.torvald.terrarum.gameactors.ActorID
|
import net.torvald.terrarum.gameactors.ActorID
|
||||||
import net.torvald.terrarum.gameactors.PhysProperties
|
import net.torvald.terrarum.gameactors.PhysProperties
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
@@ -16,7 +17,7 @@ open class Electric : FixtureBase {
|
|||||||
|
|
||||||
protected constructor() : super() {
|
protected constructor() : super() {
|
||||||
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
// newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ open class Electric : FixtureBase {
|
|||||||
App.disposables.add(mainUI)
|
App.disposables.add(mainUI)
|
||||||
|
|
||||||
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
// newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -137,7 +138,7 @@ open class Electric : FixtureBase {
|
|||||||
getWireEmissionAt(offsetX, offsetY).x <= ELECTRIC_THRESHOLD_LOW
|
getWireEmissionAt(offsetX, offsetY).x <= ELECTRIC_THRESHOLD_LOW
|
||||||
|
|
||||||
protected var oldSinkStatus: Array<Vector2>
|
protected var oldSinkStatus: Array<Vector2>
|
||||||
protected var newSinkStatus: Array<Vector2>
|
// protected var newSinkStatus: Array<Vector2>
|
||||||
|
|
||||||
open fun updateOnWireGraphTraversal(offsetX: Int, offsetY: Int, sinkType: WireEmissionType) {
|
open fun updateOnWireGraphTraversal(offsetX: Int, offsetY: Int, sinkType: WireEmissionType) {
|
||||||
val index = pointToBlockBoxIndex(offsetX, offsetY)
|
val index = pointToBlockBoxIndex(offsetX, offsetY)
|
||||||
@@ -149,9 +150,6 @@ open class Electric : FixtureBase {
|
|||||||
Vector2(acc.x + (it?.x ?: 0.0), acc.y + (it?.y ?: 0.0))
|
Vector2(acc.x + (it?.x ?: 0.0), acc.y + (it?.y ?: 0.0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
oldSinkStatus[index].set(new2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,35 +165,35 @@ open class Electric : FixtureBase {
|
|||||||
for (x in 0 until blockBox.width) {
|
for (x in 0 until blockBox.width) {
|
||||||
// get indices of "rising edges"
|
// get indices of "rising edges"
|
||||||
// get indices of "falling edges"
|
// get indices of "falling edges"
|
||||||
|
|
||||||
val wx = x + worldBlockPos!!.x
|
|
||||||
val wy = y + worldBlockPos!!.y
|
|
||||||
val new = WireCodex.getAllWiresThatAccepts(getWireSinkAt(x, y) ?: "").fold(Vector2()) { acc, (id, _) ->
|
|
||||||
INGAME.world.getWireEmitStateOf(wx, wy, id).let {
|
|
||||||
Vector2(acc.x + (it?.x ?: 0.0), acc.y + (it?.y ?: 0.0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val index = pointToBlockBoxIndex(x, y)
|
val index = pointToBlockBoxIndex(x, y)
|
||||||
|
val type = getWireSinkAt(index) ?: ""
|
||||||
|
|
||||||
if (new.x - oldSinkStatus[index].x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x >= ELECTRIC_THRESHOLD_HIGH)
|
if (type.isNotBlank()) {
|
||||||
risingEdgeIndices.add(index)
|
val old = oldSinkStatus[index]
|
||||||
else if (oldSinkStatus[index].x - new.x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x <= ELECTRIC_THRESHOLD_LOW)
|
val new = getWireStateAt(x, y, type)
|
||||||
fallingEdgeIndices.add(index)
|
|
||||||
|
val wx = x + worldBlockPos!!.x
|
||||||
|
val wy = y + worldBlockPos!!.y
|
||||||
|
|
||||||
|
// println("Wxy($wx,$wy) getWireState($type)=$new, oldState($type)=$old")
|
||||||
|
|
||||||
|
if (new.x - old.x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x >= ELECTRIC_THRESHOLD_HIGH)
|
||||||
|
risingEdgeIndices.add(index)
|
||||||
|
else if (old.x - new.x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x <= ELECTRIC_THRESHOLD_LOW)
|
||||||
|
fallingEdgeIndices.add(index)
|
||||||
|
|
||||||
|
|
||||||
oldSinkStatus[index].set(new)
|
oldSinkStatus[index].set(new)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (risingEdgeIndices.isNotEmpty()) {
|
||||||
|
// println("risingEdgeIndices=$risingEdgeIndices")
|
||||||
|
// }
|
||||||
|
|
||||||
risingEdgeIndices.forEach { onRisingEdge(it) }
|
risingEdgeIndices.forEach { onRisingEdge(it) }
|
||||||
fallingEdgeIndices.forEach { onFallingEdge(it) }
|
fallingEdgeIndices.forEach { onFallingEdge(it) }
|
||||||
updateSignal()
|
updateSignal()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*oldSinkStatus.indices.forEach { index ->
|
|
||||||
oldSinkStatus[index].set(new)
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ class FixtureTextSignCopper : Electric {
|
|||||||
blockBox = BlockBox(BlockBox.NO_COLLISION, panelCount, 2)
|
blockBox = BlockBox(BlockBox.NO_COLLISION, panelCount, 2)
|
||||||
setHitboxDimension(TILE_SIZE * blockBox.width, TILE_SIZE * blockBox.height, 0, 2)
|
setHitboxDimension(TILE_SIZE * blockBox.width, TILE_SIZE * blockBox.height, 0, 2)
|
||||||
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
// newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// must be re-spawned on reload to make it visible after load
|
// must be re-spawned on reload to make it visible after load
|
||||||
|
|||||||
@@ -62,10 +62,12 @@ class FixtureWorldPortal : Electric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onRisingEdge(readFrom: BlockBoxIndex) {
|
override fun onRisingEdge(readFrom: BlockBoxIndex) {
|
||||||
|
// printdbg(this, "readFrom=$readFrom; getWireSinkAt(readFrom)=${getWireSinkAt(readFrom)}")
|
||||||
|
|
||||||
if (getWireSinkAt(readFrom) != "digital_bit") return
|
if (getWireSinkAt(readFrom) != "digital_bit") return
|
||||||
|
|
||||||
|
|
||||||
printdbg(this, "teleport! $teleportRequest")
|
// printdbg(this, "teleport! $teleportRequest")
|
||||||
teleportRequest?.let {
|
teleportRequest?.let {
|
||||||
if (it.worldDiskToLoad != null && it.worldLoadParam != null) {
|
if (it.worldDiskToLoad != null && it.worldLoadParam != null) {
|
||||||
throw InternalError("Contradiction -- worldDiskToLoad and worldLoadParam are both not null: $teleportRequest")
|
throw InternalError("Contradiction -- worldDiskToLoad and worldLoadParam are both not null: $teleportRequest")
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
|
|||||||
|
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
|
clearTooltip()
|
||||||
uiItems.forEach { it.show() }
|
uiItems.forEach { it.show() }
|
||||||
seedInput.clearText()
|
seedInput.clearText()
|
||||||
seedInput.refreshPlaceholder()
|
seedInput.refreshPlaceholder()
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ abstract class UICanvas(
|
|||||||
|
|
||||||
/** A function that is run ONCE when the UI is requested to be opened; will work identical to [endOpening] if [openCloseTime] is zero */
|
/** A function that is run ONCE when the UI is requested to be opened; will work identical to [endOpening] if [openCloseTime] is zero */
|
||||||
open fun show() {
|
open fun show() {
|
||||||
|
clearTooltip()
|
||||||
openingClickLatched = true
|
openingClickLatched = true
|
||||||
uiItems.forEach { it.show() }
|
uiItems.forEach { it.show() }
|
||||||
handler.subUIs.forEach { it.show() }
|
handler.subUIs.forEach { it.show() }
|
||||||
|
|||||||
Reference in New Issue
Block a user