Fixed a bug where random items found in coffins didn't correctly trigger events.
This commit is contained in:
@@ -57,13 +57,14 @@ class CoffinObject(Object):
|
||||
dropDistance = random.randint(1, 2)
|
||||
dropX = self.xPos + (direction * dropDistance)
|
||||
|
||||
self.droppedItem = PowerUp(
|
||||
dropX, self.yPos, itemType, self.sounds, direction, self.level.leftBoundary, self.level.rightBoundary
|
||||
)
|
||||
|
||||
# Apply sound override after creation (similar to how graves handle it)
|
||||
# Use themed item name if override exists (for proper themed item handling)
|
||||
actualItemType = itemType
|
||||
if hasattr(self, 'itemSoundOverride'):
|
||||
self.droppedItem.soundName = self.itemSoundOverride
|
||||
actualItemType = self.itemSoundOverride
|
||||
|
||||
self.droppedItem = PowerUp(
|
||||
dropX, self.yPos, actualItemType, self.sounds, direction, self.level.leftBoundary, self.level.rightBoundary
|
||||
)
|
||||
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -562,9 +562,9 @@ class Level:
|
||||
play_sound(self.sounds[f"get_{itemSound}"])
|
||||
play_sound(self.sounds.get("fill_in_grave", "shovel_dig")) # Also play fill sound
|
||||
self.player.stats.update_stat("Items collected", 1)
|
||||
# Create PowerUp to handle the item effect
|
||||
# Create PowerUp to handle the item effect (use themed name if override exists)
|
||||
item = PowerUp(
|
||||
obj.xPos, obj.yPos, obj.graveItem, self.sounds, 1, self.leftBoundary, self.rightBoundary
|
||||
obj.xPos, obj.yPos, itemSound, self.sounds, 1, self.leftBoundary, self.rightBoundary
|
||||
)
|
||||
item.apply_effect(self.player, self)
|
||||
# Stop grave's current audio channel
|
||||
|
||||
Reference in New Issue
Block a user