mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-17 05:54:05 +09:00
UI testing env and working text buttons
Former-commit-id: b8fd27c7f71f9bc8da259ae132badcbc9ce117ac
This commit is contained in:
@@ -8,17 +8,17 @@ import net.torvald.terrarum.gameactors.faction.FactionCodex
|
||||
*/
|
||||
object RealEstateUtility {
|
||||
fun getAbsoluteTileNumber(x: Int, y: Int): Long =
|
||||
(Terrarum.ingame.world.width * y).toLong() + x
|
||||
(Terrarum.ingame!!.world.width * y).toLong() + x
|
||||
|
||||
fun resolveAbsoluteTileNumber(t: Long): Pair<Int, Int> =
|
||||
Pair((t % Terrarum.ingame.world.width).toInt(), (t / Terrarum.ingame.world.width).toInt())
|
||||
Pair((t % Terrarum.ingame!!.world.width).toInt(), (t / Terrarum.ingame!!.world.width).toInt())
|
||||
|
||||
/**
|
||||
* Get owner ID as an Actor/Faction
|
||||
*/
|
||||
fun resolveOwner(id: Long): Any =
|
||||
if (id < 0x80000000L)
|
||||
Terrarum.ingame.getActorByID(id.toInt())
|
||||
Terrarum.ingame!!.getActorByID(id.toInt())
|
||||
else
|
||||
FactionCodex.getFactionByID(id)
|
||||
}
|
||||
Reference in New Issue
Block a user