fix: axe not cutting large trees well

This commit is contained in:
minjaesong
2024-01-25 04:38:26 +09:00
parent 46557c0f91
commit 54061f64a8
4 changed files with 58 additions and 25 deletions

View File

@@ -624,26 +624,28 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
// batch-process uiAliases
// NOTE: UIs that should pause the game (e.g. Inventory) must have relevant codes ON THEIR SIDE
uiContainer.add(
// drawn first
//uiVitalPrimary,
//uiVitalSecondary,
//uiVitalItem,
// drawn first
//uiVitalPrimary,
//uiVitalSecondary,
//uiVitalItem,
noticelet,
uiBlur,
uiBlur,
uiPieMenu,
uiQuickBar,
// uiBasicInfo, // temporarily commenting out: wouldn't make sense for v 0.3 release
uiWatchTierOne,
getWearableDeviceUI,
UIScreenZoom(),
uiAutosaveNotifier,
uiInventoryPlayer,
getUIFixture,
uiTooltip,
consoleHandler,
uiCheatMotherfuckerNootNoot
// drawn last
uiPieMenu,
uiQuickBar,
// uiBasicInfo, // temporarily commenting out: wouldn't make sense for v 0.3 release
uiWatchTierOne,
getWearableDeviceUI,
UIScreenZoom(),
uiAutosaveNotifier,
uiInventoryPlayer,
getUIFixture,
uiTooltip,
consoleHandler,
uiCheatMotherfuckerNootNoot
// drawn last
)
@@ -656,7 +658,6 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
}
// these need to appear on top of any others
uiContainer.add(noticelet)
uiContainer.add(notifier)
App.setDebugTime("Ingame.UpdateCounter", 0)

View File

@@ -104,15 +104,47 @@ object AxeCore {
).let { tileBroken ->
// tile busted
if (tileBroken != null) {
var upCtr = 1
var upCtr = 0
var thisLeaf: ItemID? = null
val tileThereL = INGAME.world.getTileFromTerrain(x-1, y - upCtr)
val tileThereR = INGAME.world.getTileFromTerrain(x+1, y - upCtr)
val propThereL = BlockCodex[tileThereL]
val propThereR = BlockCodex[tileThereR]
val treeTrunkXoff = if (propThereL.hasAllTag(listOf("TREELARGE", "TREETRUNK"))) -1
else if (propThereR.hasAllTag(listOf("TREELARGE", "TREETRUNK"))) 1
else 0
if (treeTrunkXoff != 0) {
val tileThere = INGAME.world.getTileFromTerrain(x + treeTrunkXoff, y - upCtr)
val propThere = BlockCodex[tileThere]
INGAME.world.setTileTerrain(x + treeTrunkXoff, y - upCtr, Block.AIR, false)
PickaxeCore.dropItem(propThere.drop, x + treeTrunkXoff, y - upCtr)
PickaxeCore.makeDust(tile, x + treeTrunkXoff, y - upCtr, 2 + Math.random().roundToInt())
}
upCtr = 1
while (true) {
val tileHere = INGAME.world.getTileFromTerrain(x, y - upCtr)
val propHere = BlockCodex[tileHere]
if (propHere.hasTag("TREETRUNK")) {
if (propHere.hasAllTag(listOf("TREELARGE", "TREETRUNK"))) {
INGAME.world.setTileTerrain(x, y - upCtr, Block.AIR, false)
PickaxeCore.dropItem(propHere.drop, x, y - upCtr) // todo use log item if applicable
PickaxeCore.dropItem(propHere.drop, x, y - upCtr)
PickaxeCore.makeDust(tile, x, y - upCtr, 2 + Math.random().roundToInt())
if (treeTrunkXoff != 0) {
val tileThere = INGAME.world.getTileFromTerrain(x + treeTrunkXoff, y - upCtr)
val propThere = BlockCodex[tileThere]
INGAME.world.setTileTerrain(x + treeTrunkXoff, y - upCtr, Block.AIR, false)
PickaxeCore.dropItem(propThere.drop, x + treeTrunkXoff, y - upCtr)
PickaxeCore.makeDust(tile, x + treeTrunkXoff, y - upCtr, 2 + Math.random().roundToInt())
}
}
else if (propHere.hasTag("TREETRUNK")) {
INGAME.world.setTileTerrain(x, y - upCtr, Block.AIR, false)
PickaxeCore.dropItem(propHere.drop, x, y - upCtr)
PickaxeCore.makeDust(tile, x, y - upCtr, 2 + Math.random().roundToInt())
}
else if (propHere.hasTag("LEAVES")) {

View File

@@ -428,7 +428,7 @@ internal object BlocksDrawer {
// hide tiles with super low lights, kinda like Minecraft's Orebfuscator
val lightAtXY = LightmapRenderer.getLight(x, y) ?: Cvec(0)
if (lightAtXY.fastLum() <= 4f / 255f) {
if (lightAtXY.fastLum() <= 1.5f / 255f) {
tileNumber = 2 // black solid
}