Merge branch 'fix/flag-regrabs' into 'develop'

Fix mid-air flag regrabs when going fast

See merge request open-fpsz/open-fpsz!75
This commit is contained in:
anyreso 2024-04-26 14:09:37 +00:00
commit 1a19e5edfa
3 changed files with 6 additions and 8 deletions

View file

@ -44,7 +44,7 @@ func _release(inherited_velocity : Vector3, throw_speed : float) -> void:
_carried_flag.rotation_degrees.x = 0.0
_carried_flag.linear_velocity = inherited_velocity + (global_basis.z * throw_speed)
# Throw the flag from some distance in front of the player to avoid regrabbing mid-air
_carried_flag.global_position = _carried_flag.global_position + (global_basis.z * 1.5)
_carried_flag.global_position = carrier.global_position + (global_basis.z * 1.7)
_carried_flag = null
hide()

View file

@ -3,7 +3,7 @@
[ext_resource type="PackedScene" uid="uid://boviiugcnfyrj" path="res://modes/demo.tscn" id="1_50a80"]
[ext_resource type="PackedScene" uid="uid://bjctlqvs33nqy" path="res://interfaces/menus/boot/boot.tscn" id="1_acy5o"]
[ext_resource type="PackedScene" uid="uid://bvwxfgygm2xb8" path="res://modes/multiplayer.tscn" id="2_g8xeb"]
[ext_resource type="Resource" uid="uid://dut5f1sq0wfeb" path="res://maps/maps.tres" id="3_1ipir"]
[ext_resource type="Resource" path="res://maps/maps.tres" id="3_1ipir"]
[sub_resource type="GDScript" id="GDScript_e61dq"]
script/source = "class_name Game extends Node3D
@ -17,6 +17,7 @@ script/source = "class_name Game extends Node3D
@onready var maps : Array[PackedScene] = _maps_resource.get_items()
# current mode, when the value is set to null we're in the main menu
var mode : Node:
set(new_mode):
# clean up previous mode
@ -37,16 +38,13 @@ func _ready() -> void:
$BootMenu/Multiplayer.join_server.connect(_join_server)
func _unhandled_input(event : InputEvent) -> void:
# escape key pressed
if event.is_action_pressed(\"exit\"):
# reset game mode
mode = null
# check for debug build
# make it easier to exit the game during development
if OS.is_debug_build():
# exit with success
get_tree().quit(0)
else:
# show boot menu
$BootMenu.show()
# switch window mode
@ -70,7 +68,7 @@ func _start_demo() -> void:
func _start_server(port : int, nickname : String) -> void:
mode = MULTIPLAYER.instantiate()
mode.start_server({
\"port\": port,
\"port\": port,
\"nickname\": nickname,
\"map\": maps[clamp($BootMenu/Multiplayer.map_selector.selected, 0, len(maps))]
})

View file

@ -49,7 +49,7 @@ func start_server(config : Dictionary) -> void:
peer.create_server(config["port"], MAX_CLIENTS)
multiplayer.multiplayer_peer = peer
multiplayer.peer_disconnected.connect(remove_player)
_load_map.call_deferred(config["map"], config["nickname"])
func join_server(host : String, port : int, nickname : String) -> void: