mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 20:14:05 +09:00
code refactor to clarify the state of item being dynamic
fix: simple item cell not showing itemcount for stackable and canbedynamic items
This commit is contained in:
@@ -192,7 +192,7 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
override var baseMass: Double = 0.0
|
||||
override var baseToolSize: Double? = null
|
||||
override var inventoryCategory = "should_not_be_seen"
|
||||
override val isDynamic = false
|
||||
override val canBeDynamic = false
|
||||
override val materialId = ""
|
||||
|
||||
init {
|
||||
|
||||
@@ -83,7 +83,7 @@ class ActorInventory() : FixtureInventory() {
|
||||
|
||||
if (amount < 0) throw IllegalArgumentException("Consuming negative amount of an item (expected >=0, got $amount)")
|
||||
|
||||
if (item.stackable && !item.isDynamic) {
|
||||
if (item.stackable && !item.canBeDynamic) {
|
||||
remove(item, amount)
|
||||
}
|
||||
else if (item.isUnique) {
|
||||
@@ -93,7 +93,7 @@ class ActorInventory() : FixtureInventory() {
|
||||
val newItem: GameItem
|
||||
|
||||
// unpack newly-made dynamic item (e.g. any weapon, floppy disk)
|
||||
if (item.isDynamic && item.originalID == item.dynamicID) {
|
||||
if (item.canBeDynamic && !item.isCurrentlyDynamic) {
|
||||
itemEquipped[item.equipPosition] = null
|
||||
remove(item, 1)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ open class HumanoidNPC : ActorHumanoid, AIControlled, CanBeAnItem {
|
||||
actorValue[AVKey.SCALE] = value
|
||||
}
|
||||
override var inventoryCategory = "npc"
|
||||
override val isDynamic = false
|
||||
override val canBeDynamic = false
|
||||
override val materialId = ""
|
||||
|
||||
override fun startPrimaryUse(actor: ActorWithBody, delta: Float): Long {
|
||||
|
||||
Reference in New Issue
Block a user