some random ideas for future self

This commit is contained in:
minjaesong
2023-08-08 01:39:33 +09:00
parent 6672dffdbc
commit 87d92ecb74
2 changed files with 13 additions and 10 deletions

View File

@@ -1745,8 +1745,8 @@ open class ActorWithBody : Actor {
if (KeyToggler.isOn(Input.Keys.F9)) {
val blockMark = CommonResourcePool.getAsTextureRegionPack("blockmarkings_common").get(0, 0)
batch.color = HITBOX_COLOURS0
for (y in 0..intTilewiseHitbox.height.toInt()) {
for (y in 0..intTilewiseHitbox.height.toInt() + 1) {
batch.color = if (y == intTilewiseHitbox.height.toInt() + 1) Color.LIME else HITBOX_COLOURS0
for (x in 0..intTilewiseHitbox.width.toInt()) {
batch.draw(blockMark,
(intTilewiseHitbox.startX.toFloat() + x) * TILE_SIZEF,
@@ -1915,10 +1915,10 @@ open class ActorWithBody : Actor {
val tiles = ArrayList<ItemID?>()
// offset 1 pixel to the down so that friction would work
val y = hitbox.endY.plus(1.0).div(TILE_SIZE).floorToInt()
val y = intTilewiseHitbox.height.toInt() + 1
for (x in hIntTilewiseHitbox.startX.toInt()..hIntTilewiseHitbox.endX.toInt()) {
tiles.add(world!!.getTileFromTerrain(x, y))
for (x in 0..intTilewiseHitbox.width.toInt()) {
tiles.add(world!!.getTileFromTerrain(x + intTilewiseHitbox.startX.toInt(), y + intTilewiseHitbox.startY.toInt()))
}
return tiles.forEach(consumer)
@@ -1931,10 +1931,11 @@ open class ActorWithBody : Actor {
val tileProps = ArrayList<BlockProp?>()
// offset 1 pixel to the down so that friction would work
val y = hitbox.endY.plus(1.0).div(TILE_SIZE).floorToInt()
// val y = hitbox.endY.plus(1.0).div(TILE_SIZE).floorToInt()
val y = intTilewiseHitbox.height.toInt() + 1
for (x in hIntTilewiseHitbox.startX.toInt()..hIntTilewiseHitbox.endX.toInt()) {
tileProps.add(BlockCodex[world!!.getTileFromTerrain(x, y)])
for (x in 0..intTilewiseHitbox.width.toInt()) {
tileProps.add(BlockCodex[world!!.getTileFromTerrain(x + intTilewiseHitbox.startX.toInt(), y + intTilewiseHitbox.startY.toInt())])
}
return tileProps.forEach(consumer)

View File

@@ -294,11 +294,13 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
val feetTileIsAllPlatform = feetTiles.filterNotNull().all { it.isPlatform }
if (isDownDown && feetTileIsAllPlatform && (controllerV?.y ?: 0.0) >= 0.0) {// ||
// occupyingTileHasPlatform && !feetTileHasPlatform) { // FIXME commenting this out enables platform-ladder but falldown gets slowed down if the body passes thru the platform but I think this behav might be beneficial for player?
downDownVirtually = true
// downDownVirtually = true
}
if (downDownVirtually && !occupyingTileHasPlatform && !feetTileIsAllPlatform) {
downDownVirtually = false
// downDownVirtually = false
}
// TODO just disable "snap to ground" on collision solver if {player's body overlaps with the platform/downDownVirtually}?
// the point is: disable snap (or don't consider offending tiles as solid) for certain Y-pos only, tiles on Y+1 are still solid
}
private inline val hasController: Boolean