mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 13:51:53 +09:00
using gamemode to control 'being encumbered'
This commit is contained in:
@@ -149,4 +149,13 @@ object AVKey {
|
|||||||
* example value: `"SIxM+kGlrjZgLx5Zeqz7,;:UIZ5Q=2WT35SgKpOp.,vvf'fNW3G<ROimy(Y;E<,-mdtr5|^RGOqr0x*T*lC,YABr1oQwErKG)pGC'gUG"`
|
* example value: `"SIxM+kGlrjZgLx5Zeqz7,;:UIZ5Q=2WT35SgKpOp.,vvf'fNW3G<ROimy(Y;E<,-mdtr5|^RGOqr0x*T*lC,YABr1oQwErKG)pGC'gUG"`
|
||||||
*/
|
*/
|
||||||
const val WORLD_PORTAL_DICT = "worldportaldict"
|
const val WORLD_PORTAL_DICT = "worldportaldict"
|
||||||
|
|
||||||
|
/** String
|
||||||
|
* Reserved values:
|
||||||
|
* - `survival`: future use for the basegame
|
||||||
|
* - empty value: creative mode for basegame
|
||||||
|
*
|
||||||
|
* This value is only used for IngamePlayers
|
||||||
|
*/
|
||||||
|
const val GAMEMODE = "gamemode"
|
||||||
}
|
}
|
||||||
@@ -269,15 +269,20 @@ open class ActorWithBody : Actor {
|
|||||||
accelMultMovement *
|
accelMultMovement *
|
||||||
scale.sqrt()
|
scale.sqrt()
|
||||||
}
|
}
|
||||||
|
val ingamePlayersCanBeEncumbered: Boolean
|
||||||
|
get() = if (this is IngamePlayer)
|
||||||
|
!actorValue.getAsString(AVKey.GAMEMODE).isNullOrBlank()
|
||||||
|
else true
|
||||||
|
|
||||||
val encumberment: Double
|
val encumberment: Double
|
||||||
get() = if (this is Pocketed) this.inventory.encumberment else 0.0
|
get() = if (this is Pocketed && ingamePlayersCanBeEncumbered) this.inventory.encumberment else 0.0
|
||||||
|
|
||||||
val avSpeedCap: Double
|
val avSpeedCap: Double
|
||||||
get() = actorValue.getAsDouble(AVKey.SPEED)!! * // base stat
|
get() = actorValue.getAsDouble(AVKey.SPEED)!! * // base stat
|
||||||
(actorValue.getAsDouble(AVKey.SPEEDBUFF) ?: 1.0) * // buffed stat
|
(actorValue.getAsDouble(AVKey.SPEEDBUFF) ?: 1.0) * // buffed stat
|
||||||
speedMultByTile * // tile-specific
|
speedMultByTile * // tile-specific
|
||||||
scale.sqrt() // taller actors have longer legs but also receives relatively weaker gravity -> pow(0.5)
|
scale.sqrt() * // taller actors have longer legs but also receives relatively weaker gravity -> pow(0.5)
|
||||||
// ((encumberment / avStrengthNormalised).pow(-2.0/3.0)).coerceIn(0.1, 1.0) // encumbered actors move slower
|
((encumberment / avStrengthNormalised).pow(-2.0/3.0)).coerceIn(0.1, 1.0) // encumbered actors move slower
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flags and Properties
|
* Flags and Properties
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
|||||||
(actorValue.getAsDouble(AVKey.JUMPPOWERBUFF) ?: 1.0) * // buffed stat
|
(actorValue.getAsDouble(AVKey.JUMPPOWERBUFF) ?: 1.0) * // buffed stat
|
||||||
jumpMultByTile * // tile-specific
|
jumpMultByTile * // tile-specific
|
||||||
scale.pow(0.25) *
|
scale.pow(0.25) *
|
||||||
// ((encumberment / avStrengthNormalised).pow(-1.0/3.0)).coerceIn(0.48, 1.0) // encumbered actors move slower
|
((encumberment / avStrengthNormalised).pow(-1.0/3.0)).coerceIn(0.48, 1.0) // encumbered actors move slower
|
||||||
|
|
||||||
private fun jumpFunc(len: Int, counter: Int): Double {
|
private fun jumpFunc(len: Int, counter: Int): Double {
|
||||||
// linear time mode
|
// linear time mode
|
||||||
|
|||||||
Reference in New Issue
Block a user