Allow including time in the active state prompt
[mudpy.git] / mudpy / misc.py
index dce3ea6..50a9456 100644 (file)
@@ -672,8 +672,18 @@ class User:
         if not prompt:
             return get_menu_prompt(self.state)
 
+        # Allow including the World clock state
+        if "$_(time)" in prompt:
+            prompt = prompt.replace(
+                "$_(time)",
+                str(universe.groups["internal"]["counters"].get("elapsed")))
+
+        # Append a single space for clear separation from user input
+        if prompt[-1] != " ":
+            prompt = "%s " % prompt
+
         # Return the cooked prompt
-        return "%s " % prompt
+        return prompt
 
     def adjust_echoing(self):
         """Adjust echoing to match state menu requirements."""