mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-17 14:04:05 +09:00
physics objects (ActorWithBody) will now sleep if ||v|| < 0.5, faction ID is now positive integer (64-bit) only
Former-commit-id: 437cff82cf5748c36c5ad72bc43b4fc172b168c8 Former-commit-id: 3ab0500f83da229ec77b85c09ec42fd332ef62ce
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.gameactors.faction
|
||||
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import java.util.HashSet
|
||||
|
||||
/**
|
||||
@@ -13,7 +14,7 @@ class Faction(factionName: String) {
|
||||
lateinit var factionNeutral: HashSet<String>
|
||||
lateinit var factionHostile: HashSet<String>
|
||||
lateinit var factionFearful: HashSet<String>
|
||||
var factionID: Long = HQRNG().nextLong()
|
||||
var factionID: Long = generateUniqueID()
|
||||
|
||||
init {
|
||||
this.factionName = factionName
|
||||
@@ -59,4 +60,8 @@ class Faction(factionName: String) {
|
||||
factionFearful.remove(faction)
|
||||
}
|
||||
|
||||
fun generateUniqueID(): Long {
|
||||
fun Long.abs() = if (this < 0) -this else this
|
||||
return HQRNG().nextLong().abs() // set new ID
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user