New player model with anims!!!!!!
This commit is contained in:
+76
-12
@@ -24,10 +24,10 @@ enum SkinColor { BLUE, YELLOW, GREEN, RED }
|
||||
@export var green_texture : CompressedTexture2D
|
||||
@export var red_texture : CompressedTexture2D
|
||||
|
||||
@onready var _bottom_mesh: MeshInstance3D = get_node("3DGodotRobot/RobotArmature/Skeleton3D/Bottom")
|
||||
@onready var _chest_mesh: MeshInstance3D = get_node("3DGodotRobot/RobotArmature/Skeleton3D/Chest")
|
||||
@onready var _face_mesh: MeshInstance3D = get_node("3DGodotRobot/RobotArmature/Skeleton3D/Face")
|
||||
@onready var _limbs_head_mesh: MeshInstance3D = get_node("3DGodotRobot/RobotArmature/Skeleton3D/Llimbs and head")
|
||||
@onready var _bottom_mesh: MeshInstance3D = get_node_or_null("3DGodotRobot/RobotArmature/Skeleton3D/Bottom")
|
||||
@onready var _chest_mesh: MeshInstance3D = get_node_or_null("3DGodotRobot/RobotArmature/Skeleton3D/Chest")
|
||||
@onready var _face_mesh: MeshInstance3D = get_node_or_null("3DGodotRobot/RobotArmature/Skeleton3D/Face")
|
||||
@onready var _limbs_head_mesh: MeshInstance3D = get_node_or_null("3DGodotRobot/RobotArmature/Skeleton3D/Llimbs and head")
|
||||
|
||||
var _current_speed: float
|
||||
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
@@ -61,6 +61,65 @@ func _ready():
|
||||
super._ready()
|
||||
set_respawn_point(Vector3(0, 5, 0))
|
||||
|
||||
# Auto-find body node (needed for instanced scenes where @export NodePath doesn't work reliably)
|
||||
if _body == null:
|
||||
for child in get_children():
|
||||
if child.name == "Armature" or child.name == "3DGodotRobot":
|
||||
_body = child
|
||||
print("Auto-found _body: ", child.name)
|
||||
break
|
||||
if _body == null:
|
||||
push_error("Could not find body node (Armature or 3DGodotRobot)!")
|
||||
|
||||
# Auto-find spring arm offset
|
||||
if _spring_arm_offset == null:
|
||||
if has_node("SpringArmOffset"):
|
||||
_spring_arm_offset = get_node("SpringArmOffset")
|
||||
print("Auto-found _spring_arm_offset")
|
||||
else:
|
||||
push_error("Could not find SpringArmOffset!")
|
||||
|
||||
# Auto-find weapon attachments if not set
|
||||
if _weapon_attachment == null:
|
||||
if has_node("Armature/Skeleton3D/WeaponPoint"):
|
||||
_weapon_attachment = get_node("Armature/Skeleton3D/WeaponPoint")
|
||||
print("Auto-found _weapon_attachment")
|
||||
elif has_node("3DGodotRobot/RobotArmature/Skeleton3D/BoneAttachment3D"):
|
||||
_weapon_attachment = get_node("3DGodotRobot/RobotArmature/Skeleton3D/BoneAttachment3D")
|
||||
print("Auto-found _weapon_attachment (robot)")
|
||||
else:
|
||||
print("WARNING: WeaponPoint not found! Check if you've added BoneAttachment3D nodes.")
|
||||
if has_node("Armature/Skeleton3D"):
|
||||
print("Skeleton3D children:")
|
||||
var skeleton = get_node("Armature/Skeleton3D")
|
||||
for child in skeleton.get_children():
|
||||
print(" - ", child.name, " (", child.get_class(), ")")
|
||||
|
||||
# Auto-find weapon container
|
||||
if _weapon_container == null and _weapon_attachment:
|
||||
var container = _weapon_attachment.get_node_or_null("WeaponContainer")
|
||||
if container:
|
||||
_weapon_container = container
|
||||
print("Auto-found _weapon_container")
|
||||
|
||||
# Auto-find offhand attachment
|
||||
if _offhand_attachment == null:
|
||||
if has_node("Armature/Skeleton3D/OffhandPoint"):
|
||||
_offhand_attachment = get_node("Armature/Skeleton3D/OffhandPoint")
|
||||
print("Auto-found _offhand_attachment")
|
||||
elif has_node("3DGodotRobot/RobotArmature/Skeleton3D/OffHandPoint"):
|
||||
_offhand_attachment = get_node("3DGodotRobot/RobotArmature/Skeleton3D/OffHandPoint")
|
||||
print("Auto-found _offhand_attachment (robot)")
|
||||
else:
|
||||
print("WARNING: OffhandPoint not found!")
|
||||
|
||||
# Auto-find offhand container
|
||||
if _offhand_container == null and _offhand_attachment:
|
||||
var container = _offhand_attachment.get_node_or_null("OffhandContainer")
|
||||
if container:
|
||||
_offhand_container = container
|
||||
print("Auto-found _offhand_container")
|
||||
|
||||
# Try to get optional health label
|
||||
if has_node("PlayerNick/HealthLabel"):
|
||||
health_label = get_node("PlayerNick/HealthLabel")
|
||||
@@ -539,16 +598,19 @@ func _flash_hurt():
|
||||
if not _body:
|
||||
return
|
||||
|
||||
# Store original modulate
|
||||
var original_modulate = _body.modulate
|
||||
# Only works if _body has a modulate property (CanvasItem or some Node3D with visual children)
|
||||
if "modulate" in _body:
|
||||
# Store original modulate
|
||||
var original_modulate = _body.modulate
|
||||
|
||||
# Flash red
|
||||
_body.modulate = Color(1.5, 0.5, 0.5, 1.0)
|
||||
# Flash red
|
||||
_body.modulate = Color(1.5, 0.5, 0.5, 1.0)
|
||||
|
||||
# Return to normal after a brief moment
|
||||
await get_tree().create_timer(0.15).timeout
|
||||
if _body:
|
||||
_body.modulate = original_modulate
|
||||
# Return to normal after a brief moment
|
||||
await get_tree().create_timer(0.15).timeout
|
||||
if _body:
|
||||
_body.modulate = original_modulate
|
||||
# If no modulate, just skip the visual effect
|
||||
|
||||
## Weapon System
|
||||
func _setup_weapon_pickup_area():
|
||||
@@ -589,9 +651,11 @@ func _on_weapon_area_exited(area: Area3D):
|
||||
## Equip a weapon from WorldWeapon data (receives resource path)
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func equip_weapon_from_world(weapon_data_path: String):
|
||||
print("[Client ", multiplayer.get_unique_id(), "] equip_weapon_from_world called for: ", weapon_data_path)
|
||||
var data = load(weapon_data_path) as WeaponData
|
||||
if data:
|
||||
equip_weapon(data)
|
||||
print("[Client ", multiplayer.get_unique_id(), "] Equipped weapon: ", data.weapon_name)
|
||||
else:
|
||||
push_error("Failed to load weapon data from: " + weapon_data_path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user