mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-19 23:14:05 +09:00
phys arguments are now single PhysProperties object
This commit is contained in:
@@ -31,7 +31,7 @@ import java.util.*
|
||||
*
|
||||
* Created by minjaesong on 2016-01-13.
|
||||
*/
|
||||
open class ActorWithBody(renderOrder: RenderOrder, val immobileBody: Boolean = false, var usePhysics: Boolean = true) :
|
||||
open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties) :
|
||||
Actor(renderOrder) {
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val immobileBody: Boolean = f
|
||||
isNoSubjectToFluidResistance = isNoClip
|
||||
}
|
||||
|
||||
if (!usePhysics) {
|
||||
if (!physProp.usePhysics) {
|
||||
isNoCollideWorld = true
|
||||
isNoSubjectToFluidResistance = true
|
||||
isNoSubjectToGrav = true
|
||||
@@ -1154,7 +1154,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val immobileBody: Boolean = f
|
||||
}
|
||||
|
||||
private fun getTileFriction(tile: Int) =
|
||||
if (immobileBody && tile == Block.AIR)
|
||||
if (physProp.immobileBody && tile == Block.AIR)
|
||||
BlockCodex[Block.AIR].friction.frictionToMult().div(500)
|
||||
.times(if (!grounded) elasticity else 1.0)
|
||||
else
|
||||
|
||||
33
src/net/torvald/terrarum/gameactors/PhysProperties.kt
Normal file
33
src/net/torvald/terrarum/gameactors/PhysProperties.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
data class PhysProperties(
|
||||
val immobileBody: Boolean,
|
||||
var usePhysics: Boolean,
|
||||
val useStairs: Boolean
|
||||
) {
|
||||
companion object {
|
||||
val HUMANOID_DEFAULT = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = true,
|
||||
useStairs = true
|
||||
)
|
||||
/** e.g. dropped items, balls */
|
||||
val PHYSICS_OBJECT = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = true,
|
||||
useStairs = false
|
||||
)
|
||||
/** e.g. voice maker */
|
||||
val IMMOBILE = PhysProperties(
|
||||
immobileBody = true,
|
||||
usePhysics = false,
|
||||
useStairs = false
|
||||
)
|
||||
/** e.g. camera */
|
||||
val MOBILE_OBJECT = PhysProperties(
|
||||
immobileBody = false,
|
||||
usePhysics = false,
|
||||
useStairs = false
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user