From 3e0ebaa8ff79035ebaa1e5bb81596f92f52361d1 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Fri, 26 Mar 2021 21:04:36 -0500 Subject: [PATCH] RoomTemplate.kt --- .../entity/skill/construction/RoomTemplate.kt | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Server/src/main/kotlin/rs09/game/node/entity/skill/construction/RoomTemplate.kt diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/RoomTemplate.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/RoomTemplate.kt new file mode 100644 index 000000000..5127e2e68 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/RoomTemplate.kt @@ -0,0 +1,34 @@ +package rs09.game.node.entity.skill.construction + +import core.game.node.entity.skill.construction.RoomProperties + +class RoomTemplate(properties: RoomProperties) { + var hotspots: MutableList = ArrayList() + + init { + for(property in properties.hotspots){ + hotspots.add(Hotspot(property.hotspot,property.chunkX,property.chunkY,property.chunkX2,property.chunkY2)) + } + } + + fun rotate(clockwise: Boolean){ + hotspots = hotspots.map{ + if(!clockwise) { + val newChunkX = it.chunkY + val newChunkY = 7 - it.chunkX + val newChunkX2 = it.chunkY2 + val newChunkY2 = 7 - it.chunkX2 + Hotspot(it.hotspot,newChunkX,newChunkY,newChunkX2,newChunkY2) + } else { + val newChunkY = it.chunkX + val newChunkX = 7 - it.chunkY + val newChunkY2 = it.chunkX2 + val newChunkX2 = 7 - it.chunkY2 + Hotspot(it.hotspot,newChunkX,newChunkY,newChunkX2,newChunkY2) + } + }.toMutableList() + } + + + +} \ No newline at end of file