moss-n-puddles/utils/support.py
Howard Abrams 0850301c65 We can knock on a door.
And a number of bugs squashed.
2025-02-11 21:09:23 -08:00

31 lines
979 B
Python
Executable file

#!/usr/bin/env python
from typeclasses.characters import Character
def character_has(holder, item):
"""
Return true if character, holder, has an item.
Where item is probably a string name to match an item's key.
It can also be a type, for instance:
character_has(character, typeclasses.drinkables.TeaCup)
"""
for i in holder.contents:
if isinstance(item, str) and i.key == item:
return i
elif i.key == item:
return i
elif type(i) == item:
return i
elif i == item:
return i
def god_msg(msg, sender=None, location=None):
dabbler = Character.objects.search_object("#1")[0]
dabbler.msg(f"{msg} {'from ' + sender if sender else ''} {'at ' + location if location else ''}")
def debug(msg, sender=None, location=None):
god_msg(f"DEBUG: {msg}", sender, location)
# py from typeclasses.characters import Character; god = Character.objects.search_object("#1")[0]