Skip to content

Commit 5c8ea6d

Browse files
author
karel26
committed
CHANGES:
- Mission: player list can hide units now (report parameter)
1 parent 27e0833 commit 5c8ea6d

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

plugins/mission/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,22 @@ from /plugins/mission/reports to /reports/mission and amend it like so:
173173
}
174174
```
175175

176+
If you do not want to hide the players units, you can do it like so:
177+
```json
178+
{
179+
"color": "blue",
180+
"title": "Active Players",
181+
"elements":
182+
[
183+
{
184+
"class": "plugins.mission.players.Main",
185+
"params": {
186+
"hide_units": true
187+
}
188+
}
189+
]
190+
}
191+
```
176192

177193
## Discord Commands
178194
| Command | Parameter | Channel | Role | Description |

plugins/mission/players.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class Main(report.EmbedElement):
1515

16-
async def render(self, server: Server, sides: list[Coalition], in_game: bool = False) -> None:
16+
async def render(self, server: Server, sides: list[Coalition], in_game: bool = False, hide_units: bool = False) -> None:
1717
players = server.get_active_players()
1818
sides: dict[Side, dict] = {
1919
Side.NEUTRAL: {"names": [], "units": [], "SRS": []},
@@ -46,6 +46,7 @@ async def render(self, server: Server, sides: list[Coalition], in_game: bool = F
4646
if side in sides and len(sides[side]['names']):
4747
self.add_field(name='▬' * 13 + f' {side.name.title()} ' + '▬' * 13, value='_ _', inline=False)
4848
self.add_field(name='Name', value='\n'.join(sides[side]['names']) or '_ _')
49-
self.add_field(name='Unit', value='\n'.join(sides[side]['units']) or '_ _')
49+
if not hide_units:
50+
self.add_field(name='Unit', value='\n'.join(sides[side]['units']) or '_ _')
5051
if srs_users:
5152
self.add_field(name='SRS', value='\n'.join(sides[side]['SRS']) or '_ _')

0 commit comments

Comments
 (0)