mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-18 14:34:04 +09:00
visible actors are defaulted to Visible, SpriteAnimations now has "parent" actors and uses its Visible property
Former-commit-id: 0e240de4ca38a59724f364df4624c8dc79c0112d Former-commit-id: b017b24ab7591ea2fd2518308bd5656597c14f47
This commit is contained in:
@@ -18,22 +18,15 @@ import java.io.Reader
|
||||
/**
|
||||
* Created by minjaesong on 16-01-31.
|
||||
*/
|
||||
open class HumanoidNPC(aiFile: String, born: GameDate) : ActorHumanoid(born), AIControlled, CanBeAnItem {
|
||||
open class HumanoidNPC(luaScript: String, born: GameDate) : ActorHumanoid(born), AIControlled, CanBeAnItem {
|
||||
|
||||
override val scriptPath: String = aiFile
|
||||
override val scriptPath: String = ""
|
||||
|
||||
companion object {
|
||||
protected val luag = Globals()
|
||||
|
||||
init {
|
||||
luag.load(JseBaseLib())
|
||||
luag.load(TableLib())
|
||||
luag.load(StringLib())
|
||||
luag.load(TableLib())
|
||||
luag.load(CoroutineLib())
|
||||
luag.load(Bit32Lib())
|
||||
luag.load(PackageLib())
|
||||
luag.load(JseMathLib())
|
||||
LoadState.install(luag)
|
||||
LuaC.install(luag)
|
||||
}
|
||||
@@ -77,8 +70,9 @@ open class HumanoidNPC(aiFile: String, born: GameDate) : ActorHumanoid(born), AI
|
||||
|
||||
|
||||
init {
|
||||
val inputStream = javaClass.getResourceAsStream(scriptPath)
|
||||
runCommand(InputStreamReader(inputStream), scriptPath)
|
||||
//val inputStream = javaClass.getResourceAsStream(scriptPath)
|
||||
//runCommand(InputStreamReader(inputStream), scriptPath)
|
||||
runCommand(luaScript)
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +124,14 @@ open class HumanoidNPC(aiFile: String, born: GameDate) : ActorHumanoid(born), AI
|
||||
}
|
||||
}
|
||||
|
||||
fun runCommand(script: String) {
|
||||
if (!threadRun && !flagDespawn) {
|
||||
currentExecutionThread = Thread(ThreadRunCommand(luag, script, "="))
|
||||
currentExecutionThread.start()
|
||||
threadRun = true
|
||||
}
|
||||
}
|
||||
|
||||
class ThreadRunCommand : Runnable {
|
||||
|
||||
val mode: Int
|
||||
|
||||
Reference in New Issue
Block a user