Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- godot_overlay.py +19 -1
godot_overlay.py
CHANGED
|
@@ -195,6 +195,22 @@ def scripts_use_right_click(scripts) -> bool:
|
|
| 195 |
return scripts_use_identifier(scripts, ("MOUSE_BUTTON_RIGHT",))
|
| 196 |
|
| 197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
def plan_controls(project: gpj.ProjectBinary, table: dict[str, list[str]], right_click: bool = False) -> dict:
|
| 199 |
"""Hangi eylem sanal tuş olur, hangisi dokunmaya kalır.
|
| 200 |
|
|
@@ -235,7 +251,9 @@ def plan_controls(project: gpj.ProjectBinary, table: dict[str, list[str]], right
|
|
| 235 |
by_sig[sig] = row
|
| 236 |
rows.append(row)
|
| 237 |
rows.sort(key=lambda r: order[r["name"]])
|
| 238 |
-
|
|
|
|
|
|
|
| 239 |
rows.sort(key=lambda r: (r["name"] not in suggested, bool(r["note"]), is_dev_action(r["name"]), order[r["name"]]))
|
| 240 |
|
| 241 |
out = []
|
|
|
|
| 195 |
return scripts_use_identifier(scripts, ("MOUSE_BUTTON_RIGHT",))
|
| 196 |
|
| 197 |
|
| 198 |
+
# Öneri önceliği: oyunun sırası yalnız aynı öncelikteki eylemler arasında geçerli.
|
| 199 |
+
# Numaralı yuvalar (weapon_slot_1..4) dört düğmeyi yiyip "interact"ı dışarıda bırakıyordu.
|
| 200 |
+
_KEY_ACTION_RE = re.compile(
|
| 201 |
+
r"(^|_)(interact|interaction|use|action|talk|accept|confirm|ok|attack|jump|shoot|fire|dash|roll|dodge"
|
| 202 |
+
r"|skill|ability|special|reload|pause|menu|escape|inventory|bag|map|run|sprint|block|guard|parry"
|
| 203 |
+
r"|grab|pick|pickup|throw|cast|spell|heal|potion|crouch|climb)(_|$|[a-z]?$)", re.IGNORECASE)
|
| 204 |
+
_MINOR_ACTION_RE = re.compile(r"(_|^)\d+$|^ui_|(^|_)(all_up|all_down|debug|skip)(_|$)", re.IGNORECASE)
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
def action_priority(name: str) -> int:
|
| 208 |
+
"""0 = oyunu oynamak için şart, 1 = sıradan, 2 = numaralı yuva / arayüz / atlama."""
|
| 209 |
+
if _MINOR_ACTION_RE.search(name):
|
| 210 |
+
return 2
|
| 211 |
+
return 0 if _KEY_ACTION_RE.search(name) else 1
|
| 212 |
+
|
| 213 |
+
|
| 214 |
def plan_controls(project: gpj.ProjectBinary, table: dict[str, list[str]], right_click: bool = False) -> dict:
|
| 215 |
"""Hangi eylem sanal tuş olur, hangisi dokunmaya kalır.
|
| 216 |
|
|
|
|
| 251 |
by_sig[sig] = row
|
| 252 |
rows.append(row)
|
| 253 |
rows.sort(key=lambda r: order[r["name"]])
|
| 254 |
+
ranked = sorted((r for r in rows if not r["note"]), key=lambda r: (action_priority(r["name"]), order[r["name"]]))
|
| 255 |
+
chosen = {r["name"] for r in ranked[:MAX_BUTTONS]}
|
| 256 |
+
suggested = [r["name"] for r in rows if r["name"] in chosen] # ekranda oyunun sırasıyla
|
| 257 |
rows.sort(key=lambda r: (r["name"] not in suggested, bool(r["note"]), is_dev_action(r["name"]), order[r["name"]]))
|
| 258 |
|
| 259 |
out = []
|