visibility rework

This commit is contained in:
Rendo 2025-11-27 15:52:30 +05:00
commit 9d0e09220d
37 changed files with 212 additions and 75 deletions

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=8 format=3 uid="uid://cqrh2cc7m2i7f"] [gd_scene load_steps=9 format=3 uid="uid://cqrh2cc7m2i7f"]
[ext_resource type="Environment" uid="uid://d0cfgtx2yxw13" path="res://environments/prototype_environment.tres" id="1_i6jab"] [ext_resource type="Environment" uid="uid://d0cfgtx2yxw13" path="res://environments/prototype_environment.tres" id="1_i6jab"]
[ext_resource type="Script" uid="uid://ypgm3aplt78m" path="res://scripts/multiplayer/team_spawner.gd" id="4_pi0y7"] [ext_resource type="Script" uid="uid://ypgm3aplt78m" path="res://scripts/multiplayer/team_spawner.gd" id="4_pi0y7"]
[ext_resource type="Material" uid="uid://bx3f5vx71ynh5" path="res://materials/OrangeMat.tres" id="4_y6i55"] [ext_resource type="Material" uid="uid://bx3f5vx71ynh5" path="res://materials/OrangeMat.tres" id="4_y6i55"]
[ext_resource type="Material" uid="uid://mlha6r17v2en" path="res://materials/Bluemat.tres" id="5_bno23"] [ext_resource type="Material" uid="uid://mlha6r17v2en" path="res://materials/Bluemat.tres" id="5_bno23"]
[ext_resource type="Script" uid="uid://be7l33prlm8gh" path="res://scripts/multiplayer/dynamic_objects_container.gd" id="5_y6i55"]
[sub_resource type="Animation" id="Animation_y6i55"] [sub_resource type="Animation" id="Animation_y6i55"]
length = 0.001 length = 0.001
@ -98,29 +99,38 @@ polygon = PackedVector2Array(1.1265539, -0.16863012, -3.9689837, 4.1396155, -6.2
depth = 2.64 depth = 2.64
material = ExtResource("5_bno23") material = ExtResource("5_bno23")
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
_spawnable_scenes = PackedStringArray("uid://dpsr6ug3pkb40", "uid://ckjabjcvgki6n")
spawn_path = NodePath("..")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = { libraries = {
&"": SubResource("AnimationLibrary_bno23") &"": SubResource("AnimationLibrary_bno23")
} }
autoplay = "main" autoplay = "main"
[node name="DefenceSpawn" type="Marker3D" parent="."] [node name="PlayersContainer" type="Node3D" parent="."]
[node name="DefenceSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.2367034, 0.5180037, -10.260834) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.2367034, 0.5180037, -10.260834)
script = ExtResource("4_pi0y7") script = ExtResource("4_pi0y7")
spawn_radius = 10.0 spawn_radius = 10.0
[node name="AttackSpawn" type="Marker3D" parent="."] [node name="AttackSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -32.38732, 0.5180037, 8.271217) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -32.38732, 0.5180037, 8.271217)
script = ExtResource("4_pi0y7") script = ExtResource("4_pi0y7")
team = 1 team = 1
spawn_radius = 10.0 spawn_radius = 10.0
[node name="SpectatorSpawn" type="Marker3D" parent="."] [node name="SpectatorSpawn" type="Marker3D" parent="PlayersContainer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.0165482, 17.832424, 2.9756432) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.0165482, 17.832424, 2.9756432)
script = ExtResource("4_pi0y7") script = ExtResource("4_pi0y7")
team = 2 team = 2
spawn_radius = 10.0 spawn_radius = 10.0
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="PlayersContainer"]
_spawnable_scenes = PackedStringArray("uid://dpsr6ug3pkb40", "uid://ckjabjcvgki6n")
spawn_path = NodePath("..")
[node name="DynamicObjectsContainer" type="Node3D" parent="."]
script = ExtResource("5_y6i55")
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="DynamicObjectsContainer"]
_spawnable_scenes = PackedStringArray("uid://dtbpyfdawb02b")
spawn_path = NodePath("..")

View file

@ -4,12 +4,12 @@ importer="scene"
importer_version=1 importer_version=1
type="PackedScene" type="PackedScene"
uid="uid://c3hg4ux4j76j2" uid="uid://c3hg4ux4j76j2"
path="res://.godot/imported/molikman_hands.glb-28dc337a5d818e73f3f959c666943024.scn" path="res://.godot/imported/molikman_hands.glb-17829dafd195d0cd3da4b3a21f0bdff6.scn"
[deps] [deps]
source_file="res://models/molikman_hands.glb" source_file="res://models/characters/viewmodels/molikman_hands.glb"
dest_files=["res://.godot/imported/molikman_hands.glb-28dc337a5d818e73f3f959c666943024.scn"] dest_files=["res://.godot/imported/molikman_hands.glb-17829dafd195d0cd3da4b3a21f0bdff6.scn"]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 461 KiB

After

Width:  |  Height:  |  Size: 461 KiB

Before After
Before After

View file

@ -2,8 +2,8 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://eo4fkc3b4h01" uid="uid://c81mv6bw6gr6t"
path.s3tc="res://.godot/imported/molikman_hands_tex_Molikman.png-00eab978ebbbebd3d27ba6449445dd5a.s3tc.ctex" path.s3tc="res://.godot/imported/molikman_hands_tex_Molikman.png-309150e72c75bcb8d14d5eaef94f2a57.s3tc.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "imported_formats": ["s3tc_bptc"],
"vram_texture": true "vram_texture": true
@ -14,8 +14,8 @@ generator_parameters={
[deps] [deps]
source_file="res://models/molikman_hands_tex_Molikman.png" source_file="res://models/characters/viewmodels/molikman_hands_tex_Molikman.png"
dest_files=["res://.godot/imported/molikman_hands_tex_Molikman.png-00eab978ebbbebd3d27ba6449445dd5a.s3tc.ctex"] dest_files=["res://.godot/imported/molikman_hands_tex_Molikman.png-309150e72c75bcb8d14d5eaef94f2a57.s3tc.ctex"]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Before After
Before After

View file

@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://twxsiwqgu1dy"
path.s3tc="res://.godot/imported/molikman_hands_tex_bomb.png-f43d1a526d57ce29d4126c1880d5be9a.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "478cd944aa7bbc08b6e05bea8b51b71e"
}
[deps]
source_file="res://models/characters/viewmodels/molikman_hands_tex_bomb.png"
dest_files=["res://.godot/imported/molikman_hands_tex_bomb.png-f43d1a526d57ce29d4126c1880d5be9a.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

View file

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Before After
Before After

View file

@ -2,8 +2,8 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://cheflq6sljpmk" uid="uid://mjmyeeb7m7yy"
path.s3tc="res://.godot/imported/molikman_hands_tex_sp_albedo.png-1f43db41736e6d0c2527c3839e087d2e.s3tc.ctex" path.s3tc="res://.godot/imported/molikman_hands_tex_sp_albedo.png-eeec5d3a3e4d9bcb56cdb0eedad0e3d5.s3tc.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "imported_formats": ["s3tc_bptc"],
"vram_texture": true "vram_texture": true
@ -14,8 +14,8 @@ generator_parameters={
[deps] [deps]
source_file="res://models/molikman_hands_tex_sp_albedo.png" source_file="res://models/characters/viewmodels/molikman_hands_tex_sp_albedo.png"
dest_files=["res://.godot/imported/molikman_hands_tex_sp_albedo.png-1f43db41736e6d0c2527c3839e087d2e.s3tc.ctex"] dest_files=["res://.godot/imported/molikman_hands_tex_sp_albedo.png-eeec5d3a3e4d9bcb56cdb0eedad0e3d5.s3tc.ctex"]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

View file

@ -2,8 +2,8 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://cppa8jv8ean45" uid="uid://cmpn3gco5t5p2"
path.s3tc="res://.godot/imported/molikman_hands_tex_sp_roughness.png-ff414b619c112cac9e303a92eba0d925.s3tc.ctex" path.s3tc="res://.godot/imported/molikman_hands_tex_sp_roughness.png-c6dffe5c091cc4a6b361ce8b971b2c3c.s3tc.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "imported_formats": ["s3tc_bptc"],
"vram_texture": true "vram_texture": true
@ -14,8 +14,8 @@ generator_parameters={
[deps] [deps]
source_file="res://models/molikman_hands_tex_sp_roughness.png" source_file="res://models/characters/viewmodels/molikman_hands_tex_sp_roughness.png"
dest_files=["res://.godot/imported/molikman_hands_tex_sp_roughness.png-ff414b619c112cac9e303a92eba0d925.s3tc.ctex"] dest_files=["res://.godot/imported/molikman_hands_tex_sp_roughness.png-c6dffe5c091cc4a6b361ce8b971b2c3c.s3tc.ctex"]
[params] [params]

View file

@ -4,12 +4,12 @@ importer="scene"
importer_version=1 importer_version=1
type="PackedScene" type="PackedScene"
uid="uid://c2r8dbudbs7l3" uid="uid://c2r8dbudbs7l3"
path="res://.godot/imported/molikman_ingame.glb-dc1d9902b7bc622e5bda8fed04560710.scn" path="res://.godot/imported/molikman_ingame.glb-aaebce235b7cde5aaa332a05b6193b29.scn"
[deps] [deps]
source_file="res://models/molikman_ingame.glb" source_file="res://models/characters/worldmodels/molikman_ingame.glb"
dest_files=["res://.godot/imported/molikman_ingame.glb-dc1d9902b7bc622e5bda8fed04560710.scn"] dest_files=["res://.godot/imported/molikman_ingame.glb-aaebce235b7cde5aaa332a05b6193b29.scn"]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 461 KiB

After

Width:  |  Height:  |  Size: 461 KiB

Before After
Before After

View file

@ -2,8 +2,8 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://bfc7syqoe06pt" uid="uid://d1rfpdlpfnt5w"
path.s3tc="res://.godot/imported/molikman_ingame_tex_Molikman.png-5702ec26cbf18695fea633cff99e732a.s3tc.ctex" path.s3tc="res://.godot/imported/molikman_ingame_tex_Molikman.png-fa994ec91481577d99049156480274fc.s3tc.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "imported_formats": ["s3tc_bptc"],
"vram_texture": true "vram_texture": true
@ -14,8 +14,8 @@ generator_parameters={
[deps] [deps]
source_file="res://models/molikman_ingame_tex_Molikman.png" source_file="res://models/characters/worldmodels/molikman_ingame_tex_Molikman.png"
dest_files=["res://.godot/imported/molikman_ingame_tex_Molikman.png-5702ec26cbf18695fea633cff99e732a.s3tc.ctex"] dest_files=["res://.godot/imported/molikman_ingame_tex_Molikman.png-fa994ec91481577d99049156480274fc.s3tc.ctex"]
[params] [params]

BIN
models/weapons/Bomb.glb Normal file

Binary file not shown.

View file

@ -0,0 +1,42 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dftij0fdq3lbr"
path="res://.godot/imported/Bomb.glb-d4aa7dce05e968f36a20d01a6e8c400f.scn"
[deps]
source_file="res://models/weapons/Bomb.glb"
dest_files=["res://.godot/imported/Bomb.glb-d4aa7dce05e968f36a20d01a6e8c400f.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
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
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
gltf/naming_version=2
gltf/embedded_image_handling=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View file

@ -2,8 +2,8 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://2fho0wsa054v" uid="uid://kiprxlfy83qr"
path.s3tc="res://.godot/imported/molikman_hands_tex_bomb.png-7baac85b3f254b7ca25ecb123abd1736.s3tc.ctex" path.s3tc="res://.godot/imported/Bomb_tex_bomb.png-9ebaef1ac68a22dd59a32bc05f6a9a4b.s3tc.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "imported_formats": ["s3tc_bptc"],
"vram_texture": true "vram_texture": true
@ -14,8 +14,8 @@ generator_parameters={
[deps] [deps]
source_file="res://models/molikman_hands_tex_bomb.png" source_file="res://models/weapons/Bomb_tex_bomb.png"
dest_files=["res://.godot/imported/molikman_hands_tex_bomb.png-7baac85b3f254b7ca25ecb123abd1736.s3tc.ctex"] dest_files=["res://.godot/imported/Bomb_tex_bomb.png-9ebaef1ac68a22dd59a32bc05f6a9a4b.s3tc.ctex"]
[params] [params]

View file

@ -4,12 +4,12 @@ importer="scene"
importer_version=1 importer_version=1
type="PackedScene" type="PackedScene"
uid="uid://d3sjs6efbshpk" uid="uid://d3sjs6efbshpk"
path="res://.godot/imported/starting_pistol.glb-29198af604eac72687b4adaf951ef022.scn" path="res://.godot/imported/starting_pistol.glb-5a510d4729ccd8a4a1a6e6b87c5e9d4d.scn"
[deps] [deps]
source_file="res://models/starting_pistol.glb" source_file="res://models/weapons/starting_pistol.glb"
dest_files=["res://.godot/imported/starting_pistol.glb-29198af604eac72687b4adaf951ef022.scn"] dest_files=["res://.godot/imported/starting_pistol.glb-5a510d4729ccd8a4a1a6e6b87c5e9d4d.scn"]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Before After
Before After

View file

@ -2,8 +2,8 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://yl82ojt8wph5" uid="uid://dby4gckjjasjg"
path.s3tc="res://.godot/imported/starting_pistol_tex_sp_albedo.png-8161f1ff7d1a76474d978c2a86f54261.s3tc.ctex" path.s3tc="res://.godot/imported/starting_pistol_tex_sp_albedo.png-b67d5560b2f5fdc20868def544d0d36d.s3tc.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "imported_formats": ["s3tc_bptc"],
"vram_texture": true "vram_texture": true
@ -14,8 +14,8 @@ generator_parameters={
[deps] [deps]
source_file="res://models/starting_pistol_tex_sp_albedo.png" source_file="res://models/weapons/starting_pistol_tex_sp_albedo.png"
dest_files=["res://.godot/imported/starting_pistol_tex_sp_albedo.png-8161f1ff7d1a76474d978c2a86f54261.s3tc.ctex"] dest_files=["res://.godot/imported/starting_pistol_tex_sp_albedo.png-b67d5560b2f5fdc20868def544d0d36d.s3tc.ctex"]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

View file

@ -2,8 +2,8 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://bb302fhk1eu05" uid="uid://u5ofn7whunh"
path.s3tc="res://.godot/imported/starting_pistol_tex_sp_roughness.png-2f38dacd3f9e1e69ced706fb91133b7c.s3tc.ctex" path.s3tc="res://.godot/imported/starting_pistol_tex_sp_roughness.png-5f5db40d7fa74c333919ab39658cbad8.s3tc.ctex"
metadata={ metadata={
"imported_formats": ["s3tc_bptc"], "imported_formats": ["s3tc_bptc"],
"vram_texture": true "vram_texture": true
@ -14,8 +14,8 @@ generator_parameters={
[deps] [deps]
source_file="res://models/starting_pistol_tex_sp_roughness.png" source_file="res://models/weapons/starting_pistol_tex_sp_roughness.png"
dest_files=["res://.godot/imported/starting_pistol_tex_sp_roughness.png-2f38dacd3f9e1e69ced706fb91133b7c.s3tc.ctex"] dest_files=["res://.godot/imported/starting_pistol_tex_sp_roughness.png-5f5db40d7fa74c333919ab39658cbad8.s3tc.ctex"]
[params] [params]

View file

@ -3,7 +3,7 @@
[ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"] [ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"]
[ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"] [ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
[ext_resource type="Script" uid="uid://bjhbdh6xsjgnn" path="res://scripts/player/player_camera.gd" id="3_qhqgy"] [ext_resource type="Script" uid="uid://bjhbdh6xsjgnn" path="res://scripts/player/player_camera.gd" id="3_qhqgy"]
[ext_resource type="PackedScene" uid="uid://c3hg4ux4j76j2" path="res://models/molikman_hands.glb" id="4_dqkch"] [ext_resource type="PackedScene" uid="uid://c3hg4ux4j76j2" path="res://models/characters/viewmodels/molikman_hands.glb" id="4_dqkch"]
[ext_resource type="Script" uid="uid://6c14qse4vnra" path="res://scripts/player/player_raycast.gd" id="4_fjrip"] [ext_resource type="Script" uid="uid://6c14qse4vnra" path="res://scripts/player/player_raycast.gd" id="4_fjrip"]
[ext_resource type="Script" uid="uid://bmecgup3kcua7" path="res://scripts/weapon_system/weapon_system.gd" id="4_qlg0r"] [ext_resource type="Script" uid="uid://bmecgup3kcua7" path="res://scripts/weapon_system/weapon_system.gd" id="4_qlg0r"]
[ext_resource type="Script" uid="uid://dd5mp72dq43v6" path="res://scripts/multiplayer/own_visibility_toggle.gd" id="4_smehm"] [ext_resource type="Script" uid="uid://dd5mp72dq43v6" path="res://scripts/multiplayer/own_visibility_toggle.gd" id="4_smehm"]
@ -11,7 +11,7 @@
[ext_resource type="PackedScene" uid="uid://djwjl8xll53vn" path="res://scenes/weapons/starting_pistol.tscn" id="7_fjrip"] [ext_resource type="PackedScene" uid="uid://djwjl8xll53vn" path="res://scenes/weapons/starting_pistol.tscn" id="7_fjrip"]
[ext_resource type="Script" uid="uid://7gmgcaxfh8sb" path="res://scripts/debug/property_shower.gd" id="7_oprun"] [ext_resource type="Script" uid="uid://7gmgcaxfh8sb" path="res://scripts/debug/property_shower.gd" id="7_oprun"]
[ext_resource type="Script" uid="uid://3777rkbebgjm" path="res://scripts/state_machine/machine.gd" id="8_f1ej7"] [ext_resource type="Script" uid="uid://3777rkbebgjm" path="res://scripts/state_machine/machine.gd" id="8_f1ej7"]
[ext_resource type="PackedScene" uid="uid://c2r8dbudbs7l3" path="res://models/molikman_ingame.glb" id="8_smehm"] [ext_resource type="PackedScene" uid="uid://c2r8dbudbs7l3" path="res://models/characters/worldmodels/molikman_ingame.glb" id="8_smehm"]
[ext_resource type="Script" uid="uid://bv8sgx78s8hwn" path="res://scripts/player/states/crouching.gd" id="9_oprun"] [ext_resource type="Script" uid="uid://bv8sgx78s8hwn" path="res://scripts/player/states/crouching.gd" id="9_oprun"]
[ext_resource type="Script" uid="uid://u0e2b2mvij1k" path="res://scripts/player/states/standing.gd" id="10_a8ls1"] [ext_resource type="Script" uid="uid://u0e2b2mvij1k" path="res://scripts/player/states/standing.gd" id="10_a8ls1"]
[ext_resource type="Script" uid="uid://cwasvwhm5yg0o" path="res://scripts/player/states/walk.gd" id="11_qfm1y"] [ext_resource type="Script" uid="uid://cwasvwhm5yg0o" path="res://scripts/player/states/walk.gd" id="11_qfm1y"]
@ -125,10 +125,14 @@ _data = {
&"crouch": SubResource("Animation_oprun") &"crouch": SubResource("Animation_oprun")
} }
[node name="Player" type="CharacterBody3D"] [node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("weapon_models")]
collision_layer = 2 collision_layer = 2
collision_mask = 3 collision_mask = 3
script = ExtResource("1_g2els") script = ExtResource("1_g2els")
weapon_models = {
&"bomb": NodePath("Camera3D/molikman_hands/Armature"),
&"sp": NodePath("Camera3D/molikman_hands/GunArm")
}
[node name="molikman_ingame" parent="." instance=ExtResource("8_smehm")] [node name="molikman_ingame" parent="." instance=ExtResource("8_smehm")]
transform = Transform3D(0.75, 0, 0, 0, 0.75, 0, 0, 0, 0.75, 0, 1.1793717, 0) transform = Transform3D(0.75, 0, 0, 0, 0.75, 0, 0, 0, 0.75, 0, 1.1793717, 0)
@ -248,21 +252,20 @@ script = ExtResource("12_fulsm")
player = NodePath("../..") player = NodePath("../..")
SPEED = 5.0 SPEED = 5.0
[node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("default_pistol", "default_knife", "animation_player", "camera")] [node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("default_pistol", "default_knife", "animation_player", "camera", "player")]
script = ExtResource("4_qlg0r") script = ExtResource("4_qlg0r")
default_pistol = NodePath("StartingPistol") default_pistol = NodePath("StartingPistol")
default_knife = NodePath("Bomb") default_knife = NodePath("Bomb")
animation_player = NodePath("../Camera3D/molikman_hands/AnimationPlayer") animation_player = NodePath("../Camera3D/molikman_hands/AnimationPlayer")
camera = NodePath("../Camera3D") camera = NodePath("../Camera3D")
player = NodePath("..")
[node name="StartingPistol" parent="WeaponSystem" node_paths=PackedStringArray("visibility_mesh") instance=ExtResource("7_fjrip")] [node name="StartingPistol" parent="WeaponSystem" instance=ExtResource("7_fjrip")]
visibility_mesh = NodePath("../../Camera3D/molikman_hands/GunArm")
[node name="Shoot" parent="WeaponSystem/StartingPistol" index="1" node_paths=PackedStringArray("raycast")] [node name="Shoot" parent="WeaponSystem/StartingPistol" index="1" node_paths=PackedStringArray("raycast")]
raycast = NodePath("../../../Camera3D/RayCast3D") raycast = NodePath("../../../Camera3D/RayCast3D")
[node name="Bomb" parent="WeaponSystem" node_paths=PackedStringArray("visibility_mesh") instance=ExtResource("17_fjvrb")] [node name="Bomb" parent="WeaponSystem" instance=ExtResource("17_fjvrb")]
visibility_mesh = NodePath("../../Camera3D/molikman_hands/Armature")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = { libraries = {

View file

@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3 uid="uid://dtbpyfdawb02b"]
[ext_resource type="PackedScene" uid="uid://dftij0fdq3lbr" path="res://models/weapons/Bomb.glb" id="1_yh58y"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_yh58y"]
properties/0/path = NodePath(".:position")
properties/0/spawn = true
properties/0/replication_mode = 2
[node name="ActiveBomb" type="Node3D"]
[node name="Bomb" parent="." instance=ExtResource("1_yh58y")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1307683, 0)
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_yh58y")

View file

@ -1,11 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://bxdatd1ilfgmc"] [gd_scene load_steps=4 format=3 uid="uid://bxdatd1ilfgmc"]
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://scripts/weapon_system/weapon_substate_machine.gd" id="1_krsgt"] [ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://scripts/weapon_system/weapon_substate_machine.gd" id="1_krsgt"]
[ext_resource type="PackedScene" uid="uid://dftij0fdq3lbr" path="res://models/weapons/Bomb.glb" id="2_1x0so"]
[ext_resource type="Script" uid="uid://rx78vdadldm7" path="res://scripts/weapon_system/bomb/bomb_state.gd" id="2_870cc"] [ext_resource type="Script" uid="uid://rx78vdadldm7" path="res://scripts/weapon_system/bomb/bomb_state.gd" id="2_870cc"]
[node name="Bomb" type="Node" node_paths=PackedStringArray("enter_state")] [node name="Bomb" type="Node" node_paths=PackedStringArray("enter_state")]
script = ExtResource("1_krsgt") script = ExtResource("1_krsgt")
animation_prefix = &"baked_bomb_" animation_prefix = &"baked_bomb_"
model = ExtResource("2_1x0so")
visibility_target = &"bomb"
max_ammo = 1 max_ammo = 1
can_be_previous = false can_be_previous = false
enter_state = NodePath("Main") enter_state = NodePath("Main")

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=8 format=3 uid="uid://djwjl8xll53vn"] [gd_scene load_steps=9 format=3 uid="uid://djwjl8xll53vn"]
[ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://scripts/weapon_system/weapon_substate_machine.gd" id="1_g7s1i"] [ext_resource type="Script" uid="uid://e6lqknfl4ngt" path="res://scripts/weapon_system/weapon_substate_machine.gd" id="1_g7s1i"]
[ext_resource type="PackedScene" uid="uid://d3sjs6efbshpk" path="res://models/weapons/starting_pistol.glb" id="2_016ti"]
[ext_resource type="Script" uid="uid://ofv4e3dsfe8" path="res://scripts/weapon_system/gun/idle_state.gd" id="2_cmn6f"] [ext_resource type="Script" uid="uid://ofv4e3dsfe8" path="res://scripts/weapon_system/gun/idle_state.gd" id="2_cmn6f"]
[ext_resource type="Script" uid="uid://vj13r83l3xyq" path="res://scripts/weapon_system/gun/semi_auto_shoot_state.gd" id="3_016ti"] [ext_resource type="Script" uid="uid://vj13r83l3xyq" path="res://scripts/weapon_system/gun/semi_auto_shoot_state.gd" id="3_016ti"]
[ext_resource type="Script" uid="uid://hmekwp8444ao" path="res://scripts/weapon_system/gun/reload_state.gd" id="4_hoqxt"] [ext_resource type="Script" uid="uid://hmekwp8444ao" path="res://scripts/weapon_system/gun/reload_state.gd" id="4_hoqxt"]
@ -21,6 +22,8 @@ point_count = 5
[node name="StartingPistol" type="Node" node_paths=PackedStringArray("enter_state")] [node name="StartingPistol" type="Node" node_paths=PackedStringArray("enter_state")]
script = ExtResource("1_g7s1i") script = ExtResource("1_g7s1i")
animation_prefix = &"baked_sp_" animation_prefix = &"baked_sp_"
model = ExtResource("2_016ti")
visibility_target = &"sp"
max_ammo = 20 max_ammo = 20
enter_state = NodePath("Intro") enter_state = NodePath("Intro")
metadata/_custom_type_script = "uid://e6lqknfl4ngt" metadata/_custom_type_script = "uid://e6lqknfl4ngt"

View file

@ -0,0 +1,5 @@
extends Node3D
func _ready() -> void:
Session.dynamic_objects_container = self

View file

@ -0,0 +1 @@
uid://be7l33prlm8gh

View file

@ -5,3 +5,5 @@ enum TEAMS {
ATTACK, ATTACK,
SPECTATE SPECTATE
} }
var dynamic_objects_container: Node3D

View file

@ -31,7 +31,7 @@ func spawn_spectator(id: int) -> void:
deferred_setup.bind(inst,Session.TEAMS.SPECTATE).call_deferred() deferred_setup.bind(inst,Session.TEAMS.SPECTATE).call_deferred()
func deferred_setup(what: Node3D, new_team: Session.TEAMS): func deferred_setup(what: Node3D, new_team: Session.TEAMS):
get_tree().current_scene.add_child(what) get_parent().add_child(what)
var distance = randf_range(0,spawn_radius) var distance = randf_range(0,spawn_radius)
var angle = randf_range(0,TAU) var angle = randf_range(0,TAU)
var new_position = global_position + Vector3.RIGHT.rotated(Vector3.UP,angle) * distance var new_position = global_position + Vector3.RIGHT.rotated(Vector3.UP,angle) * distance

View file

@ -3,6 +3,7 @@ extends CharacterBody3D
class_name Player class_name Player
@export var team: Session.TEAMS @export var team: Session.TEAMS
@export var weapon_models: Dictionary[StringName,Node3D]
signal spawned signal spawned

View file

@ -1,5 +1,6 @@
extends WeaponState extends WeaponState
const active_bomb: PackedScene = preload("res://scenes/weapons/active_bomb.tscn")
func enter(): func enter():
machine.animation_player.play(machine.animation_prefix+"plant") machine.animation_player.play(machine.animation_prefix+"plant")
@ -10,8 +11,13 @@ func exit():
func on_animation_finished(animation: StringName): func on_animation_finished(animation: StringName):
if animation == machine.animation_prefix + "plant": if animation == machine.animation_prefix + "plant":
var bomb = active_bomb.instantiate()
Session.dynamic_objects_container.add_child(bomb,true)
bomb.global_position = machine.player_camera.get_parent().global_position
return_to_previous.emit() return_to_previous.emit()
func state_input(event: InputEvent) -> void: func state_input(event: InputEvent) -> void:
if event.is_action_released("plr_bomb"): if event.is_action_released("plr_bomb"):
return_to_previous.emit() return_to_previous.emit()

View file

@ -3,10 +3,12 @@ extends SubStateMachine
class_name WeaponSubStateMachine class_name WeaponSubStateMachine
@export var animation_prefix: StringName @export var animation_prefix: StringName
@export var visibility_mesh: Node3D @export var model: PackedScene
@export var visibility_target: StringName
@export var max_ammo: int @export var max_ammo: int
@onready var ammo: int = max_ammo @onready var ammo: int = max_ammo
@onready var remaining_ammo: int = max_ammo * 3
@export var can_be_previous: bool = true @export var can_be_previous: bool = true
@ -15,6 +17,7 @@ signal request_return
var system: WeaponSystem var system: WeaponSystem
var animation_player: AnimationPlayer var animation_player: AnimationPlayer
var player_camera: PlayerCamera var player_camera: PlayerCamera
var player: Player
func _ready() -> void: func _ready() -> void:
for child in get_children(): for child in get_children():
@ -26,11 +29,11 @@ func _ready() -> void:
func enter() -> void: func enter() -> void:
super() super()
visibility_mesh.visible = true player.weapon_models[visibility_target].show()
func exit() -> void: func exit() -> void:
super() super()
visibility_mesh.visible = false player.weapon_models[visibility_target].hide()
@rpc("authority","call_local","reliable") @rpc("authority","call_local","reliable")
func use_begin() -> void: func use_begin() -> void:

View file

@ -7,14 +7,15 @@ class_name WeaponSystem
@export var animation_player: AnimationPlayer @export var animation_player: AnimationPlayer
@export var camera: PlayerCamera @export var camera: PlayerCamera
@export var player: Player
var current_state: WeaponSubStateMachine var current_state: WeaponSubStateMachine
var last_slot: StringName var last_slot: StringName
var slots: Dictionary[StringName,WeaponSubStateMachine] = { var slots: Dictionary[StringName,WeaponSubStateMachine] = {
"primary": null, "primary": null,
"secondary": default_pistol, "secondary": null,
"knife": default_knife, "knife": null,
"bomb": null, "bomb": null,
"ability_first": null, "ability_first": null,
"ability_second": null, "ability_second": null,
@ -25,34 +26,31 @@ var slots: Dictionary[StringName,WeaponSubStateMachine] = {
signal switched_to(state: WeaponSubStateMachine) signal switched_to(state: WeaponSubStateMachine)
func _ready() -> void: func _ready() -> void:
for child in get_children():
if child is WeaponSubStateMachine:
child.system = self
child.animation_player = animation_player
child.player_camera = camera
child.request_return.connect(return_to_previous)
else:
push_warning("Child of weapon system is not ability or weapon")
current_state = default_pistol current_state = default_pistol
slots["knife"] = default_knife add(default_knife,"knife")
slots["secondary"] = default_pistol add(default_pistol,"secondary")
current_state.enter() current_state.enter()
func can_add(slot: StringName) -> bool: func can_add(slot: StringName) -> bool:
return slots.has(slot) return slots.has(slot) and slots[slot] == null
@rpc("call_local","reliable")
func add(state: WeaponSubStateMachine, slot: StringName) -> void: func add(state: WeaponSubStateMachine, slot: StringName) -> void:
if can_add(slot) == false: if can_add(slot) == false:
return return
print('leech')
if state.get_parent() == null:
add_child(state) add_child(state)
if state.get_parent() != self:
state.reparent(self)
slots[slot] = state slots[slot] = state
state.system = self state.system = self
state.animation_player = animation_player state.animation_player = animation_player
state.player_camera = camera state.player_camera = camera
state.player = player
state.request_return.connect(return_to_previous)
func switch(to: StringName): func switch(to: StringName):
if slots.has(to) == false or slots[to] == null or slots[to] == current_state: if slots.has(to) == false or slots[to] == null or slots[to] == current_state: