Session ground mananger finshed

Take_eggs for collector started.
This commit is contained in:
Tooze 2026-05-20 00:09:38 -04:00
parent 5cae5cf0a3
commit 8e28316763
5 changed files with 20 additions and 17 deletions

View file

@ -3,7 +3,6 @@ package content.minigame.barbassault.arena
import content.minigame.barbassault.BarbRole
import content.minigame.barbassault.arena.BaHornSystem.HornHelper.getHealerHorn
import content.minigame.barbassault.arena.BarbassaultSession.AttackerStyle
import content.minigame.barbassault.arena.scenery.All_Eggs
import content.minigame.barbassault.arena.scenery.EggCannon
import content.minigame.barbassault.arena.scenery.EggCannon.Companion.loadEggHopper
import content.minigame.barbassault.arena.scenery.EggCannon.Companion.loadHopperEggs
@ -30,7 +29,6 @@ import core.game.world.GameWorld.Pulser
import core.game.world.map.Direction
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import core.game.worldevents.holiday.easter.EasterEvent.Companion.BUN_EARS
import org.rs09.consts.Items
import org.rs09.consts.Scenery
@ -198,17 +196,21 @@ class BarbassaultArenaListener : InteractionListener {
//delete from ground as runner "eats"
return@on true
}
on(All_Eggs, IntType.GROUNDITEM, "Take") { player, node ->
on(EggCannon.ALL_EGGS, IntType.GROUNDITEM, "Take") { player, node ->
if (node !is GroundItem) return@on true
node.isActive = false
GroundItemManager.destroy(node)
val session = player.baSession ?: return@on true
session.BAgroundItems.remove(node)
addItemOrDrop(player, node.id) // no room, lets just redrop it, what COULD GO WRONG
if (session.team.getRoleForPlayer(player) != BarbRole.COLLECTOR) {
sendMessage(player,"not a collector")
}
if (!player.inventory.add(node)) {
node.isActive = false
(node as SessionGroundSpawn).isAutoSpawn = false
session.BAgroundItems.remove(node)
GroundItemManager.destroy(node)
return@on true
}
//todo find correct message
sendMessage(player,"You can not pick up any more EGGGS!")
return@on true
}
}

View file

@ -201,7 +201,8 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
val alreadyExists = groundItems.any { it.id == spawnItem.id && it.location == spawnLoc && !it.isRemoved }
if (!alreadyExists) {
val thisGroundItem = produceGroundSpawnItem(6,Item(spawnItem.id, 1),spawnLoc) //produceGroundItem(leader, spawnItem.id, 1, spawnLoc).apply {
sendMessage(leader, "spawned item: $spawnLoc")
//sendMessage(leader, "spawned item: $spawnLoc")
BAgroundItems.add(thisGroundItem)
}
}
}
@ -354,7 +355,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
return npc
}
fun produceGroundSpawnItem(rate:Int,item: Item,location: Location): SessionGroundSpawn {
val thisGroundItem = SessionGroundSpawn(this,rate,item,location)
val thisGroundItem = SessionGroundSpawn(this,rate,item,base.transform(location))
thisGroundItem.init()
return thisGroundItem
}

View file

@ -1,6 +1,7 @@
package content.minigame.barbassault.arena.Npcs
import content.minigame.barbassault.arena.SessionGroundSpawn
import content.minigame.barbassault.baSession
import core.api.produceGroundItem
import core.api.sendMessage
@ -21,7 +22,7 @@ fun dropPenanceEggCluster(killer: Player, npc: NPC? = null) {
for (i in eggs.indices) {
val tile = tiles[i]
val thisGroundItem = session.produceGroundSpawnItem(60,Item(eggs[i],1),tile)
val thisGroundItem = SessionGroundSpawn(session,60,Item(eggs[i],1),tile)
thisGroundItem.init()
sendMessage(killer, tile.toString())

View file

@ -7,7 +7,7 @@ import core.game.world.GameWorld
import core.game.world.map.Location
class SessionGroundSpawn(private var session: BarbassaultSession, private var respawnRate: Int, item: Item?,location: Location?) : GroundItem(item, session.base.transform(location)) {
class SessionGroundSpawn(private var session: BarbassaultSession, private var respawnRate: Int, item: Item?,location: Location?) : GroundItem(item, location) {
private var active = true
private var autoSpawn = true
@ -46,7 +46,7 @@ class SessionGroundSpawn(private var session: BarbassaultSession, private var re
}
GameWorld.Pulser.submit(object : Pulse(respawnRate) {
override fun pulse(): Boolean {
val thisGroundItem = GroundItemManager.create(this@SessionGroundSpawn)
GroundItemManager.create(this@SessionGroundSpawn)
return true
}
})

View file

@ -30,7 +30,6 @@ import org.rs09.consts.NPCs
// half -> EGG_HOPPER_20265
// full -> EGG_HOPPER_20266
//varbit 3268
val All_Eggs = intArrayOf(Items.GREEN_EGG_10531,Items.RED_EGG_10532,Items.BLUE_EGG_10533)
@Initializable
class EggCannon : ComponentPlugin() {