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:
minjaesong
2024-02-11 20:51:54 +09:00
parent 8e97914834
commit 77bc646991
30 changed files with 51 additions and 50 deletions

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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 {