home · contact · privacy
Replace client TURN line with frequently updated toilet need stat.
[plomrogue2] / rogue_chat.html
index 212a1d637680f0d5753f81d863b55e6535e04871..291a98c341431c6c6cedf5bce2c966c2a63c30aa 100644 (file)
@@ -129,8 +129,8 @@ terminal rows: <input id="n_rows" type="number" step=4 min=24 value=24 />
 </div>
 <script>
 "use strict";
-let websocket_location = "wss://plomlompom.com/rogue_chat/";
-//let websocket_location = "ws://localhost:8000/";
+//let websocket_location = "wss://plomlompom.com/rogue_chat/";
+let websocket_location = "ws://localhost:8000/";
 
 let mode_helps = {
     'play': {
@@ -485,11 +485,12 @@ let server = {
         let tokens = parser.tokenize(event.data);
         if (tokens[0] === 'TURN') {
             game.turn_complete = false;
-            game.turn = parseInt(tokens[1]);
         } else if (tokens[0] === 'OTHER_WIPE') {
             game.portals_new = {};
             explorer.annotations_new = {};
             game.things_new = [];
+        } else if (tokens[0] === 'BLADDER_PRESSURE') {
+            game.bladder_pressure_new = parseInt(tokens[1])
         } else if (tokens[0] === 'THING') {
             let t = game.get_thing_temp(tokens[4], true);
             t.position = parser.parse_yx(tokens[1]);
@@ -546,6 +547,7 @@ let server = {
             game.things = game.things_new;
             game.player = game.things[game.player_id];
             game.players_hat_chars = game.players_hat_chars_new;
+            game.bladder_pressure = game.bladder_pressure_new
             game.turn_complete = true;
             if (tui.mode.name == 'post_login_wait') {
                 tui.switch_mode('play');
@@ -1210,10 +1212,8 @@ let tui = {
       }
       terminal.write(0, this.window_width, 'MODE: ' + this.mode.short_desc + ' – ' + help);
   },
-  draw_turn_line: function(n) {
-      if (game.turn_complete) {
-          terminal.write(1, this.window_width, 'TURN: ' + game.turn);
-      }
+  draw_stats_line: function(n) {
+      terminal.write(1, this.window_width, 'BLADDER: ' + game.bladder_pressure);
   },
   draw_history: function() {
       let log_display_lines = [];
@@ -1328,7 +1328,7 @@ let tui = {
         this.draw_input();
     } else {
         this.draw_map();
-        this.draw_turn_line();
+        this.draw_stats_line();
         this.draw_mode_line();
         if (this.mode.shows_info) {
           this.draw_info();
@@ -1368,6 +1368,8 @@ let game = {
         this.portals = {};
         this.portals_new = {};
         this.players_hat_chars = "";
+        this.bladder_pressure = 0;
+        this.bladder_pressure_new = 0;
     },
     get_thing_temp: function(id_, create_if_not_found=false) {
         if (id_ in game.things_new) {