Delete bone_commands.py
Browse files- bone_commands.py +0 -434
bone_commands.py
DELETED
|
@@ -1,434 +0,0 @@
|
|
| 1 |
-
import shlex
|
| 2 |
-
from typing import Dict, Callable, List, Optional
|
| 3 |
-
from bone_core import LoreManifest, Prisma
|
| 4 |
-
from bone_config import BonePresets, BoneConfig
|
| 5 |
-
|
| 6 |
-
class CommandStateInterface:
|
| 7 |
-
def __init__(self, engine_ref, prisma_ref, config_ref):
|
| 8 |
-
self.eng = engine_ref
|
| 9 |
-
self.P = prisma_ref
|
| 10 |
-
self.Config = config_ref
|
| 11 |
-
|
| 12 |
-
def log(self, text: str, category: str = "CMD"):
|
| 13 |
-
if hasattr(self.eng, "events"):
|
| 14 |
-
self.eng.events.log(text, category)
|
| 15 |
-
else:
|
| 16 |
-
print(f"[{category}] {text}")
|
| 17 |
-
|
| 18 |
-
def trigger_visual_cortex(self) -> Optional[Dict]:
|
| 19 |
-
if hasattr(self.eng, "process_turn"):
|
| 20 |
-
return self.eng.process_turn("LOOK")
|
| 21 |
-
return None
|
| 22 |
-
|
| 23 |
-
def modify_resource(self, resource: str, delta: float):
|
| 24 |
-
if resource == "stamina":
|
| 25 |
-
self.eng.stamina = max(0.0, self.eng.stamina + delta)
|
| 26 |
-
elif resource == "atp":
|
| 27 |
-
if hasattr(self.eng, "bio"):
|
| 28 |
-
self.eng.bio.mito.state.atp_pool = max(
|
| 29 |
-
0.0, self.eng.bio.mito.state.atp_pool + delta
|
| 30 |
-
)
|
| 31 |
-
|
| 32 |
-
def get_resource(self, resource: str) -> float:
|
| 33 |
-
if resource == "stamina":
|
| 34 |
-
return self.eng.stamina
|
| 35 |
-
if resource == "atp":
|
| 36 |
-
return self.eng.bio.mito.state.atp_pool
|
| 37 |
-
if resource == "health":
|
| 38 |
-
return self.eng.health
|
| 39 |
-
return 0.0
|
| 40 |
-
|
| 41 |
-
def save_state(self) -> str:
|
| 42 |
-
if not hasattr(self.eng, "mind") or not hasattr(self.eng.mind, "mem"):
|
| 43 |
-
return "Error: Memory system not found."
|
| 44 |
-
loc = "Unknown"
|
| 45 |
-
last_out = "Silence."
|
| 46 |
-
inv = []
|
| 47 |
-
if hasattr(self.eng, "cortex"):
|
| 48 |
-
state = self.eng.cortex.gather_state(
|
| 49 |
-
getattr(self.eng.cortex, "last_physics", {})
|
| 50 |
-
)
|
| 51 |
-
loc = state.get("world", {}).get("orbit", ["Void"])[0]
|
| 52 |
-
if self.eng.cortex.dialogue_buffer:
|
| 53 |
-
last_out = self.eng.cortex.dialogue_buffer[-1]
|
| 54 |
-
if hasattr(self.eng, "gordon"):
|
| 55 |
-
inv = getattr(self.eng.gordon, "inventory", [])
|
| 56 |
-
continuity_packet = {
|
| 57 |
-
"location": loc,
|
| 58 |
-
"last_output": last_out,
|
| 59 |
-
"inventory": inv,
|
| 60 |
-
}
|
| 61 |
-
atlas_data = None
|
| 62 |
-
if hasattr(self.eng, "navigator") and self.eng.navigator:
|
| 63 |
-
atlas_data = self.eng.navigator.export_atlas()
|
| 64 |
-
mito_traits = {}
|
| 65 |
-
antibodies = None
|
| 66 |
-
if hasattr(self.eng, "bio"):
|
| 67 |
-
if hasattr(self.eng.bio, "mito") and hasattr(self.eng.bio.mito, "state"):
|
| 68 |
-
mito_traits = self.eng.bio.mito.state.__dict__
|
| 69 |
-
if hasattr(self.eng.bio, "immune"):
|
| 70 |
-
antibodies = list(self.eng.bio.immune.active_antibodies)
|
| 71 |
-
return self.eng.mind.mem.save(
|
| 72 |
-
health=self.eng.health,
|
| 73 |
-
stamina=self.eng.stamina,
|
| 74 |
-
mutations={},
|
| 75 |
-
trauma_accum=getattr(self.eng, "trauma_accum", {}),
|
| 76 |
-
joy_history=[],
|
| 77 |
-
mitochondria_traits=mito_traits,
|
| 78 |
-
antibodies=antibodies,
|
| 79 |
-
soul_data=(
|
| 80 |
-
self.eng.soul.to_dict() if hasattr(self.eng, "soul") else None
|
| 81 |
-
),
|
| 82 |
-
continuity=continuity_packet,
|
| 83 |
-
world_atlas=atlas_data,
|
| 84 |
-
village_data=None,
|
| 85 |
-
)
|
| 86 |
-
return "Error: Memory system unreachable."
|
| 87 |
-
|
| 88 |
-
def get_vitals(self) -> Dict[str, float]:
|
| 89 |
-
metrics = self.eng.get_metrics()
|
| 90 |
-
return {
|
| 91 |
-
"health": metrics.get("health", 0.0),
|
| 92 |
-
"stamina": metrics.get("stamina", 0.0),
|
| 93 |
-
"atp": metrics.get("atp", 0.0),
|
| 94 |
-
"max_health": getattr(self.Config, "MAX_HEALTH", 100.0),
|
| 95 |
-
"max_stamina": getattr(self.Config, "MAX_STAMINA", 100.0),
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
def get_inventory(self) -> List[str]:
|
| 99 |
-
if hasattr(self.eng, "gordon"):
|
| 100 |
-
return getattr(self.eng.gordon, "inventory", [])
|
| 101 |
-
return []
|
| 102 |
-
|
| 103 |
-
def get_navigation_report(self) -> str:
|
| 104 |
-
if not hasattr(self.eng, "navigator") or not hasattr(self.eng, "phys"):
|
| 105 |
-
return "Navigation Offline."
|
| 106 |
-
nav = self.eng.navigator
|
| 107 |
-
packet = None
|
| 108 |
-
if hasattr(self.eng.phys, "observer"):
|
| 109 |
-
packet = getattr(self.eng.phys.observer, "last_physics_packet", None)
|
| 110 |
-
|
| 111 |
-
if nav and packet:
|
| 112 |
-
return nav.report_position(packet)
|
| 113 |
-
return "Navigation Systems Unresponsive."
|
| 114 |
-
|
| 115 |
-
def get_soul_status(self) -> Optional[str]:
|
| 116 |
-
soul = getattr(self.eng, "soul", None)
|
| 117 |
-
if soul:
|
| 118 |
-
return soul.get_soul_state()
|
| 119 |
-
return None
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
class ResourceTax:
|
| 123 |
-
def __init__(self, state: CommandStateInterface):
|
| 124 |
-
self.state = state
|
| 125 |
-
|
| 126 |
-
def levy(self, _context: str, costs: Dict[str, float]) -> bool:
|
| 127 |
-
stamina_cost = costs.get("stamina", 0.0)
|
| 128 |
-
atp_cost = costs.get("atp", 0.0)
|
| 129 |
-
if self.state.get_resource("stamina") < stamina_cost:
|
| 130 |
-
self.state.log(
|
| 131 |
-
f"{self.state.P.RED}🛑 EXHAUSTED: Requires {stamina_cost} Stamina.{self.state.P.RST}"
|
| 132 |
-
)
|
| 133 |
-
return False
|
| 134 |
-
if self.state.get_resource("atp") < atp_cost:
|
| 135 |
-
self.state.log(
|
| 136 |
-
f"{self.state.P.RED}🛑 STARVING: Requires {atp_cost} ATP.{self.state.P.RST}"
|
| 137 |
-
)
|
| 138 |
-
return False
|
| 139 |
-
if stamina_cost > 0:
|
| 140 |
-
self.state.modify_resource("stamina", -stamina_cost)
|
| 141 |
-
if atp_cost > 0:
|
| 142 |
-
self.state.modify_resource("atp", -atp_cost)
|
| 143 |
-
return True
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
class CommandRegistry:
|
| 147 |
-
def __init__(self, state: CommandStateInterface):
|
| 148 |
-
self.state = state
|
| 149 |
-
self.commands: Dict[str, Callable] = {}
|
| 150 |
-
self.help_text: Dict[str, str] = {}
|
| 151 |
-
|
| 152 |
-
def register(self, name: str, func: Callable, help_str: str):
|
| 153 |
-
self.commands[name] = func
|
| 154 |
-
self.help_text[name] = help_str
|
| 155 |
-
|
| 156 |
-
def execute(self, text: str) -> bool:
|
| 157 |
-
if not text.startswith("/"):
|
| 158 |
-
return False
|
| 159 |
-
try:
|
| 160 |
-
parts = shlex.split(text)
|
| 161 |
-
except ValueError:
|
| 162 |
-
self.state.log("Syntax Error.", "CMD")
|
| 163 |
-
return True
|
| 164 |
-
cmd = parts[0].lower()
|
| 165 |
-
if cmd in self.commands:
|
| 166 |
-
return self.commands[cmd](parts)
|
| 167 |
-
else:
|
| 168 |
-
self.state.log(f"Unknown command '{cmd}'. Try /help.", "CMD")
|
| 169 |
-
return True
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
class CommandProcessor:
|
| 173 |
-
def __init__(
|
| 174 |
-
self,
|
| 175 |
-
engine,
|
| 176 |
-
prisma_ref,
|
| 177 |
-
_lexicon_ref=None,
|
| 178 |
-
config_ref=None,
|
| 179 |
-
_cartographer_ref=None,
|
| 180 |
-
):
|
| 181 |
-
real_config = config_ref if config_ref else BoneConfig
|
| 182 |
-
self.interface = CommandStateInterface(engine, prisma_ref, real_config)
|
| 183 |
-
self.tax = ResourceTax(self.interface)
|
| 184 |
-
self.registry = CommandRegistry(self.interface)
|
| 185 |
-
self.P = prisma_ref
|
| 186 |
-
self.registry.register("/help", self._cmd_help, "Show this menu")
|
| 187 |
-
self.registry.register("/status", self._cmd_status, "Check vitals")
|
| 188 |
-
self.registry.register("/save", self._cmd_save, "Persist state")
|
| 189 |
-
self.registry.register("/inventory", self._cmd_inventory, "Check pockets")
|
| 190 |
-
self.registry.register("/map", self._cmd_map, "Navigation check")
|
| 191 |
-
self.registry.register("/mode", self._cmd_mode, "Switch operational mode")
|
| 192 |
-
self.registry.register("/debug", self._cmd_debug, "Toggle verbose logs")
|
| 193 |
-
self.registry.register("/exit", self._cmd_exit, "Shutdown")
|
| 194 |
-
self.registry.register("/soul", self._cmd_soul, "Introspection")
|
| 195 |
-
self.registry.register("/look", self._cmd_look, "Observe environment")
|
| 196 |
-
self.registry.register("/reload", self._cmd_reload, "Hot-reload Lore")
|
| 197 |
-
self.registry.register(
|
| 198 |
-
"/truth", self._cmd_truth, "Adjust Reality Ambiguity [0-3]"
|
| 199 |
-
)
|
| 200 |
-
self.registry.register(
|
| 201 |
-
"/soothe", self._cmd_soothe, "Burn ATP to quell memory guilt"
|
| 202 |
-
)
|
| 203 |
-
self.registry.register("/use", self._cmd_use, "Use/Consume an item")
|
| 204 |
-
|
| 205 |
-
def execute(self, text: str):
|
| 206 |
-
if hasattr(self.interface.eng, "reality_stack"):
|
| 207 |
-
stack = self.interface.eng.reality_stack
|
| 208 |
-
rules = stack.get_grammar_rules()
|
| 209 |
-
if not rules.get("allow_commands", True):
|
| 210 |
-
self.interface.log(
|
| 211 |
-
f"{self.P.RED}COMMAND REJECTED: Reality Depth {stack.current_depth} prohibits administrative override.{self.P.RST}",
|
| 212 |
-
"ERR",
|
| 213 |
-
)
|
| 214 |
-
return True
|
| 215 |
-
return self.registry.execute(text)
|
| 216 |
-
|
| 217 |
-
def _cmd_soothe(self, _parts):
|
| 218 |
-
cost = 25.0
|
| 219 |
-
current_stamina = self.interface.get_resource("stamina")
|
| 220 |
-
if current_stamina < cost:
|
| 221 |
-
self.interface.log(
|
| 222 |
-
f"{self.P.RED}Too weak to mourn. (Req: {cost} Stamina){self.P.RST}"
|
| 223 |
-
)
|
| 224 |
-
return True
|
| 225 |
-
if (
|
| 226 |
-
not hasattr(self.interface.eng, "mind")
|
| 227 |
-
or not hasattr(self.interface.eng.mind, "mem")
|
| 228 |
-
or not hasattr(self.interface.eng.mind.mem, "soothe_conscience")
|
| 229 |
-
):
|
| 230 |
-
self.interface.log(
|
| 231 |
-
f"{self.P.YEL}The subconscious is not installed.{self.P.RST}"
|
| 232 |
-
)
|
| 233 |
-
return True
|
| 234 |
-
self.interface.modify_resource("stamina", -cost)
|
| 235 |
-
result_msg = self.interface.eng.mind.mem.soothe_conscience()
|
| 236 |
-
self.interface.log(
|
| 237 |
-
f"{self.P.OCHRE}🏺 {result_msg} (-{cost} Stamina){self.P.RST}"
|
| 238 |
-
)
|
| 239 |
-
return True
|
| 240 |
-
|
| 241 |
-
def _cmd_help(self, _parts):
|
| 242 |
-
lines = [
|
| 243 |
-
f"\n{self.P.CYN}/// BONEAMANITA 15.8.0 TERMINAL ///{self.P.RST}",
|
| 244 |
-
f"{self.P.GRY}Operating Phase: {self.interface.get_soul_status() or 'EXTANT'}{self.P.RST}\n",
|
| 245 |
-
]
|
| 246 |
-
structure = {
|
| 247 |
-
"SURVIVAL": ["/status", "/inventory", "/look"],
|
| 248 |
-
"PROTOCOL": ["/save", "/mode", "/exit", "/help"],
|
| 249 |
-
"MYSTICISM": ["/soul", "/map", "/truth"],
|
| 250 |
-
"MAINTENANCE": ["/debug", "/reload"],
|
| 251 |
-
}
|
| 252 |
-
buckets = {k: [] for k in structure.keys()}
|
| 253 |
-
buckets["UNCATEGORIZED"] = []
|
| 254 |
-
cmd_to_cat = {cmd: cat for cat, cmds in structure.items() for cmd in cmds}
|
| 255 |
-
for cmd, desc in self.registry.help_text.items():
|
| 256 |
-
cat = cmd_to_cat.get(cmd, "UNCATEGORIZED")
|
| 257 |
-
buckets[cat].append((cmd, desc))
|
| 258 |
-
for cat, cmds in buckets.items():
|
| 259 |
-
if not cmds:
|
| 260 |
-
continue
|
| 261 |
-
lines.append(f"{self.P.WHT}[{cat}]{self.P.RST}")
|
| 262 |
-
for cmd, desc in cmds:
|
| 263 |
-
lines.append(f" {self.P.CYN}{cmd:<12}{self.P.RST} {desc}")
|
| 264 |
-
lines.append("")
|
| 265 |
-
lines.append(f"{self.P.GRY}>> Use wisely. Entropy is watching.{self.P.RST}")
|
| 266 |
-
self.interface.log("\n".join(lines))
|
| 267 |
-
return True
|
| 268 |
-
|
| 269 |
-
def _cmd_status(self, _parts):
|
| 270 |
-
v = self.interface.get_vitals()
|
| 271 |
-
|
| 272 |
-
def bar(curr, max_v, col):
|
| 273 |
-
max_v = max(1.0, max_v)
|
| 274 |
-
filled = int(max(0.0, min(1.0, curr / max_v)) * 10)
|
| 275 |
-
return f"{col}{'█'*filled}{'░'*(10-filled)}{self.P.RST}"
|
| 276 |
-
|
| 277 |
-
self.interface.log(
|
| 278 |
-
f"Health: {bar(v['health'], v['max_health'], self.P.RED)} {v['health']:.0f}\n"
|
| 279 |
-
f"Stamina: {bar(v['stamina'], v['max_stamina'], self.P.GRN)} {v['stamina']:.0f}\n"
|
| 280 |
-
f"Energy: {bar(v['atp'], 200, self.P.YEL)} {v['atp']:.0f}"
|
| 281 |
-
)
|
| 282 |
-
return True
|
| 283 |
-
|
| 284 |
-
def _cmd_mode(self, parts):
|
| 285 |
-
if len(parts) < 2:
|
| 286 |
-
self.interface.log("Usage: /mode [ZEN_GARDEN | THUNDERDOME | SANCTUARY]")
|
| 287 |
-
return True
|
| 288 |
-
mode_name = parts[1].upper()
|
| 289 |
-
if not hasattr(BonePresets, mode_name):
|
| 290 |
-
self.interface.log(f"{self.P.RED}Unknown mode: {mode_name}.{self.P.RST}")
|
| 291 |
-
return True
|
| 292 |
-
if self.tax.levy("MODE_SWITCH", {"stamina": 10.0}):
|
| 293 |
-
preset = getattr(BonePresets, mode_name)
|
| 294 |
-
logs = self.interface.Config.load_preset(preset)
|
| 295 |
-
for log in logs:
|
| 296 |
-
self.interface.log(log)
|
| 297 |
-
phys_packet = None
|
| 298 |
-
if hasattr(self.interface.eng, "phys") and hasattr(
|
| 299 |
-
self.interface.eng.phys, "tension"
|
| 300 |
-
):
|
| 301 |
-
phys_packet = getattr(
|
| 302 |
-
self.interface.eng.phys.tension, "last_physics_packet", None
|
| 303 |
-
)
|
| 304 |
-
if phys_packet:
|
| 305 |
-
self.interface.Config.reconcile_state(phys_packet)
|
| 306 |
-
self.interface.log(
|
| 307 |
-
f"{self.P.CYN}State reconciled to {mode_name} parameters.{self.P.RST}"
|
| 308 |
-
)
|
| 309 |
-
self.interface.log(f"Switched to {mode_name}.")
|
| 310 |
-
return True
|
| 311 |
-
|
| 312 |
-
def _cmd_save(self, _parts):
|
| 313 |
-
res = self.interface.save_state()
|
| 314 |
-
if "Error" in res or "Failed" in res:
|
| 315 |
-
self.interface.log(f"{self.P.RED}SAVE FAILED: {res}{self.P.RST}")
|
| 316 |
-
else:
|
| 317 |
-
self.interface.log(f"{self.P.GRN}SAVED: {res}{self.P.RST}")
|
| 318 |
-
return True
|
| 319 |
-
|
| 320 |
-
def _cmd_inventory(self, _parts):
|
| 321 |
-
items = self.interface.get_inventory()
|
| 322 |
-
P = self.interface.P
|
| 323 |
-
self.interface.log(f"{P.WHT}/// GORDON KNOT STORAGE ///{P.RST}")
|
| 324 |
-
if not items:
|
| 325 |
-
self.interface.log(f"{P.GRY} [POCKETS EMPTY]{P.RST}")
|
| 326 |
-
return
|
| 327 |
-
for i, item in enumerate(items):
|
| 328 |
-
self.interface.log(f" {P.GRY}{i + 1}.{P.RST} {P.CYN}{item.upper()}{P.RST}")
|
| 329 |
-
self.interface.log(
|
| 330 |
-
f"{P.GRY} ({len(items)}/{self.interface.Config.INVENTORY.MAX_SLOTS} Slots){P.RST}"
|
| 331 |
-
)
|
| 332 |
-
|
| 333 |
-
def _cmd_map(self, _parts):
|
| 334 |
-
if not self.tax.levy("MAP", {"stamina": 2.0}):
|
| 335 |
-
return True
|
| 336 |
-
nav_report = self.interface.get_navigation_report()
|
| 337 |
-
self.interface.log(nav_report)
|
| 338 |
-
return True
|
| 339 |
-
|
| 340 |
-
def _cmd_debug(self, _parts):
|
| 341 |
-
self.interface.Config.VERBOSE_LOGGING = (
|
| 342 |
-
not self.interface.Config.VERBOSE_LOGGING
|
| 343 |
-
)
|
| 344 |
-
self.interface.log(f"Debug Mode: {self.interface.Config.VERBOSE_LOGGING}")
|
| 345 |
-
return True
|
| 346 |
-
|
| 347 |
-
def _cmd_exit(self, _parts):
|
| 348 |
-
import sys
|
| 349 |
-
|
| 350 |
-
self.interface.log(f"{Prisma.RED}System Halt Initiated.{Prisma.RST}", "SYS")
|
| 351 |
-
if "streamlit" in sys.modules:
|
| 352 |
-
try:
|
| 353 |
-
import streamlit as st
|
| 354 |
-
|
| 355 |
-
st.stop()
|
| 356 |
-
except Exception:
|
| 357 |
-
pass
|
| 358 |
-
raise KeyboardInterrupt
|
| 359 |
-
|
| 360 |
-
def _cmd_soul(self, _parts):
|
| 361 |
-
soul_msg = self.interface.get_soul_status()
|
| 362 |
-
if soul_msg:
|
| 363 |
-
self.interface.log(f"{self.P.MAG}{soul_msg}{self.P.RST}")
|
| 364 |
-
return True
|
| 365 |
-
|
| 366 |
-
def _cmd_look(self, _parts):
|
| 367 |
-
result = self.interface.trigger_visual_cortex()
|
| 368 |
-
if result and result.get("ui"):
|
| 369 |
-
self.interface.log(result["ui"])
|
| 370 |
-
else:
|
| 371 |
-
self.interface.log("Blindness. The engine cannot see.")
|
| 372 |
-
return True
|
| 373 |
-
|
| 374 |
-
def _cmd_reload(self, parts):
|
| 375 |
-
if len(parts) > 1:
|
| 376 |
-
target = parts[1].upper()
|
| 377 |
-
LoreManifest.get_instance().flush_cache(target)
|
| 378 |
-
self.interface.log(f"Reloaded {target}.")
|
| 379 |
-
else:
|
| 380 |
-
LoreManifest.get_instance().flush_cache()
|
| 381 |
-
self.interface.log("Reloaded all Lore.")
|
| 382 |
-
return True
|
| 383 |
-
|
| 384 |
-
def _cmd_truth(self, parts):
|
| 385 |
-
if len(parts) < 2:
|
| 386 |
-
self.interface.log(
|
| 387 |
-
"Usage: /truth [0=Boardroom, 1=Workshop, 2=RedTeam, 3=Palimpsest]"
|
| 388 |
-
)
|
| 389 |
-
return True
|
| 390 |
-
from bone_gui import TruthRenderer
|
| 391 |
-
|
| 392 |
-
try:
|
| 393 |
-
mode = int(parts[1])
|
| 394 |
-
if not (0 <= mode <= 3):
|
| 395 |
-
raise ValueError
|
| 396 |
-
controller = getattr(self.interface.eng, "cycle_controller", None)
|
| 397 |
-
if not controller:
|
| 398 |
-
self.interface.log("Error: CycleController not found.")
|
| 399 |
-
return True
|
| 400 |
-
reporter = getattr(controller, "reporter", None)
|
| 401 |
-
if not reporter:
|
| 402 |
-
self.interface.log("Error: CycleReporter not found.")
|
| 403 |
-
return True
|
| 404 |
-
if not hasattr(reporter.renderer, "dial_setting"):
|
| 405 |
-
self.interface.log(
|
| 406 |
-
f"{self.P.YEL}[SYS] Transplanting TruthRenderer into active cycle...{self.P.RST}"
|
| 407 |
-
)
|
| 408 |
-
new_renderer = TruthRenderer(self.interface.eng)
|
| 409 |
-
reporter.renderer = new_renderer
|
| 410 |
-
reporter.renderers["STANDARD"] = new_renderer
|
| 411 |
-
reporter.renderer.dial_setting = mode
|
| 412 |
-
modes = ["BOARDROOM", "WORKSHOP", "RED TEAM", "PALIMPSEST"]
|
| 413 |
-
self.interface.log(
|
| 414 |
-
f"{self.P.CYN}Ambiguity Dial set to: {modes[mode]}{self.P.RST}"
|
| 415 |
-
)
|
| 416 |
-
except ValueError:
|
| 417 |
-
self.interface.log("Invalid mode. Use 0-3.")
|
| 418 |
-
except Exception as e:
|
| 419 |
-
self.interface.log(f"Truth Dial Failure: {e}")
|
| 420 |
-
return True
|
| 421 |
-
|
| 422 |
-
def _cmd_use(self, parts):
|
| 423 |
-
if len(parts) < 2:
|
| 424 |
-
self.interface.log("Usage: /use [ITEM_NAME]")
|
| 425 |
-
return True
|
| 426 |
-
item_name = parts[1].upper()
|
| 427 |
-
gordon = getattr(self.interface.eng, "gordon", None)
|
| 428 |
-
if not gordon:
|
| 429 |
-
self.interface.log(f"{self.P.RED}Inventory system offline.{self.P.RST}")
|
| 430 |
-
return True
|
| 431 |
-
success, msg = gordon.consume(item_name)
|
| 432 |
-
color = self.P.GRN if success else self.P.OCHRE
|
| 433 |
-
self.interface.log(f"{color}{msg}{self.P.RST}")
|
| 434 |
-
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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