adopting Java 9/Kotlin 1.2

This commit is contained in:
minjaesong
2018-02-10 21:40:17 +09:00
parent f5fba1e273
commit e94ebf9949
31 changed files with 326 additions and 69 deletions

View File

@@ -6,9 +6,6 @@
<JetCodeStyleSettings> <JetCodeStyleSettings>
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" /> <option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
</JetCodeStyleSettings> </JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<XML> <XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML> </XML>

41
.idea/codeStyles/Project.xml generated Normal file
View File

@@ -0,0 +1,41 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
</JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="1" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
<option name="WRAP_ON_TYPING" value="0" />
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="5" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="5" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

16
.idea/compiler.xml generated
View File

@@ -1,22 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing> <annotationProcessing>
<profile default="true" name="Default" enabled="true"> <profile default="true" name="Default" enabled="true" />
<processorPath useClasspath="true" />
</profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel target="1.8" /> <bytecodeTargetLevel target="1.8" />
</component> </component>

8
.idea/kotlinc.xml generated
View File

@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Kotlin2JsCompilerArguments">
<option name="moduleKind" value="plain" />
</component>
<component name="Kotlin2JvmCompilerArguments"> <component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="1.8" /> <option name="jvmTarget" value="1.8" />
</component> </component>
<component name="KotlinCommonCompilerArguments">
<option name="languageVersion" value="1.1" />
<option name="apiVersion" value="1.1" />
<option name="coroutinesWarn" value="true" />
</component>
</project> </project>

View File

@@ -1,12 +0,0 @@
<component name="libraryTable">
<library name="KotlinJavaRuntime">
<CLASSES>
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -1,6 +1,6 @@
*Terrarum* *Terrarum*
Copyright (C) 2013-2017 Minjaesong (Torvald) Copyright (C) 2013-2018 Minjaesong (Torvald)
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

14
assets/18BitColour.frag Normal file
View File

@@ -0,0 +1,14 @@
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main(void) {
vec4 color = texture2D(u_texture, v_texCoords).rgba;
color.r = floor(63.0 * color.r + 0.5) / 63.0;
color.g = floor(63.0 * color.g + 0.5) / 63.0;
color.b = floor(63.0 * color.b + 0.5) / 63.0;
// a: passthrough
gl_FragColor = vec4(color.rgb, 0.0);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,7 @@
package net.torvald.random package net.torvald.random
import net.torvald.terrarum.serialise.toLittleLong
import org.apache.commons.codec.digest.DigestUtils
import java.util.Random import java.util.Random
/** /**
@@ -14,8 +16,10 @@ class HQRNG @JvmOverloads constructor(seed: Long = System.nanoTime()) : Random()
if (seed == 0L) if (seed == 0L)
throw IllegalArgumentException("Invalid seed: cannot be zero") throw IllegalArgumentException("Invalid seed: cannot be zero")
s0 = (6364136223846793005L * seed + 1442695040888963407L) val hash = DigestUtils.sha256(seed.toString())
s1 = (6364136223846793005L * s0 + 1442695040888963407L)
s0 = hash.copyOfRange(0, 8).toLittleLong()
s1 = hash.copyOfRange(8, 16).toLittleLong()
} }
override fun nextLong(): Long { override fun nextLong(): Long {

View File

@@ -1449,6 +1449,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
BlocksDrawer.resize(Terrarum.WIDTH, Terrarum.HEIGHT) BlocksDrawer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
LightmapRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT) LightmapRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
MegaRainGovernor.resize()
worldDrawFrameBuffer.dispose() worldDrawFrameBuffer.dispose()
worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false) worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)

View File

@@ -6,6 +6,9 @@ import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer import com.badlogic.gdx.graphics.glutils.FrameBuffer
/**
* Must be called by the App Loader
*/
object PostProcessor { object PostProcessor {
private val batch = SpriteBatch() private val batch = SpriteBatch()
@@ -21,7 +24,7 @@ object PostProcessor {
//Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT) //Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
batch.shader = null batch.shader = Terrarum.shader18Bit // essential design decision; 262 144 colours VGA; NOT related with LCD monitor's internals
batch.inUse { batch.inUse {
val texture = screenTexHolder.colorBufferTexture val texture = screenTexHolder.colorBufferTexture
batch.shader.setUniformMatrix("u_projTrans", batch.projectionMatrix) batch.shader.setUniformMatrix("u_projTrans", batch.projectionMatrix)

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum
import com.badlogic.gdx.Gdx import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Screen import com.badlogic.gdx.Screen
import com.badlogic.gdx.assets.AssetManager
import com.badlogic.gdx.graphics.* import com.badlogic.gdx.graphics.*
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer import com.badlogic.gdx.graphics.glutils.FrameBuffer
@@ -10,6 +11,7 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import com.badlogic.gdx.utils.GdxRuntimeException import com.badlogic.gdx.utils.GdxRuntimeException
import com.google.gson.JsonArray import com.google.gson.JsonArray
import com.google.gson.JsonPrimitive import com.google.gson.JsonPrimitive
import net.torvald.terrarum.gameactors.ActorWithPhysics
import net.torvald.terrarum.gameactors.floorInt import net.torvald.terrarum.gameactors.floorInt
import net.torvald.terrarum.imagefont.TinyAlphNum import net.torvald.terrarum.imagefont.TinyAlphNum
import net.torvald.terrarum.imagefont.Watch7SegMain import net.torvald.terrarum.imagefont.Watch7SegMain
@@ -98,7 +100,9 @@ object Terrarum : Screen {
/** /**
* To be used with physics simulator * To be used with physics simulator
*/ */
val TARGET_FPS: Double = 26.0 + (2.0 / 3.0) // lower value == faster gravity response (IT WON'T HOTSWAP!!) val TARGET_FPS: Double = 26.0 + (2.0 / 3.0)
// 26.0 + (2.0 / 3.0) // lower value == faster gravity response (IT WON'T HOTSWAP!!)
// protip: using METER, game unit and SI unit will have same number
/** /**
* To be used with render, to achieve smooth frame drawing * To be used with render, to achieve smooth frame drawing
@@ -212,6 +216,7 @@ object Terrarum : Screen {
lateinit var shaderBlendGlow: ShaderProgram lateinit var shaderBlendGlow: ShaderProgram
lateinit var shaderRGBOnly: ShaderProgram lateinit var shaderRGBOnly: ShaderProgram
lateinit var shaderAtoGrey: ShaderProgram lateinit var shaderAtoGrey: ShaderProgram
lateinit var shader18Bit: ShaderProgram
lateinit var textureWhiteSquare: Texture lateinit var textureWhiteSquare: Texture
@@ -225,6 +230,9 @@ object Terrarum : Screen {
val deltaTime: Float; get() = Gdx.graphics.rawDeltaTime val deltaTime: Float; get() = Gdx.graphics.rawDeltaTime
lateinit var assetManager: AssetManager
init { init {
println("$NAME version ${TerrarumAppLoader.getVERSION_STRING()}") println("$NAME version ${TerrarumAppLoader.getVERSION_STRING()}")
@@ -322,6 +330,8 @@ object Terrarum : Screen {
} }
assetManager = AssetManager()
println("[Terrarum] GL_VERSION = $GL_VERSION") println("[Terrarum] GL_VERSION = $GL_VERSION")
println("[Terrarum] GL_MAX_TEXTURE_SIZE = $GL_MAX_TEXTURE_SIZE") println("[Terrarum] GL_MAX_TEXTURE_SIZE = $GL_MAX_TEXTURE_SIZE")
@@ -383,6 +393,8 @@ object Terrarum : Screen {
shaderRGBOnly = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/rgbonly.frag")) shaderRGBOnly = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/rgbonly.frag"))
shaderAtoGrey = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/aonly.frag")) shaderAtoGrey = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/aonly.frag"))
shader18Bit = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/18BitColour.frag"))
if (!shaderBlendGlow.isCompiled) { if (!shaderBlendGlow.isCompiled) {
Gdx.app.log("shaderBlendGlow", shaderBlendGlow.log) Gdx.app.log("shaderBlendGlow", shaderBlendGlow.log)

View File

@@ -124,6 +124,8 @@ object BlockCodex {
} }
catch (e: NumberFormatException) { catch (e: NumberFormatException) {
} }
catch (e1: IllegalStateException) {
}
return ret return ret
} }
@@ -135,6 +137,8 @@ object BlockCodex {
} }
catch (e: NumberFormatException) { catch (e: NumberFormatException) {
} }
catch (e1: IllegalStateException) {
}
return ret return ret
} }

View File

@@ -54,6 +54,7 @@ object CommandDict {
"spawntapestry" to SpawnTapestry, "spawntapestry" to SpawnTapestry,
"imtest" to JavaIMTest, "imtest" to JavaIMTest,
"cheatmotherfuckernootnoot" to CheatWarnTest, "cheatmotherfuckernootnoot" to CheatWarnTest,
"spawnlunarlander" to SpawnPhysTestLunarLander,
/* !! */"exportlayer" to ExportLayerData, /* !! */"exportlayer" to ExportLayerData,

View File

@@ -21,10 +21,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
val yvel = if (args.size >= 4) args[3].toDouble() else 0.0 val yvel = if (args.size >= 4) args[3].toDouble() else 0.0
val ball = PhysTestBall(Terrarum.ingame!!.world) val ball = PhysTestBall(Terrarum.ingame!!.world)
ball.setPosition( ball.setPosition(mouseX, mouseY)
(mouseX + WorldCamera.x).toDouble(),
(mouseY + WorldCamera.y).toDouble()
)
ball.elasticity = elasticity ball.elasticity = elasticity
ball.applyForce(Vector2(xvel, yvel)) ball.applyForce(Vector2(xvel, yvel))
@@ -34,10 +31,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
val elasticity = args[1].toDouble() val elasticity = args[1].toDouble()
val ball = PhysTestBall(Terrarum.ingame!!.world) val ball = PhysTestBall(Terrarum.ingame!!.world)
ball.setPosition( ball.setPosition(mouseX, mouseY)
(mouseX + WorldCamera.x).toDouble(),
(mouseY + WorldCamera.y).toDouble()
)
ball.elasticity = elasticity ball.elasticity = elasticity
Terrarum.ingame!!.addNewActor(ball) Terrarum.ingame!!.addNewActor(ball)

View File

@@ -0,0 +1,24 @@
package net.torvald.terrarum.console
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.PhysTestLuarLander
import net.torvald.terrarum.worlddrawer.WorldCamera
/**
* Created by minjaesong on 2018-01-18.
*/
internal object SpawnPhysTestLunarLander : ConsoleCommand {
override fun execute(args: Array<String>) {
val mouseX = Terrarum.mouseX
val mouseY = Terrarum.mouseY
val lander = PhysTestLuarLander(Terrarum.ingame!!.world)
lander.setPosition(mouseX, mouseY)
Terrarum.ingame!!.addNewActor(lander)
}
override fun printUsage() {
Echo("control it with arrow keys")
}
}

View File

@@ -1375,7 +1375,7 @@ open class ActorWithPhysics(val world: GameWorld, renderOrder: RenderOrder, val
* Constants * Constants
*/ */
@Transient private val METER = 24.0 @Transient val METER = 24.0
/** /**
* [m / s^2] * SI_TO_GAME_ACC -> [px / InternalFrame^2] * [m / s^2] * SI_TO_GAME_ACC -> [px / InternalFrame^2]
*/ */

View File

@@ -10,7 +10,7 @@ import net.torvald.terrarum.Terrarum
/** /**
* Created by minjaesong on 2017-12-18. * Created by minjaesong on 2017-12-18.
*/ */
class ParticleMegaRain(posX: Double, posY: Double) : ParticleBase(Actor.RenderOrder.BEHIND, false, 3.2f) { class ParticleMegaRain(posX: Double, posY: Double) : ParticleBase(Actor.RenderOrder.BEHIND, true, 3.2f) {
init { init {
body = MegaRainGovernor.get() body = MegaRainGovernor.get()
@@ -22,7 +22,7 @@ class ParticleMegaRain(posX: Double, posY: Double) : ParticleBase(Actor.RenderOr
w, h w, h
) )
velocity.y = 18.0 velocity.y = 11.5 * ActorWithPhysics.SI_TO_GAME_VEL
} }
} }
@@ -46,11 +46,12 @@ object MegaRainGovernor {
val h = body.height val h = body.height
bodies = Array(1024) { bodies = Array(1024) {
val pixmap = Pixmap(Terrarum.WIDTH * 2, Terrarum.HEIGHT / 4, Pixmap.Format.RGBA8888) //val pixmap = Pixmap(Terrarum.WIDTH * 2, Terrarum.HEIGHT / 4, Pixmap.Format.RGBA8888)
val pixmap = Pixmap(64, 64, Pixmap.Format.RGBA8888)
val rng = HQRNG() val rng = HQRNG()
repeat(64) { repeat(rng.nextInt(2) + 3) { // 3 or 4
val rndX = rng.nextInt(pixmap.width - body.width) val rndX = rng.nextInt(pixmap.width - body.width)
val rndY = rng.nextInt(pixmap.height - body.height) val rndY = rng.nextInt(pixmap.height - body.height)
@@ -71,7 +72,7 @@ object MegaRainGovernor {
fun get(): TextureRegion { fun get(): TextureRegion {
if (withdrawCounter >= bodies.size) { if (withdrawCounter >= bodies.size) {
withdrawCounter = 0 withdrawCounter = 0
bodies.shuffle() //bodies.shuffle() // if pre-rendered random set is sufficiently large, it'd look random enough
} }
return bodies[withdrawCounter++] return bodies[withdrawCounter++]

View File

@@ -0,0 +1,60 @@
package net.torvald.terrarum.gameactors
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.ModMgr
import net.torvald.terrarum.gameworld.GameWorld
/**
* Created by minjaesong on 2018-01-17.
*/
class PhysTestLuarLander(world: GameWorld) : ActorWithPhysics(world, RenderOrder.MIDTOP), Controllable {
private val texture = Texture(ModMgr.getGdxFile("basegame", "sprites/phystest_lunarlander.tga"))
override val hitbox: Hitbox
init {
hitbox = Hitbox(0.0, 0.0, 0.0, 0.0)
setHitboxDimension(texture.width, texture.height, 0, 0)
actorValue[AVKey.SPEED] = 8.0
avBaseMass = 18650.0
}
override fun run() {
super.run()
}
override fun update(delta: Float) {
super.update(delta)
if (Gdx.input.isKeyPressed(Input.Keys.UP)) {
controllerMoveDelta!!.y = avSpeedCap
}
}
override fun keyDown(keycode: Int): Boolean {
return true
}
override fun drawGlow(batch: SpriteBatch) {
}
override fun drawBody(batch: SpriteBatch) {
batch.color = Color.WHITE
batch.draw(texture, hitbox.startX.toFloat(), hitbox.endY.toFloat(), hitbox.width.toFloat(), -hitbox.height.toFloat())
}
override fun onActorValueChange(key: String, value: Any?) {
super.onActorValueChange(key, value)
}
override fun dispose() {
super.dispose()
texture.dispose()
}
}

View File

@@ -1,7 +1,51 @@
package net.torvald.terrarum.gameactors.ai package net.torvald.terrarum.gameactors.ai
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.HumanoidNPC
import net.torvald.terrarum.gameactors.Second
/** /**
* Slime's stupid AI but can adjust his jump power to smack you as fast as possible
* by achieving "allostasis".
*
* Created by minjaesong on 2017-12-10. * Created by minjaesong on 2017-12-10.
*/ */
class SmarterSlimes { class SmarterSlimes : ActorAI {
val memoryCells = IntArray(12, { 0 })
// index 0: most recent memory
// intentionally making it stupid by using less precise INT
// also we're not discrimination different enemies, making it further dumb
// stores "overshoot" amount (learn target) of x position
var maxJumpDist: Double = -1.0
var cooltime: Second = 5f
override fun update(actor: HumanoidNPC, delta: Float) {
// sensor: compare(my X pos, nearest enemy's X pos)
maxJumpDist = actor.avSpeedCap * actor.jumpAirTime // speed * air_time
// (to be precise, we need simulation just like jumpAirTime, but oh well; we like it LINEAR)
// TEST: just target player
val playerXPos = Terrarum.ingame!!.player.centrePosPoint.x
val thisXPos = actor.centrePosPoint.x
val xDiff = thisXPos - playerXPos
// extrapolate from memories:
// otherwise linear extp. except the slope is d of 0th and 2nd point
if (xDiff > 0) {
actor.moveLeft()
}
}
} }

View File

@@ -184,12 +184,12 @@ object Lang {
val index = lastChar.toInt() - HANGUL_SYL_START val index = lastChar.toInt() - HANGUL_SYL_START
return if (index % 28 == 0) word + "" else word + "" return if (index % 28 == 0) word + "" else word + ""
} }
else if (lastChar >= 'A' && lastChar <= 'Z' || lastChar >= 'a' && lastChar <= 'z') { else if (lastChar in 'A'..'Z' || lastChar in 'a'..'z') {
val index = (lastChar.toInt() - 0x41) % 0x20 val index = (lastChar.toInt() - 0x41) % 0x20
return if (HANGUL_POST_INDEX_ALPH[index] == 0) word + "" else word + "" return if (HANGUL_POST_INDEX_ALPH[index] == 0) word + "" else word + ""
} }
else { else {
return "(는)" return ""
} }
} }
@@ -200,12 +200,12 @@ object Lang {
val index = lastChar.toInt() - HANGUL_SYL_START val index = lastChar.toInt() - HANGUL_SYL_START
return if (index % 28 == 0) word + "" else word + "" return if (index % 28 == 0) word + "" else word + ""
} }
else if (lastChar >= 'A' && lastChar <= 'Z' || lastChar >= 'a' && lastChar <= 'z') { else if (lastChar in 'A'..'Z' || lastChar in 'a'..'z') {
val index = (lastChar.toInt() - 0x41) % 0x20 val index = (lastChar.toInt() - 0x41) % 0x20
return if (HANGUL_POST_INDEX_ALPH[index] == 0) word + "" else word + "" return if (HANGUL_POST_INDEX_ALPH[index] == 0) word + "" else word + ""
} }
else { else {
return "(가)" return ""
} }
} }

View File

@@ -28,6 +28,9 @@ class UICheatDetected : UICanvas() {
private val backgroundCol = Color(0x181818C0) private val backgroundCol = Color(0x181818C0)
override fun renderUI(batch: SpriteBatch, camera: Camera) { override fun renderUI(batch: SpriteBatch, camera: Camera) {
Terrarum.ingame?.consoleHandler?.setAsClose()
Terrarum.ingame?.consoleHandler?.isVisible = false
batch.color = backgroundCol batch.color = backgroundCol
batch.fillRect(0f, 0f, width.toFloat(), height.toFloat()) batch.fillRect(0f, 0f, width.toFloat(), height.toFloat())

View File

@@ -84,11 +84,10 @@ object WeatherMixer {
if (KeyToggler.isOn(Input.Keys.F2)) { if (KeyToggler.isOn(Input.Keys.F2)) {
val playerPosX = player.hitbox.centeredX val playerPosX = player.hitbox.centeredX
val playerPosY = player.hitbox.centeredY val playerPosY = player.hitbox.centeredY
kotlin.repeat(1) { kotlin.repeat(7) {
// 4 seems good
val rainParticle = ParticleMegaRain( val rainParticle = ParticleMegaRain(
playerPosX + HQRNG().nextInt(Terrarum.WIDTH) - Terrarum.HALFW, playerPosX + HQRNG().nextInt(Terrarum.WIDTH) - Terrarum.HALFW,
playerPosY - Terrarum.HALFH playerPosY - Terrarum.HEIGHT
) )
Terrarum.ingame!!.addParticle(rainParticle) Terrarum.ingame!!.addParticle(rainParticle)
} }
@@ -229,13 +228,13 @@ object WeatherMixer {
var mixFrom: String? var mixFrom: String?
try { mixFrom = JSON.get("mixFrom").asJsonPrimitive.asString } try { mixFrom = JSON.get("mixFrom").asJsonPrimitive.asString }
catch (e: NullPointerException) { mixFrom = null } catch (e: IllegalStateException) { mixFrom = null }
var mixPercentage: Double? var mixPercentage: Double?
try { mixPercentage = JSON.get("mixPercentage").asJsonPrimitive.asDouble } try { mixPercentage = JSON.get("mixPercentage").asJsonPrimitive.asDouble }
catch (e: NullPointerException) { mixPercentage = null } catch (e: IllegalStateException) { mixPercentage = null }

View File

@@ -10,3 +10,78 @@ Follow these fomulae:
- (ThisWgt / TargetWgt) ^ (3/4) - (ThisWgt / TargetWgt) ^ (3/4)
# Cultivation and Forestry
Lots of species to grow, comsume, process and trade
- _Stardew Valley_ is specialised for the cultivation
- Ground texture: use Actors
- Crops grow stages: 4
- Item sprite stages: 2 (fresh and rotten)
If any cheating is detected (corrupted or tampered save, _Resetti_ triggered, addinventory), all itemised crops will rot and cheat-inflicted ground plants will reset their age to zero
## Edible
### Primary Foodstuffs
- Wheat
- Maize
- Aubergine
- Tomato
- Leek (Allium ampeloprasum) / Bunching onion (A. fistulosum, in Chinese/Japanese/Korean language pack)
- Garlic
- Pumpkin
- Cabbage
- Hot Pepper (Capsicum annuum)
### Primary Rooting Foodstuffs
- Potato
- Parsnip
- Carrot
### Secondary Foodstuffs
- Ginger
- Green Bean
- Coffee
- Strawberry
- Hop
- Grape
### Exotic Foodstuffs
- Rice
- Napa Cabbage (Brassica rapa Pekinensis)
### Trade Plants
- Ginseng (Panax ginseng)
## Fruit Trees
- Apple
- Orange (Citrus × sinensis)
- Peach
- Cherry (Prunus avium)
- Pomegranate
- Lemon
- Pear (Pyrus communis)
## Inedible
- Sunflower
- Rose
- Hibiscus Flower
# "Stalk" Market
Some crops have highly varing market prices, which resembles stock market.
- 4 Random number sets, one set is chosen and consumed
- Market price = RNG-Table + Randomised "deviation"
- Random sets are value noise with different width of "waves"

Binary file not shown.

Binary file not shown.