Fixed Castle Wars compilation errors for chunk.objects API and getLocalNPCs rename

This commit is contained in:
dam 2026-06-03 00:06:33 +03:00
parent 9716d6caf5
commit 31becd5e4a
No known key found for this signature in database
GPG key ID: 4AF4E722399663FB
3 changed files with 5 additions and 13 deletions

View file

@ -277,12 +277,11 @@ object CastleWarsGameState {
fun registerClimbingRope(rope: Scenery, originalWall: Scenery) {
val key = Location.create(rope.location)
val chunk = RegionManager.getRegionChunk(rope.location)
rope.isActive = true
rope.isRenderable = true
activeClimbingRopes[key] = ActiveClimbingRope(rope, Scenery(originalWall))
chunk.objects[rope.location.chunkOffsetX][rope.location.chunkOffsetY] = rope
SceneryBuilder.add(rope)
}
fun getClimbingRope(location: Location): Scenery? {
@ -291,15 +290,9 @@ object CastleWarsGameState {
fun removeClimbingRope(location: Location, sendUpdate: Boolean = true): Boolean {
val activeRope = activeClimbingRopes.remove(Location.create(location)) ?: return false
val chunk = RegionManager.getRegionChunk(activeRope.rope.location)
activeRope.rope.isActive = false
chunk.objects[activeRope.rope.location.chunkOffsetX][activeRope.rope.location.chunkOffsetY] =
activeRope.originalWall
if (sendUpdate) {
chunk.flag(ObjectUpdateFlag(activeRope.rope, true))
}
SceneryBuilder.replace(activeRope.rope, activeRope.originalWall)
return true
}

View file

@ -8,7 +8,7 @@ import core.game.node.entity.impl.PulseManager
import core.game.node.entity.player.Player
import core.game.system.timer.impl.Poison
import core.game.world.map.Location
import core.game.world.map.RegionManager.getLocalNpcs
import core.game.world.map.RegionManager.getLocalNPCs
import core.game.world.map.path.Pathfinder
import core.game.world.map.zone.*
@ -103,7 +103,7 @@ class CastleWarsGameZone : MapZone("CastleWarsGame", true, ZoneRestriction.RANDO
val isMovingUp = to.z > from.z
val isChangingZLevel = to.z != from.z
for (n in getLocalNpcs(e, 5)) {
for (n in getLocalNPCs(e.location, 5)) {
if (n.isInvisible || n === e) {
continue
}
@ -138,4 +138,3 @@ class CastleWarsGameZone : MapZone("CastleWarsGame", true, ZoneRestriction.RANDO
return ZoneType.CASTLE_WARS.id
}
}

View file

@ -341,6 +341,6 @@ class CastleWarsItemHandler : InteractionListener {
NPCs.BARRICADE_1532, NPCs.BARRICADE_1533, NPCs.BARRICADE_1534, NPCs.BARRICADE_1535
)
return RegionManager.getLocalNpcs(location, radius).filter { it.id in barricadeIds && it.isActive }
return RegionManager.getLocalNPCs(location, radius).filter { it.id in barricadeIds && it.isActive }
}
}