mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 10:34:06 +09:00
removing terrain block also removes its ore
This commit is contained in:
@@ -376,12 +376,24 @@ open class GameWorld(
|
|||||||
|
|
||||||
if (BlockCodex[itemID].isSolid) {
|
if (BlockCodex[itemID].isSolid) {
|
||||||
layerFluids.unsafeSetTile(x, y, fluidNameToNumberMap[Fluid.NULL]!!, 0f)
|
layerFluids.unsafeSetTile(x, y, fluidNameToNumberMap[Fluid.NULL]!!, 0f)
|
||||||
|
// Terrarum.ingame?.modified(LandUtil.LAYER_FLUID, x, y)
|
||||||
}
|
}
|
||||||
// fluid tiles-item should be modified so that they will also place fluid onto their respective map
|
// fluid tiles-item should be modified so that they will also place fluid onto their respective map
|
||||||
|
|
||||||
|
val oldOre = layerOres.unsafeGetTile(x, y)
|
||||||
|
val deleteOldOre = (oldOre != 0 && !BlockCodex[itemID].isSolid)
|
||||||
|
|
||||||
|
if (deleteOldOre) {
|
||||||
|
layerOres.unsafeSetTile(x, y, 0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
if (!bypassEvent && oldTerrain != itemID) {
|
if (!bypassEvent && oldTerrain != itemID) {
|
||||||
Terrarum.ingame?.queueTerrainChangedEvent(oldTerrain, itemID, x, y)
|
Terrarum.ingame?.queueTerrainChangedEvent(oldTerrain, itemID, x, y)
|
||||||
Terrarum.ingame?.modified(LandUtil.LAYER_TERR, x, y)
|
Terrarum.ingame?.modified(LandUtil.LAYER_TERR, x, y)
|
||||||
|
|
||||||
|
if (deleteOldOre) {
|
||||||
|
Terrarum.ingame?.modified(LandUtil.LAYER_ORES, x, y)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +410,7 @@ open class GameWorld(
|
|||||||
|
|
||||||
if (!bypassEvent) {
|
if (!bypassEvent) {
|
||||||
Terrarum.ingame?.queueWireChangedEvent(tile, false, x, y)
|
Terrarum.ingame?.queueWireChangedEvent(tile, false, x, y)
|
||||||
Terrarum.ingame?.modified(LandUtil.LAYER_WIRE, x, y)
|
// Terrarum.ingame?.modified(LandUtil.LAYER_WIRE, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -430,7 +442,7 @@ open class GameWorld(
|
|||||||
if (wireNode != null) {
|
if (wireNode != null) {
|
||||||
if (!bypassEvent) {
|
if (!bypassEvent) {
|
||||||
Terrarum.ingame?.queueWireChangedEvent(tile, true, x, y)
|
Terrarum.ingame?.queueWireChangedEvent(tile, true, x, y)
|
||||||
Terrarum.ingame?.modified(LandUtil.LAYER_WIRE, x, y)
|
// Terrarum.ingame?.modified(LandUtil.LAYER_WIRE, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// disconnect neighbouring nodes
|
// disconnect neighbouring nodes
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ object LandUtil {
|
|||||||
|
|
||||||
const val LAYER_TERR = 0
|
const val LAYER_TERR = 0
|
||||||
const val LAYER_WALL = 1
|
const val LAYER_WALL = 1
|
||||||
const val LAYER_WIRE = 2
|
const val LAYER_ORES = 2
|
||||||
|
const val LAYER_WIRE = 20
|
||||||
const val LAYER_FLUID = 3
|
const val LAYER_FLUID = 3
|
||||||
|
|
||||||
fun toChunkNum(world: GameWorld, x: Int, y: Int): Int {
|
fun toChunkNum(world: GameWorld, x: Int, y: Int): Int {
|
||||||
|
|||||||
Reference in New Issue
Block a user