mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 21:14:04 +09:00
fixes, bits and pieces, changes in ID referencing, terrain and wall takes damage, working test pickaxe, and a new issue
This commit is contained in:
@@ -2,21 +2,22 @@ package net.torvald.terrarum.realestate
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.faction.FactionCodex
|
||||
import net.torvald.terrarum.gameworld.TileAddress
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-27.
|
||||
*/
|
||||
object RealEstateUtility {
|
||||
fun getAbsoluteTileNumber(x: Int, y: Int): Long =
|
||||
fun getAbsoluteTileNumber(x: Int, y: Int): TileAddress =
|
||||
(Terrarum.ingame!!.world.width * y).toLong() + x
|
||||
|
||||
fun resolveAbsoluteTileNumber(t: Long): Pair<Int, Int> =
|
||||
fun resolveAbsoluteTileNumber(t: TileAddress): Pair<Int, Int> =
|
||||
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 =
|
||||
fun resolveOwner(id: TileAddress): Any =
|
||||
if (id < 0x80000000L)
|
||||
Terrarum.ingame!!.getActorByID(id.toInt())
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user