Type specific setChanged override in MatterySlot

This commit is contained in:
DBotThePony 2025-02-24 16:29:11 +07:00
parent 13c9e93d31
commit 96d902bc98
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -51,6 +51,14 @@ inline fun <S : Slot> makeSlots(containers: List<Container>?, size: Int, initial
open class MatterySlot(container: Container, index: Int, x: Int = 0, y: Int = 0) : Slot(container, index, x, y) {
var ignoreSpectators = true
override fun setChanged() {
if (container is IMatteryContainer) {
(container as IMatteryContainer).setChanged(index)
} else {
super.setChanged()
}
}
override fun mayPickup(player: Player): Boolean {
return super.mayPickup(player) && (!ignoreSpectators || !player.isSpectator)
}