home · contact · privacy
In client map drawing, draw Player things last (= on top).
authorChristian Heller <c.heller@plomlompom.de>
Sun, 6 Dec 2020 19:37:38 +0000 (20:37 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 6 Dec 2020 19:37:38 +0000 (20:37 +0100)
rogue_chat.html
rogue_chat_curses.py

index d4cedc2d9fca7cfbbd69d4e0e485198d5636096a..ef87c0f5888b8b449680cd22357bd1c5865da2fe 100644 (file)
@@ -929,8 +929,7 @@ let tui = {
                 map_lines_split[coordinate[0]][coordinate[1]] = original[0] + 'P';
             }
             let used_positions = [];
                 map_lines_split[coordinate[0]][coordinate[1]] = original[0] + 'P';
             }
             let used_positions = [];
-            for (const thing_id in game.things) {
-                let t = game.things[thing_id];
+            function draw_thing(t, used_positions) {
                 let symbol = game.thing_types[t.type_];
                 let meta_char = ' ';
                 if (t.thing_char) {
                 let symbol = game.thing_types[t.type_];
                 let meta_char = ' ';
                 if (t.thing_char) {
@@ -941,6 +940,18 @@ let tui = {
                 };
                 map_lines_split[t.position[0]][t.position[1]] = symbol + meta_char;
                 used_positions.push(t.position.toString());
                 };
                 map_lines_split[t.position[0]][t.position[1]] = symbol + meta_char;
                 used_positions.push(t.position.toString());
+            }
+            for (const thing_id in game.things) {
+                let t = game.things[thing_id];
+                if (t.type_ != 'Player') {
+                    draw_thing(t, used_positions);
+                }
+            };
+            for (const thing_id in game.things) {
+                let t = game.things[thing_id];
+                if (t.type_ == 'Player') {
+                    draw_thing(t, used_positions);
+                }
             };
         }
         let player = game.things[game.player_id];
             };
         }
         let player = game.things[game.player_id];
index 70d60b27f1c6ee8abfccf31f6b3d0a0f73d54d2e..be3c53f7226fcbecdb26cdacde5b99127da17d15 100755 (executable)
@@ -790,7 +790,8 @@ class TUI:
                         original = map_lines_split[p.y][p.x]
                         map_lines_split[p.y][p.x] = original[0] + 'P'
                     used_positions = []
                         original = map_lines_split[p.y][p.x]
                         map_lines_split[p.y][p.x] = original[0] + 'P'
                     used_positions = []
-                    for t in self.game.things:
+
+                    def draw_thing(t, used_positions):
                         symbol = self.game.thing_types[t.type_]
                         meta_char = ' '
                         if hasattr(t, 'thing_char'):
                         symbol = self.game.thing_types[t.type_]
                         meta_char = ' '
                         if hasattr(t, 'thing_char'):
@@ -799,6 +800,11 @@ class TUI:
                             meta_char = '+'
                         map_lines_split[t.position.y][t.position.x] = symbol + meta_char
                         used_positions += [t.position]
                             meta_char = '+'
                         map_lines_split[t.position.y][t.position.x] = symbol + meta_char
                         used_positions += [t.position]
+
+                    for t in [t for t in self.game.things if t.type_ != 'Player']:
+                        draw_thing(t, used_positions)
+                    for t in [t for t in self.game.things if t.type_ == 'Player']:
+                        draw_thing(t, used_positions)
                 player = self.game.get_thing(self.game.player_id)
                 if self.mode.shows_info or self.mode.name == 'control_tile_draw':
                     map_lines_split[self.explorer.y][self.explorer.x] = '??'
                 player = self.game.get_thing(self.game.player_id)
                 if self.mode.shows_info or self.mode.name == 'control_tile_draw':
                     map_lines_split[self.explorer.y][self.explorer.x] = '??'