feat: Introduce player character with input management and gridmap interaction visuals.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
[gd_resource type="BoxMesh" format=3 uid="uid://b5cc3prem52r6"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_e3p1j"]
|
||||
albedo_color = Color(0.38039216, 1, 0.9607843, 0.5)
|
||||
transparency = 1
|
||||
albedo_color = Color(0.38039216, 1, 0.9607843, 0.75)
|
||||
|
||||
[resource]
|
||||
material = SubResource("StandardMaterial3D_e3p1j")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mf1g6"]
|
||||
transparency = 1
|
||||
albedo_color = Color(0.90588236, 0.73333335, 0.22352941, 0.5)
|
||||
albedo_color = Color(0.90588236, 0.73333335, 0.22352941, 0.75)
|
||||
|
||||
[resource]
|
||||
material = SubResource("StandardMaterial3D_mf1g6")
|
||||
|
||||
+7
-4
@@ -754,7 +754,7 @@ func _apply_tint_recursive(node: Node, color: Color):
|
||||
|
||||
var immunity_timer: float = 0.0
|
||||
var tekton_carry_timer: float = 0.0
|
||||
const MAX_TEKTON_CARRY_TIME: float = 4.0
|
||||
const MAX_TEKTON_CARRY_TIME: float = 3.0
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local")
|
||||
@@ -1188,13 +1188,16 @@ func _physics_process(delta):
|
||||
if can_rpc():
|
||||
rpc("remote_set_position", current_world_pos, Time.get_ticks_msec())
|
||||
|
||||
# Tekton Auto-Drop Timer (3s Rule)
|
||||
# Tekton Auto-Reward Timer (3s Rule)
|
||||
if is_multiplayer_authority() and is_carrying_tekton:
|
||||
tekton_carry_timer += delta
|
||||
if tekton_carry_timer >= MAX_TEKTON_CARRY_TIME:
|
||||
tekton_carry_timer = 0.0
|
||||
print("[Player %s] 3-second rule: Auto-dropping Tekton" % name)
|
||||
drop_tekton()
|
||||
print("[Player %s] 3-second rule: Auto-spawning reward tiles" % name)
|
||||
if powerup_manager and powerup_manager.has_method("spawn_boost_reward"):
|
||||
powerup_manager.spawn_boost_reward()
|
||||
else:
|
||||
drop_tekton()
|
||||
elif not is_carrying_tekton:
|
||||
tekton_carry_timer = 0.0
|
||||
|
||||
|
||||
@@ -93,10 +93,7 @@ func handle_unhandled_input(event):
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
elif event.is_action_pressed("action_grab_tekton"):
|
||||
if player.is_carrying_tekton:
|
||||
if player.powerup_manager and player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
player.powerup_manager.spawn_boost_reward()
|
||||
else:
|
||||
if not player.is_carrying_tekton:
|
||||
if player.powerup_manager and player.powerup_manager.has_method("can_use_special"):
|
||||
player.grab_tekton()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
@@ -390,12 +390,8 @@ func _on_button_pressed(button_name: String):
|
||||
# if local_player.powerup_manager and local_player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
# local_player.powerup_manager.spawn_boost_reward()
|
||||
"TektonGrab":
|
||||
if local_player.is_carrying_tekton:
|
||||
if local_player.powerup_manager and local_player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
local_player.powerup_manager.spawn_boost_reward()
|
||||
else:
|
||||
if not local_player.is_carrying_tekton and local_player.has_method("grab_tekton"):
|
||||
local_player.grab_tekton()
|
||||
if not local_player.is_carrying_tekton and local_player.has_method("grab_tekton"):
|
||||
local_player.grab_tekton()
|
||||
|
||||
|
||||
func _on_button_released(button_name: String):
|
||||
@@ -597,25 +593,12 @@ func _on_boost_points_changed(current_points: int, max_points: int):
|
||||
# var can_spawn = local_player and local_player.is_carrying_tekton
|
||||
# _update_boost_button_state(spawn_boost_button, can_spawn)
|
||||
|
||||
# Tekton Grab (👋) is only enabled if full AND not already carrying one
|
||||
# Now modified: If CARRYING, it is ALWAYS enabled to act as SpawnBoost. If NOT carrying, needs to be full.
|
||||
var can_grab_or_spawn = (local_player and local_player.is_carrying_tekton) or (is_full)
|
||||
_update_boost_button_state(tekton_grab_button, can_grab_or_spawn)
|
||||
# Tekton Grab is only enabled if full AND not already carrying one
|
||||
var can_grab = not (local_player and local_player.is_carrying_tekton) and (is_full)
|
||||
_update_boost_button_state(tekton_grab_button, can_grab)
|
||||
|
||||
func _on_tekton_carried_changed(_is_carrying: bool):
|
||||
# Refresh button states when player grabs/throws a tekton
|
||||
if tekton_grab_button:
|
||||
if _is_carrying:
|
||||
# Swapping to Spawn function (Hotkey E)
|
||||
tekton_grab_button.icon = load("res://assets/graphics/touch_control/spawn_tile.png")
|
||||
if SettingsManager:
|
||||
_ensure_shortcut_label(tekton_grab_button, "TektonGrab")
|
||||
else:
|
||||
# Swapping back to Grab function (Hotkey G)
|
||||
tekton_grab_button.icon = load("res://assets/graphics/touch_control/grab_tekton.png")
|
||||
if SettingsManager:
|
||||
_ensure_shortcut_label(tekton_grab_button, "TektonGrab")
|
||||
|
||||
# Refresh button states
|
||||
var powerup_mgr = local_player.get_node_or_null("PowerUpManager")
|
||||
if powerup_mgr:
|
||||
_on_boost_points_changed(powerup_mgr.current_boost, powerup_mgr.MAX_BOOST)
|
||||
|
||||
Reference in New Issue
Block a user