From 906f17ed986dd76908742c20134f542359fff7c6 Mon Sep 17 00:00:00 2001 From: soundmud Date: Mon, 9 May 2016 19:47:36 +0200 Subject: [PATCH] recallable control groups Control + 6, 7, 8 or 9: sets group 6, 7, 8 or 9 with the currently controlled units Shift + 6, 7, 8 or 9: extends group 6, 7, 8 or 9 with the currently controlled units 6, 7, 8 or 9: recalls group 6, 7, 8 or 9 --- doc/src/manual.txt | 23 ++++++++++++++++++++--- res/ui/bindings.txt | 18 ++++++++++++++++++ soundrts/clientgame.py | 28 +++++++++++++++++++++++----- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/doc/src/manual.txt b/doc/src/manual.txt index 8b53f1ca..0f0988c5 100644 --- a/doc/src/manual.txt +++ b/doc/src/manual.txt @@ -191,6 +191,26 @@ To block an exit (path, bridge), you can either: A unit or a gate will let friendly units pass. +Zoom mode (experimental) +^^^^^^^^^^^^^^^^^^^^^^^^ + +New in 1.2 alpha 10. + +F8: enter or exit zoom mode. Escape exits zoom mode too. + +The square in divided in 3 x 3 smaller squares. A zoomed square can be used as a target for an order (go to, essentially). + +Recallable control groups +^^^^^^^^^^^^^^^^^^^^^^^^^ + +New in 1.2 alpha 10. + +Control + 6, 7, 8 or 9: sets group 6, 7, 8 or 9 with the currently controlled units + +Shift + 6, 7, 8 or 9: extends group 6, 7, 8 or 9 with the currently controlled units + +6, 7, 8 or 9: recalls group 6, 7, 8 or 9 + Other commands ^^^^^^^^^^^^^^ @@ -217,9 +237,6 @@ Since SoundRTS 1.1 alpha 3, Alt + A is the same than Alt + G. Backquote (the key below Escape): console command (only in single player mode). The only useful commands at the moment are add_units (to get units or buildings instantly) and victory (to win, for example to skip a chapter). Example of a "add_units" command: "add_units a1 100 archer". New in SoundRTS 1.2 alpha 9. -F8 (experimental): enter or exit zoom mode. Escape exits zoom mode too. New in SoundRTS 1.2 alpha 10. The square in divided in 3 x 3 smaller squares. A zoomed square can be used as a target for an order (go to, essentially). - - 4. Multiplayer games -------------------- diff --git a/res/ui/bindings.txt b/res/ui/bindings.txt index b5b4da7a..65cea44f 100644 --- a/res/ui/bindings.txt +++ b/res/ui/bindings.txt @@ -163,13 +163,31 @@ CTRL ALT s: select_units worker SOLDIER 2: group 2 local 3: group 3 local 4: group 4 local +5: group 5 local CTRL 1: group 1 CTRL 2: group 2 CTRL 3: group 3 CTRL 4: group 4 +CTRL 5: group 5 0: ungroup +; recallable groups + +6: recall_group 6 +7: recall_group 7 +8: recall_group 8 +9: recall_group 9 +CTRL 6: set_group 6 +CTRL 7: set_group 7 +CTRL 8: set_group 8 +CTRL 9: set_group 9 +SHIFT 6: append_group 6 +SHIFT 7: append_group 7 +SHIFT 8: append_group 8 +SHIFT 9: append_group 9 + + ; miscellaneous ESCAPE: escape diff --git a/soundrts/clientgame.py b/soundrts/clientgame.py index 8ff8a1d4..77bfe9fd 100644 --- a/soundrts/clientgame.py +++ b/soundrts/clientgame.py @@ -74,6 +74,7 @@ def __init__(self, server, speed=config.speed): self.alert_squares = {} self.dobjets = {} self.group = [] + self.groups = {} self.lost_units = [] self.neutralized_units = [] self.previous_menus = {} @@ -911,6 +912,8 @@ def say_group(self, prefix=[]): group = [self.dobjets[x].short_title for x in self.group if x in self.dobjets] voice.item(prefix + [138] + self.summary(group) + u.orders_txt) + else: + voice.item(prefix + [4205]) # no unit controlled def tell_enemies_in_square(self, place): enemies = [x.short_title for x in self.dobjets.values() @@ -1055,13 +1058,10 @@ def cmd_default(self, *args): self.order = None def cmd_unit_status(self): - self.update_group() - if not self.group: - voice.item([4205]) # no unit controlled - else: + self.say_group(self.place.title) + if self.group: self.follow_mode = True self._follow_if_needed() - self.say_group(self.place.title) def cmd_help(self, incr): incr = int(incr) @@ -1228,6 +1228,24 @@ def cmd_select_units(self, *args): self.selectionner_unite(1, *(list(self._arrange(args)) + [True])) self.grouper(1, *self._arrange(args)) + # recallable groups + + def cmd_set_group(self, name, *args): + self.groups[name] = set(self.group) + voice.item(["ok"]) + + def cmd_append_group(self, name, *args): + if name not in self.groups: + self.groups[name] = set() + self.groups[name].update(self.group) + voice.item(["ok"]) + + def cmd_recall_group(self, name, *args): + if name not in self.groups: + self.groups[name] = set() + self.group = self.groups[name] + self.say_group() + # select order order = None