Skip to content

Commit a267697

Browse files
committed
CHANGES:
- Penalty: new event "reslot" added
1 parent 2987bfc commit a267697

File tree

4 files changed

+54
-10
lines changed

4 files changed

+54
-10
lines changed

plugins/punishment/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ DEFAULT:
2727
human: 12
2828
AI: 8
2929
reason: Friendly fire on a team member
30-
- event: collision_hit # if you hit another team member, you get 5 points, 1 if it was an AI.
30+
- event: collision_hit # If you hit another team member, you get 5 points, 1 if it was an AI.
3131
human: 5
3232
AI: 1
3333
reason: Colliding with a team member
34+
- event: reslot # If you re-slotted when being shot at, you get 30 points (you stole a kill)
35+
default: 30
36+
reason: Respawning when being shot at
3437
forgive: 30 # People can forgive others in-between of 30 seconds (default) with the .forgive in-game chat command.
3538
punishments: # list of punishments, based on the users penalty points
3639
- points: 100 # we temp-ban the player when they reached 100 points.

plugins/punishment/listener.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import time
33

44
from core import EventListener, Server, Player, event, chat_command, get_translation, ChatCommand, Channel, \
5-
ThreadSafeDict, Side
5+
ThreadSafeDict
66
from plugins.competitive.commands import Competitive
77
from typing import Optional, TYPE_CHECKING
88

@@ -11,9 +11,9 @@
1111

1212
_ = get_translation(__name__.split('.')[1])
1313

14-
# we can expect any missile that has more than 120s to not hit
14+
# we can expect any missile that was in the air for more than 60s to not hit
1515
# TODO: improve that by weapon
16-
MAX_MISSILE_TIME = 120
16+
MAX_MISSILE_TIME = 60
1717

1818

1919
class PunishmentEventListener(EventListener["Punishment"]):
@@ -257,12 +257,12 @@ async def onPlayerChangeSlot(self, server: Server, data: dict) -> None:
257257

258258
delta_time = int(time.time()) - shot_time
259259
if delta_time < MAX_MISSILE_TIME:
260-
# we will not punish disconnects for now but report them
261-
admin = self.bot.get_admin_channel(server)
262-
if admin:
263-
await admin.send(
264-
"```" + _("Player {} ({}) reslotted after being shot at {} seconds ago.").format(
265-
player.name, player.ucid, delta_time) + "```")
260+
event = {
261+
"eventName": "reslot",
262+
"server_name": server.name,
263+
"initiator": player
264+
}
265+
asyncio.create_task(self._check_punishment(event))
266266
else:
267267
# we will not punish reslotting before landing for now but report them
268268
channel_id = server.channels[Channel.EVENTS]

samples/plugins/punishment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ DEFAULT:
1717
human: 5
1818
AI: 1
1919
reason: Colliding with a team member
20+
- event: reslot # If you re-slotted when being shot at, you get 30 points (you stole a kill)
21+
default: 30
22+
reason: Respawning when being shot at
2023
forgive: 30 # People can forgive others in-between of 30 seconds (default) with the .forgive in-game chat command.
2124
punishments: # list of punishments, based on the users penalty points
2225
- points: 100 # we temp-ban the player when they reached 100 points.

samples/plugins/tournament.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
DEFAULT:
2+
use_signup_form: false # Do you want the participating squadrons to write an application form on signup? (default: false)
3+
match_generation: trueskill # One of trueskill or standard (see below)
4+
autostart_matches: false # If you want your matches to be autostarted by the bot (with a 1 day and 1 hour reminder per DM), set this to true (default: false)
5+
coalition_passwords: true # Auto-generate coalition passwords for red and blue.
6+
allow_exports: false # Do not allow exports (default: false).
7+
auto_join: true # If true, your pilot will be automatically assigned to the associated squadron on join (default: false).
8+
delayed_start: 300 # optional: give people 300 seconds to prepare their planes.
9+
time_to_choose: 600 # The time in seconds squadrons have to choose their customizations for the next round (default: 600s).
10+
sudden_death: false # true: add one decisive round after the configured rounds were played if no winner was found. false: wait until the best out of X is reached.
11+
balance_multiplier: true # true: use a sophisticated multiplier for credit points, based on the Trueskill™️ difference
12+
remove_on_death: .* # Optional: if set, any unit that was lost and where the name matches this regular expression will be removed in the next round of the same match
13+
# mission: Tournament.miz # Optional: the mission to load, otherwise the current mission is used. (Could be a name or a number. If name it has to be in the mission list.)
14+
mission: # Optional: if you provide a list of missions, a random pick will be done. Terrain perferences of the squadrons will be considered.
15+
- Caucasus.miz # you need at least (!) one mission on Caucasus or MarianaIslands
16+
- PersianGulf.miz # all missions need to be in your mission list in serverSettings.lua!
17+
events:
18+
go: {message: "GO GO GO! The fight is now on!", sound: "siren.ogg"} # Go message to be sent at match start (optional add a sound)
19+
presets:
20+
file: presets_tournament.yaml
21+
initial: # presets that have to be applied to any mission
22+
- default # Add a default preset (sample has a sound to be added)
23+
- sanitize # preset to be used for sanitization (security settings in mission)
24+
- random_weather # Randomize the weather
25+
even:
26+
- switch_sides # This will switch the blue and red sides on any even round (2, 4, ..)
27+
# uneven: # just to show you that it is there also
28+
choices: # list of preset | cost in squadron credits
29+
'AIM-120': {"costs": 2} # each AIM-120 costs you 2 credit points
30+
'AIM-9x': {"costs": 1} # each AIM-9x costs you 1 credit points
31+
'AWACS': {"costs": 0, "max": 1, "ticket": "AWACS"} # each AWACS costs you no credit points but one AWACS ticket. You can only choose one AWACS per round.
32+
tickets: # you can get a specific number of tickets per tournament
33+
AWACS: {num: 1, credits: 500} # you get 1 ticket per default, but you can optionally sell tickets with /ticket sell and get the number in credits for it
34+
channels:
35+
info: 112233445566778899 # information channel
36+
streamer: 91827364519283745 # channel for a tournament streamer
37+
category: 119922883377446655 # a category where all match channels will be created into
38+
admin: 998877665544332211 # optional: gamemaster admin channel (if not set, a central admin channel will be used)

0 commit comments

Comments
 (0)