mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-16 08:55:33 +00:00
✨ Inventory, Weapons and refactoring
This commit is contained in:
parent
fa3e1f8d22
commit
39a9200e58
74 changed files with 1812 additions and 3895 deletions
BIN
entities/weapons/chaingun/assets/chaingun.blend
Normal file
BIN
entities/weapons/chaingun/assets/chaingun.blend
Normal file
Binary file not shown.
BIN
entities/weapons/chaingun/assets/chaingun.glb
Normal file
BIN
entities/weapons/chaingun/assets/chaingun.glb
Normal file
Binary file not shown.
34
entities/weapons/chaingun/assets/chaingun.glb.import
Normal file
34
entities/weapons/chaingun/assets/chaingun.glb.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://cumv8wij5uufk"
|
||||
path="res://.godot/imported/chaingun.glb-16cef2303c058492773f5f33b566245e.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/weapons/chaingun/assets/chaingun.glb"
|
||||
dest_files=["res://.godot/imported/chaingun.glb-16cef2303c058492773f5f33b566245e.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
17
entities/weapons/chaingun/assets/mat_flare.tres
Normal file
17
entities/weapons/chaingun/assets/mat_flare.tres
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://dkyb51bkvgamw"]
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_343cd"]
|
||||
load_path = "res://.godot/imported/Flare00.png-75515c1e8df86aba86a9e55bb8ca7901.s3tc.ctex"
|
||||
|
||||
[resource]
|
||||
transparency = 1
|
||||
cull_mode = 2
|
||||
shading_mode = 0
|
||||
vertex_color_use_as_albedo = true
|
||||
albedo_color = Color(0.860369, 0.860369, 0.860369, 1)
|
||||
albedo_texture = SubResource("CompressedTexture2D_343cd")
|
||||
billboard_mode = 3
|
||||
billboard_keep_scale = true
|
||||
particles_anim_h_frames = 1
|
||||
particles_anim_v_frames = 1
|
||||
particles_anim_loop = false
|
||||
27
entities/weapons/chaingun/assets/process_mat_fire.tres
Normal file
27
entities/weapons/chaingun/assets/process_mat_fire.tres
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
[gd_resource type="ParticleProcessMaterial" load_steps=5 format=3 uid="uid://drjuqikmi1uth"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_4bco7"]
|
||||
offsets = PackedFloat32Array(0.00806452, 1)
|
||||
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_gtja2"]
|
||||
gradient = SubResource("Gradient_4bco7")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_d0rrq"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.980263, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_5xpsc"]
|
||||
curve = SubResource("Curve_d0rrq")
|
||||
|
||||
[resource]
|
||||
lifetime_randomness = 1.0
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 0.3
|
||||
spread = 180.0
|
||||
gravity = Vector3(0, -2, 0)
|
||||
scale_min = 0.75
|
||||
scale_max = 1.5
|
||||
scale_curve = SubResource("CurveTexture_5xpsc")
|
||||
color = Color(5, 2, 1, 1)
|
||||
color_ramp = SubResource("GradientTexture1D_gtja2")
|
||||
BIN
entities/weapons/chaingun/assets/tracer.blend
Normal file
BIN
entities/weapons/chaingun/assets/tracer.blend
Normal file
Binary file not shown.
BIN
entities/weapons/chaingun/assets/tracer.glb
Normal file
BIN
entities/weapons/chaingun/assets/tracer.glb
Normal file
Binary file not shown.
34
entities/weapons/chaingun/assets/tracer.glb.import
Normal file
34
entities/weapons/chaingun/assets/tracer.glb.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://bf7v57agnxtcp"
|
||||
path="res://.godot/imported/tracer.glb-49c5c0f531fb5d373b2273b8c055ba52.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/weapons/chaingun/assets/tracer.glb"
|
||||
dest_files=["res://.godot/imported/tracer.glb-49c5c0f531fb5d373b2273b8c055ba52.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
import_script/path=""
|
||||
_subresources={}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=1
|
||||
44
entities/weapons/chaingun/chaingun.gd
Normal file
44
entities/weapons/chaingun/chaingun.gd
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# 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 ChainGun extends Node3D
|
||||
|
||||
@export_range(0, 250) var ammo : int = 250
|
||||
@export var fire_rate : float = .1 # seconds
|
||||
@export var reload_time : float = 0. # seconds
|
||||
|
||||
@export_category("Animations")
|
||||
@export var anim_player : AnimationPlayer
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
func trigger() -> void:
|
||||
# play the fire animation
|
||||
anim_player.play("fire")
|
||||
# init projectile
|
||||
var projectile : Node3D = $ProjectileSpawner.new_projectile(
|
||||
ChainGunProjectile,
|
||||
owner.linear_velocity,
|
||||
owner.match_participant_component
|
||||
)
|
||||
# add to owner of player for now
|
||||
GameManager.mode.add_child(projectile)
|
||||
projectile.shape_cast.add_exception(owner)
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if self.visible:
|
||||
anim_player.play("equip")
|
||||
#self.sounds.play("equip")
|
||||
45
entities/weapons/chaingun/chaingun.tscn
Normal file
45
entities/weapons/chaingun/chaingun.tscn
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://b0xql5hi0b52y"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cumv8wij5uufk" path="res://entities/weapons/chaingun/assets/chaingun.glb" id="1_d8tdv"]
|
||||
[ext_resource type="Script" path="res://entities/weapons/chaingun/chaingun.gd" id="2_qsqeh"]
|
||||
[ext_resource type="Script" path="res://entities/components/projectile_spawner.gd" id="3_knyrc"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0sfwgilfbpx5" path="res://entities/weapons/chaingun/projectile.tscn" id="4_p63ts"]
|
||||
|
||||
[node name="ChainGun" node_paths=PackedStringArray("anim_player") instance=ExtResource("1_d8tdv")]
|
||||
script = ExtResource("2_qsqeh")
|
||||
anim_player = NodePath("AnimationPlayer")
|
||||
|
||||
[node name="ProjectileSpawner" type="Marker3D" parent="." index="0"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.124544, 0.476417)
|
||||
script = ExtResource("3_knyrc")
|
||||
PROJECTILE = ExtResource("4_p63ts")
|
||||
inheritance = 1.0
|
||||
|
||||
[node name="Skeleton3D" parent="Armature" index="0"]
|
||||
bones/1/rotation = Quaternion(3.09086e-08, 0.707107, 0.707107, 3.09086e-08)
|
||||
bones/2/rotation = Quaternion(3.09086e-08, 0.707107, 0.707107, -3.09086e-08)
|
||||
bones/3/rotation = Quaternion(3.09086e-08, 0.707107, 0.707107, -3.09086e-08)
|
||||
|
||||
[node name="BarrelsInner" parent="Armature/Skeleton3D" index="0"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946)
|
||||
|
||||
[node name="BarrelsOuter" parent="Armature/Skeleton3D" index="1"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946)
|
||||
|
||||
[node name="Base" parent="Armature/Skeleton3D" index="2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946)
|
||||
|
||||
[node name="Grip" parent="Armature/Skeleton3D" index="3"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946)
|
||||
|
||||
[node name="AnimationPlayer" parent="." index="2"]
|
||||
autoplay = "idle"
|
||||
|
||||
[node name="Barrels" type="BoneAttachment3D" parent="." index="3"]
|
||||
transform = Transform3D(-1, 0, 8.74227e-08, 8.74227e-08, 0, 1, 0, 1, 0, -2.32831e-10, 0.692504, 0.756307)
|
||||
bone_name = "barrels"
|
||||
bone_idx = 1
|
||||
use_external_skeleton = true
|
||||
external_skeleton = NodePath("../Armature/Skeleton3D")
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
55
entities/weapons/chaingun/projectile.gd
Normal file
55
entities/weapons/chaingun/projectile.gd
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
# 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 ChainGunProjectile extends Node3D
|
||||
|
||||
@export var speed : float = 180. # m/s
|
||||
@export var lifespan : float = .5 # in seconds
|
||||
@export var build_up_time : float = .6 # seconds
|
||||
|
||||
var shooter : MatchParticipantComponent
|
||||
var velocity : Vector3 = Vector3.ZERO
|
||||
|
||||
@onready var shape_cast : ShapeCast3D = $ShapeCast3D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$Timer.wait_time = lifespan
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
queue_free()
|
||||
|
||||
func _physics_process(delta : float) -> void:
|
||||
global_position += velocity * delta
|
||||
if shape_cast.is_colliding():
|
||||
for collision_id in shape_cast.get_collision_count():
|
||||
var collider : Object = shape_cast.get_collider(collision_id)
|
||||
if collider is Player:
|
||||
if is_multiplayer_authority():
|
||||
assert(shooter)
|
||||
collider.health_component.damage.rpc(18, shooter.player_id, shooter.team_id)
|
||||
queue_free()
|
||||
|
||||
## This method is a parameterized constructor for the [ChainGunProjectile] scene of the [ChainGun]
|
||||
static func new_projectile(
|
||||
origin : Marker3D,
|
||||
inherited_velocity : Vector3,
|
||||
_shooter : MatchParticipantComponent,
|
||||
scene : PackedScene
|
||||
) -> ChainGunProjectile:
|
||||
var projectile : ChainGunProjectile = scene.instantiate()
|
||||
projectile.shooter = _shooter
|
||||
projectile.transform = origin.global_transform
|
||||
projectile.velocity = origin.global_basis.z.normalized() * projectile.speed + inherited_velocity
|
||||
return projectile
|
||||
25
entities/weapons/chaingun/projectile.tscn
Normal file
25
entities/weapons/chaingun/projectile.tscn
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://b0sfwgilfbpx5"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bf7v57agnxtcp" path="res://entities/weapons/chaingun/assets/tracer.glb" id="1_p7mmn"]
|
||||
[ext_resource type="Script" path="res://entities/weapons/chaingun/projectile.gd" id="2_jjfwk"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dbodg"]
|
||||
radius = 0.2
|
||||
height = 2.5
|
||||
|
||||
[node name="ChainGunProjectile" instance=ExtResource("1_p7mmn")]
|
||||
script = ExtResource("2_jjfwk")
|
||||
|
||||
[node name="ShapeCast3D" type="ShapeCast3D" parent="." index="0"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 4.29628)
|
||||
shape = SubResource("CapsuleShape3D_dbodg")
|
||||
target_position = Vector3(0, -3, 0)
|
||||
collision_mask = 2147483653
|
||||
|
||||
[node name="tracerinner" parent="." index="1"]
|
||||
transform = Transform3D(0.0505494, 0, 0, 0, 0.0505494, 0, 0, 0, 0.0505494, 0, 0, 2.49628)
|
||||
|
||||
[node name="Timer" type="Timer" parent="." index="2"]
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue