root.monsterMovementSettings
This commit is contained in:
parent
30c63e5845
commit
2e22dd9922
src/main/kotlin/ru/dbotthepony/kstarbound
@ -749,6 +749,13 @@ class Starbound : ISBFileLocator {
|
|||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.setTableFunction("monsterMovementSettings", this) { args ->
|
||||||
|
val name = args.getString()
|
||||||
|
val monster = monsterTypes[name] ?: throw NoSuchElementException("No such monster type $name")
|
||||||
|
args.push(gson.toJsonTree(monster.value.baseParameters.movementSettings))
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
state.pop()
|
state.pop()
|
||||||
|
|
||||||
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package ru.dbotthepony.kstarbound.defs.player
|
package ru.dbotthepony.kstarbound.defs
|
||||||
|
|
||||||
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
||||||
|
|
||||||
@ -7,4 +7,4 @@ data class JumpProfile(
|
|||||||
val jumpSpeed: Double,
|
val jumpSpeed: Double,
|
||||||
val jumpInitialPercentage: Double,
|
val jumpInitialPercentage: Double,
|
||||||
val jumpHoldTime: Double,
|
val jumpHoldTime: Double,
|
||||||
)
|
)
|
@ -0,0 +1,22 @@
|
|||||||
|
package ru.dbotthepony.kstarbound.defs
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList
|
||||||
|
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
||||||
|
import ru.dbotthepony.kvector.vector.ndouble.Vector2d
|
||||||
|
|
||||||
|
@JsonFactory
|
||||||
|
data class MovementParameters(
|
||||||
|
val flySpeed: Double? = null,
|
||||||
|
val airFriction: Double? = null,
|
||||||
|
val airJumpProfile: JumpProfile? = null,
|
||||||
|
val airForce: Double? = null,
|
||||||
|
|
||||||
|
val runSpeed: Double? = null,
|
||||||
|
val walkSpeed: Double? = null,
|
||||||
|
val mass: Double? = null,
|
||||||
|
|
||||||
|
// TODO: А оно вообще используется? Как по мне движок старбаунда генерирует коллизию из пикселей текстуры
|
||||||
|
val collisionPoly: ImmutableList<Vector2d>? = null,
|
||||||
|
val crouchingPoly: ImmutableList<Vector2d>? = null,
|
||||||
|
val standingPoly: ImmutableList<Vector2d>? = null,
|
||||||
|
)
|
@ -4,7 +4,10 @@ import com.google.common.collect.ImmutableList
|
|||||||
import com.google.common.collect.ImmutableMap
|
import com.google.common.collect.ImmutableMap
|
||||||
import com.google.common.collect.ImmutableSet
|
import com.google.common.collect.ImmutableSet
|
||||||
import ru.dbotthepony.kstarbound.defs.AssetReference
|
import ru.dbotthepony.kstarbound.defs.AssetReference
|
||||||
|
import ru.dbotthepony.kstarbound.defs.DirectAssetReference
|
||||||
|
import ru.dbotthepony.kstarbound.defs.IScriptable
|
||||||
import ru.dbotthepony.kstarbound.defs.IThingWithDescription
|
import ru.dbotthepony.kstarbound.defs.IThingWithDescription
|
||||||
|
import ru.dbotthepony.kstarbound.defs.MovementParameters
|
||||||
import ru.dbotthepony.kstarbound.defs.RegistryReference
|
import ru.dbotthepony.kstarbound.defs.RegistryReference
|
||||||
import ru.dbotthepony.kstarbound.defs.animation.AnimationDefinition
|
import ru.dbotthepony.kstarbound.defs.animation.AnimationDefinition
|
||||||
import ru.dbotthepony.kstarbound.defs.item.TreasurePoolDefinition
|
import ru.dbotthepony.kstarbound.defs.item.TreasurePoolDefinition
|
||||||
@ -20,5 +23,12 @@ data class MonsterTypeDefinition(
|
|||||||
val animation: AssetReference<AnimationDefinition>,
|
val animation: AssetReference<AnimationDefinition>,
|
||||||
// [ { "default" : "poptopTreasure", "bow" : "poptopHunting" } ],
|
// [ { "default" : "poptopTreasure", "bow" : "poptopHunting" } ],
|
||||||
val dropPools: ImmutableList<ImmutableMap<String, RegistryReference<TreasurePoolDefinition>>>,
|
val dropPools: ImmutableList<ImmutableMap<String, RegistryReference<TreasurePoolDefinition>>>,
|
||||||
// val baseParameters
|
val baseParameters: BaseParameters
|
||||||
) : IThingWithDescription
|
) : IThingWithDescription {
|
||||||
|
@JsonFactory
|
||||||
|
data class BaseParameters(
|
||||||
|
val movementSettings: MovementParameters? = null,
|
||||||
|
override val scriptDelta: Int = 1,
|
||||||
|
override val scripts: ImmutableList<DirectAssetReference>
|
||||||
|
) : IScriptable
|
||||||
|
}
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
package ru.dbotthepony.kstarbound.defs.player
|
|
||||||
|
|
||||||
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
|
||||||
|
|
||||||
@JsonFactory
|
|
||||||
data class MovementParameters(
|
|
||||||
val flySpeed: Double? = null,
|
|
||||||
val airFriction: Double? = null,
|
|
||||||
val airJumpProfile: JumpProfile? = null,
|
|
||||||
val airForce: Double? = null,
|
|
||||||
)
|
|
@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableMap
|
|||||||
import com.google.common.collect.ImmutableSet
|
import com.google.common.collect.ImmutableSet
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import ru.dbotthepony.kstarbound.defs.AssetReference
|
import ru.dbotthepony.kstarbound.defs.AssetReference
|
||||||
|
import ru.dbotthepony.kstarbound.defs.MovementParameters
|
||||||
import ru.dbotthepony.kstarbound.defs.RegistryReference
|
import ru.dbotthepony.kstarbound.defs.RegistryReference
|
||||||
import ru.dbotthepony.kstarbound.defs.Species
|
import ru.dbotthepony.kstarbound.defs.Species
|
||||||
import ru.dbotthepony.kstarbound.util.SBPattern
|
import ru.dbotthepony.kstarbound.util.SBPattern
|
||||||
|
Loading…
Reference in New Issue
Block a user