Skip to content

Commit 1a585e1

Browse files
author
KirillMysnik
committed
Added admin_life_management included plugin
1 parent 0da1d59 commit 1a585e1

5 files changed

Lines changed: 105 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Slay/Resurrect players"""
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# =============================================================================
2+
# >> IMPORTS
3+
# =============================================================================
4+
# Source.Python Admin
5+
from admin.admin import main_menu
6+
from admin.core.features import PlayerBasedFeature
7+
from admin.core.frontends.menus import (
8+
AdminMenuSection, PlayerBasedAdminCommand)
9+
from admin.core.helpers import log_admin_action
10+
from admin.core.plugins.strings import PluginStrings
11+
12+
13+
# =============================================================================
14+
# >> GLOBAL VARIABLES
15+
# =============================================================================
16+
plugin_strings = PluginStrings("admin_life_management")
17+
18+
19+
# =============================================================================
20+
# >> CLASSES
21+
# =============================================================================
22+
class _SlayFeature(PlayerBasedFeature):
23+
flag = "admin.admin_life_management.slay"
24+
25+
def execute(self, client, player):
26+
player.slay()
27+
28+
log_admin_action(plugin_strings['message slayed'].tokenized(
29+
admin_name=client.player.name,
30+
player_name=player.name,
31+
))
32+
33+
# The singleton object of the _SlayFeature class.
34+
slay_feature = _SlayFeature()
35+
36+
37+
class _ResurrectFeature(PlayerBasedFeature):
38+
flag = "admin.admin_life_management.resurrect"
39+
40+
def execute(self, client, player):
41+
player.spawn()
42+
43+
log_admin_action(plugin_strings['message resurrected'].tokenized(
44+
admin_name=client.player.name,
45+
player_name=player.name,
46+
))
47+
48+
# The singleton object of the _ResurrectFeature class.
49+
resurrect_feature = _ResurrectFeature()
50+
51+
52+
# =============================================================================
53+
# >> MENU ENTRIES
54+
# =============================================================================
55+
menu_section = main_menu.add_entry(AdminMenuSection(
56+
main_menu, plugin_strings['section_title']))
57+
58+
slay_menu_command = menu_section.add_entry(PlayerBasedAdminCommand(
59+
slay_feature,
60+
menu_section,
61+
plugin_strings['popup_title slay']
62+
))
63+
64+
resurrect_menu_command = menu_section.add_entry(PlayerBasedAdminCommand(
65+
resurrect_feature,
66+
menu_section,
67+
plugin_strings['popup_title resurrect']
68+
))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
verbose_name = "Admin Life Management"
2+
author = "Source-Python-Dev-Team"
3+
description = "Provide slaying and resurrection functionality."
4+
public_convar = False
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Contains plugin information."""
2+
3+
# =============================================================================
4+
# >> IMPORTS
5+
# =============================================================================
6+
# Source.Python Admin
7+
from admin.core.plugins.info import AdminPluginInfo
8+
9+
10+
# =============================================================================
11+
# >> PLUGIN INFO
12+
# =============================================================================
13+
info = AdminPluginInfo(__name__)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[message slayed]
2+
en="Admin {admin_name} has slayed {player_name}"
3+
ru="Администратор {admin_name} убил {player_name}"
4+
5+
[message resurrected]
6+
en="Admin {admin_name} has resurrected {player_name}"
7+
ru="Администратор {admin_name} воскресил {player_name}"
8+
9+
[section_title]
10+
en="Life Management"
11+
ru="Управление жизнями"
12+
13+
[popup_title slay]
14+
en="Slay"
15+
ru="Убить"
16+
17+
[popup_title resurrect]
18+
en="Resurrect"
19+
ru="Воскресить"

0 commit comments

Comments
 (0)