🐛 Fix network issues affecting flag and player movement

This commit is contained in:
Squinty 2024-04-17 16:07:24 +00:00
parent 327ea8f707
commit 55b1ac4fa1
9 changed files with 34 additions and 33 deletions

View file

@ -1,15 +1,15 @@
# This file is part of open-fpsz.
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
class_name ExplosiveDamageComponent extends Area3D

View file

@ -32,18 +32,16 @@ func _process(_delta):
_carried_flag.global_position = attachment.global_position
_carried_flag.global_rotation = attachment.global_rotation
@rpc("call_local")
func _grab(flag : Flag):
if not _is_carrying():
flag.grab()
_carried_flag = flag
@rpc("call_local")
func _drop(throw_speed : float):
func _release(inherited_velocity : Vector3, throw_speed : float):
if _is_carrying():
_carried_flag.drop()
_carried_flag.rotation_degrees.x = 0.0
_carried_flag.linear_velocity = attachment.global_basis.z * throw_speed
_carried_flag.linear_velocity = inherited_velocity + (attachment.global_basis.z * throw_speed)
_carried_flag = null
func _is_carrying() -> bool:
@ -51,10 +49,10 @@ func _is_carrying() -> bool:
func _sensor_on_body_entered(collider):
if collider is Flag:
_grab.rpc(collider)
_grab(collider)
func drop():
_drop.rpc(0.0)
_release(Vector3.ZERO, 0.0)
func throw():
_drop.rpc(max_throw_speed)
func throw(inherited_velocity : Vector3):
_release(inherited_velocity, max_throw_speed)