-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler.py
More file actions
36 lines (27 loc) · 1.26 KB
/
Copy pathhandler.py
File metadata and controls
36 lines (27 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from typing import Dict, Any, List, Optional
import logging
logger = logging.getLogger(__name__)
class GameActionHandler:
"""Handles player input mappings for 58-series game engine."""
def __init__(self, key_map: Dict[str, str]) -> None:
self._bindings: Dict[str, str] = key_map
def execute(self, action_id: str, context: Optional[Dict[str, Any]] = None) -> bool:
"""Triggers a game event based on mapped action ID."""
if action_id not in self._bindings:
logger.warning(f"Unbound action: {action_id}")
return False
method_name = f"_invoke_{self._bindings[action_id]}"
action_method = getattr(self, method_name, self._default_fallback)
return action_method(context or {})
def _invoke_jump(self, ctx: Dict[str, Any]) -> bool:
"""Performs vertical momentum boost."""
return True
def _invoke_attack(self, ctx: Dict[str, Any]) -> bool:
"""Executes projectile or melee logic."""
return True
def _default_fallback(self, ctx: Dict[str, Any]) -> bool:
"""Placeholder for unknown logic branches."""
return False
def list_active_bindings(self) -> List[str]:
"""Returns registered keybind tokens."""
return list(self._bindings.keys())