mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
precedence of the elvis operator is still confusing :(
This commit is contained in:
@@ -157,7 +157,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
|
||||
@Transient val MASS_LOWEST = 0.1 // Kilograms
|
||||
/** Apparent mass. Use "avBaseMass" for base mass */
|
||||
val mass: Double
|
||||
get() = actorValue.getAsDouble(AVKey.BASEMASS) ?: MASS_DEFAULT * Math.pow(scale, 3.0)
|
||||
get() = (actorValue.getAsDouble(AVKey.BASEMASS) ?: MASS_DEFAULT) * Math.pow(scale, 3.0)
|
||||
/*set(value) { // use "var avBaseMass: Double"
|
||||
if (value <= 0)
|
||||
throw IllegalArgumentException("mass cannot be less than or equal to zero.")
|
||||
@@ -1157,7 +1157,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
|
||||
|
||||
for (y in tyStart..tyEnd) {
|
||||
for (x in txStart..txEnd) {
|
||||
val tile = world!!.getTileFromTerrain(x, y) ?: Block.STONE
|
||||
val tile = world!!.getTileFromTerrain(x, y)
|
||||
|
||||
if (feet) {
|
||||
if (shouldICollideWithThisFeet(tile))
|
||||
@@ -1198,7 +1198,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
|
||||
var hasFloor = false
|
||||
|
||||
for (x in pxStart..pxEnd) {
|
||||
val tile = world!!.getTileFromTerrain(x / TILE_SIZE, y / TILE_SIZE) ?: Block.STONE
|
||||
val tile = world!!.getTileFromTerrain(x / TILE_SIZE, y / TILE_SIZE)
|
||||
|
||||
if (feet) {
|
||||
if (shouldICollideWithThisFeet(tile)) {
|
||||
@@ -1499,8 +1499,8 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
|
||||
var density = 0
|
||||
forEachOccupyingFluid {
|
||||
// get max density for each tile
|
||||
if (it?.isFluid() ?: false && it?.getProp()?.density ?: 0 > density) {
|
||||
density = it?.getProp()?.density ?: 0
|
||||
if (it?.isFluid() == true && it.getProp().density > density) {
|
||||
density = it.getProp().density
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,11 +119,11 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
+ ccG
|
||||
+ "${WorldCamera.y}")
|
||||
|
||||
printLine(batch, 3, "veloX reported $ccG${player.externalV.x}")
|
||||
printLine(batch, 4, "veloY reported $ccG${player.externalV.y}")
|
||||
printLine(batch, 3, "veloX external $ccG${player.externalV.x}")
|
||||
printLine(batch, 4, "veloY external $ccG${player.externalV.y}")
|
||||
|
||||
printLine(batch, 5, "p_WalkX $ccG${player.controllerV?.x}")
|
||||
printLine(batch, 6, "p_WalkY $ccG${player.controllerV?.y}")
|
||||
printLine(batch, 5, "veloX control $ccG${player.controllerV?.x}")
|
||||
printLine(batch, 6, "veloY control $ccG${player.controllerV?.y}")
|
||||
|
||||
printLineColumn(batch, 2, 3, "veloX measured $ccG${xdelta / updateCount}")
|
||||
printLineColumn(batch, 2, 4, "veloY measured $ccG${ydelta / updateCount}")
|
||||
|
||||
Reference in New Issue
Block a user