mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-14 16:04:50 +00:00
✨ Working profile names in-game, basic settings save/load system, flag drops on player death
This commit is contained in:
parent
98cc079b38
commit
6dde93ea00
12 changed files with 122 additions and 67 deletions
|
|
@ -1,6 +1,24 @@
|
|||
# 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 FlagCarryComponent extends Node
|
||||
## This component allows its entity to grab, carry and throw flags
|
||||
##
|
||||
## To work correctly the owner MUST set an attachment point for carried flags
|
||||
## and a sensor to detect when flags are within grab range
|
||||
|
||||
@export var throw_velocity : float = 10.0
|
||||
@export var max_throw_speed : float = 10.0
|
||||
@export var attachment : Node3D
|
||||
@export var sensor : Area3D
|
||||
|
||||
|
|
@ -20,11 +38,12 @@ func _grab(flag : Flag):
|
|||
flag.grab()
|
||||
_carried_flag = flag
|
||||
|
||||
func throw():
|
||||
@rpc("call_local")
|
||||
func _drop(throw_speed : float):
|
||||
if _is_carrying():
|
||||
_carried_flag.drop()
|
||||
_carried_flag.linear_velocity = attachment.global_basis.z * throw_velocity
|
||||
_carried_flag.rotation_degrees.x = 0.0
|
||||
_carried_flag.linear_velocity = attachment.global_basis.z * throw_speed
|
||||
_carried_flag = null
|
||||
|
||||
func _is_carrying() -> bool:
|
||||
|
|
@ -33,3 +52,9 @@ func _is_carrying() -> bool:
|
|||
func _sensor_on_body_entered(collider):
|
||||
if collider is Flag:
|
||||
_grab.rpc(collider)
|
||||
|
||||
func drop():
|
||||
_drop.rpc(0.0)
|
||||
|
||||
func throw():
|
||||
_drop.rpc(max_throw_speed)
|
||||
|
|
|
|||
|
|
@ -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 HealthComponent extends Area3D
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bof3mg7wgxrmn"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bof3mg7wgxrmn"]
|
||||
|
||||
[ext_resource type="Script" path="res://components/health_component.gd" id="1_00xis"]
|
||||
[ext_resource type="Shape3D" uid="uid://dkwljsgaflf31" path="res://entities/player/collision_shape.res" id="2_sgbmt"]
|
||||
|
||||
[node name="HealthComponent" type="Area3D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_00xis")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = ExtResource("2_sgbmt")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue