mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-11 22:31:52 +09:00
fix: new encumbrance limit was not applied AT ALL
This commit is contained in:
@@ -163,7 +163,7 @@ internal object SavegameMigrator {
|
||||
}
|
||||
|
||||
|
||||
@AppliedVersion("0.3.99999")
|
||||
@AppliedVersion("0.4.0")
|
||||
fun updatePlayerEncumbrance(actor: Actor) {
|
||||
if (actor is IngamePlayer && actor.actorValue.getAsInt("encumbrance") == 1000) {
|
||||
actor.actorValue.set("encumbrance", 50000)
|
||||
|
||||
@@ -25,6 +25,18 @@ class ActorInventory() : FixtureInventory() {
|
||||
this.capacityMode = capacityMode
|
||||
}
|
||||
|
||||
override var maxCapacity: Long = 0
|
||||
get() = when (capacityMode) {
|
||||
CAPACITY_MODE_COUNT -> field
|
||||
CAPACITY_MODE_WEIGHT -> actor.actorValue.getAsInt(AVKey.ENCUMBRANCE)?.toLong() ?: field
|
||||
CAPACITY_MODE_NO_ENCUMBER -> 0x7FFFFFFFFFFFFFFFL
|
||||
else -> throw IllegalArgumentException()
|
||||
}
|
||||
set(value) {
|
||||
if (capacityMode == CAPACITY_MODE_COUNT)
|
||||
field = value
|
||||
}
|
||||
|
||||
/**
|
||||
* List of all equipped items (tools, armours, rings, necklaces, etc.)
|
||||
*
|
||||
|
||||
@@ -18,8 +18,8 @@ import java.math.BigInteger
|
||||
|
||||
open class FixtureInventory() {
|
||||
|
||||
var maxCapacity = 100L
|
||||
var capacityMode = CAPACITY_MODE_COUNT
|
||||
open var maxCapacity = 100L
|
||||
open var capacityMode = CAPACITY_MODE_COUNT
|
||||
|
||||
constructor(maxCapacity: Long, capacityMode: Int) : this() {
|
||||
this.maxCapacity = maxCapacity
|
||||
|
||||
Reference in New Issue
Block a user