feat: implement player character with state management, network synchronization, and manager integration.
This commit is contained in:
+21
-7
@@ -1933,6 +1933,10 @@ func sync_throw_tekton(target_pos: Vector2i):
|
||||
if p.has_method("apply_stagger"):
|
||||
print("[Throw] Applying stagger to %s" % p.name)
|
||||
p.apply_stagger(3.0)
|
||||
# Apply floor freeze around the stunned player (Radius 0 or 1? "change to 6" implies under them)
|
||||
if tekton.has_method("temporarily_change_floor"):
|
||||
tekton.temporarily_change_floor(Vector2i(p.current_position.x, p.current_position.y), 1, 6, 3.0)
|
||||
|
||||
NotificationManager.send_message(self , "Stunned " + p.name + "!", NotificationManager.MessageType.WARNING)
|
||||
|
||||
# 2. Tekton drops tiles (Spawn tiles around) AND shrinks
|
||||
@@ -1976,12 +1980,22 @@ func sync_knock_tekton(tekton_path: NodePath):
|
||||
if is_multiplayer_authority():
|
||||
rpc("trigger_screen_shake", "heavy")
|
||||
|
||||
func _find_nearby_tekton() -> Node3D:
|
||||
func _find_nearby_tekton() -> Node3D: # Find closest Tekton
|
||||
var closest_tekton = null
|
||||
var min_dist = 9999.0
|
||||
|
||||
var tektons = get_tree().get_nodes_in_group("Tektons")
|
||||
for tekton in tektons:
|
||||
if tekton.is_carried: continue
|
||||
for t in tektons:
|
||||
if t.is_carried: continue
|
||||
if t.get("is_recovering"): continue # Cannot grab recovering/shrunk Tekton
|
||||
|
||||
var dist = (tekton.current_position - current_position).length()
|
||||
if dist <= 1.5: # Adjacent (1.0 or 1.41)
|
||||
return tekton
|
||||
return null
|
||||
# Check adjacency (or same tile)
|
||||
# Assuming is_adjacent_or_same is a helper function that checks if two Vector2i are adjacent or the same.
|
||||
# For example: (pos1 - pos2).length_squared() <= 2 (for adjacent or same tile)
|
||||
var dist_grid = (t.current_position - current_position).length()
|
||||
if dist_grid <= 1.5: # Adjacent (1.0 or 1.41) or same tile (0.0)
|
||||
var dist = global_position.distance_to(t.global_position)
|
||||
if dist < min_dist:
|
||||
min_dist = dist
|
||||
closest_tekton = t
|
||||
return closest_tekton
|
||||
|
||||
Reference in New Issue
Block a user