Fixed incubator appearing to lose contents

This commit is contained in:
Player Name 2025-02-01 14:13:26 +00:00 committed by Ryan
parent 4a016d45e5
commit 2cf8392691
2 changed files with 10 additions and 6 deletions

View file

@ -1,11 +1,8 @@
package content.global.skill.summoning.pet
import core.api.*
import core.cache.def.impl.SceneryDefinition
import core.game.node.Node
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.GroundItemManager
import core.game.interaction.*
import core.tools.StringUtils

View file

@ -42,6 +42,13 @@ class IncubatorTimer : PersistTimer (500, "incubation") {
root["eggs"] = arr
}
override fun onRegister(entity: Entity) {
if (entity !is Player) return
for ((region, _) in incubatingEggs) {
setVarbit(entity.asPlayer(), varbitForRegion(region), 1, true)
}
}
override fun run (entity: Entity) : Boolean {
if (entity !is Player) return false
for ((_, egg) in incubatingEggs) {
@ -60,14 +67,14 @@ class IncubatorTimer : PersistTimer (500, "incubation") {
}
companion object {
val TAVERLY_REGION = 11573
val TAVERLY_VARBIT = 4277
val TAVERLEY_REGION = 11573
val TAVERLEY_VARBIT = 4277
val YANILLE_REGION = 10288
val YANILLE_VARBIT = 4221
fun varbitForRegion (region: Int) : Int {
return when (region) {
TAVERLY_REGION -> TAVERLY_VARBIT
TAVERLEY_REGION -> TAVERLEY_VARBIT
YANILLE_REGION -> YANILLE_VARBIT
else -> -1
}