mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
adopting Java 9/Kotlin 1.2
This commit is contained in:
3
.idea/codeStyleSettings.xml
generated
3
.idea/codeStyleSettings.xml
generated
@@ -6,9 +6,6 @@
|
||||
<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>
|
||||
|
||||
41
.idea/codeStyles/Project.xml
generated
Normal file
41
.idea/codeStyles/Project.xml
generated
Normal 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
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
16
.idea/compiler.xml
generated
16
.idea/compiler.xml
generated
@@ -1,22 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<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>
|
||||
<profile default="true" name="Default" enabled="true">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
</component>
|
||||
|
||||
8
.idea/kotlinc.xml
generated
8
.idea/kotlinc.xml
generated
@@ -1,14 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Kotlin2JsCompilerArguments">
|
||||
<option name="moduleKind" value="plain" />
|
||||
</component>
|
||||
<component name="Kotlin2JvmCompilerArguments">
|
||||
<option name="jvmTarget" value="1.8" />
|
||||
</component>
|
||||
<component name="KotlinCommonCompilerArguments">
|
||||
<option name="languageVersion" value="1.1" />
|
||||
<option name="apiVersion" value="1.1" />
|
||||
<option name="coroutinesWarn" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/libraries/KotlinJavaRuntime.xml
generated
12
.idea/libraries/KotlinJavaRuntime.xml
generated
@@ -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>
|
||||
@@ -1,6 +1,6 @@
|
||||
*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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
14
assets/18BitColour.frag
Normal file
14
assets/18BitColour.frag
Normal 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);
|
||||
}
|
||||
BIN
assets/modules/basegame/sprites/phystest_lunarlander.tga
LFS
Normal file
BIN
assets/modules/basegame/sprites/phystest_lunarlander.tga
LFS
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,7 @@
|
||||
package net.torvald.random
|
||||
|
||||
import net.torvald.terrarum.serialise.toLittleLong
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
import java.util.Random
|
||||
|
||||
/**
|
||||
@@ -14,8 +16,10 @@ class HQRNG @JvmOverloads constructor(seed: Long = System.nanoTime()) : Random()
|
||||
if (seed == 0L)
|
||||
throw IllegalArgumentException("Invalid seed: cannot be zero")
|
||||
|
||||
s0 = (6364136223846793005L * seed + 1442695040888963407L)
|
||||
s1 = (6364136223846793005L * s0 + 1442695040888963407L)
|
||||
val hash = DigestUtils.sha256(seed.toString())
|
||||
|
||||
s0 = hash.copyOfRange(0, 8).toLittleLong()
|
||||
s1 = hash.copyOfRange(8, 16).toLittleLong()
|
||||
}
|
||||
|
||||
override fun nextLong(): Long {
|
||||
|
||||
@@ -1449,6 +1449,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
||||
|
||||
BlocksDrawer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
|
||||
LightmapRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
|
||||
MegaRainGovernor.resize()
|
||||
|
||||
worldDrawFrameBuffer.dispose()
|
||||
worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||
|
||||
@@ -6,6 +6,9 @@ import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
|
||||
/**
|
||||
* Must be called by the App Loader
|
||||
*/
|
||||
object PostProcessor {
|
||||
|
||||
private val batch = SpriteBatch()
|
||||
@@ -21,7 +24,7 @@ object PostProcessor {
|
||||
//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 {
|
||||
val texture = screenTexHolder.colorBufferTexture
|
||||
batch.shader.setUniformMatrix("u_projTrans", batch.projectionMatrix)
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Screen
|
||||
import com.badlogic.gdx.assets.AssetManager
|
||||
import com.badlogic.gdx.graphics.*
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
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.google.gson.JsonArray
|
||||
import com.google.gson.JsonPrimitive
|
||||
import net.torvald.terrarum.gameactors.ActorWithPhysics
|
||||
import net.torvald.terrarum.gameactors.floorInt
|
||||
import net.torvald.terrarum.imagefont.TinyAlphNum
|
||||
import net.torvald.terrarum.imagefont.Watch7SegMain
|
||||
@@ -98,7 +100,9 @@ object Terrarum : Screen {
|
||||
/**
|
||||
* 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
|
||||
@@ -212,6 +216,7 @@ object Terrarum : Screen {
|
||||
lateinit var shaderBlendGlow: ShaderProgram
|
||||
lateinit var shaderRGBOnly: ShaderProgram
|
||||
lateinit var shaderAtoGrey: ShaderProgram
|
||||
lateinit var shader18Bit: ShaderProgram
|
||||
|
||||
|
||||
lateinit var textureWhiteSquare: Texture
|
||||
@@ -225,6 +230,9 @@ object Terrarum : Screen {
|
||||
val deltaTime: Float; get() = Gdx.graphics.rawDeltaTime
|
||||
|
||||
|
||||
lateinit var assetManager: AssetManager
|
||||
|
||||
|
||||
init {
|
||||
println("$NAME version ${TerrarumAppLoader.getVERSION_STRING()}")
|
||||
|
||||
@@ -322,6 +330,8 @@ object Terrarum : Screen {
|
||||
}
|
||||
|
||||
|
||||
assetManager = AssetManager()
|
||||
|
||||
|
||||
println("[Terrarum] GL_VERSION = $GL_VERSION")
|
||||
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"))
|
||||
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) {
|
||||
Gdx.app.log("shaderBlendGlow", shaderBlendGlow.log)
|
||||
|
||||
@@ -124,6 +124,8 @@ object BlockCodex {
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
}
|
||||
catch (e1: IllegalStateException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
@@ -135,6 +137,8 @@ object BlockCodex {
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
}
|
||||
catch (e1: IllegalStateException) {
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ object CommandDict {
|
||||
"spawntapestry" to SpawnTapestry,
|
||||
"imtest" to JavaIMTest,
|
||||
"cheatmotherfuckernootnoot" to CheatWarnTest,
|
||||
"spawnlunarlander" to SpawnPhysTestLunarLander,
|
||||
|
||||
|
||||
/* !! */"exportlayer" to ExportLayerData,
|
||||
|
||||
@@ -21,10 +21,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
|
||||
val yvel = if (args.size >= 4) args[3].toDouble() else 0.0
|
||||
|
||||
val ball = PhysTestBall(Terrarum.ingame!!.world)
|
||||
ball.setPosition(
|
||||
(mouseX + WorldCamera.x).toDouble(),
|
||||
(mouseY + WorldCamera.y).toDouble()
|
||||
)
|
||||
ball.setPosition(mouseX, mouseY)
|
||||
ball.elasticity = elasticity
|
||||
ball.applyForce(Vector2(xvel, yvel))
|
||||
|
||||
@@ -34,10 +31,7 @@ internal object SpawnPhysTestBall : ConsoleCommand {
|
||||
val elasticity = args[1].toDouble()
|
||||
|
||||
val ball = PhysTestBall(Terrarum.ingame!!.world)
|
||||
ball.setPosition(
|
||||
(mouseX + WorldCamera.x).toDouble(),
|
||||
(mouseY + WorldCamera.y).toDouble()
|
||||
)
|
||||
ball.setPosition(mouseX, mouseY)
|
||||
ball.elasticity = elasticity
|
||||
|
||||
Terrarum.ingame!!.addNewActor(ball)
|
||||
|
||||
24
src/net/torvald/terrarum/console/SpawnPhysTestLunarLander.kt
Normal file
24
src/net/torvald/terrarum/console/SpawnPhysTestLunarLander.kt
Normal 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")
|
||||
}
|
||||
}
|
||||
@@ -1375,7 +1375,7 @@ open class ActorWithPhysics(val world: GameWorld, renderOrder: RenderOrder, val
|
||||
* Constants
|
||||
*/
|
||||
|
||||
@Transient private val METER = 24.0
|
||||
@Transient val METER = 24.0
|
||||
/**
|
||||
* [m / s^2] * SI_TO_GAME_ACC -> [px / InternalFrame^2]
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.torvald.terrarum.Terrarum
|
||||
/**
|
||||
* 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 {
|
||||
body = MegaRainGovernor.get()
|
||||
@@ -22,7 +22,7 @@ class ParticleMegaRain(posX: Double, posY: Double) : ParticleBase(Actor.RenderOr
|
||||
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
|
||||
|
||||
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()
|
||||
|
||||
repeat(64) {
|
||||
repeat(rng.nextInt(2) + 3) { // 3 or 4
|
||||
val rndX = rng.nextInt(pixmap.width - body.width)
|
||||
val rndY = rng.nextInt(pixmap.height - body.height)
|
||||
|
||||
@@ -71,7 +72,7 @@ object MegaRainGovernor {
|
||||
fun get(): TextureRegion {
|
||||
if (withdrawCounter >= bodies.size) {
|
||||
withdrawCounter = 0
|
||||
bodies.shuffle()
|
||||
//bodies.shuffle() // if pre-rendered random set is sufficiently large, it'd look random enough
|
||||
}
|
||||
|
||||
return bodies[withdrawCounter++]
|
||||
|
||||
60
src/net/torvald/terrarum/gameactors/PhysTestLuarLander.kt
Normal file
60
src/net/torvald/terrarum/gameactors/PhysTestLuarLander.kt
Normal 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()
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,51 @@
|
||||
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.
|
||||
*/
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -184,12 +184,12 @@ object Lang {
|
||||
val index = lastChar.toInt() - HANGUL_SYL_START
|
||||
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
|
||||
return if (HANGUL_POST_INDEX_ALPH[index] == 0) word + "는" else word + "은"
|
||||
}
|
||||
else {
|
||||
return "은(는)"
|
||||
return "은"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,12 +200,12 @@ object Lang {
|
||||
val index = lastChar.toInt() - HANGUL_SYL_START
|
||||
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
|
||||
return if (HANGUL_POST_INDEX_ALPH[index] == 0) word + "가" else word + "이"
|
||||
}
|
||||
else {
|
||||
return "이(가)"
|
||||
return "이"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ class UICheatDetected : UICanvas() {
|
||||
private val backgroundCol = Color(0x181818C0)
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
Terrarum.ingame?.consoleHandler?.setAsClose()
|
||||
Terrarum.ingame?.consoleHandler?.isVisible = false
|
||||
|
||||
batch.color = backgroundCol
|
||||
batch.fillRect(0f, 0f, width.toFloat(), height.toFloat())
|
||||
|
||||
|
||||
@@ -84,11 +84,10 @@ object WeatherMixer {
|
||||
if (KeyToggler.isOn(Input.Keys.F2)) {
|
||||
val playerPosX = player.hitbox.centeredX
|
||||
val playerPosY = player.hitbox.centeredY
|
||||
kotlin.repeat(1) {
|
||||
// 4 seems good
|
||||
kotlin.repeat(7) {
|
||||
val rainParticle = ParticleMegaRain(
|
||||
playerPosX + HQRNG().nextInt(Terrarum.WIDTH) - Terrarum.HALFW,
|
||||
playerPosY - Terrarum.HALFH
|
||||
playerPosY - Terrarum.HEIGHT
|
||||
)
|
||||
Terrarum.ingame!!.addParticle(rainParticle)
|
||||
}
|
||||
@@ -229,13 +228,13 @@ object WeatherMixer {
|
||||
|
||||
var mixFrom: String?
|
||||
try { mixFrom = JSON.get("mixFrom").asJsonPrimitive.asString }
|
||||
catch (e: NullPointerException) { mixFrom = null }
|
||||
catch (e: IllegalStateException) { mixFrom = null }
|
||||
|
||||
|
||||
|
||||
var mixPercentage: Double?
|
||||
try { mixPercentage = JSON.get("mixPercentage").asJsonPrimitive.asDouble }
|
||||
catch (e: NullPointerException) { mixPercentage = null }
|
||||
catch (e: IllegalStateException) { mixPercentage = null }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,3 +10,78 @@ Follow these fomulae:
|
||||
- (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"
|
||||
BIN
work_files/graphics/sprites/fixtures/crops_-_part_of_1x3_fixtures_collection.psd
LFS
Normal file
BIN
work_files/graphics/sprites/fixtures/crops_-_part_of_1x3_fixtures_collection.psd
LFS
Normal file
Binary file not shown.
BIN
work_files/graphics/sprites/fixtures/furnitures_2x2.psd
LFS
Normal file
BIN
work_files/graphics/sprites/fixtures/furnitures_2x2.psd
LFS
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user