actor entity
This commit is contained in:
parent
bfc39a6cb6
commit
125af3141d
@ -6,7 +6,7 @@ import ru.dbotthepony.kstarbound.json.builder.JsonFlat
|
||||
import ru.dbotthepony.kstarbound.world.physics.Poly
|
||||
|
||||
@JsonFactory
|
||||
data class PlayerMovementParameters(
|
||||
data class ActorMovementParameters(
|
||||
@JsonFlat
|
||||
val base: BaseMovementParameters.Impl = BaseMovementParameters.Impl(),
|
||||
|
||||
@ -39,8 +39,8 @@ data class PlayerMovementParameters(
|
||||
|
||||
val pathExploreRate: Double? = null,
|
||||
) : BaseMovementParameters by base {
|
||||
fun merge(other: PlayerMovementParameters): PlayerMovementParameters {
|
||||
return PlayerMovementParameters(
|
||||
fun merge(other: ActorMovementParameters): ActorMovementParameters {
|
||||
return ActorMovementParameters(
|
||||
base = base.merge(other.base),
|
||||
standingPoly = standingPoly ?: other.standingPoly,
|
||||
crouchingPoly = crouchingPoly ?: other.crouchingPoly,
|
@ -7,7 +7,7 @@ import ru.dbotthepony.kstarbound.Registry
|
||||
import ru.dbotthepony.kstarbound.defs.AssetReference
|
||||
import ru.dbotthepony.kstarbound.defs.IScriptable
|
||||
import ru.dbotthepony.kstarbound.defs.IThingWithDescription
|
||||
import ru.dbotthepony.kstarbound.defs.PlayerMovementParameters
|
||||
import ru.dbotthepony.kstarbound.defs.ActorMovementParameters
|
||||
import ru.dbotthepony.kstarbound.defs.animation.AnimationDefinition
|
||||
import ru.dbotthepony.kstarbound.defs.item.TreasurePoolDefinition
|
||||
import ru.dbotthepony.kstarbound.json.builder.JsonFactory
|
||||
@ -29,7 +29,7 @@ data class MonsterTypeDefinition(
|
||||
) : IThingWithDescription by desc {
|
||||
@JsonFactory
|
||||
data class BaseParameters(
|
||||
val movementSettings: PlayerMovementParameters? = null,
|
||||
val movementSettings: ActorMovementParameters? = null,
|
||||
@JsonFlat
|
||||
val script: IScriptable,
|
||||
) : IScriptable by script
|
||||
|
@ -6,7 +6,7 @@ import com.google.common.collect.ImmutableSet
|
||||
import com.google.gson.JsonObject
|
||||
import ru.dbotthepony.kstarbound.Registry
|
||||
import ru.dbotthepony.kstarbound.defs.AssetReference
|
||||
import ru.dbotthepony.kstarbound.defs.PlayerMovementParameters
|
||||
import ru.dbotthepony.kstarbound.defs.ActorMovementParameters
|
||||
import ru.dbotthepony.kstarbound.defs.Species
|
||||
import ru.dbotthepony.kstarbound.util.SBPattern
|
||||
import ru.dbotthepony.kstarbound.defs.animation.AnimationDefinition
|
||||
@ -32,8 +32,8 @@ data class PlayerDefinition(
|
||||
|
||||
val defaultCodexes: ImmutableMap<String, ImmutableList<Registry.Ref<IItemDefinition>>>,
|
||||
val metaBoundBox: AABB,
|
||||
val movementParameters: PlayerMovementParameters,
|
||||
val zeroGMovementParameters: PlayerMovementParameters,
|
||||
val movementParameters: ActorMovementParameters,
|
||||
val zeroGMovementParameters: ActorMovementParameters,
|
||||
|
||||
val statusControllerSettings: StatusControllerSettings,
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
package ru.dbotthepony.kstarbound.world.entities
|
||||
|
||||
import ru.dbotthepony.kstarbound.world.World
|
||||
|
||||
abstract class ActorEntity(world: World<*, *>) : Entity(world) {
|
||||
var isWalking = false
|
||||
var isRunning = false
|
||||
var isCrouching = false
|
||||
var isFlying = false
|
||||
var isFalling = false
|
||||
var canJump = false
|
||||
var isJumping = false
|
||||
var isGroundMovement = false
|
||||
var isLiquidMovement = false
|
||||
|
||||
override fun move() {
|
||||
super.move()
|
||||
}
|
||||
}
|
@ -2,32 +2,17 @@ package ru.dbotthepony.kstarbound.world.entities
|
||||
|
||||
import ru.dbotthepony.kstarbound.GlobalDefaults
|
||||
import ru.dbotthepony.kstarbound.Starbound
|
||||
import ru.dbotthepony.kstarbound.defs.BaseMovementParameters
|
||||
import ru.dbotthepony.kstarbound.defs.PlayerMovementParameters
|
||||
import ru.dbotthepony.kstarbound.defs.ActorMovementParameters
|
||||
import ru.dbotthepony.kstarbound.world.World
|
||||
import ru.dbotthepony.kstarbound.world.physics.Poly
|
||||
|
||||
class PlayerEntity(world: World<*, *>) : Entity(world) {
|
||||
override val movementParameters: PlayerMovementParameters = GlobalDefaults.playerMovementParameters
|
||||
|
||||
var isWalking = false
|
||||
var isRunning = false
|
||||
var isCrouching = false
|
||||
var isFlying = false
|
||||
var isFalling = false
|
||||
var canJump = false
|
||||
var isJumping = false
|
||||
var isGroundMovement = false
|
||||
var isLiquidMovement = false
|
||||
override val movementParameters: ActorMovementParameters = GlobalDefaults.actorMovementParameters
|
||||
|
||||
init {
|
||||
GlobalDefaults.playerMovementParameters.standingPoly?.let {
|
||||
GlobalDefaults.actorMovementParameters.standingPoly?.let {
|
||||
//hitboxes.add(it)
|
||||
hitboxes.add(Starbound.gson.fromJson("""[ [-0.75, -2.0], [-0.35, -2.5], [0.35, -2.5], [0.75, -2.0], [0.75, 0.65], [0.35, 1.22], [-0.35, 1.22], [-0.75, 0.65] ]""", Poly::class.java))
|
||||
}
|
||||
}
|
||||
|
||||
override fun move() {
|
||||
super.move()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user