feat: implement procedural humanoid animations, modular weapon system, and dummy entity base classes
This commit is contained in:
@@ -61,6 +61,15 @@ func _process(_delta: float) -> void:
|
||||
vm_camera.fov = camera.fov
|
||||
|
||||
func _build_loadout() -> void:
|
||||
var is_auth = false
|
||||
if player:
|
||||
is_auth = player.is_multiplayer_authority()
|
||||
else:
|
||||
is_auth = is_multiplayer_authority()
|
||||
|
||||
if not is_auth:
|
||||
return # Let the player_movement_controller's remote _process call _build_remote_loadout
|
||||
|
||||
# Clear existing weapons
|
||||
for w in weapons.values():
|
||||
if is_instance_valid(w):
|
||||
@@ -69,6 +78,16 @@ func _build_loadout() -> void:
|
||||
|
||||
var l = LoadoutManager.get_active_loadout()
|
||||
|
||||
if player:
|
||||
player.synced_loadout_p1 = l["primary_1"]
|
||||
player.synced_loadout_p2 = l["primary_2"]
|
||||
player.synced_loadout_sp = l["special"]
|
||||
if l.has("melee"):
|
||||
player.synced_loadout_melee = l["melee"]
|
||||
else:
|
||||
player.synced_loadout_melee = ""
|
||||
player.synced_loadout_ready = true
|
||||
|
||||
_spawn_weapon(1, l["primary_1"])
|
||||
_spawn_weapon(2, l["primary_2"])
|
||||
_spawn_weapon(3, l["special"])
|
||||
@@ -77,6 +96,20 @@ func _build_loadout() -> void:
|
||||
|
||||
_equip_slot(1)
|
||||
|
||||
func _build_remote_loadout(p1: String, p2: String, sp: String, melee: String) -> void:
|
||||
for w in weapons.values():
|
||||
if is_instance_valid(w):
|
||||
w.queue_free()
|
||||
weapons.clear()
|
||||
|
||||
_spawn_weapon(1, p1)
|
||||
_spawn_weapon(2, p2)
|
||||
_spawn_weapon(3, sp)
|
||||
if melee != "":
|
||||
_spawn_weapon(4, melee)
|
||||
|
||||
_equip_slot(1)
|
||||
|
||||
func _spawn_weapon(slot: int, weapon_id: String) -> void:
|
||||
if weapon_id == "" or weapon_id == "none" or not LoadoutManager.weapon_db.has(weapon_id):
|
||||
return
|
||||
@@ -184,6 +217,9 @@ func _equip_slot(slot: int) -> void:
|
||||
var humanoid = player.get_node("HumanoidModel")
|
||||
if humanoid.has_method("set_weapon") and w.has_meta("script_path"):
|
||||
humanoid.set_weapon(w.get_meta("script_path"))
|
||||
# Update the synced variable so remote peers pick it up
|
||||
if "synced_weapon_path" in player:
|
||||
player.synced_weapon_path = w.get_meta("script_path")
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
|
||||
|
||||
Reference in New Issue
Block a user