mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +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
|
@Transient val MASS_LOWEST = 0.1 // Kilograms
|
||||||
/** Apparent mass. Use "avBaseMass" for base mass */
|
/** Apparent mass. Use "avBaseMass" for base mass */
|
||||||
val mass: Double
|
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"
|
/*set(value) { // use "var avBaseMass: Double"
|
||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
throw IllegalArgumentException("mass cannot be less than or equal to zero.")
|
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 (y in tyStart..tyEnd) {
|
||||||
for (x in txStart..txEnd) {
|
for (x in txStart..txEnd) {
|
||||||
val tile = world!!.getTileFromTerrain(x, y) ?: Block.STONE
|
val tile = world!!.getTileFromTerrain(x, y)
|
||||||
|
|
||||||
if (feet) {
|
if (feet) {
|
||||||
if (shouldICollideWithThisFeet(tile))
|
if (shouldICollideWithThisFeet(tile))
|
||||||
@@ -1198,7 +1198,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
|
|||||||
var hasFloor = false
|
var hasFloor = false
|
||||||
|
|
||||||
for (x in pxStart..pxEnd) {
|
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 (feet) {
|
||||||
if (shouldICollideWithThisFeet(tile)) {
|
if (shouldICollideWithThisFeet(tile)) {
|
||||||
@@ -1499,8 +1499,8 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
|
|||||||
var density = 0
|
var density = 0
|
||||||
forEachOccupyingFluid {
|
forEachOccupyingFluid {
|
||||||
// get max density for each tile
|
// get max density for each tile
|
||||||
if (it?.isFluid() ?: false && it?.getProp()?.density ?: 0 > density) {
|
if (it?.isFluid() == true && it.getProp().density > density) {
|
||||||
density = it?.getProp()?.density ?: 0
|
density = it.getProp().density
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,11 +119,11 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
+ ccG
|
+ ccG
|
||||||
+ "${WorldCamera.y}")
|
+ "${WorldCamera.y}")
|
||||||
|
|
||||||
printLine(batch, 3, "veloX reported $ccG${player.externalV.x}")
|
printLine(batch, 3, "veloX external $ccG${player.externalV.x}")
|
||||||
printLine(batch, 4, "veloY reported $ccG${player.externalV.y}")
|
printLine(batch, 4, "veloY external $ccG${player.externalV.y}")
|
||||||
|
|
||||||
printLine(batch, 5, "p_WalkX $ccG${player.controllerV?.x}")
|
printLine(batch, 5, "veloX control $ccG${player.controllerV?.x}")
|
||||||
printLine(batch, 6, "p_WalkY $ccG${player.controllerV?.y}")
|
printLine(batch, 6, "veloY control $ccG${player.controllerV?.y}")
|
||||||
|
|
||||||
printLineColumn(batch, 2, 3, "veloX measured $ccG${xdelta / updateCount}")
|
printLineColumn(batch, 2, 3, "veloX measured $ccG${xdelta / updateCount}")
|
||||||
printLineColumn(batch, 2, 4, "veloY measured $ccG${ydelta / updateCount}")
|
printLineColumn(batch, 2, 4, "veloY measured $ccG${ydelta / updateCount}")
|
||||||
|
|||||||
Reference in New Issue
Block a user