mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-10 22:14:39 +00:00
🎉 initial commit
This commit is contained in:
commit
d02447c7e6
185 changed files with 8442 additions and 0 deletions
BIN
weapons/space_gun/assets/SpaceGun.glb
Normal file
BIN
weapons/space_gun/assets/SpaceGun.glb
Normal file
Binary file not shown.
45
weapons/space_gun/assets/SpaceGun.glb.import
Normal file
45
weapons/space_gun/assets/SpaceGun.glb.import
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://clq4uym4arpv3"
|
||||
path="res://.godot/imported/SpaceGun.glb-ee1e940c9dd77150eaf36c6537feefef.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://weapons/space_gun/assets/SpaceGun.glb"
|
||||
dest_files=["res://.godot/imported/SpaceGun.glb-ee1e940c9dd77150eaf36c6537feefef.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={
|
||||
"materials": {
|
||||
"_defaultMat": {
|
||||
"use_external/enabled": true,
|
||||
"use_external/path": ""
|
||||
},
|
||||
"dark": {
|
||||
"use_external/enabled": true,
|
||||
"use_external/path": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
gltf/naming_version=1
|
||||
gltf/embedded_image_handling=2
|
||||
BIN
weapons/space_gun/assets/albedo.png
Normal file
BIN
weapons/space_gun/assets/albedo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 364 KiB |
35
weapons/space_gun/assets/albedo.png.import
Normal file
35
weapons/space_gun/assets/albedo.png.import
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cvtqt0k2ewd07"
|
||||
path.s3tc="res://.godot/imported/albedo.png-7f543d432ab75668956abd5bcc51a13b.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://weapons/space_gun/assets/albedo.png"
|
||||
dest_files=["res://.godot/imported/albedo.png-7f543d432ab75668956abd5bcc51a13b.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=0
|
||||
11
weapons/space_gun/assets/material.tres
Normal file
11
weapons/space_gun/assets/material.tres
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://de6t4olk7hrs1"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cvtqt0k2ewd07" path="res://weapons/space_gun/assets/albedo.png" id="1_36iph"]
|
||||
[ext_resource type="Shader" path="res://shaders/zclip.gdshader" id="1_c4uko"]
|
||||
|
||||
[resource]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_c4uko")
|
||||
shader_parameter/FOV = 70.0
|
||||
shader_parameter/albedo = Color(1, 1, 1, 1)
|
||||
shader_parameter/texture_albedo = ExtResource("1_36iph")
|
||||
BIN
weapons/space_gun/assets/textures/albedo0.png
Normal file
BIN
weapons/space_gun/assets/textures/albedo0.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 364 KiB |
34
weapons/space_gun/assets/textures/albedo0.png.import
Normal file
34
weapons/space_gun/assets/textures/albedo0.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b30y3pq4u5r0h"
|
||||
path="res://.godot/imported/albedo0.png-8dedb9e51f95ee8e69f9a00bccf9fb16.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://weapons/space_gun/assets/textures/albedo0.png"
|
||||
dest_files=["res://.godot/imported/albedo0.png-8dedb9e51f95ee8e69f9a00bccf9fb16.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
37
weapons/space_gun/projectile.gd
Normal file
37
weapons/space_gun/projectile.gd
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
extends Node3D
|
||||
|
||||
const speed : float = 68.0
|
||||
var velocity : Vector3 = Vector3.ZERO
|
||||
|
||||
# @FIXME: with an imaginary box around the map
|
||||
const lifespan : float = 5.0 # in seconds
|
||||
|
||||
@onready var shape_cast = $ShapeCast3D
|
||||
@onready var game = get_tree().get_current_scene()
|
||||
|
||||
const EXPLOSION = preload("res://weapons/space_gun/projectile_explosion.tscn")
|
||||
|
||||
func _ready():
|
||||
var lifespan_timer = Timer.new()
|
||||
lifespan_timer.set_wait_time(lifespan)
|
||||
lifespan_timer.set_one_shot(true)
|
||||
lifespan_timer.set_autostart(true)
|
||||
lifespan_timer.timeout.connect(self_destruct)
|
||||
add_child(lifespan_timer)
|
||||
|
||||
func self_destruct():
|
||||
explode(position)
|
||||
|
||||
func explode(spawn_location):
|
||||
var spawned_explosion = EXPLOSION.instantiate()
|
||||
spawned_explosion.position = spawn_location
|
||||
game.add_child(spawned_explosion)
|
||||
spawned_explosion.explode()
|
||||
queue_free()
|
||||
|
||||
func _physics_process(delta):
|
||||
global_position += velocity * delta
|
||||
shape_cast.target_position = to_local(global_position - velocity) * delta
|
||||
if shape_cast.is_colliding():
|
||||
var contact_point = shape_cast.collision_result[0].point
|
||||
explode(contact_point)
|
||||
29
weapons/space_gun/projectile.tscn
Normal file
29
weapons/space_gun/projectile.tscn
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dn1tcakam5egs"]
|
||||
|
||||
[ext_resource type="Script" path="res://weapons/space_gun/projectile.gd" id="1_4j1dp"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o6j55"]
|
||||
albedo_color = Color(0, 0.498039, 0.854902, 1)
|
||||
emission_enabled = true
|
||||
emission = Color(0.482353, 0.65098, 1, 1)
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_umtte"]
|
||||
radius = 0.3
|
||||
|
||||
[node name="Projectile" type="Node3D"]
|
||||
script = ExtResource("1_4j1dp")
|
||||
|
||||
[node name="Mesh" type="CSGSphere3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0, 0)
|
||||
radius = 0.3
|
||||
radial_segments = 24
|
||||
rings = 8
|
||||
material = SubResource("StandardMaterial3D_o6j55")
|
||||
|
||||
[node name="ShapeCast3D" type="ShapeCast3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0, 0)
|
||||
shape = SubResource("SphereShape3D_umtte")
|
||||
target_position = Vector3(0, 0, 0)
|
||||
margin = 0.1
|
||||
max_results = 1
|
||||
debug_shape_custom_color = Color(1, 0, 0, 1)
|
||||
24
weapons/space_gun/projectile_explosion.gd
Normal file
24
weapons/space_gun/projectile_explosion.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var fire = $Fire
|
||||
@onready var explosion_area = $Area3D
|
||||
var explosion_effect_pending : bool = false
|
||||
|
||||
const impulse_force = 1000;
|
||||
|
||||
func explode():
|
||||
explosion_effect_pending = true
|
||||
fire.emitting = true
|
||||
|
||||
func _physics_process(_delta):
|
||||
if explosion_effect_pending:
|
||||
var bodies = explosion_area.get_overlapping_bodies()
|
||||
|
||||
for body in bodies:
|
||||
if body is RigidBody3D:
|
||||
var direction = (body.global_position - global_position).normalized()
|
||||
body.apply_central_impulse(direction * impulse_force)
|
||||
|
||||
explosion_effect_pending = false
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
queue_free()
|
||||
39
weapons/space_gun/projectile_explosion.tscn
Normal file
39
weapons/space_gun/projectile_explosion.tscn
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://8atq41j7wd55"]
|
||||
|
||||
[ext_resource type="Script" path="res://weapons/space_gun/projectile_explosion.gd" id="1_fp5td"]
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_3mf41"]
|
||||
spread = 180.0
|
||||
initial_velocity_min = 12.0
|
||||
initial_velocity_max = 12.0
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wpu51"]
|
||||
albedo_color = Color(0.819608, 0, 0, 1)
|
||||
emission_enabled = true
|
||||
emission = Color(1, 0.254902, 0.109804, 1)
|
||||
emission_energy_multiplier = 4.0
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_k3pnh"]
|
||||
material = SubResource("StandardMaterial3D_wpu51")
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ou8x6"]
|
||||
radius = 5.0
|
||||
|
||||
[node name="ProjectileExplosion" type="Node3D"]
|
||||
script = ExtResource("1_fp5td")
|
||||
|
||||
[node name="Fire" type="GPUParticles3D" parent="."]
|
||||
emitting = false
|
||||
amount = 24
|
||||
lifetime = 0.5
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
fixed_fps = 60
|
||||
process_material = SubResource("ParticleProcessMaterial_3mf41")
|
||||
draw_pass_1 = SubResource("SphereMesh_k3pnh")
|
||||
|
||||
[node name="Area3D" type="Area3D" parent="."]
|
||||
input_ray_pickable = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
|
||||
shape = SubResource("SphereShape3D_ou8x6")
|
||||
37
weapons/space_gun/space_gun.gd
Normal file
37
weapons/space_gun/space_gun.gd
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
extends Node3D
|
||||
class_name SpaceGun
|
||||
|
||||
signal shoot(projectile, velocity, initial_location, initial_rotation)
|
||||
|
||||
const PROJECTILE = preload("res://weapons/space_gun/projectile.tscn")
|
||||
|
||||
@onready var nozzle = $Nozzle
|
||||
@onready var inventory = get_parent()
|
||||
|
||||
const ammo_max : int = 20
|
||||
var ammo : int = ammo_max
|
||||
|
||||
var inheritance : float = 100.0 # percent
|
||||
|
||||
func print_node_properties(node):
|
||||
var properties = node.get_property_list()
|
||||
for prop in properties:
|
||||
prints(prop.name, node.get(prop.name))
|
||||
|
||||
func _ready():
|
||||
shoot.connect(_on_shoot)
|
||||
|
||||
func _input(_event):
|
||||
if Input.is_action_just_pressed("fire_primary"):
|
||||
var projectile = PROJECTILE.instantiate()
|
||||
shoot.emit(projectile, nozzle, inventory.owner)
|
||||
|
||||
func _on_shoot(projectile, origin, player):
|
||||
projectile.position = origin.global_position
|
||||
projectile.rotation = origin.global_rotation
|
||||
projectile.velocity = origin.global_basis.z.normalized() * projectile.speed
|
||||
var inheritance_factor = clamp(inheritance, 0., 100.) / 100.
|
||||
projectile.velocity += (player.linear_velocity * inheritance_factor)
|
||||
inventory.owner.add_sibling(projectile)
|
||||
var collider = projectile.shape_cast
|
||||
collider.add_exception(player)
|
||||
78
weapons/space_gun/space_gun.tscn
Normal file
78
weapons/space_gun/space_gun.tscn
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue