Deterministic trapdoor destination

This commit is contained in:
dam 2026-05-13 19:19:49 +03:00
parent eca0f81a1c
commit 029870a1bd
No known key found for this signature in database
GPG key ID: 4AF4E722399663FB
2 changed files with 35 additions and 4 deletions

View file

@ -81,6 +81,9 @@ private val castleWarsStairDestinationOverrides: Map<Location, Location> = mapOf
Location.create(2374, 3131, 2) to Location.create(2373, 3133, 3)
)
private val saradominTrapdoorDestination: Location = Location.create(2429, 3075, 1)
private val zamorakTrapdoorDestination: Location = Location.create(2370, 3132, 1)
internal fun getCastleWarsStairDestination(start: Location): Location? {
return SpecialLadders.getDestination(start) ?: castleWarsStairDestinationOverrides[start]
}
@ -814,8 +817,7 @@ class CastleWarsListeners : InteractionListener {
sendMessage(player, "You cannot take the flag into your respawn room!")
return@on true
}
val destination = CastleWarsRespawnArea.saradominRespawnRoom.randomWalkableLoc
teleport(player, destination, TeleportManager.TeleportType.INSTANT)
teleport(player, saradominTrapdoorDestination, TeleportManager.TeleportType.INSTANT)
return@on true
}
on(CastleWars.zamorakTrapdoor, IntType.SCENERY, "Go-down") { player, node ->
@ -828,8 +830,7 @@ class CastleWarsListeners : InteractionListener {
sendMessage(player, "You cannot take the flag into your respawn room!")
return@on true
}
val destination = CastleWarsRespawnArea.zamorakRespawnRoom.randomWalkableLoc
teleport(player, destination, TeleportManager.TeleportType.INSTANT)
teleport(player, zamorakTrapdoorDestination, TeleportManager.TeleportType.INSTANT)
return@on true
}

View file

@ -359,6 +359,36 @@ class CastleWarsTests {
}
}
@Test
fun trapdoorsTeleportPlayersToSpecificTilesInsideRespawnRooms() {
TestUtils.getMockPlayer("cwtrapdoorsara").use { saradominPlayer ->
TestUtils.getMockPlayer("cwtrapdoorzam").use { zamorakPlayer ->
CastleWarsGameArea.saradominPlayers.add(saradominPlayer)
CastleWarsGameArea.zamorakPlayers.add(zamorakPlayer)
assertTrue(
runSceneryInteraction(
CastleWars.saradominTrapdoor,
"Go-down",
saradominPlayer,
Scenery(CastleWars.saradominTrapdoor, Location.create(2429, 3075, 2), 10, 0)
)
)
assertTrue(
runSceneryInteraction(
CastleWars.zamorakTrapdoor,
"Go-down",
zamorakPlayer,
Scenery(CastleWars.zamorakTrapdoor, Location.create(2370, 3132, 2), 10, 0)
)
)
assertEquals(Location.create(2429, 3075, 1), saradominPlayer.properties.teleportLocation)
assertEquals(Location.create(2370, 3132, 1), zamorakPlayer.properties.teleportLocation)
}
}
}
@Test
fun gameEndAwardsDrawTicketWithoutFivePerTeamOrTenMinuteGate() {
TestUtils.getMockPlayer("cwticket1").use { sara1 ->