From cb45568ffc7bcc4fd227564a574d60b3119d07db Mon Sep 17 00:00:00 2001 From: unfa Date: Fri, 10 Sep 2021 02:04:27 +0200 Subject: [PATCH] Fixed the deluge of RPC errors. Fixed VFX instancing error. Updated some scenes to new format. --- Game/Assets/Characters/Player.gd | 5 +++++ Game/Assets/Characters/Player.tscn | 2 +- Game/Assets/Weapons/Weapon.gd | 2 +- Game/Assets/Weapons/Weapon.tscn | 14 +++++++------- Game/Main.gd | 4 +++- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Game/Assets/Characters/Player.gd b/Game/Assets/Characters/Player.gd index ac168fc..3eb9e1c 100644 --- a/Game/Assets/Characters/Player.gd +++ b/Game/Assets/Characters/Player.gd @@ -111,6 +111,11 @@ func _ready() -> void: # rpc_config(&"set_linear_velocity", MultiplayerAPI.RPC_MODE_PUPPET) # head.rpc_config(&"set_rotation", MultiplayerAPI.RPC_MODE_PUPPETSYNC) # rpc_config(&"set_info", MultiplayerAPI.RPC_MODE_PUPPETSYNC) + + if is_network_authority(): # prevent puppets from attempting to steer the authority - this just causes RPC errors + input_active = true + else: + input_active = false func aim(event) -> void: var mouse_motion = event as InputEventMouseMotion diff --git a/Game/Assets/Characters/Player.tscn b/Game/Assets/Characters/Player.tscn index 111f1d7..3fc1733 100644 --- a/Game/Assets/Characters/Player.tscn +++ b/Game/Assets/Characters/Player.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=17 format=3 uid="uid://cwuys43c7ak61"] [ext_resource type="Script" path="res://Assets/Characters/Player.gd" id="1"] -[ext_resource type="PackedScene" path="res://Assets/Weapons/Weapon.tscn" id="3"] +[ext_resource type="PackedScene" uid="uid://bemrov0tiy08n" path="res://Assets/Weapons/Weapon.tscn" id="3"] [ext_resource type="Texture2D" uid="uid://cguy76rs8e220" path="res://Assets/Effects/Flame.png" id="3_jw7jd"] [sub_resource type="StandardMaterial3D" id="4"] diff --git a/Game/Assets/Weapons/Weapon.gd b/Game/Assets/Weapons/Weapon.gd index 53186a2..2fd64c1 100644 --- a/Game/Assets/Weapons/Weapon.gd +++ b/Game/Assets/Weapons/Weapon.gd @@ -48,9 +48,9 @@ var impact_player = preload("res://Assets/Effects/ImpactBlood.tscn") impact_vfx = impact_wall.instantiate() if impact_vfx: + get_tree().root.add_child(impact_vfx) impact_vfx.global_transform = impact_vfx.global_transform.looking_at(ray['normal']) impact_vfx.global_transform.origin = ray['position'] - get_tree().root.add_child(impact_vfx) #print(ray) diff --git a/Game/Assets/Weapons/Weapon.tscn b/Game/Assets/Weapons/Weapon.tscn index d8e87fd..19dcdde 100644 --- a/Game/Assets/Weapons/Weapon.tscn +++ b/Game/Assets/Weapons/Weapon.tscn @@ -1,9 +1,9 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=4 format=3 uid="uid://bemrov0tiy08n"] -[ext_resource path="res://Assets/Weapons/Handgun/Handgun.gltf" type="PackedScene" id=1] -[ext_resource path="res://Assets/Weapons/Weapon.gd" type="Script" id=2] +[ext_resource type="PackedScene" uid="uid://cajs6ugsr1efo" path="res://Assets/Weapons/Handgun/Handgun.gltf" id="1"] +[ext_resource type="Script" path="res://Assets/Weapons/Weapon.gd" id="2"] -[sub_resource type="Animation" id=1] +[sub_resource type="Animation" id="1"] resource_name = "Default" length = 0.433333 tracks/0/type = "transform" @@ -29,9 +29,9 @@ tracks/2/enabled = true tracks/2/keys = PackedFloat32Array(0, 1, 0, 0, 0, 0, -2.52435e-29, 7.10543e-15, 1, 1, 1, 1, 0.0666667, 1, 0.00131352, 0.00153854, -0.00218139, 0.0163412, 1.22913e-08, 0.00983989, 0.999818, 1, 1, 1, 0.133333, 1, 0.00476759, 0.00558436, -0.00791762, 0.0593126, 5.85811e-08, 0.0357152, 0.9976, 1, 1, 1, 0.2, 1, 0.00591084, 0.00692347, -0.00981623, 0.0734948, 2.37198e-08, 0.0442549, 0.996313, 1, 1, 1, 0.333333, 1, 0.00017027, 0.000199437, -0.000282773, 0.00211715, 6.15582e-08, 0.00127486, 0.999997, 1, 1, 1, 0.4, 1, 0, 0, 0, 0, -2.52435e-29, 7.10543e-15, 1, 1, 1, 1, 0.433333, 1, 0, 0, 0, 0, -2.52435e-29, 7.10543e-15, 1, 1, 1, 1) [node name="Weapon" type="Node3D"] -script = ExtResource( 2 ) +script = ExtResource( "2" ) -[node name="Handgun" parent="." instance=ExtResource( 1 )] +[node name="Handgun" parent="." instance=ExtResource( "1" )] [node name="Skeleton3D" parent="Handgun/Handgun_Armature" index="0"] bones/0/pose = Transform3D(1, -1.42109e-14, -5.04871e-29, 1.42109e-14, 1, -3.58732e-43, 5.04871e-29, -3.58732e-43, 1, 0, 0, 0) @@ -40,7 +40,7 @@ bones/2/pose = Transform3D(1, 1.49012e-08, 1.49012e-08, -1.49012e-08, 1, 2.98023 [node name="AnimationPlayer" parent="Handgun" index="4"] autoplay = "Default" -anims/Default = SubResource( 1 ) +anims/Default = SubResource( "1" ) blend_times = [] [editable path="Handgun"] diff --git a/Game/Main.gd b/Game/Main.gd index 2e61ea0..69cd0ef 100644 --- a/Game/Main.gd +++ b/Game/Main.gd @@ -4,7 +4,9 @@ enum GameFocus {MENU, GAME, CHAT, AWAY} enum NetworkRole {NONE, CLIENT, SERVER, DEDICATED_SERVER, RELAY_SERVER} const NET_PORT = 12597 -const NET_SERVER = "liblast.unfa.xyz" #"localhost" + +#const NET_SERVER = "liblast.unfa.xyz" +const NET_SERVER = "localhost" var peer = ENetMultiplayerPeer.new()