Skip to content

Commit

Permalink
recallable control groups
Browse files Browse the repository at this point in the history
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
  • Loading branch information
soundmud committed May 9, 2016
1 parent ff6db6c commit 906f17e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 8 deletions.
23 changes: 20 additions & 3 deletions doc/src/manual.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^^^^

Expand All @@ -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
--------------------

Expand Down
18 changes: 18 additions & 0 deletions res/ui/bindings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 23 additions & 5 deletions soundrts/clientgame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 906f17e

Please sign in to comment.