more ai work

This commit is contained in:
derek
2025-05-02 16:58:01 -05:00
parent 88a60d469e
commit 68facaf544
9 changed files with 38 additions and 54 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://cfaydhd6u5bmb"]
[gd_scene load_steps=18 format=3 uid="uid://cfaydhd6u5bmb"]
[ext_resource type="Script" uid="uid://bkii8jwf0k7tq" path="res://scripts/LevelManager.gd" id="1_wa46b"]
[ext_resource type="PackedScene" uid="uid://24slv0pyxcd5" path="res://assets/level_bounds.tscn" id="2_a2a5u"]
@@ -12,13 +12,14 @@
[ext_resource type="Material" uid="uid://bb0beroi2p3gd" path="res://assets/materials/FrostedGlass.tres" id="7_t6ubg"]
[ext_resource type="PackedScene" uid="uid://c6bpysq1tjhy4" path="res://vendingmahcine.tscn" id="11_sdike"]
[ext_resource type="PackedScene" uid="uid://uethfe5v66tg" path="res://assets/item_pickup.tscn" id="12_5u3xe"]
[ext_resource type="PackedScene" uid="uid://dlhjacsike5a4" path="res://assets/oildrum1.tscn" id="13_540vx"]
[sub_resource type="BoxShape3D" id="BoxShape3D_t6ubg"]
size = Vector3(92.25, 82.386, 76.6396)
[sub_resource type="NavigationMesh" id="NavigationMesh_wa46b"]
vertices = PackedVector3Array(-19.5, 1, 0, -5, 1, 0, -5, 1, -1.25, -4.5, 1, -1.5, -4.5, 1, -19.5, -19.5, 1, -19.5, 8.5, 1, -1.5, 8.75, 1, -19.5, 9, 1, 0.5, 19.5, 1, 0.5, 19.5, 1, -19.5, -4, 4.5, -0.5, -4, 4.5, 0.5, 3, 4.5, 0.5, 3, 4.5, -0.5, 7.25, 4.25, -0.5, 7.25, 4.25, 0.25, 7.75, 4.25, 0.25, 7.75, 4.25, -0.5, -3.75, 1, -0.25, -3.75, 1, 0.25, 3, 1, 0.25, 3, 1, -0.25, 4, 5, -0.25, 4, 5, 10.5, 5.25, 5, 10.5, 5.25, 5, -0.25, -19.5, 1, 12, -8.75, 1, 12, -8.5, 1, 11.25, -5, 1, 1, 6.25, 1, 11.25, 4.75, 1, 11.5, 4.75, 1, 19.5, 8.75, 1, 1.25, 6.25, 1, 1.25, 19.5, 1, 19.5, -6, 1, 10.75, -4.5, 1, 1.5, 4.25, 1, 1.5, 4.25, 1, 10.25, 5, 1, 10.25, 5, 1, 1.25, 3, 1, 10.75, 3, 1, 1.5, -8.25, 1, 12.25, -8.5, 1, 18.25, -9.5, 1, 18.5, -9.5, 1, 19.5, 3.25, 1, 11.5, -10, 4, 13.25, -9.75, 4, 17.5, -9.25, 4, 13.5, -9.25, 4, 13, -19.5, 4, 13, -10.75, 1, 18.25, -19.5, 1, 19.5, -10.75, 1, 14.25, -19.5, 1, 14.25)
polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(2, 0, 3), PackedInt32Array(3, 0, 4), PackedInt32Array(4, 0, 5), PackedInt32Array(3, 4, 6), PackedInt32Array(6, 4, 7), PackedInt32Array(8, 6, 9), PackedInt32Array(9, 6, 7), PackedInt32Array(9, 7, 10), PackedInt32Array(14, 13, 11), PackedInt32Array(11, 13, 12), PackedInt32Array(18, 17, 15), PackedInt32Array(15, 17, 16), PackedInt32Array(22, 21, 19), PackedInt32Array(19, 21, 20), PackedInt32Array(26, 25, 23), PackedInt32Array(23, 25, 24), PackedInt32Array(29, 28, 27), PackedInt32Array(30, 29, 1), PackedInt32Array(1, 29, 27), PackedInt32Array(1, 27, 0), PackedInt32Array(33, 32, 31), PackedInt32Array(31, 35, 34), PackedInt32Array(8, 9, 34), PackedInt32Array(34, 9, 31), PackedInt32Array(31, 9, 33), PackedInt32Array(33, 9, 36), PackedInt32Array(38, 37, 30), PackedInt32Array(30, 37, 29), PackedInt32Array(40, 39, 41), PackedInt32Array(41, 39, 42), PackedInt32Array(44, 43, 38), PackedInt32Array(38, 43, 37), PackedInt32Array(28, 29, 45), PackedInt32Array(45, 29, 37), PackedInt32Array(47, 46, 48), PackedInt32Array(48, 46, 33), PackedInt32Array(49, 32, 33), PackedInt32Array(45, 37, 46), PackedInt32Array(46, 37, 43), PackedInt32Array(46, 43, 49), PackedInt32Array(46, 49, 33), PackedInt32Array(53, 52, 50), PackedInt32Array(50, 52, 51), PackedInt32Array(53, 50, 54), PackedInt32Array(47, 48, 55), PackedInt32Array(55, 48, 56), PackedInt32Array(57, 55, 58), PackedInt32Array(58, 55, 56)]
vertices = PackedVector3Array(-19.5, 1, 0, -5, 1, 0, -5, 1, -1.25, -4.5, 1, -1.5, -4.5, 1, -19.5, -19.5, 1, -19.5, 5.25, 1, -1.25, 5.5, 1, -19.5, 7.5, 1, -1, 7.75, 1, 0.5, 19.5, 1, 0.5, 19.5, 1, -19.5, -4, 4.5, -0.5, -4, 4.5, 0.5, 3, 4.5, 0.5, 3, 4.5, -0.5, -3.75, 1, -0.25, -3.75, 1, 0.25, 3, 1, 0.25, 3, 1, -0.25, 4, 5, -0.25, 4, 5, 10.5, 5.25, 5, 10.5, 5.25, 5, -0.25, -19.5, 1, 12, -8.75, 1, 12, -8.5, 1, 11.25, -5, 1, 1, 6.25, 4, 0, 6.25, 4, 1, 6.75, 4, 1, 6.75, 4, 0, 6.25, 1, 11.25, 4.75, 1, 11.5, 4.75, 1, 19.5, 19.5, 1, 19.5, 7.5, 1, 2, 6.25, 1, 2, -6, 1, 10.75, -4.5, 1, 1.5, 4.25, 1, 1.5, 4.25, 1, 10.25, 5, 1, 10.25, 5, 1, 1.25, 3, 1, 10.75, 3, 1, 1.5, -8.25, 1, 12.25, -8.5, 1, 18.25, -9.5, 1, 18.5, -9.5, 1, 19.5, 3.25, 1, 11.5, -10, 4, 13.25, -9.75, 4, 17.5, -9.25, 4, 13.5, -9.25, 4, 13, -19.5, 4, 13, -10.75, 1, 18.25, -19.5, 1, 19.5, -10.75, 1, 14.25, -19.5, 1, 14.25)
polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(2, 0, 3), PackedInt32Array(3, 0, 4), PackedInt32Array(4, 0, 5), PackedInt32Array(3, 4, 6), PackedInt32Array(6, 4, 7), PackedInt32Array(9, 8, 10), PackedInt32Array(10, 8, 11), PackedInt32Array(11, 8, 7), PackedInt32Array(8, 6, 7), PackedInt32Array(15, 14, 12), PackedInt32Array(12, 14, 13), PackedInt32Array(19, 18, 16), PackedInt32Array(16, 18, 17), PackedInt32Array(23, 22, 20), PackedInt32Array(20, 22, 21), PackedInt32Array(26, 25, 24), PackedInt32Array(27, 26, 1), PackedInt32Array(1, 26, 24), PackedInt32Array(1, 24, 0), PackedInt32Array(31, 30, 28), PackedInt32Array(28, 30, 29), PackedInt32Array(33, 32, 34), PackedInt32Array(34, 32, 35), PackedInt32Array(32, 37, 36), PackedInt32Array(36, 9, 32), PackedInt32Array(32, 9, 10), PackedInt32Array(32, 10, 35), PackedInt32Array(39, 38, 27), PackedInt32Array(27, 38, 26), PackedInt32Array(41, 40, 42), PackedInt32Array(42, 40, 43), PackedInt32Array(45, 44, 39), PackedInt32Array(39, 44, 38), PackedInt32Array(25, 26, 46), PackedInt32Array(46, 26, 38), PackedInt32Array(48, 47, 49), PackedInt32Array(49, 47, 34), PackedInt32Array(50, 33, 34), PackedInt32Array(46, 38, 47), PackedInt32Array(47, 38, 44), PackedInt32Array(47, 44, 50), PackedInt32Array(47, 50, 34), PackedInt32Array(54, 53, 51), PackedInt32Array(51, 53, 52), PackedInt32Array(54, 51, 55), PackedInt32Array(48, 49, 56), PackedInt32Array(56, 49, 57), PackedInt32Array(58, 56, 59), PackedInt32Array(59, 56, 57)]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_t6ubg"]
transparency = 1
@@ -82,7 +83,7 @@ size = Vector3(5.10229, 4.0282, 1)
material = SubResource("StandardMaterial3D_sdike")
[node name="vendingmachine" parent="NavigationRegion3D" instance=ExtResource("11_sdike")]
transform = Transform3D(-0.206085, 0, 0.978534, 0, 1, 0, -0.978534, 0, -0.206085, 6.89547, 0.711414, 0.072493)
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 5.84023, 0.514531, 0.560712)
item = ExtResource("12_5u3xe")
is_pickup = true
@@ -95,3 +96,15 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.28023, 1.45981, -1.07754)
[node name="EnemySpawner" parent="Level" instance=ExtResource("6_5u3xe")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.291284, 1, 3.32874)
[node name="Oildrum1" parent="." instance=ExtResource("13_540vx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.764425, 1.58364, 5.4923)
[node name="Oildrum2" parent="." instance=ExtResource("13_540vx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.10549, 1.58364, 4.59505)
[node name="Oildrum3" parent="." instance=ExtResource("13_540vx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.615206, 1.58363, 6.69656)
[node name="Oildrum4" parent="." instance=ExtResource("13_540vx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.3897, 1.58363, 14.1142)

View File

@@ -169,4 +169,9 @@ fixed_fps = 60
process_material = SubResource("ParticleProcessMaterial_nu0ea")
draw_pass_1 = SubResource("PlaneMesh_hi6ep")
[node name="CollisionCheck" type="RayCast3D" parent="."]
target_position = Vector3(0, 0, -20)
collision_mask = 109
collide_with_areas = true
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@@ -27,8 +27,8 @@ bullet_damage = 1
smoke_enabled = false
bullet_force_mod = 5.0
bullet_speed = 600
decibels_of_gunfire_sound = 160.0
max_distance_heard = 100
decibels_of_gunfire_sound = 50.0
max_distance_heard = 5
casing = ExtResource("2_g6owq")
mag = ExtResource("4_xovdq")
vibration_weak_magnitude = 0.1

View File

@@ -1,44 +0,0 @@
[gd_scene load_steps=7 format=3 uid="uid://domhm87hbhbg1"]
[ext_resource type="Script" path="res://demo/src/Player.gd" id="1_nm1yx"]
[ext_resource type="Script" path="res://demo/src/CameraManager.gd" id="2_loos7"]
[sub_resource type="SphereShape3D" id="SphereShape3D_smq6u"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_lwhhq"]
height = 1.5
[sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_twc2s"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_lsqiy"]
[node name="Player" type="CharacterBody3D"]
collision_layer = 2
script = ExtResource("1_nm1yx")
[node name="CameraManager" type="Node3D" parent="."]
script = ExtResource("2_loos7")
[node name="Arm" type="SpringArm3D" parent="CameraManager"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.906308, 0.422618, 0, -0.422618, 0.906308, 0, 2.32515, -0.0321627)
shape = SubResource("SphereShape3D_smq6u")
spring_length = 6.0
margin = 0.5
[node name="Camera3D" type="Camera3D" parent="CameraManager/Arm"]
unique_name_in_owner = true
near = 0.25
far = 16384.0
[node name="CollisionShapeBody" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, 0)
shape = SubResource("CapsuleShape3D_lwhhq")
[node name="CollisionShapeRay" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 1, 0)
shape = SubResource("SeparationRayShape3D_twc2s")
[node name="Body" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
mesh = SubResource("CapsuleMesh_lsqiy")

View File

@@ -12,7 +12,7 @@ config_version=5
config/name="First Person Test"
config/tags=PackedStringArray("fps")
run/main_scene="uid://f7e0v1r6ra6c"
run/main_scene="uid://cfaydhd6u5bmb"
config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="uid://6svuq1l83al5"

View File

@@ -10,6 +10,7 @@ extends RigidBody3D
@onready var radius_shape: CollisionShape3D = $BlastRadius/CollisionShape3D
@onready var audio_drop: AudioStreamPlayer3D = $audio_drop
@onready var flames: GPUParticles3D = $Flames
@onready var collision_check: RayCast3D = $CollisionCheck
var leak_hp = false
var blast_amount
@@ -56,7 +57,6 @@ func explode():
#apply linear velocity power as the inverse % of distance towards the edge (bonus points if using curve texture)
#break breakable objects
for body in bodies_in_blast:
#calculate blast power and direction
var blast_direction = (body.global_position - blast_radius_area.global_position).normalized()
var blast_amount = 1 - ((body.global_position - blast_radius_area.global_position).length() / radius_shape.shape.radius)
@@ -82,6 +82,8 @@ func explode():
body.stunned_timer.start()
body.velocity += blast_velocity
SignalBus.emit_signal("suspicious_sound",global_position,180,35)
#Spawn gpu particles
var explosionspawn = explosion.instantiate()
explosionspawn.position = self.global_position

View File

@@ -335,6 +335,7 @@ func _physics_process(delta):
var recoil_amount = Vector3(-.3,0,0)
land_sound.volume_db = land_volume
land_sound.play()
SignalBus.emit_signal("suspicious_sound",global_position,10,10)
Input.start_joy_vibration(0,.1,.1,.1)
recoil.add_recoil(recoil_amount,10,10)
moving_fast_top_speed = 0.0
@@ -555,6 +556,10 @@ func _headbob(time) -> Vector3:
if pos.y >= .07 and is_on_floor() and velocity.length() >= 1 and !footstep_sound.is_playing():
footstep_sound.play()
if !crouched:
SignalBus.emit_signal("suspicious_sound",global_position,10,7)
else:
SignalBus.emit_signal("suspicious_sound",global_position,5,1)
return pos

View File

@@ -101,8 +101,11 @@ func _ready():
func _process(delta):
line_of_sight.global_position = global_position
move_and_slide()
look_at_player()
if !is_on_floor():
velocity -= Vector3(0,9.8,0) * delta
look_at_player()
func stun():
change_state_to("stunned")

View File

@@ -21,7 +21,7 @@ class_name weapon_resource
@export var bullet_force_mod = 5.0
@export var bullet_speed = 600
@export var decibels_of_gunfire_sound = 160.0
@export var max_distance_heard = 100 #in meters
@export var max_distance_heard = 75 #in meters
@export_group("Gun Assets")
@export var casing : Resource
@export var mag : Resource