mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 12:34:05 +09:00
IS_DEVELOPMENT_BUILD key can now be toggled with vm option '-ea'
This commit is contained in:
@@ -90,7 +90,7 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
|
|||||||
|
|
||||||
fun destroy() {
|
fun destroy() {
|
||||||
if (!destroyed) {
|
if (!destroyed) {
|
||||||
println("[UnsafePtr] Destroying pointer $this; called from:")
|
printdbg(this, "Destroying pointer $this; called from:")
|
||||||
printStackTrace(this)
|
printStackTrace(this)
|
||||||
|
|
||||||
UnsafeHelper.unsafe.freeMemory(ptr)
|
UnsafeHelper.unsafe.freeMemory(ptr)
|
||||||
@@ -100,7 +100,7 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
|
|||||||
UnsafeHelper.unsafeAllocatedSize -= size
|
UnsafeHelper.unsafeAllocatedSize -= size
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println("[UnsafePtr] Destroy() is called but the pointer $this is already been destroyed; called from:")
|
printdbg(this, "Destroy() is called but the pointer $this is already been destroyed; called from:")
|
||||||
printStackTrace(this)
|
printStackTrace(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,13 @@ public class App implements ApplicationListener {
|
|||||||
/**
|
/**
|
||||||
* when FALSE, some assertion and print code will not execute
|
* when FALSE, some assertion and print code will not execute
|
||||||
*/
|
*/
|
||||||
public static boolean IS_DEVELOPMENT_BUILD = true;
|
public static boolean IS_DEVELOPMENT_BUILD = false;
|
||||||
|
|
||||||
|
{
|
||||||
|
// if -ea flag is set, turn on all the debug prints
|
||||||
|
try { assert (false); }
|
||||||
|
catch (AssertionError e) { IS_DEVELOPMENT_BUILD = true; }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton instance
|
* Singleton instance
|
||||||
@@ -378,8 +383,6 @@ public class App implements ApplicationListener {
|
|||||||
Object[] iconPathsTemp = appIconPaths.toArray();
|
Object[] iconPathsTemp = appIconPaths.toArray();
|
||||||
appConfig.setWindowIcon(Arrays.copyOf(iconPathsTemp, iconPathsTemp.length, String[].class));
|
appConfig.setWindowIcon(Arrays.copyOf(iconPathsTemp, iconPathsTemp.length, String[].class));
|
||||||
|
|
||||||
IS_DEVELOPMENT_BUILD = true;
|
|
||||||
|
|
||||||
// set some more configuration vars
|
// set some more configuration vars
|
||||||
MULTITHREAD = THREAD_COUNT >= 3 && getConfigBoolean("multithread");
|
MULTITHREAD = THREAD_COUNT >= 3 && getConfigBoolean("multithread");
|
||||||
|
|
||||||
@@ -920,10 +923,12 @@ public class App implements ApplicationListener {
|
|||||||
|
|
||||||
|
|
||||||
// test print
|
// test print
|
||||||
System.out.println("[App] Test printing every registered item");
|
if (IS_DEVELOPMENT_BUILD) {
|
||||||
Terrarum.INSTANCE.getItemCodex().getItemCodex().values().stream().map(GameItem::getOriginalID).forEach(
|
System.out.println("[App] Test printing every registered item");
|
||||||
(String s) -> System.out.print(s + " "));
|
Terrarum.INSTANCE.getItemCodex().getItemCodex().values().stream().map(GameItem::getOriginalID).forEach(
|
||||||
System.out.println();
|
(String s) -> System.out.print(s + " "));
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1348,6 +1353,14 @@ public class App implements ApplicationListener {
|
|||||||
System.out.println("[" + out + "] " + message);
|
System.out.println("[" + out + "] " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void printmsgerr(Object obj, Object message) {
|
||||||
|
String out = (obj instanceof String) ? (String) obj : obj.getClass().getSimpleName();
|
||||||
|
if (message == null)
|
||||||
|
System.out.println(csiR + "[" + out + "] null" + csi0);
|
||||||
|
else
|
||||||
|
System.out.println(csiR + "[" + out + "] " + message + csi0);
|
||||||
|
}
|
||||||
|
|
||||||
public static ShaderProgram loadShaderFromFile(String vert, String frag) {
|
public static ShaderProgram loadShaderFromFile(String vert, String frag) {
|
||||||
ShaderProgram s = new ShaderProgram(Gdx.files.internal(vert), Gdx.files.internal(frag));
|
ShaderProgram s = new ShaderProgram(Gdx.files.internal(vert), Gdx.files.internal(frag));
|
||||||
|
|
||||||
@@ -1369,29 +1382,23 @@ public class App implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void measureDebugTime(String name, kotlin.jvm.functions.Function0<kotlin.Unit> block) {
|
public static void measureDebugTime(String name, kotlin.jvm.functions.Function0<kotlin.Unit> block) {
|
||||||
if (IS_DEVELOPMENT_BUILD) {
|
|
||||||
//debugTimers.put(name, kotlin.system.TimingKt.measureNanoTime(block));
|
//debugTimers.put(name, kotlin.system.TimingKt.measureNanoTime(block));
|
||||||
|
|
||||||
long start = System.nanoTime();
|
long start = System.nanoTime();
|
||||||
block.invoke();
|
block.invoke();
|
||||||
debugTimers.put(name, System.nanoTime() - start);
|
debugTimers.put(name, System.nanoTime() - start);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDebugTime(String name, long value) {
|
public static void setDebugTime(String name, long value) {
|
||||||
if (IS_DEVELOPMENT_BUILD) {
|
debugTimers.put(name, value);
|
||||||
debugTimers.put(name, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addDebugTime(String target, String... targets) {
|
public static void addDebugTime(String target, String... targets) {
|
||||||
if (IS_DEVELOPMENT_BUILD) {
|
long l = 0L;
|
||||||
long l = 0L;
|
for (String s : targets) {
|
||||||
for (String s : targets) {
|
l += ((long) debugTimers.get(s));
|
||||||
l += ((long) debugTimers.get(s));
|
|
||||||
}
|
|
||||||
debugTimers.put(target, l);
|
|
||||||
}
|
}
|
||||||
|
debugTimers.put(target, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getTIME_T() {
|
public static long getTIME_T() {
|
||||||
|
|||||||
@@ -219,10 +219,10 @@ object ModMgr {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printdbg(this, "Module $moduleName processed")
|
printmsg(this, "Module $moduleName processed")
|
||||||
}
|
}
|
||||||
catch (noSuchModule: FileNotFoundException) {
|
catch (noSuchModule: FileNotFoundException) {
|
||||||
printdbgerr(this, "No such module: $moduleName, skipping...")
|
printmsgerr(this, "No such module: $moduleName, skipping...")
|
||||||
|
|
||||||
logError(LoadErrorType.NOT_EVEN_THERE, moduleName)
|
logError(LoadErrorType.NOT_EVEN_THERE, moduleName)
|
||||||
|
|
||||||
@@ -232,8 +232,8 @@ object ModMgr {
|
|||||||
// TODO: Instead of skipping module with error, just display the error message onto the face?
|
// TODO: Instead of skipping module with error, just display the error message onto the face?
|
||||||
|
|
||||||
|
|
||||||
printdbgerr(this, "There was an error while loading module $moduleName")
|
printmsgerr(this, "There was an error while loading module $moduleName")
|
||||||
printdbgerr(this, "\t$e")
|
printmsgerr(this, "\t$e")
|
||||||
print(App.csiR); e.printStackTrace(System.out); print(App.csi0)
|
print(App.csiR); e.printStackTrace(System.out); print(App.csi0)
|
||||||
|
|
||||||
logError(LoadErrorType.YOUR_FAULT, moduleName, e)
|
logError(LoadErrorType.YOUR_FAULT, moduleName, e)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package net.torvald.terrarum.blockproperties
|
|||||||
import net.torvald.gdx.graphics.Cvec
|
import net.torvald.gdx.graphics.Cvec
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.App.printdbg
|
import net.torvald.terrarum.App.printdbg
|
||||||
import net.torvald.terrarum.App.printmsg
|
|
||||||
import net.torvald.terrarum.ReferencingRanges.PREFIX_VIRTUALTILE
|
import net.torvald.terrarum.ReferencingRanges.PREFIX_VIRTUALTILE
|
||||||
import net.torvald.terrarum.gameitems.ItemID
|
import net.torvald.terrarum.gameitems.ItemID
|
||||||
import net.torvald.terrarum.gameworld.FluidType
|
import net.torvald.terrarum.gameworld.FluidType
|
||||||
@@ -59,7 +58,7 @@ class BlockCodex {
|
|||||||
* Later entry (possible from other modules) will replace older ones
|
* Later entry (possible from other modules) will replace older ones
|
||||||
*/
|
*/
|
||||||
fun fromModule(module: String, path: String) {
|
fun fromModule(module: String, path: String) {
|
||||||
App.printmsg(this, "Building block properties table")
|
printdbg(this, "Building block properties table")
|
||||||
try {
|
try {
|
||||||
register(module, CSVFetcher.readFromModule(module, path))
|
register(module, CSVFetcher.readFromModule(module, path))
|
||||||
}
|
}
|
||||||
@@ -67,7 +66,7 @@ class BlockCodex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun fromCSV(module: String, csvString: String) {
|
fun fromCSV(module: String, csvString: String) {
|
||||||
App.printmsg(this, "Building wire properties table for module $module")
|
printdbg(this, "Building wire properties table for module $module")
|
||||||
|
|
||||||
val csvParser = org.apache.commons.csv.CSVParser.parse(
|
val csvParser = org.apache.commons.csv.CSVParser.parse(
|
||||||
csvString,
|
csvString,
|
||||||
@@ -211,7 +210,7 @@ class BlockCodex {
|
|||||||
|
|
||||||
blockProps[prop.id] = prop
|
blockProps[prop.id] = prop
|
||||||
|
|
||||||
printmsg(this, "Setting prop ${prop.id} ->>\t${prop.nameKey}\tsolid:${prop.isSolid}")
|
printdbg(this, "Setting prop ${prop.id} ->>\t${prop.nameKey}\tsolid:${prop.isSolid}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.blockproperties
|
package net.torvald.terrarum.blockproperties
|
||||||
|
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
|
import net.torvald.terrarum.App.printdbg
|
||||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||||
import net.torvald.terrarum.gameitems.GameItem
|
import net.torvald.terrarum.gameitems.GameItem
|
||||||
import net.torvald.terrarum.gameitems.ItemID
|
import net.torvald.terrarum.gameitems.ItemID
|
||||||
@@ -39,7 +40,7 @@ class WireCodex {
|
|||||||
* @param path to the "wires" directory, not path to the CSV; must end with a slash!
|
* @param path to the "wires" directory, not path to the CSV; must end with a slash!
|
||||||
*/
|
*/
|
||||||
fun fromModule(module: String, path: String) {
|
fun fromModule(module: String, path: String) {
|
||||||
App.printmsg(this, "Building wire properties table for module $module")
|
printdbg(this, "Building wire properties table for module $module")
|
||||||
try {
|
try {
|
||||||
register(module, path, CSVFetcher.readFromModule(module, path + "wires.csv"))
|
register(module, path, CSVFetcher.readFromModule(module, path + "wires.csv"))
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@ class WireCodex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun fromCSV(module: String, path: String, csvString: String) {
|
fun fromCSV(module: String, path: String, csvString: String) {
|
||||||
App.printmsg(this, "Building wire properties table for module $module")
|
printdbg(this, "Building wire properties table for module $module")
|
||||||
|
|
||||||
val csvParser = org.apache.commons.csv.CSVParser.parse(
|
val csvParser = org.apache.commons.csv.CSVParser.parse(
|
||||||
csvString,
|
csvString,
|
||||||
@@ -64,7 +65,7 @@ class WireCodex {
|
|||||||
setProp(module, it.intVal("id"), it)
|
setProp(module, it.intVal("id"), it)
|
||||||
}
|
}
|
||||||
|
|
||||||
App.printmsg(this, "Registering wire textures into the resource pool")
|
printdbg(this, "Registering wire textures into the resource pool")
|
||||||
wireProps.keys.forEach { id ->
|
wireProps.keys.forEach { id ->
|
||||||
val wireid = id.split(':').last().toInt()
|
val wireid = id.split(':').last().toInt()
|
||||||
|
|
||||||
@@ -148,6 +149,6 @@ class WireCodex {
|
|||||||
val loadedClassInstance = loadedClassConstructor.newInstance(prop.id, invImgSheet, invImgX, invImgY)
|
val loadedClassInstance = loadedClassConstructor.newInstance(prop.id, invImgSheet, invImgX, invImgY)
|
||||||
ItemCodex[prop.id] = loadedClassInstance as GameItem
|
ItemCodex[prop.id] = loadedClassInstance as GameItem
|
||||||
|
|
||||||
App.printmsg(this, "Setting prop ${prop.id} ->>\t${prop.nameKey}")
|
printdbg(this, "Setting prop ${prop.id} ->>\t${prop.nameKey}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -371,6 +371,20 @@ fun mouseInInteractableRange(actor: ActorWithBody, action: () -> Boolean): Boole
|
|||||||
val distMax = actor.actorValue.getAsDouble(AVKey.REACH)!! * (actor.actorValue.getAsDouble(AVKey.REACHBUFF) ?: 1.0) * actor.scale // perform some error checking here
|
val distMax = actor.actorValue.getAsDouble(AVKey.REACH)!! * (actor.actorValue.getAsDouble(AVKey.REACHBUFF) ?: 1.0) * actor.scale // perform some error checking here
|
||||||
if (dist <= distMax.sqr()) return action() else return false
|
if (dist <= distMax.sqr()) return action() else return false
|
||||||
}
|
}
|
||||||
|
fun mouseInInteractableRangeTools(actor: ActorWithBody, item: GameItem?, reachMultiplierInTiles: (Int) -> Double = { it.toDouble() }, action: () -> Boolean): Boolean {
|
||||||
|
if (item == null) return false
|
||||||
|
val mousePos1 = Vector2(Terrarum.mouseX, Terrarum.mouseY)
|
||||||
|
val mousePos2 = Vector2(Terrarum.mouseX + INGAME.world.width * TILE_SIZED, Terrarum.mouseY)
|
||||||
|
val mousePos3 = Vector2(Terrarum.mouseX - INGAME.world.width * TILE_SIZED, Terrarum.mouseY)
|
||||||
|
val actorPos = actor.centrePosVector
|
||||||
|
val dist = minOf(actorPos.distanceSquared(mousePos1), actorPos.distanceSquared(mousePos2), actorPos.distanceSquared(mousePos3))
|
||||||
|
|
||||||
|
val reachBonus = (actor.actorValue.getAsDouble(AVKey.REACHBUFF) ?: 1.0) * actor.scale
|
||||||
|
val distMax = actor.actorValue.getAsDouble(AVKey.REACH)!! * reachBonus // perform some error checking here
|
||||||
|
val toolDistMax = (TILE_SIZED * reachMultiplierInTiles(item.material.toolReach)) * reachBonus
|
||||||
|
|
||||||
|
if (dist <= minOf(toolDistMax, distMax).sqr()) return action() else return false
|
||||||
|
}
|
||||||
fun IntRange.pickRandom() = HQRNG().nextInt(this.endInclusive - this.start + 1) + this.start // count() on 200 million entries? Se on vitun hyvää idea
|
fun IntRange.pickRandom() = HQRNG().nextInt(this.endInclusive - this.start + 1) + this.start // count() on 200 million entries? Se on vitun hyvää idea
|
||||||
fun IntArray.pickRandom(): Int = this[HQRNG().nextInt(this.size)]
|
fun IntArray.pickRandom(): Int = this[HQRNG().nextInt(this.size)]
|
||||||
fun DoubleArray.pickRandom(): Double = this[HQRNG().nextInt(this.size)]
|
fun DoubleArray.pickRandom(): Double = this[HQRNG().nextInt(this.size)]
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ class ItemCodex {
|
|||||||
* @param: dynamicID string of "dyn:<random id>"
|
* @param: dynamicID string of "dyn:<random id>"
|
||||||
*/
|
*/
|
||||||
fun registerNewDynamicItem(dynamicID: ItemID, item: GameItem) {
|
fun registerNewDynamicItem(dynamicID: ItemID, item: GameItem) {
|
||||||
if (App.IS_DEVELOPMENT_BUILD) {
|
printdbg(this, "Registering new dynamic item $dynamicID (from ${item.originalID})")
|
||||||
printdbg(this, "Registering new dynamic item $dynamicID (from ${item.originalID})")
|
|
||||||
}
|
|
||||||
dynamicItemDescription[dynamicID] = item
|
dynamicItemDescription[dynamicID] = item
|
||||||
dynamicToStaticTable[dynamicID] = item.originalID
|
dynamicToStaticTable[dynamicID] = item.originalID
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.torvald.terrarum.itemproperties
|
package net.torvald.terrarum.itemproperties
|
||||||
|
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App.printdbg
|
||||||
import net.torvald.terrarum.App.printmsg
|
|
||||||
import net.torvald.terrarum.Codex
|
import net.torvald.terrarum.Codex
|
||||||
import net.torvald.terrarum.blockproperties.floatVal
|
import net.torvald.terrarum.blockproperties.floatVal
|
||||||
import net.torvald.terrarum.blockproperties.intVal
|
import net.torvald.terrarum.blockproperties.intVal
|
||||||
@@ -44,7 +43,7 @@ class MaterialCodex {
|
|||||||
internal constructor()
|
internal constructor()
|
||||||
|
|
||||||
fun fromModule(module: String, path: String) {
|
fun fromModule(module: String, path: String) {
|
||||||
App.printmsg(this, "Building material properties table")
|
printdbg(this, "Building material properties table")
|
||||||
try {
|
try {
|
||||||
register(CSVFetcher.readFromModule(module, path))
|
register(CSVFetcher.readFromModule(module, path))
|
||||||
}
|
}
|
||||||
@@ -74,7 +73,7 @@ class MaterialCodex {
|
|||||||
|
|
||||||
materialProps[prop.identifier] = prop
|
materialProps[prop.identifier] = prop
|
||||||
|
|
||||||
printmsg(this, "${prop.identifier}\t${prop.strength}\t${prop.density}\t${prop.forceMod}\t${prop.enduranceMod}")
|
printdbg(this, "${prop.identifier}\t${prop.strength}\t${prop.density}\t${prop.forceMod}\t${prop.enduranceMod}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1137,8 +1137,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
arrayOf(actorContainerActive, actorContainerInactive).forEach { actorContainer ->
|
arrayOf(actorContainerActive, actorContainerInactive).forEach { actorContainer ->
|
||||||
val indexToDelete = actorContainer.searchForIndex(actor.referenceID) { it.referenceID }
|
val indexToDelete = actorContainer.searchForIndex(actor.referenceID) { it.referenceID }
|
||||||
if (indexToDelete != null) {
|
if (indexToDelete != null) {
|
||||||
printdbg(this, "Removing actor $actor")
|
// printdbg(this, "Removing actor $actor")
|
||||||
printStackTrace(this)
|
// printStackTrace(this)
|
||||||
|
|
||||||
actor.dispose()
|
actor.dispose()
|
||||||
actorContainer.removeAt(indexToDelete)
|
actorContainer.removeAt(indexToDelete)
|
||||||
@@ -1180,13 +1180,13 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
override fun addNewActor(actor: Actor?) {
|
override fun addNewActor(actor: Actor?) {
|
||||||
if (actor == null) return
|
if (actor == null) return
|
||||||
|
|
||||||
if (App.IS_DEVELOPMENT_BUILD && theGameHasActor(actor.referenceID)) {
|
if (theGameHasActor(actor.referenceID)) {
|
||||||
throw ReferencedActorAlreadyExistsException(actor)
|
throw ReferencedActorAlreadyExistsException(actor)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (actor.referenceID !in ReferencingRanges.ACTORS_WIRES && actor.referenceID !in ReferencingRanges.ACTORS_WIRES_HELPER) {
|
if (actor.referenceID !in ReferencingRanges.ACTORS_WIRES && actor.referenceID !in ReferencingRanges.ACTORS_WIRES_HELPER) {
|
||||||
printdbg(this, "Adding actor $actor")
|
// printdbg(this, "Adding actor $actor")
|
||||||
printStackTrace(this)
|
// printStackTrace(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
actorContainerActive.add(actor)
|
actorContainerActive.add(actor)
|
||||||
@@ -1199,7 +1199,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun activateDormantActor(actor: Actor) {
|
fun activateDormantActor(actor: Actor) {
|
||||||
if (App.IS_DEVELOPMENT_BUILD && !isInactive(actor.referenceID)) {
|
if (!isInactive(actor.referenceID)) {
|
||||||
/*if (isActive(actor.referenceID))
|
/*if (isActive(actor.referenceID))
|
||||||
throw Error("The actor $actor is already activated")
|
throw Error("The actor $actor is already activated")
|
||||||
else
|
else
|
||||||
@@ -1306,7 +1306,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
println("[Ingame] Resize event")
|
printdbg(this, "Resize event")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
worldFBO = FloatFrameBuffer(App.scr.width, App.scr.height, false)
|
worldFBO = FloatFrameBuffer(App.scr.width, App.scr.height, false)
|
||||||
|
|
||||||
// load list of savegames
|
// load list of savegames
|
||||||
println("[TitleScreen] update list of savegames")
|
printdbg(this, "update list of savegames")
|
||||||
// to show "Continue" and "Load" on the titlescreen, uncomment this line
|
// to show "Continue" and "Load" on the titlescreen, uncomment this line
|
||||||
App.updateListOfSavegames()
|
App.updateListOfSavegames()
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ internal class FixtureStorageChest : FixtureBase {
|
|||||||
actorValue[AVKey.BASEMASS] = MASS
|
actorValue[AVKey.BASEMASS] = MASS
|
||||||
|
|
||||||
|
|
||||||
println("FixtureStorageChest constructor call")
|
|
||||||
printStackTrace(this)
|
printStackTrace(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.torvald.terrarum.gameactors.ActorWithBody
|
|||||||
import net.torvald.terrarum.gameitems.GameItem
|
import net.torvald.terrarum.gameitems.GameItem
|
||||||
import net.torvald.terrarum.gameitems.ItemID
|
import net.torvald.terrarum.gameitems.ItemID
|
||||||
import net.torvald.terrarum.gameitems.mouseInInteractableRange
|
import net.torvald.terrarum.gameitems.mouseInInteractableRange
|
||||||
|
import net.torvald.terrarum.gameitems.mouseInInteractableRangeTools
|
||||||
import net.torvald.terrarum.itemproperties.Calculate
|
import net.torvald.terrarum.itemproperties.Calculate
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem
|
import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem
|
||||||
import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.BASE_MASS_AND_SIZE
|
import net.torvald.terrarum.modulebasegame.gameitems.PickaxeCore.BASE_MASS_AND_SIZE
|
||||||
@@ -29,7 +30,7 @@ object PickaxeCore {
|
|||||||
fun startPrimaryUse(
|
fun startPrimaryUse(
|
||||||
actor: ActorWithBody, delta: Float, item: GameItem?, mx: Int, my: Int,
|
actor: ActorWithBody, delta: Float, item: GameItem?, mx: Int, my: Int,
|
||||||
dropProbability: Double = 1.0, mw: Int = 1, mh: Int = 1, attackActorBlocks: Boolean = true
|
dropProbability: Double = 1.0, mw: Int = 1, mh: Int = 1, attackActorBlocks: Boolean = true
|
||||||
) = mouseInInteractableRange(actor) {
|
) = mouseInInteractableRangeTools(actor, item) {
|
||||||
// un-round the mx
|
// un-round the mx
|
||||||
val ww = INGAME.world.width
|
val ww = INGAME.world.width
|
||||||
val apos = actor.centrePosPoint
|
val apos = actor.centrePosPoint
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
scrollAnimCounter = 0f
|
scrollAnimCounter = 0f
|
||||||
loadFired = 0
|
loadFired = 0
|
||||||
|
|
||||||
println("savelist mode: $mode")
|
printdbg(this, "savelist mode: $mode")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import com.badlogic.gdx.graphics.Camera
|
|||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.App.printdbg
|
import net.torvald.terrarum.App.*
|
||||||
import net.torvald.terrarum.App.printdbgerr
|
|
||||||
import net.torvald.terrarum.QNDTreeNode
|
import net.torvald.terrarum.QNDTreeNode
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.Yaml
|
import net.torvald.terrarum.Yaml
|
||||||
@@ -109,7 +108,7 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
|
|||||||
val tag = it.tags
|
val tag = it.tags
|
||||||
if (tag.contains("WRITETOCONFIG")) WriteConfig()
|
if (tag.contains("WRITETOCONFIG")) WriteConfig()
|
||||||
|
|
||||||
print("[UIRemoCon] Returning from ${currentRemoConContents.data}")
|
if (IS_DEVELOPMENT_BUILD) print("[UIRemoCon] Returning from ${currentRemoConContents.data}")
|
||||||
|
|
||||||
if (currentRemoConContents.parent != null) {
|
if (currentRemoConContents.parent != null) {
|
||||||
remoConTray.consume()
|
remoConTray.consume()
|
||||||
@@ -120,7 +119,7 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
|
|||||||
|
|
||||||
parent.uiFakeBlurOverlay.setAsClose()
|
parent.uiFakeBlurOverlay.setAsClose()
|
||||||
|
|
||||||
println(" to ${currentlySelectedRemoConItem}")
|
if (IS_DEVELOPMENT_BUILD) println(" to ${currentlySelectedRemoConItem}")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw NullPointerException("No parent node to return")
|
throw NullPointerException("No parent node to return")
|
||||||
@@ -128,8 +127,10 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// check if target exists
|
// check if target exists
|
||||||
//println("current node: ${currentRemoConContents.data}")
|
if (IS_DEVELOPMENT_BUILD) {
|
||||||
//currentRemoConContents.children.forEach { println("- ${it.data}") }
|
//println("current node: ${currentRemoConContents.data}")
|
||||||
|
//currentRemoConContents.children.forEach { println("- ${it.data}") }
|
||||||
|
}
|
||||||
|
|
||||||
if (currentRemoConContents.children.size > selectedIndex ?: 0x7FFFFFFF) {
|
if (currentRemoConContents.children.size > selectedIndex ?: 0x7FFFFFFF) {
|
||||||
setNewRemoConContents(currentRemoConContents.children[selectedIndex!!])
|
setNewRemoConContents(currentRemoConContents.children[selectedIndex!!])
|
||||||
|
|||||||
Reference in New Issue
Block a user