A whole lotta bodges for multiplayer. Gonna need to rethink some things.

This commit is contained in:
Dustin 2025-04-17 23:05:15 -07:00
parent 0248be637d
commit 9283a3263f
2 changed files with 42 additions and 39 deletions

View File

@ -37,9 +37,10 @@ func _ready() -> void:
puppet_anim_sprite_name = animated_sprite.animation
puppet_anim_sprite_frame = animated_sprite.frame
puppet_transform = transform
# if not is_network_master():
# animated_sprite.set_process(false)
# animated_sprite.set_physics_process(false)
## Disable Process and Physics on puppets
if not is_network_master():
animated_sprite.set_process(false)
animated_sprite.set_physics_process(false)
#movement_state_machine.init_animated_actor(self)
#movement_component.attack_function = funcref(self, "attack")
# movement_component.player_number = player_number

View File

@ -35,6 +35,8 @@ func _ready():
PlayerInfo.player_inventory = player_inventory
# PlayerInfo.player_stamina = stamina_component.stamina
# I think we only want to do this for network master players now
if is_network_master():
player_info_index = PlayerInfo.register_player()
print ("Registered as player: ", player_info_index)
player_data = PlayerInfo.get_player_data(player_info_index)
@ -42,6 +44,8 @@ func _ready():
print ("My health is: ", player_data.player_health)
player_data.player_inventory = player_inventory
player_data.player_stamina = stamina_component.stamina
else:
$Hurtbox_Component.hurtbox_entered_function = ''
# Set initial player position in world.
global_position = LevelInfo.player_start_position
@ -51,13 +55,11 @@ func _ready():
movement_component.state_stamina_cost = state_stamina_cost
puppet_pos = position
#var stamina_recovery :float = 0.0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if is_network_master():
#PlayerInfo.player_position = global_position.round()
player_data.player_position = global_position.round()
# stamina_recovery += delta