Skip to content

Commit

Permalink
Censor /status and allow for custom status to be set (requires KFO Cl…
Browse files Browse the repository at this point in the history
…ient update) (#141)

* Hub Status
  • Loading branch information
EstatoDeviato authored Dec 27, 2024
1 parent 2eaaf10 commit 97af98d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 14 additions & 11 deletions server/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from server import commands
from server.evidence import EvidenceList
from server.exceptions import ClientError, AreaError, ArgumentError, ServerError
from server.constants import MusicEffect, derelative
from server.constants import MusicEffect, derelative, censor

from collections import OrderedDict

Expand Down Expand Up @@ -1745,18 +1745,21 @@ def change_status(self, value):
Set the status of the area.
:param value: status code
"""
allowed_values = (
"idle",
"rp",
"casing",
"looking-for-players",
"lfp",
"recess",
"gaming",
value = censor(
value,
self.server.censors["whole"],
self.server.censors["replace"],
True,
)
if value.lower() not in allowed_values:
value = censor(
value,
self.server.censors["partial"],
self.server.censors["replace"],
False,
)
if value.lower() == "hub":
raise AreaError(
f'Invalid status. Possible values: {", ".join(allowed_values)}'
'Hub Status is a restricted value.'
)
if value.lower() == "lfp":
value = "looking-for-players"
Expand Down
2 changes: 1 addition & 1 deletion server/area_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ def send_arup_status(self, clients=None):
return
status_list = [1]
if len(self.server.hub_manager.hubs) > 1:
status_list = [1, "GAMING"]
status_list = [1, "HUB"]
if clients is None:
clients = self.clients
for client in clients:
Expand Down

0 comments on commit 97af98d

Please sign in to comment.