mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
the event works; ingame works; but starts as "bugged noclip"
This commit is contained in:
@@ -220,9 +220,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
*/
|
*/
|
||||||
private fun enter(worldParams: NewWorldParameters) {
|
private fun enter(worldParams: NewWorldParameters) {
|
||||||
printdbg(this, "Ingame called")
|
printdbg(this, "Ingame called")
|
||||||
Thread.currentThread().getStackTrace().forEach {
|
printStackTrace()
|
||||||
printdbg(this, "-> $it")
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gameInitialised) {
|
if (gameInitialised) {
|
||||||
printdbg(this, "loaded successfully.")
|
printdbg(this, "loaded successfully.")
|
||||||
@@ -255,7 +253,10 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// test actor
|
// test actor
|
||||||
//addNewActor(PlayerBuilderCynthia())
|
//addNewActor(PlayerBuilderCynthia())
|
||||||
|
|
||||||
setTheRealGamerFirstTime(PlayerBuilderSigrid())
|
|
||||||
|
// it won't work:
|
||||||
|
//setTheRealGamerFirstTime(PlayerBuilderSigrid())
|
||||||
|
// because NO GL CONTEXT IN THIS THREAD, might want 'postInit()'?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,9 +264,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
/** Load rest of the game with GL context */
|
/** Load rest of the game with GL context */
|
||||||
fun postInit() {
|
fun postInit() {
|
||||||
//LightmapRenderer.world = this.world
|
setTheRealGamerFirstTime(PlayerBuilderSigrid())
|
||||||
//BlocksDrawer.world = this.world
|
|
||||||
//FeaturesDrawer.world = this.world
|
|
||||||
|
|
||||||
|
|
||||||
MegaRainGovernor // invoke MegaRain Governor
|
MegaRainGovernor // invoke MegaRain Governor
|
||||||
@@ -442,15 +442,11 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
if (!gameFullyLoaded) {
|
if (!gameFullyLoaded) {
|
||||||
|
|
||||||
if (gameLoadMode == GameLoadMode.CREATE_NEW) {
|
if (gameLoadMode == GameLoadMode.CREATE_NEW) {
|
||||||
actorNowPlaying = PlayerBuilderSigrid()
|
|
||||||
|
|
||||||
// go to spawn position
|
// go to spawn position
|
||||||
actorNowPlaying?.setPosition(
|
actorNowPlaying?.setPosition(
|
||||||
world.spawnX * FeaturesDrawer.TILE_SIZE.toDouble(),
|
world.spawnX * FeaturesDrawer.TILE_SIZE.toDouble(),
|
||||||
world.spawnY * FeaturesDrawer.TILE_SIZE.toDouble()
|
world.spawnY * FeaturesDrawer.TILE_SIZE.toDouble()
|
||||||
)
|
)
|
||||||
|
|
||||||
addNewActor(actorNowPlaying)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
postInit()
|
postInit()
|
||||||
@@ -762,6 +758,9 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
throw RuntimeException("Attempted to remove player.")
|
throw RuntimeException("Attempted to remove player.")
|
||||||
val indexToDelete = actorContainer.binarySearch(actor.referenceID!!)
|
val indexToDelete = actorContainer.binarySearch(actor.referenceID!!)
|
||||||
if (indexToDelete >= 0) {
|
if (indexToDelete >= 0) {
|
||||||
|
printdbg(this, "Removing actor $actor")
|
||||||
|
printStackTrace()
|
||||||
|
|
||||||
actorContainer.removeAt(indexToDelete)
|
actorContainer.removeAt(indexToDelete)
|
||||||
|
|
||||||
// indexToDelete >= 0 means that the actor certainly exists in the game
|
// indexToDelete >= 0 means that the actor certainly exists in the game
|
||||||
@@ -799,6 +798,9 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
throw Error("The actor $actor already exists in the game")
|
throw Error("The actor $actor already exists in the game")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
printdbg(this, "Adding actor $actor")
|
||||||
|
printStackTrace()
|
||||||
|
|
||||||
actorContainer.add(actor)
|
actorContainer.add(actor)
|
||||||
insertionSortLastElem(actorContainer) // we can do this as we are only adding single actor
|
insertionSortLastElem(actorContainer) // we can do this as we are only adding single actor
|
||||||
|
|
||||||
@@ -968,4 +970,9 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun printStackTrace() {
|
||||||
|
Thread.currentThread().getStackTrace().forEach {
|
||||||
|
printdbg(this, "-> $it")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user