From: Christian Heller Date: Thu, 17 Dec 2020 00:29:30 +0000 (+0100) Subject: Add dancing task/action. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/git-logo.png?a=commitdiff_plain;h=1ece82099bbf02faed3d1348d7014b8ed38528a9;p=plomrogue2 Add dancing task/action. --- diff --git a/config.json b/config.json index 79537a9..437a496 100644 --- a/config.json +++ b/config.json @@ -24,6 +24,7 @@ "wear": "W", "consume": "C", "spin": "S", + "dance": "T", "help": "h", "toggle_map_mode": "L", "toggle_tile_draw": "m", diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index 6f42109..cc37527 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -374,3 +374,12 @@ class Task_SPIN(Task): def do(self): self.thing.carrying.spin() self.thing.send_msg('CHAT "You spin this object."') + + + +class Task_DANCE(Task): + + def do(self): + self.thing.send_msg('CHAT "You dance."') + self.thing.dancing += 10 + self.thing.game.changed = True diff --git a/plomrogue/things.py b/plomrogue/things.py index dbec52f..c538a23 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -678,7 +678,7 @@ class Thing_Player(ThingAnimate): if 1000000 * random.random() < self.energy: self.send_msg('CHAT "Your body tries to ' 'dance off its energy surplus."') - self.dancing = 50 + self.dancing += 50 self.game.changed = True def send_msg(self, msg): diff --git a/rogue_chat.html b/rogue_chat.html index 47bf58d..6497fa9 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -54,6 +54,7 @@ terminal rows: + @@ -101,6 +102,7 @@ terminal rows:
  • flatten surroundings:
  • teleport:
  • spin: +
  • dance:
  • open/close:
  • consume:
  • install: @@ -262,6 +264,7 @@ let key_descriptions = { 'install': '(un-)install', 'wear': '(un-)wear', 'spin': 'spin', + 'dance': 'dance', 'toggle_map_mode': 'toggle map view', 'toggle_tile_draw': 'toggle protection character drawing', 'hex_move_upleft': 'up-left', @@ -724,6 +727,7 @@ let tui = { 'command': 'COMMAND', 'consume': 'INTOXICATE', 'spin': 'SPIN', + 'dance': 'DANCE', }, offset: [0,0], map_lines: [], @@ -735,7 +739,7 @@ let tui = { this.mode_play.available_modes = ["chat", "study", "edit", "admin_enter", "command_thing", "take_thing", "drop_thing"] this.mode_play.available_actions = ["move", "teleport", "door", "consume", - "wear", "spin"]; + "wear", "spin", "dance"]; this.mode_study.available_modes = ["chat", "play", "admin_enter", "edit"] this.mode_study.available_actions = ["toggle_map_mode", "move_explorer"]; this.mode_admin.available_modes = ["admin_thing_protect", "control_pw_type", @@ -1686,6 +1690,8 @@ tui.inputEl.addEventListener('keydown', (event) => { server.send(["TASK:WEAR"]); } else if (event.key === tui.keys.spin && tui.task_action_on('spin')) { server.send(["TASK:SPIN"]); + } else if (event.key === tui.keys.dance && tui.task_action_on('dance')) { + server.send(["TASK:DANCE"]); } else if (event.key in tui.movement_keys && tui.task_action_on('move')) { server.send(['TASK:MOVE', tui.movement_keys[event.key]]); } else if (event.key === tui.keys.teleport) { @@ -1798,8 +1804,8 @@ document.getElementById("install").onclick = function() { document.getElementById("wear").onclick = function() { server.send(['TASK:WEAR']); }; -document.getElementById("spin").onclick = function() { - server.send(['TASK:SPIN']); +document.getElementById("dance").onclick = function() { + server.send(['TASK:DANCE']); }; document.getElementById("teleport").onclick = function() { game.teleport(); diff --git a/rogue_chat.py b/rogue_chat.py index cc6421f..1fe4c91 100755 --- a/rogue_chat.py +++ b/rogue_chat.py @@ -20,7 +20,7 @@ from plomrogue.commands import (cmd_ALL, cmd_LOGIN, cmd_NICK, cmd_PING, cmd_THIN from plomrogue.tasks import (Task_WAIT, Task_MOVE, Task_WRITE, Task_PICK_UP, Task_DROP, Task_FLATTEN_SURROUNDINGS, Task_DOOR, Task_INTOXICATE, Task_COMMAND, Task_INSTALL, - Task_WEAR, Task_SPIN) + Task_WEAR, Task_SPIN, Task_DANCE) from plomrogue.things import (Thing_Player, Thing_Item, Thing_ItemSpawner, Thing_SpawnPoint, Thing_SpawnPointSpawner, Thing_Door, Thing_DoorSpawner, Thing_Bottle, @@ -86,6 +86,7 @@ game.register_task(Task_COMMAND) game.register_task(Task_INSTALL) game.register_task(Task_WEAR) game.register_task(Task_SPIN) +game.register_task(Task_DANCE) game.register_thing_type(Thing_Player) game.register_thing_type(Thing_Item) game.register_thing_type(Thing_ItemSpawner) diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index f0ec663..a58b842 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -512,7 +512,7 @@ class TUI: "command_thing", "take_thing", "drop_thing"] self.mode_play.available_actions = ["move", "teleport", "door", "consume", - "install", "wear", "spin"] + "install", "wear", "spin", "dance"] self.mode_study.available_modes = ["chat", "play", "admin_enter", "edit"] self.mode_study.available_actions = ["toggle_map_mode", "move_explorer"] self.mode_admin.available_modes = ["admin_thing_protect", "control_pw_type", @@ -566,6 +566,7 @@ class TUI: 'install': 'I', 'wear': 'W', 'spin': 'S', + 'dance': 'T', 'help': 'h', 'toggle_map_mode': 'L', 'toggle_tile_draw': 'm', @@ -1144,6 +1145,7 @@ class TUI: 'door': 'open/close', 'consume': 'consume', 'spin': 'spin', + 'dance': 'dance', } action_tasks = { @@ -1157,6 +1159,7 @@ class TUI: 'command': 'COMMAND', 'consume': 'INTOXICATE', 'spin': 'SPIN', + 'dance': 'DANCE', } curses.curs_set(False) # hide cursor @@ -1329,6 +1332,8 @@ class TUI: self.send('TASK:WEAR') elif key == self.keys['spin'] and task_action_on('spin'): self.send('TASK:SPIN') + elif key == self.keys['dance'] and task_action_on('dance'): + self.send('TASK:DANCE') elif key == self.keys['teleport']: if self.game.player.position in self.game.portals: self.host = self.game.portals[self.game.player.position]