♻️ systems refactoring

This commit is contained in:
anyreso 2024-05-08 10:25:06 -04:00
parent 5ab387571e
commit 69c8b65093
17 changed files with 186 additions and 168 deletions

View file

@ -13,7 +13,7 @@ signal nickname_changed(new_nickname : String)
player_id_changed.emit(player_id)
@export var team_id : int = 1
func _enter_tree() -> void:
func _ready() -> void:
root_path = "."
replication_config = SceneReplicationConfig.new()
for prop : String in ["player_id", "team_id", "nickname"]:

View file

@ -103,7 +103,7 @@ func _setup_pawn(_new_player_id : int) -> void:
func _is_pawn() -> bool:
var peer_is_pawn : bool = multiplayer.get_unique_id() == match_participant_component.player_id
return Game.mode is Singleplayer or peer_is_pawn
return Global.type is Singleplayer or peer_is_pawn
# @NOTE: this method works only because `tp_mesh` duplicates weapons meshes from the inventory
func _on_inventory_selection_changed(_selected : Node3D, index : int) -> void:

View file

@ -263,6 +263,10 @@ replication_config = SubResource("SceneReplicationConfig_rqdp6")
root_path = NodePath(".")
replication_config = SubResource("SceneReplicationConfig_5j4ew")
script = ExtResource("6_ymcrr")
jetting = null
skiing = null
direction = null
camera_rotation = null
[node name="MatchParticipantComponent" type="MultiplayerSynchronizer" parent="."]
root_path = NodePath(".")

View file

@ -35,7 +35,7 @@ func trigger() -> void:
owner.match_participant_component
)
# add to owner of player for now
Game.mode.add_child(projectile)
Global.type.add_child(projectile)
projectile.shape_cast.add_exception(owner)
func _on_visibility_changed() -> void:

View file

@ -21,7 +21,7 @@ func trigger() -> void:
owner.match_participant_component
)
# add to owner of player for now
Game.mode.add_child(projectile)
Global.type.add_child(projectile)
func _on_visibility_changed() -> void:
if self.visible:

View file

@ -10,7 +10,7 @@ script = ExtResource("2_38xn3")
anim_player = NodePath("AnimationPlayer")
[node name="ProjectileSpawner" type="Node3D" parent="." index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.266945)
script = ExtResource("4_5h5sw")
PROJECTILE = ExtResource("3_rg5nk")
inheritance = 0.75

View file

@ -36,7 +36,7 @@ func trigger() -> void:
owner.match_participant_component
)
# add to owner of player for now
Game.mode.add_child(projectile)
Global.type.add_child(projectile)
# ensure projectile does not collide with owner
var collider : ShapeCast3D = projectile.shape_cast
collider.add_exception(owner)