Files
tekton/test_smack.py
T

56 lines
1.6 KiB
Python

import re
with open("scripts/managers/gauntlet_manager.gd", "r") as f:
content = f.read()
new_process = """func _process(delta: float) -> void:
if not is_active:
return
elapsed_time += delta
# Phase escalation
_check_phase_transition()
# Cannon timer (server only)
if multiplayer.is_server():
cannon_timer -= delta
if cannon_timer <= 0.0:
_fire_volley()
cannon_timer = cannon_interval
# Smack mechanic update
var all_players = get_tree().get_nodes_in_group("Players")
for player in all_players:
var pid = player.get("peer_id") if "peer_id" in player else player.name.to_int()
if not smack_cooldowns.has(pid) and not smack_charged.has(pid):
smack_cooldowns[pid] = SMACK_COOLDOWN
smack_charged[pid] = 0.0
if smack_cooldowns[pid] > 0:
smack_cooldowns[pid] -= delta
if smack_cooldowns[pid] <= 0:
smack_cooldowns[pid] = 0.0
smack_charged[pid] = SMACK_CHARGE_WINDOW
if player.has_method("sync_modulate"):
if _can_rpc():
player.rpc("sync_modulate", Color.PINK)
else:
player.sync_modulate(Color.PINK)
elif smack_charged[pid] > 0:
smack_charged[pid] -= delta
if smack_charged[pid] <= 0:
smack_charged[pid] = 0.0
smack_cooldowns[pid] = SMACK_COOLDOWN
if player.has_method("sync_modulate"):
if _can_rpc():
player.rpc("sync_modulate", Color.WHITE)
else:
player.sync_modulate(Color.WHITE)"""
content = re.sub(r"func _process\(delta: float\) -> void:.*?(?=\n# =+)", new_process, content, flags=re.DOTALL)
with open("scripts/managers/gauntlet_manager.gd", "w") as f:
f.write(content)