dump (another useless message)

This commit is contained in:
minjaesong
2018-08-05 21:57:18 +09:00
parent 24b2e2a2af
commit eee8a18875
130 changed files with 1350 additions and 563 deletions

View File

@@ -0,0 +1,115 @@
package net.torvald.terrarum.gameactors
/**
* See [res/raw/Creature_raw_doc.md] for information about raw.
*
* Created by minjaesong on 2016-04-02.
*/
object AVKey {
const val BUFF = "buff"
/** pixels per frame
* walking/running speed
*/
const val SPEED = "speed"
const val SPEEDBUFF = "$SPEED$BUFF"
/** pixels per frame squared
* acceleration of the movement (e.g. running, flying, driving, etc.)
*/
const val ACCEL = "accel"
const val ACCELBUFF = "$ACCEL$BUFF"
/** internal value used by ActorHumanoid to implement friction in walkfunction */
const val SCALE = "scale"
const val SCALEBUFF = "$SCALE$BUFF" // aka PHYSIQUE
/** pixels */
const val BASEHEIGHT = "baseheight"
/** kilogrammes */
const val BASEMASS = "basemass"
/** pixels per frame */
const val JUMPPOWER = "jumppower"
const val JUMPPOWERBUFF = "$JUMPPOWER$BUFF"
/** Int
* "Default" value of 1 000
*/
const val STRENGTH = "strength"
const val STRENGTHBUFF = "$STRENGTH$BUFF"
const val ENCUMBRANCE = "encumbrance"
/** 30-bit RGB (Int)
* 0000 0010000000 0010000000 0010000000
* ^ Red ^ Green ^ Blue
*/
const val LUMR = "luminosityred"
const val LUMG = "luminositygreen"
const val LUMB = "luminosityblue"
const val LUMA = "luminosityuv"
const val DRAGCOEFF = "dragcoeff"
const val FALLDAMPENMULT = "falldampenmult"
/** String
* e.g. Jarppi
*/
const val NAME = "name"
/** String
* e.g. Duudsoni
*/
const val RACENAME = "racename"
/** String
* e.g. Duudsonit
*/
const val RACENAMEPLURAL = "racenameplural"
/** killogrammes
* will affect attack strength, speed and inventory label
* (see "Attack momentum calculator.numbers")
* e.g. Hatchet (tiny)
*/
const val TOOLSIZE = "toolsize"
/** Boolean
* whether the player can talk with it
*/
const val INTELLIGENT = "intelligent"
/** (unit TBA)
* base defence point of the species
*/
const val BASEDEFENCE = "basedefence"
/** (unit TBA)
* current defence point of worn armour(s)
*/
const val ARMOURDEFENCE = "armourdefence"
const val ARMOURDEFENCEBUFF = "$ARMOURDEFENCE$BUFF"
const val MAGICREGENRATE = "magicregenrate"
const val MAGICREGENRATEBUFF = "$MAGICREGENRATE$BUFF"
/** Double
*
*/
const val ACTION_INTERVAL = "actioninterval"
/** String
* UUID for certain fixtures
*/
const val UUID = "uuid"
const val __PLAYER_QUICKSLOTSEL = "__quickslotselection"
/** Double
* When using tool/arm/etc. how long action button is held, in milliseconds (Int)
* Or for NPCs, how long it has been waiting for next move
*/
const val __ACTION_TIMER = "__actiontimer"
const val HEALTH = "health"
const val MAGIC = "magic"
const val __HISTORICAL_BORNTIME = "__borntime" // time_t
const val __HISTORICAL_DEADTIME = "__deadtime" // time_t
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,6 @@
package net.torvald.terrarum.gameactors
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.gameactors.Actor
import net.torvald.terrarum.gameactors.Hitbox
/**
* Actor with visible body

View File

@@ -1,6 +1,6 @@
package net.torvald.terrarum.gameactors
import net.torvald.point.Point2d
import net.torvald.terrarum.Point2d
import org.dyn4j.geometry.Vector2
/**

View File

@@ -1,20 +1,11 @@
package net.torvald.terrarum.gameactors.ai
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.gameactors.AIControlled
import net.torvald.terrarum.modulebasegame.gameactors.AVKey
import net.torvald.terrarum.modulebasegame.gameactors.ActorWithPhysics
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import org.luaj.vm2.*
import org.luaj.vm2.lib.OneArgFunction
import org.luaj.vm2.lib.ZeroArgFunction
/**
* Created by minjaesong on 2016-10-24.
*/
/*internal class AILuaAPI(g: Globals, actor: ActorWithPhysics) {
/*internal class AILuaAPI(g: Globals, actor: ActorWBMovable) {
// FIXME when actor jumps, the actor releases left/right stick
@@ -51,9 +42,9 @@ import org.luaj.vm2.lib.ZeroArgFunction
companion object {
/**
* Reads arbitrary ActorWithPhysics and returns its information as Lua table
* Reads arbitrary ActorWBMovable and returns its information as Lua table
*/
fun composeActorObject(actor: ActorWithPhysics): LuaTable {
fun composeActorObject(actor: ActorWBMovable): LuaTable {
val t: LuaTable = LuaTable()
val moveDelta = actor.externalForce + actor.controllerMoveDelta
@@ -80,7 +71,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
operator fun LuaTable.set(index: Int, value: Int) { this[index] = value.toLua() }
}
class GetSelfActorInfo(val actor: ActorWithPhysics) : ZeroArgFunction() {
class GetSelfActorInfo(val actor: ActorWBMovable) : ZeroArgFunction() {
override fun call(): LuaValue {
return composeActorObject(actor)
}
@@ -116,13 +107,13 @@ import org.luaj.vm2.lib.ZeroArgFunction
}
}
class GetX(val actor: ActorWithPhysics) : ZeroArgFunction() {
class GetX(val actor: ActorWBMovable) : ZeroArgFunction() {
override fun call(): LuaValue {
return LuaValue.valueOf(actor.hitbox.centeredX)
}
}
class GetY(val actor: ActorWithPhysics) : ZeroArgFunction() {
class GetY(val actor: ActorWBMovable) : ZeroArgFunction() {
override fun call(): LuaValue {
return LuaValue.valueOf(actor.hitbox.centeredY)
}
@@ -205,7 +196,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
}
}
class GetNearbyTiles(val actor: ActorWithPhysics) : OneArgFunction() {
class GetNearbyTiles(val actor: ActorWBMovable) : OneArgFunction() {
/** @param radius
*
* 3 will return 7x7 array, 0 will return 1x1, 1 will return 3x3
@@ -232,7 +223,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
luatable[y - feetTilePos[1]] = LuaTable()
for (x in feetTilePos[0] - radius..feetTilePos[0] + radius) {
val tile = BlockCodex[(Terrarum.ingame!! as Ingame).world.getTileFromTerrain(x, y) ?: Block.NULL]
val tile = BlockCodex[(Terrarum.ingame!!.world).getTileFromTerrain(x, y) ?: Block.NULL]
val solidity = tile.isSolid.toInt()
val liquidity = tile.isFluid.toInt()
val gravity = tile.isFallable.toInt()
@@ -247,7 +238,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
}
}
class GetFloorsHeight(val actor: ActorWithPhysics) : OneArgFunction() {
class GetFloorsHeight(val actor: ActorWBMovable) : OneArgFunction() {
/** @param radius
*
* 3 will return len:7 array, 0 will return len:1, 1 will return len:3
@@ -276,7 +267,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
// search down
var searchDownCounter = 0
while (true) {
val tile = (Terrarum.ingame!! as Ingame).world.getTileFromTerrain(x, feetTilePos[1] + searchDownCounter) ?: Block.STONE
val tile = (Terrarum.ingame!!.world).getTileFromTerrain(x, feetTilePos[1] + searchDownCounter) ?: Block.STONE
if (BlockCodex[tile].isSolid || searchDownCounter >= searchDownLimit) {
luatable[x - feetTilePos[0]] = searchDownCounter
break
@@ -290,7 +281,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
}
}
class GetCeilingsHeight(val actor: ActorWithPhysics) : OneArgFunction() {
class GetCeilingsHeight(val actor: ActorWBMovable) : OneArgFunction() {
/** @param arg radius
*
* 3 will return 7x7 array, 0 will return 1x1, 1 will return 3x3
@@ -319,7 +310,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
// search up
var searchUpCounter = 0
while (true) {
val tile = (Terrarum.ingame!! as Ingame).world.getTileFromTerrain(x, feetTilePos[1] - searchUpCounter) ?: Block.STONE
val tile = (Terrarum.ingame!!.world).getTileFromTerrain(x, feetTilePos[1] - searchUpCounter) ?: Block.STONE
if (BlockCodex[tile].isSolid || searchUpCounter >= searchUpLimit) {
luatable[x - feetTilePos[0]] = searchUpCounter
break
@@ -333,7 +324,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
}
}
class GetLedgesHeight(val actor: ActorWithPhysics) : OneArgFunction() {
class GetLedgesHeight(val actor: ActorWBMovable) : OneArgFunction() {
/** @param arg radius
* ==
* <- (non-solid found)
@@ -361,7 +352,7 @@ import org.luaj.vm2.lib.ZeroArgFunction
// search up
var searchUpCounter = 0
while (true) {
val tile = (Terrarum.ingame!! as Ingame).world.getTileFromTerrain(x, feetTilePos[1] - searchUpCounter) ?: Block.STONE
val tile = (Terrarum.ingame!!.world).getTileFromTerrain(x, feetTilePos[1] - searchUpCounter) ?: Block.STONE
if (!BlockCodex[tile].isSolid || searchUpCounter >= searchUpLimit) {
luatable[x - feetTilePos[0]] = searchUpCounter
break