mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
fluid wip and hopefully fixed F3 dangling ptr
This commit is contained in:
@@ -35,6 +35,7 @@ class EntryPoint : ModuleEntryPoint() {
|
||||
ModMgr.GameItemLoader.invoke(moduleName)
|
||||
ModMgr.GameBlockLoader.invoke(moduleName)
|
||||
ModMgr.GameOreLoader.invoke(moduleName)
|
||||
ModMgr.GameFluidLoader.invoke(moduleName)
|
||||
ModMgr.GameLanguageLoader.invoke(moduleName)
|
||||
ModMgr.GameCraftingRecipeLoader.invoke(moduleName)
|
||||
ModMgr.GameAudioLoader.invoke(moduleName)
|
||||
|
||||
@@ -196,6 +196,8 @@ object IngameRenderer : Disposable {
|
||||
// printdbg(this, "Set new RenderedWorld (UUID=${world.worldIndex}) at time ${System.currentTimeMillis()} (disposed: ${world.disposed}), called by:")
|
||||
// printStackTrace(this)
|
||||
|
||||
var successful = false
|
||||
|
||||
try {
|
||||
|
||||
// change worlds from internal methods
|
||||
@@ -210,11 +212,19 @@ object IngameRenderer : Disposable {
|
||||
// "new world: ${world.hashCode()}")
|
||||
newWorldLoadedLatch = true
|
||||
}
|
||||
|
||||
successful = true
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
// new init, do nothing
|
||||
}
|
||||
finally {
|
||||
if (successful)
|
||||
TerrarumPostProcessor.debugUI.world = world
|
||||
else
|
||||
TerrarumPostProcessor.debugUI.world = null
|
||||
}
|
||||
}
|
||||
|
||||
private var oldCamX = 0
|
||||
|
||||
@@ -88,7 +88,7 @@ object WorldSimulator {
|
||||
|
||||
if (ingame.terrainChangeQueue.isNotEmpty()) { App.measureDebugTime("WorldSimulator.degrass") { buryGrassImmediately() } }
|
||||
App.measureDebugTime("WorldSimulator.growGrass") { growOrKillGrass() }
|
||||
App.measureDebugTime("WorldSimulator.fluids") { /*moveFluids(delta)*/ }
|
||||
App.measureDebugTime("WorldSimulator.fluids") { moveFluids(delta) }
|
||||
App.measureDebugTime("WorldSimulator.fallables") { displaceFallables(delta) }
|
||||
App.measureDebugTime("WorldSimulator.wires") { simulateWires(delta) }
|
||||
App.measureDebugTime("WorldSimulator.collisionDroppedItem") { collideDroppedItems() }
|
||||
|
||||
@@ -163,7 +163,7 @@ class ActorGlowOrb(throwPitch: Float) : ActorLobbed(throwPitch) {
|
||||
spriteEmissive = SingleImageSprite(this, itemImage)
|
||||
|
||||
avBaseMass = 1.0
|
||||
density = 1400.0
|
||||
density = 580.0
|
||||
}
|
||||
|
||||
@Transient private val lifePower = 10000L // charge reaches 0 on timeDelta = 9 * lifePower
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameitems
|
||||
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blockproperties.Fluid
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.GameItem.EquipPosition.HAND_GRIP
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-07-14.
|
||||
*/
|
||||
class ItemBottomlessWaterBucket(originalID: ItemID) : GameItem(originalID) {
|
||||
|
||||
override var baseToolSize: Double? = PickaxeCore.BASE_MASS_AND_SIZE
|
||||
override var inventoryCategory = Category.TOOL
|
||||
override val canBeDynamic = false
|
||||
override val materialId = "CUPR"
|
||||
override var baseMass = 2.0
|
||||
override var equipPosition = HAND_GRIP
|
||||
override var originalName = "ITEM_BOTTOMLESS_WATER_BUCKET"
|
||||
|
||||
init {
|
||||
stackable = false
|
||||
isUnique = true
|
||||
}
|
||||
|
||||
override fun startPrimaryUse(actor: ActorWithBody, delta: Float): Long {
|
||||
val mx = Terrarum.mouseTileX; val my =Terrarum.mouseTileY
|
||||
INGAME.world.setFluid(mx, my, Fluid.WATER, 1f)
|
||||
printdbg(this, "Pouring water at ($mx, $my)")
|
||||
return 0L
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user