Skip to content

Commit

Permalink
Add SVCHousingOfficer class to CharacterService_ren.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KiloOscarSix committed Apr 15, 2024
1 parent d97a630 commit b6062ac
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions CharacterService_ren.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Iterable, Optional, Union

from game.characters.npcs.svc_housing_officer_ren import SVCHousingOfficer
from renpy import store
import renpy.exports as renpy

Expand All @@ -19,10 +20,16 @@
class CharacterService:
@staticmethod
def get_user_by_str(name: str) -> Character:
name = name.lower()
try:
return getattr(store, name.lower().replace(" ", "_"))
return getattr(store, name.replace(" ", "_"))
except AttributeError:
raise AttributeError(f"{name} is not a valid character.")
try:
if name == "svc housing officer":
return SVCHousingOfficer()
return getattr(store, name.title().replace(" ", ""))()
except AttributeError:
raise AttributeError(f"{name} is not a valid character.")

@staticmethod
def get_user(character: Union[Character, str]) -> Character:
Expand Down

0 comments on commit b6062ac

Please sign in to comment.