more various tweaks to held items and chests in order to make carrying chests fun
This commit is contained in:
@@ -3,25 +3,26 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b73sneqhodmjy"
|
||||
path="res://.godot/imported/chest1-low_chest1.hinge_BaseColor.png-e677c1ec48f3117604ffc73d36f4d0dc.ctex"
|
||||
path.s3tc="res://.godot/imported/chest1-low_chest1.hinge_BaseColor.png-e677c1ec48f3117604ffc73d36f4d0dc.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_BaseColor.png"
|
||||
dest_files=["res://.godot/imported/chest1-low_chest1.hinge_BaseColor.png-e677c1ec48f3117604ffc73d36f4d0dc.ctex"]
|
||||
dest_files=["res://.godot/imported/chest1-low_chest1.hinge_BaseColor.png-e677c1ec48f3117604ffc73d36f4d0dc.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
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=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
@@ -31,4 +32,4 @@ 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
|
||||
detect_3d/compress_to=0
|
||||
|
||||
@@ -3,25 +3,26 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bcswxt834jvxj"
|
||||
path="res://.godot/imported/chest1-low_chest1.hinge_Metallic.png-1bc29fbc5c7821edb88a7df25acda950.ctex"
|
||||
path.s3tc="res://.godot/imported/chest1-low_chest1.hinge_Metallic.png-1bc29fbc5c7821edb88a7df25acda950.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_Metallic.png"
|
||||
dest_files=["res://.godot/imported/chest1-low_chest1.hinge_Metallic.png-1bc29fbc5c7821edb88a7df25acda950.ctex"]
|
||||
dest_files=["res://.godot/imported/chest1-low_chest1.hinge_Metallic.png-1bc29fbc5c7821edb88a7df25acda950.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
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=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
@@ -31,4 +32,4 @@ 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
|
||||
detect_3d/compress_to=0
|
||||
|
||||
@@ -3,32 +3,33 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://4y2wbs6slkfu"
|
||||
path="res://.godot/imported/chest1-low_chest1.hinge_Normal.png-30813dfd50661662f810997b943193fb.ctex"
|
||||
path.s3tc="res://.godot/imported/chest1-low_chest1.hinge_Normal.png-30813dfd50661662f810997b943193fb.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_Normal.png"
|
||||
dest_files=["res://.godot/imported/chest1-low_chest1.hinge_Normal.png-30813dfd50661662f810997b943193fb.ctex"]
|
||||
dest_files=["res://.godot/imported/chest1-low_chest1.hinge_Normal.png-30813dfd50661662f810997b943193fb.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/normal_map=1
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
roughness/mode=1
|
||||
roughness/src_normal="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_Normal.png"
|
||||
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
|
||||
detect_3d/compress_to=0
|
||||
|
||||
@@ -3,25 +3,26 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b0ewa0o07myc3"
|
||||
path="res://.godot/imported/chest1-low_chest1.hinge_Roughness.png-50fe5877654c56f190396d2b8bb420a9.ctex"
|
||||
path.s3tc="res://.godot/imported/chest1-low_chest1.hinge_Roughness.png-50fe5877654c56f190396d2b8bb420a9.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_Roughness.png"
|
||||
dest_files=["res://.godot/imported/chest1-low_chest1.hinge_Roughness.png-50fe5877654c56f190396d2b8bb420a9.ctex"]
|
||||
dest_files=["res://.godot/imported/chest1-low_chest1.hinge_Roughness.png-50fe5877654c56f190396d2b8bb420a9.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
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=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
@@ -31,4 +32,4 @@ 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
|
||||
detect_3d/compress_to=0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=38 format=3 uid="uid://drwae3loscbw7"]
|
||||
[gd_scene load_steps=37 format=3 uid="uid://drwae3loscbw7"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/player.gd" id="1_x7wms"]
|
||||
[ext_resource type="Script" path="res://scripts/recoil.gd" id="3_405jc"]
|
||||
@@ -7,7 +7,6 @@
|
||||
[ext_resource type="PackedScene" uid="uid://br882tlh3cfwu" path="res://hud.tscn" id="5_yenaw"]
|
||||
[ext_resource type="AudioStream" uid="uid://bki17g7j4kqn4" path="res://assets/Audio/PickupSound Mixdown 3.wav" id="8_dwqsx"]
|
||||
[ext_resource type="Shader" path="res://assets/Shaders/speedlines.gdshader" id="10_5hu7c"]
|
||||
[ext_resource type="Script" path="res://scripts/bullet_ray.gd" id="10_ektr6"]
|
||||
[ext_resource type="AudioStream" uid="uid://dyd272r7n2ecd" path="res://assets/Audio/footsteps-shoes-jump-land-beach-sand-SBA-300118001.wav" id="10_tn0pn"]
|
||||
[ext_resource type="AudioStream" uid="uid://cjpvibojo13qv" path="res://assets/Audio/clock-ticking-exact-looping-SBA-300062891.wav" id="11_6k4fy"]
|
||||
[ext_resource type="AudioStream" uid="uid://bl8yg1d3bsxs3" path="res://assets/Audio/constant-natural-strong-wind-looping-SBA-300062687.wav" id="11_he7p5"]
|
||||
@@ -222,7 +221,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.487738)
|
||||
target_position = Vector3(0, 0, -200)
|
||||
collision_mask = 105
|
||||
collide_with_areas = true
|
||||
script = ExtResource("10_ektr6")
|
||||
|
||||
[node name="InteractRay" type="RayCast3D" parent="Head/Recoil/Camera3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.00322104, -0.0232438)
|
||||
|
||||
@@ -21,7 +21,7 @@ recoil_amount = Vector3(0.05, 0.05, 0.05)
|
||||
kick_amount = 0.1
|
||||
max_ammo = 20
|
||||
start_mags = 3
|
||||
bullet_damage = 1
|
||||
bullet_damage = 2
|
||||
smoke_enabled = false
|
||||
bullet_force_mod = 5.0
|
||||
bullet_speed = 600
|
||||
|
||||
@@ -19,8 +19,8 @@ ads = false
|
||||
recoil_amount = Vector3(0.05, 0.05, 0.05)
|
||||
kick_amount = 0.1
|
||||
max_ammo = 6
|
||||
start_mags = 1
|
||||
bullet_damage = 1
|
||||
start_mags = 3
|
||||
bullet_damage = 5
|
||||
smoke_enabled = false
|
||||
bullet_force_mod = 5.0
|
||||
bullet_speed = 1200
|
||||
|
||||
17
chest1.tscn
17
chest1.tscn
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=43 format=4 uid="uid://diefmwmyoc5of"]
|
||||
[gd_scene load_steps=47 format=4 uid="uid://diefmwmyoc5of"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/chest_1.gd" id="1_0qjnf"]
|
||||
[ext_resource type="Texture2D" uid="uid://bpo5wltswxbfs" path="res://assets/Models/SubstancePainterTest/chest1-low_chest1.base_BaseColor.png" id="1_e8125"]
|
||||
@@ -20,6 +20,10 @@
|
||||
[ext_resource type="Texture2D" uid="uid://wjqeybvbi584" path="res://assets/Models/SubstancePainterTest/chest1-low_chest1.lock_Normal.png" id="11_pdg8f"]
|
||||
[ext_resource type="Texture2D" uid="uid://bq0glgbvc75ue" path="res://assets/Models/SubstancePainterTest/chest1-low_chest1.lock_Roughness.png" id="12_ei51g"]
|
||||
[ext_resource type="Texture2D" uid="uid://d03e3v1yyks6l" path="res://assets/Models/SubstancePainterTest/chest1-low_chest1.band_Metallic.png" id="12_s5cat"]
|
||||
[ext_resource type="Texture2D" uid="uid://b73sneqhodmjy" path="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_BaseColor.png" id="13_qyl67"]
|
||||
[ext_resource type="Texture2D" uid="uid://bcswxt834jvxj" path="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_Metallic.png" id="14_nq6gg"]
|
||||
[ext_resource type="Texture2D" uid="uid://4y2wbs6slkfu" path="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_Normal.png" id="15_u8r22"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0ewa0o07myc3" path="res://assets/Models/SubstancePainterTest/chest1-low_chest1.hinge_Roughness.png" id="16_hltmh"]
|
||||
[ext_resource type="Script" path="res://scripts/target_collision.gd" id="18_j3j81"]
|
||||
[ext_resource type="AudioStream" uid="uid://b7uv25xlfv41p" path="res://assets/Audio/Foley Inventory and Interactions/Foley Inventory and Interactions/Drop Item/Drop Metal A.wav" id="19_an6dy"]
|
||||
[ext_resource type="AudioStream" uid="uid://dxoi2nyjbgbr6" path="res://assets/Audio/Foley Inventory and Interactions/Foley Inventory and Interactions/Drop Item/Drop Metal B.wav" id="20_52bd4"]
|
||||
@@ -37,11 +41,16 @@ normal_texture = ExtResource("4_aqsid")
|
||||
heightmap_texture = ExtResource("2_ioplr")
|
||||
texture_filter = 0
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_utrnj"]
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_toyun"]
|
||||
resource_name = "chest1.hinge"
|
||||
cull_mode = 2
|
||||
albedo_color = Color(0.906332, 0.906332, 0.906332, 1)
|
||||
roughness = 0.5
|
||||
albedo_texture = ExtResource("13_qyl67")
|
||||
metallic = 1.0
|
||||
metallic_texture = ExtResource("14_nq6gg")
|
||||
roughness_texture = ExtResource("16_hltmh")
|
||||
normal_enabled = true
|
||||
normal_texture = ExtResource("15_u8r22")
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_8dop3"]
|
||||
_surfaces = [{
|
||||
@@ -91,7 +100,7 @@ _surfaces = [{
|
||||
"index_count": 168,
|
||||
"index_data": PackedByteArray("AQAJAAQAAQAGAAkABwAQAAoABwANABAADAAWAA8ADAATABYAEgAcABUAEgAZABwAGAAhABsAGAAeACEAHwAnACIAHwAkACcAEQAFAAsABQApAC8AKQAdACMAHQARABcAEQApAAUAKQARAB0AJQAuACgAJQArAC4AKgADAC0AKgAAAAMALAAIAAIACAAUAA4AFAAgABoAIAAsACYALAAUAAgAFAAsACAAMQA5ADQAMQA2ADkANwBAADoANwA9AEAAPABGAD8APABDAEYAQgBMAEUAQgBJAEwASABRAEsASABOAFEATwBXAFIATwBUAFcAQQA1ADsANQBZAF8AWQBNAFMATQBBAEcAQQBZADUAWQBBAE0AVQBeAFgAVQBbAF4AWgAzAF0AWgAwADMAXAA4ADIAOABEAD4ARABQAEoAUABcAFYAXABEADgARABcAFAA"),
|
||||
"lods": [0.0181144, PackedByteArray("BgAQAAMABgANABAAKgAGAAMAKgADAC0ADAAbAA8ADAASABsAEgAnABsAEgAkACcABQApAC8AEQApAAUAKQARAB0AJQAuACgAJQArAC4ACAAUAA4ALAAUAAgAFAAsACYANgBAADMANgA9AEAAWgA2ADMAWgAzAF0APABLAD8APABCAEsAQgBXAEsAQgBUAFcANQBZAF8AQQBZADUAWQBBAE0AVQBeAFgAVQBbAF4AOABEAD4AXABEADgARABcAFYA")],
|
||||
"material": SubResource("StandardMaterial3D_utrnj"),
|
||||
"material": SubResource("StandardMaterial3D_toyun"),
|
||||
"name": "chest1.hinge",
|
||||
"primitive": 3,
|
||||
"uv_scale": Vector4(2, 2, 0, 0),
|
||||
|
||||
@@ -11,7 +11,7 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="First Person Test"
|
||||
run/main_scene="res://scenes/asset_checker.tscn"
|
||||
run/main_scene="res://assets/blockout_2.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=25 format=3 uid="uid://jdwpc622vmok"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://jdwpc622vmok"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/LevelManager.gd" id="1_1bnbi"]
|
||||
[ext_resource type="Resource" uid="uid://bxcxqt7rmfvdw" path="res://GameModes/hubworld.tres" id="2_62iy8"]
|
||||
@@ -17,10 +17,6 @@
|
||||
[ext_resource type="PackedScene" uid="uid://bji3bukudxlhm" path="res://assets/health_dispenser.tscn" id="13_h5xga"]
|
||||
[ext_resource type="PackedScene" uid="uid://d4suhr3allsj" path="res://assets/revolver2_pickup.tscn" id="14_ak7yq"]
|
||||
[ext_resource type="PackedScene" uid="uid://dyu46bns8mesv" path="res://assets/mac10_pickup.tscn" id="17_u30rd"]
|
||||
[ext_resource type="PackedScene" uid="uid://hp4xn8oqdxnd" path="res://assets/machete_pickup.tscn" id="19_po1ll"]
|
||||
[ext_resource type="PackedScene" uid="uid://dugcxo2665me0" path="res://assets/revolver1_pickup.tscn" id="20_cte0x"]
|
||||
[ext_resource type="PackedScene" uid="uid://cucqbjb8bcha5" path="res://assets/blunderbuss_pickup.tscn" id="21_7mdbv"]
|
||||
[ext_resource type="PackedScene" uid="uid://clu76sc4uoswn" path="res://assets/rocketlauncher_pickup.tscn" id="21_8nq5q"]
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_s7e4t"]
|
||||
sky_top_color = Color(0.623488, 0.812575, 0.900791, 1)
|
||||
@@ -265,17 +261,5 @@ item = ExtResource("17_u30rd")
|
||||
item_name = "Mac 10"
|
||||
item_price = 100
|
||||
|
||||
[node name="machete_pickup" parent="." instance=ExtResource("19_po1ll")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.62977, 0.478022, 7.20831)
|
||||
|
||||
[node name="pistol1_pickup" parent="." instance=ExtResource("20_cte0x")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.08118, 0.423819, 5.64694)
|
||||
|
||||
[node name="blunderbuss_pickup" parent="." instance=ExtResource("21_7mdbv")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.25088, 0.636966, 3.43924)
|
||||
|
||||
[node name="mac10_pickup" parent="." instance=ExtResource("17_u30rd")]
|
||||
transform = Transform3D(0.478002, 0.878359, 0, -0.878359, 0.478002, 0, 0, 0, 1, 4.01705, 1.63936, 8.05346)
|
||||
|
||||
[node name="rocketlauncher1_pickup" parent="." instance=ExtResource("21_8nq5q")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.72876, 1.17629, -7.85933)
|
||||
transform = Transform3D(-0.254518, -0.967068, 0, 0.967068, -0.254518, 0, 0, 0, 1, -7.54046, 1.3363, 3.95008)
|
||||
|
||||
@@ -25,6 +25,9 @@ func _on_area_3d_body_entered(body):
|
||||
if body.is_in_group("player"):
|
||||
can_jump = true
|
||||
player = body
|
||||
if body.is_class("Chest"):
|
||||
body.velocity.y = jump_amount
|
||||
jump_sound.play()
|
||||
|
||||
func _on_area_3d_body_exited(body: Node3D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
extends RayCast3D
|
||||
|
||||
@onready var hit_indicator: AudioStreamPlayer = $"../../../../Audio/HitIndicator"
|
||||
@onready var camera: Camera3D = $".."
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@@ -12,31 +13,32 @@ func _ready() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func hitscan_fire(bullet_damage,bullet_force_mod,bullethole):
|
||||
func hitscan_fire(bullet_damage,bullet_force_mod,bullethole,range):
|
||||
|
||||
if is_colliding():
|
||||
|
||||
#bullethole effect
|
||||
var instance_bullethole = bullethole.instantiate()
|
||||
get_collider().add_child(instance_bullethole)
|
||||
instance_bullethole.global_transform.origin = get_collision_point()
|
||||
if (abs(get_collision_normal().y) > 0.99):
|
||||
instance_bullethole.look_at(get_collision_point() + get_collision_normal(), Vector3(0,0,1))
|
||||
else:
|
||||
instance_bullethole.look_at(get_collision_point() + get_collision_normal())
|
||||
if camera.distance_to(get_collision_point) <= range:
|
||||
#bullethole effect
|
||||
var instance_bullethole = bullethole.instantiate()
|
||||
get_collider().add_child(instance_bullethole)
|
||||
instance_bullethole.global_transform.origin = get_collision_point()
|
||||
if (abs(get_collision_normal().y) > 0.99):
|
||||
instance_bullethole.look_at(get_collision_point() + get_collision_normal(), Vector3(0,0,1))
|
||||
else:
|
||||
instance_bullethole.look_at(get_collision_point() + get_collision_normal())
|
||||
|
||||
#move rigidbodies
|
||||
if get_collider().is_in_group("scene_rigidbody"):
|
||||
get_collider().linear_velocity += rotation * Vector3(0,0,-bullet_force_mod)
|
||||
#move rigidbodies
|
||||
if get_collider().is_in_group("scene_rigidbody"):
|
||||
get_collider().linear_velocity += rotation * Vector3(0,0,-bullet_force_mod)
|
||||
|
||||
if get_collider().is_in_group("breakable"):
|
||||
get_collider().breaking( Vector3(0,0,-bullet_force_mod))
|
||||
if get_collider().is_in_group("breakable"):
|
||||
get_collider().breaking( Vector3(0,0,-bullet_force_mod))
|
||||
|
||||
|
||||
if get_collider().is_in_group("enemy_target"):
|
||||
emit_signal("enemy_hit")
|
||||
get_collider().hit(bullet_damage)
|
||||
if get_collider().is_in_group("enemy_target"):
|
||||
emit_signal("enemy_hit")
|
||||
get_collider().hit(bullet_damage)
|
||||
|
||||
if get_collider().is_in_group("switch"):
|
||||
get_collider().hit()
|
||||
if get_collider().is_in_group("switch"):
|
||||
get_collider().hit()
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ func _on_timer_timeout():
|
||||
timer.wait_time = rand_timer #rand_timer
|
||||
|
||||
# Shoot that shit
|
||||
var pickup_spawn = level_control.item_pickup.instantiate()
|
||||
var pickup_spawn = level_control.ITEM_PICKUP.instantiate()
|
||||
var item_stats = level_control.pickup_spawn(false)
|
||||
##SET VARIABLES
|
||||
pickup_spawn.pickup_type = item_stats["pickup_type"]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
extends RigidBody3D
|
||||
class_name Chest
|
||||
|
||||
@export var weapon_drops : Array[Resource]
|
||||
@export var health : float = 30
|
||||
|
||||
var open = false
|
||||
var drop_weapon
|
||||
@@ -19,7 +21,8 @@ func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func hit(dam):
|
||||
if !open:
|
||||
health -= dam
|
||||
if !open and health <= 0:
|
||||
anim_player.play("open")
|
||||
open = true
|
||||
|
||||
@@ -31,4 +34,4 @@ func spawn_drop():
|
||||
get_tree().current_scene.add_child(drop_weapon)
|
||||
|
||||
func interact():
|
||||
hit(0)
|
||||
hit(1)
|
||||
|
||||
@@ -86,6 +86,7 @@ var current_weapon_index
|
||||
var recoiling = false
|
||||
var dead = false
|
||||
var hud_visible : bool = true
|
||||
|
||||
var held_item : Node
|
||||
var held_item_linear_damp_cache
|
||||
var held_item_angular_damp_cache
|
||||
@@ -93,7 +94,8 @@ var held_item_gravity_cache
|
||||
var held_item_mass_cache
|
||||
var held_item_collision_cache
|
||||
var hold_offset
|
||||
var held_item_rotation = Vector3(0,0,0)
|
||||
var held_item_rotation : float = 0
|
||||
|
||||
var gamespeed_controlled = false
|
||||
var crouched = false
|
||||
var flashlight_on : bool = false
|
||||
@@ -137,7 +139,6 @@ var controlled_elsewhere = false
|
||||
@onready var weapon_pickup_audio: AudioStreamPlayer = $Audio/WeaponPickup
|
||||
@onready var motion_lines: ColorRect = $Head/Recoil/Camera3D/MotionLines
|
||||
@onready var moveable_holder: Node3D = $Head/Recoil/Camera3D/MoveableHolder
|
||||
@onready var moveable_rotation: Node3D = $Head/Recoil/Camera3D/MoveableHolder/MoveableRotation
|
||||
@onready var stand_check: RayCast3D = $StandCheck
|
||||
@onready var r_hand_test: MeshInstance3D = $Head/Recoil/Camera3D/WeaponHolder/RHandTest
|
||||
@onready var enemy_killed_audio: AudioStreamPlayer = $Audio/EnemyKilled
|
||||
@@ -405,13 +406,14 @@ func _physics_process(delta):
|
||||
|
||||
#Weapon Swap Up
|
||||
if Input.is_action_just_pressed("scroll_up"):
|
||||
if held_item != null:
|
||||
held_item_rotation += deg_to_rad(45)
|
||||
print("HELD ITEM ROTATION : ",held_item_rotation)
|
||||
if gun != null:
|
||||
if !gun.anim_player.is_playing():
|
||||
if held_item == null:
|
||||
if GameGlobals.held_guns.size() > 1:
|
||||
weapon_select(GameGlobals.current_gun_index + 1)
|
||||
else:
|
||||
moveable_holder.rotation.y += deg_to_rad(45)
|
||||
else:
|
||||
if gun_is_holstered:
|
||||
holster_gun(false)
|
||||
@@ -424,7 +426,7 @@ func _physics_process(delta):
|
||||
if GameGlobals.held_guns.size() > 1:
|
||||
weapon_select(GameGlobals.current_gun_index - 1)
|
||||
else:
|
||||
moveable_holder.rotation.y -= deg_to_rad(45)
|
||||
held_item_rotation -= deg_to_rad(45)
|
||||
else:
|
||||
if gun_is_holstered:
|
||||
holster_gun(false)
|
||||
@@ -461,6 +463,12 @@ func _physics_process(delta):
|
||||
held_key_check += delta
|
||||
## IF HELD
|
||||
if held_key_check >= HELD_BUTTON_AMT:
|
||||
if interact_ray.is_colliding():
|
||||
var body = interact_ray.get_collider()
|
||||
if interact_ray.get_collider().has_method("interact"):
|
||||
body.interact()
|
||||
held_key_check = 0.0
|
||||
elif Input.is_action_just_released("interact"):
|
||||
if held_item != null:
|
||||
release_moveable()
|
||||
elif interact_ray.is_colliding():
|
||||
@@ -468,13 +476,6 @@ func _physics_process(delta):
|
||||
if interact_ray.get_collider().get_class() == "RigidBody3D":
|
||||
grab_moveable(body)
|
||||
held_key_check = 0.0
|
||||
elif Input.is_action_just_released("interact"):
|
||||
if interact_ray.is_colliding():
|
||||
var body = interact_ray.get_collider()
|
||||
if interact_ray.get_collider().has_method("interact"):
|
||||
body.interact()
|
||||
held_key_check = 0.0
|
||||
|
||||
#kick
|
||||
if Input.is_action_just_pressed("kick"):
|
||||
if !animation_player.is_playing():
|
||||
@@ -626,9 +627,8 @@ func hold_item(_delta):
|
||||
if held_item != null:
|
||||
interact_ray.look_at(held_item.global_position, Vector3.UP)
|
||||
var held_dir = (moveable_holder.global_position - held_item.global_position) #+ hold_offset
|
||||
held_item.linear_velocity = held_dir * 15
|
||||
held_item.look_at(moveable_rotation.global_position, Vector3.UP)
|
||||
|
||||
held_item.linear_velocity = held_dir * 50
|
||||
held_item.rotation = Vector3(0,held_item_rotation,0) + Vector3(0,camera.global_rotation.y,0)
|
||||
#break when moved too far away
|
||||
var distance_from_player = abs(self.global_position - held_item.global_position)
|
||||
if distance_from_player.length() > 5:
|
||||
@@ -647,7 +647,6 @@ func release_moveable():
|
||||
held_item.set_collision_layer_value(1,held_item_collision_cache)
|
||||
held_item = null
|
||||
hold_offset = null
|
||||
moveable_holder.rotation = Vector3(0,0,0)
|
||||
|
||||
## GUNS AND AMMO
|
||||
func holster_gun(holster):
|
||||
|
||||
@@ -43,7 +43,7 @@ func breaking(bullet_velocity):
|
||||
#pickup drop
|
||||
while number_of_drops > 0:
|
||||
|
||||
var pickup_spawn = level_control.item_pickup.instantiate()
|
||||
var pickup_spawn = level_control.ITEM_PICKUP.instantiate()
|
||||
var item_stats = level_control.pickup_spawn(false)
|
||||
|
||||
##SET VARIABLES
|
||||
|
||||
@@ -204,7 +204,7 @@ func drop_loot(number_of_drops):
|
||||
#pickup drop
|
||||
while number_of_drops > 0:
|
||||
|
||||
var pickup_spawn = level_control.item_pickup.instantiate()
|
||||
var pickup_spawn = level_control.ITEM_PICKUP.instantiate()
|
||||
var item_stats = level_control.pickup_spawn(false)
|
||||
|
||||
##SET VARIABLES
|
||||
|
||||
@@ -39,24 +39,23 @@ func interact():
|
||||
func vend():
|
||||
var item_vend
|
||||
if is_pickup:
|
||||
item_vend = level_control.item_pickup.instantiate()
|
||||
item_vend = level_control.ITEM_PICKUP.instantiate()
|
||||
var item_stats
|
||||
item_stats = level_control.pickup_spawn(is_random)
|
||||
##SET VARIABLES
|
||||
item_vend.pickup_type = pickup_type
|
||||
if level_control.player.gun != null:
|
||||
if level_control.player.gun.ammo_type != 5:
|
||||
item_vend.ammo_type = level_control.player.gun.ammo_type
|
||||
if level_control.player.gun.weapon_info.bullet.ammo_type != 5:
|
||||
item_vend.ammo_type = level_control.player.gun.weapon_info.bullet.ammo_type
|
||||
else:
|
||||
item_vend.ammo_type = item_stats["ammo_type"]
|
||||
if pickup_type == 0:
|
||||
if level_control.player.gun != null:
|
||||
item_vend.value = level_control.player.gun.max_ammo
|
||||
item_vend.value = level_control.player.gun.weapon_info.max_ammo
|
||||
else:
|
||||
item_vend.value = item_stats["value"]
|
||||
else:
|
||||
item_vend.value = pickup_amount
|
||||
print("ITEM : ",item_vend.pickup_type,item_vend.ammo_type,item_vend.value)
|
||||
else:
|
||||
item_vend = item.instantiate()
|
||||
item_vend.position = vend_ray.global_position
|
||||
|
||||
@@ -8,6 +8,7 @@ class_name weapon_resource
|
||||
@export_enum("Mag","Revolver","Bolt Action") var reload_type = 0
|
||||
@export var bullet : bullet_resource
|
||||
@export_enum("Auto", "Single", "Burst") var fire_mode: int
|
||||
@export var hitscan_range : float = 100 ##for hitscan and melee weapons
|
||||
@export var fov_zoom_amt = .98
|
||||
@export var ads : bool = false
|
||||
@export var recoil_amount : Vector3 = Vector3(.05,.05,.05)
|
||||
|
||||
@@ -160,7 +160,6 @@ func spawn_casing():
|
||||
instance_casing.player_velocity = player.velocity * transform.basis
|
||||
get_tree().get_root().add_child(instance_casing)
|
||||
|
||||
|
||||
func spawn_revolver_casings():
|
||||
if casing_array.size() > 0:
|
||||
var ammo_needed = weapon_info.max_ammo - GameGlobals.gun_ammo[weapon_info.gun_name]
|
||||
@@ -271,6 +270,10 @@ func bullet_fire():
|
||||
if weapon_info.fire_mode != 0:
|
||||
cycle_count -= 1
|
||||
|
||||
func hitscan_fire():
|
||||
# Fire hitscan
|
||||
pass
|
||||
|
||||
func swapped_out():
|
||||
queue_free()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user