mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-18 14:34:04 +09:00
bunch of codes:
- Test InputStream() on VirtualComputer (blocking/unblocking using simple semaphore) -- no more dirty lua impl of io.read - Typealias Kotlin 1.1 - Primitive box drawing on VideoCard - Removing unnecessary fonts Former-commit-id: cece88af3a3430678e685856eec78b4a9d598b4f Former-commit-id: 22eed3a7beb9b4cb34636cbab2ff0e94989bdb31
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.ActorValue
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.KVHashMap
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-19.
|
||||
*/
|
||||
class ActorValue : KVHashMap()
|
||||
@@ -354,9 +354,9 @@ open class ActorWithSprite(renderOrder: ActorOrder, val immobileBody: Boolean =
|
||||
isNoSubjectToFluidResistance = isPlayerNoClip
|
||||
}
|
||||
|
||||
/**
|
||||
* Actual physics thing (altering velocity) starts from here
|
||||
*/
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Codes that modifies velocity (moveDelta and externalForce) //
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
// Combine velo and walk
|
||||
applyMovementVelocity()
|
||||
@@ -376,6 +376,10 @@ open class ActorWithSprite(renderOrder: ActorOrder, val immobileBody: Boolean =
|
||||
// Set 'next' position (hitbox) from canonical and walking velocity
|
||||
setNewNextHitbox()
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// Codes that (SHOULD) displaces nextHitbox directly //
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* solveCollision()?
|
||||
* If and only if:
|
||||
@@ -386,6 +390,10 @@ open class ActorWithSprite(renderOrder: ActorOrder, val immobileBody: Boolean =
|
||||
applyNormalForce()
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// Codes that modifies velocity (after hitbox displacement) //
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
if (!immobileBody) { // TODO test no friction on immobileBody
|
||||
setHorizontalFriction()
|
||||
}
|
||||
@@ -395,6 +403,10 @@ open class ActorWithSprite(renderOrder: ActorOrder, val immobileBody: Boolean =
|
||||
setVerticalFriction()
|
||||
}
|
||||
|
||||
|
||||
// some spacing //
|
||||
|
||||
|
||||
// apply our compensation to actual hitbox
|
||||
updateHitbox()
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.torvald.JsonFetcher
|
||||
import net.torvald.random.Fudge3
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import com.google.gson.JsonObject
|
||||
import net.torvald.terrarum.ActorValue
|
||||
import net.torvald.terrarum.gameactors.ActorHumanoid
|
||||
import org.newdawn.slick.SlickException
|
||||
import java.io.IOException
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.torvald.JsonFetcher
|
||||
import net.torvald.terrarum.gameactors.faction.Faction
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import com.google.gson.JsonObject
|
||||
import net.torvald.terrarum.ActorValue
|
||||
import net.torvald.terrarum.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.gameactors.faction.FactionFactory
|
||||
import net.torvald.terrarum.gameitem.EquipPosition
|
||||
|
||||
@@ -47,10 +47,10 @@ class LuaAIWrapper(private val scriptPath: String) : ActorAI {
|
||||
|
||||
override fun update(delta: Int) {
|
||||
// run "update()" function in the script
|
||||
luag.get("update").call(delta.toLuaValue())
|
||||
luag.get("update").call(delta.toLua())
|
||||
}
|
||||
|
||||
var currentExecutionThread = Thread()
|
||||
lateinit var currentExecutionThread: Thread
|
||||
var threadRun = false
|
||||
|
||||
fun runCommand(reader: Reader, filename: String) {
|
||||
@@ -109,5 +109,5 @@ class LuaAIWrapper(private val scriptPath: String) : ActorAI {
|
||||
}
|
||||
}
|
||||
|
||||
fun Int.toLuaValue(): LuaValue = LuaInteger.valueOf(this)
|
||||
fun Int.toLua(): LuaValue = LuaInteger.valueOf(this)
|
||||
}
|
||||
Reference in New Issue
Block a user