summaryrefslogtreewikicommitdiff
path: root/core/src/inv/Debug.kt
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2026-03-26 23:15:33 -0400
committerFreya Murphy <freya@freyacat.org>2026-03-27 23:09:23 -0400
commitf8322cd21cde68a72b05efbad3a05b8e67c0bdd0 (patch)
treed7e60bc8fedadc8fa7ae725571cad1f398eaf6dc /core/src/inv/Debug.kt
downloadkenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.tar.gz
kenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.tar.bz2
kenshinshideandseek2-f8322cd21cde68a72b05efbad3a05b8e67c0bdd0.zip
initial
Diffstat (limited to 'core/src/inv/Debug.kt')
-rw-r--r--core/src/inv/Debug.kt49
1 files changed, 49 insertions, 0 deletions
diff --git a/core/src/inv/Debug.kt b/core/src/inv/Debug.kt
new file mode 100644
index 0000000..5e9d9d4
--- /dev/null
+++ b/core/src/inv/Debug.kt
@@ -0,0 +1,49 @@
+package cat.freya.khs.inv
+
+import cat.freya.khs.Khs
+import cat.freya.khs.config.ItemConfig
+import cat.freya.khs.game.Game
+import cat.freya.khs.player.Inventory
+import cat.freya.khs.player.Player
+
+const val DEBUG_TITLE = "Teleport"
+val BECOME_HIDER = ItemConfig("&6Become a &lHider", "LEATHER_CHESTPLATE")
+val BECOME_SEEKER = ItemConfig("&cBecome a &lSEEKER", "GOLDEN_CHESTPLATE")
+val BECOME_SPECTATOR = ItemConfig("&8Become a &lSPECTATOR", "IRON_CHESTPLATE")
+val DIE_IN_GAME = ItemConfig("&cDie in game", "SKELETON_SKULL")
+val REVEAL_DISGUISE = ItemConfig("&cReveal disguise", "BARRIER")
+
+fun becomeHider(plugin: Khs, player: Player) {
+ plugin.game.setTeam(player.uuid, Game.Team.HIDER)
+ plugin.game.loadHider(player)
+ if (plugin.game.status == Game.Status.SEEKING) plugin.game.giveHiderItems(player)
+}
+
+fun becomeSeeker(plugin: Khs, player: Player) {
+ plugin.game.setTeam(player.uuid, Game.Team.SEEKER)
+ plugin.game.loadSeeker(player)
+ if (plugin.game.status == Game.Status.SEEKING) plugin.game.giveSeekerItems(player)
+}
+
+fun becomeSpectator(plugin: Khs, player: Player) {
+ plugin.game.setTeam(player.uuid, Game.Team.SPECTATOR)
+ plugin.game.loadSpectator(player)
+}
+
+fun dieInGame(plugin: Khs, player: Player) {
+ val team = plugin.game.getTeam(player.uuid)
+ if (team == null || team == Game.Team.SPECTATOR) return
+ if (plugin.game.status != Game.Status.SEEKING) return
+ player.health = 0.1
+}
+
+fun createDebugMenu(plugin: Khs): Inventory? {
+ val inv = plugin.shim.createInventory(DEBUG_TITLE, 9u) ?: return null
+ val items = listOf(BECOME_HIDER, BECOME_SEEKER, BECOME_SPECTATOR, DIE_IN_GAME, REVEAL_DISGUISE)
+ items
+ .map { plugin.shim.parseItem(it) }
+ .filterNotNull()
+ .withIndex()
+ .forEach { (i, item) -> inv.set(i.toUInt(), item) }
+ return inv
+}