diff --git a/asset_dev/beast/slutch/slutch.blend b/asset_dev/beast/slutch/slutch.blend new file mode 100644 index 0000000..432ce6e Binary files /dev/null and b/asset_dev/beast/slutch/slutch.blend differ diff --git a/asset_dev/beast/slutch/slutch.blend1 b/asset_dev/beast/slutch/slutch.blend1 new file mode 100644 index 0000000..0a9bb56 Binary files /dev/null and b/asset_dev/beast/slutch/slutch.blend1 differ diff --git a/assets/npc/slutch_beast/slutch.bin b/assets/npc/slutch_beast/slutch.bin new file mode 100644 index 0000000..d06d364 Binary files /dev/null and b/assets/npc/slutch_beast/slutch.bin differ diff --git a/assets/npc/slutch_beast/slutch.gltf b/assets/npc/slutch_beast/slutch.gltf new file mode 100644 index 0000000..aaa16d2 --- /dev/null +++ b/assets/npc/slutch_beast/slutch.gltf @@ -0,0 +1,104 @@ +{ + "asset":{ + "generator":"Khronos glTF Blender I/O v4.3.47", + "version":"2.0" + }, + "scene":0, + "scenes":[ + { + "name":"Scene", + "nodes":[ + 0 + ] + } + ], + "nodes":[ + { + "mesh":0, + "name":"Slutch" + } + ], + "meshes":[ + { + "name":"Slutch", + "primitives":[ + { + "attributes":{ + "POSITION":0, + "NORMAL":1, + "TEXCOORD_0":2 + }, + "indices":3 + } + ] + } + ], + "accessors":[ + { + "bufferView":0, + "componentType":5126, + "count":312, + "max":[ + 1.618986964225769, + 2.0478501319885254, + 1.716138243675232 + ], + "min":[ + -1.7170332670211792, + -0.20000004768371582, + -1.6321383714675903 + ], + "type":"VEC3" + }, + { + "bufferView":1, + "componentType":5126, + "count":312, + "type":"VEC3" + }, + { + "bufferView":2, + "componentType":5126, + "count":312, + "type":"VEC2" + }, + { + "bufferView":3, + "componentType":5123, + "count":324, + "type":"SCALAR" + } + ], + "bufferViews":[ + { + "buffer":0, + "byteLength":3744, + "byteOffset":0, + "target":34962 + }, + { + "buffer":0, + "byteLength":3744, + "byteOffset":3744, + "target":34962 + }, + { + "buffer":0, + "byteLength":2496, + "byteOffset":7488, + "target":34962 + }, + { + "buffer":0, + "byteLength":648, + "byteOffset":9984, + "target":34963 + } + ], + "buffers":[ + { + "byteLength":10632, + "uri":"slutch.bin" + } + ] +} diff --git a/assets/npc/slutch_beast/slutch.gltf.import b/assets/npc/slutch_beast/slutch.gltf.import new file mode 100644 index 0000000..e281345 --- /dev/null +++ b/assets/npc/slutch_beast/slutch.gltf.import @@ -0,0 +1,37 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://uj7nf8db7sbv" +path="res://.godot/imported/slutch.gltf-7d5703769250c9cbc9f5876b5fe20664.scn" + +[deps] + +source_file="res://assets/npc/slutch_beast/slutch.gltf" +dest_files=["res://.godot/imported/slutch.gltf-7d5703769250c9cbc9f5876b5fe20664.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +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="" +_subresources={} +gltf/naming_version=1 +gltf/embedded_image_handling=1 diff --git a/levels/grunkbeast_test/procedural_grunkbeast_test.tscn b/levels/grunkbeast_test/procedural_grunkbeast_test.tscn index fba5372..d7b18b4 100644 --- a/levels/grunkbeast_test/procedural_grunkbeast_test.tscn +++ b/levels/grunkbeast_test/procedural_grunkbeast_test.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" uid="uid://b1tbovuphat7d" path="res://levels/grunkbeast_test/procedural_grunkbeast_test.gd" id="1_ixhpa"] [ext_resource type="Script" uid="uid://bukihqt1lybnx" path="res://src/util/frame_skipper.gd" id="2_82w0n"] -[ext_resource type="PackedScene" uid="uid://d2664rpg4losx" path="res://src/world/procedural_grunk_beast/procedural_grunk_beast.tscn" id="3_b4iwh"] +[ext_resource type="PackedScene" uid="uid://d2664rpg4losx" path="res://src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.tscn" id="3_b4iwh"] [ext_resource type="Script" uid="uid://cpt8dy0csa3eu" path="res://levels/grunkbeast_test/fixed_camera.gd" id="4_32imj"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_goufh"] diff --git a/levels/pathing_test/pathing_test.tscn b/levels/pathing_test/pathing_test.tscn index 099307a..06ff24a 100644 --- a/levels/pathing_test/pathing_test.tscn +++ b/levels/pathing_test/pathing_test.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=60 format=4 uid="uid://tvirbm0kgvp8"] +[gd_scene load_steps=61 format=4 uid="uid://tvirbm0kgvp8"] [ext_resource type="PackedScene" uid="uid://bwe2jdmvinhqd" path="res://src/player/player.tscn" id="1_fgk6j"] [ext_resource type="PackedScene" uid="uid://ehf5sg3ahvbf" path="res://src/world/grunk_beast/grunk_beast.tscn" id="2_1lom2"] @@ -26,6 +26,7 @@ [ext_resource type="ArrayMesh" uid="uid://xn5nceqby4wd" path="res://assets/level/wall/wall_3.mesh" id="23_7rrnb"] [ext_resource type="ArrayMesh" uid="uid://c4klxlj1oop7t" path="res://assets/level/hallway/hallway_4.mesh" id="24_x0es6"] [ext_resource type="Material" uid="uid://b8xdnogrfefvf" path="res://levels/ghost_ship/guide_sign/mess_hall_sign.material" id="25_jvcry"] +[ext_resource type="PackedScene" uid="uid://cubwniraol1qn" path="res://src/props/bulkhead/bulkhead.tscn" id="27_18csx"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_1lom2"] @@ -37,12 +38,14 @@ background_mode = 2 sky = SubResource("Sky_pka60") [sub_resource type="NavigationMesh" id="NavigationMesh_gyhlh"] -vertices = PackedVector3Array(-26.25, 0.499, -29.25, -26.5, 0.499, -30.75, -27.5, 0.499, -30.75, -27.5, 0.499, -17.25, -26.75, 0.499, -18.25, -26.25, 0.499, -19, -0.25, 0.499, -17.5, 0.75, 0.499, -18, 0.75, 0.499, -19.75, -0.75, 0.499, -19, -1.25, 0.499, -18.5, -1, 0.499, -17.25, -3.25, 0.499, -24.25, -3.25, 0.499, -20.25, -1.25, 0.499, -20.25, 1.75, 0.499, -20.25, 1.75, 0.499, -24.25, -25.75, 0.499, -18.5, -25.5, 0.499, -18.25, -19.75, 0.499, -17.5, -24.75, 0.499, -17.25, -18, 0.499, -17.5, -0.5, 0.499, -16.75, -20.25, 0.499, -18.5, -0.5, 0.499, -6, 0.75, 0.499, -6, 0.75, 0.499, -12.75, 0, 0.499, -13.25, -17, 0.499, -18.5, -24.25, 0.499, -24.25, -24.25, 0.499, -20.25, 2.5, 0.499, -19.75, 24.25, 0.499, -24.25, 2.5, 0.499, -5.75, 24.25, 0.499, -5.5, -2.25, 0.499, -4.25, -2.25, 0.499, -15.5, -24.25, 0.499, -15.5, -1.5, 0.499, -3.75, -24.25, 0.499, 24.25, -1.5, 0.499, 24.25, 0.75, 0.499, -4.25, -0.5, 0.499, -4.25, 1.75, 0.499, -3.75, 1.75, 0.499, 24.25, 2.5, 0.499, -4.25, 24.25, 0.499, 24.25) -polygons = [PackedInt32Array(4, 3, 5), PackedInt32Array(5, 3, 0), PackedInt32Array(0, 3, 1), PackedInt32Array(1, 3, 2), PackedInt32Array(11, 10, 6), PackedInt32Array(6, 10, 9), PackedInt32Array(6, 9, 7), PackedInt32Array(7, 9, 8), PackedInt32Array(14, 13, 12), PackedInt32Array(8, 14, 15), PackedInt32Array(15, 14, 16), PackedInt32Array(16, 14, 12), PackedInt32Array(18, 4, 17), PackedInt32Array(20, 18, 19), PackedInt32Array(8, 9, 14), PackedInt32Array(19, 21, 20), PackedInt32Array(20, 21, 11), PackedInt32Array(6, 22, 11), PackedInt32Array(17, 23, 18), PackedInt32Array(18, 23, 19), PackedInt32Array(25, 24, 26), PackedInt32Array(26, 24, 27), PackedInt32Array(10, 11, 28), PackedInt32Array(28, 11, 21), PackedInt32Array(6, 27, 22), PackedInt32Array(22, 27, 24), PackedInt32Array(17, 4, 5), PackedInt32Array(30, 29, 13), PackedInt32Array(13, 29, 12), PackedInt32Array(15, 16, 31), PackedInt32Array(31, 16, 32), PackedInt32Array(33, 31, 34), PackedInt32Array(34, 31, 32), PackedInt32Array(37, 36, 35), PackedInt32Array(35, 38, 37), PackedInt32Array(37, 38, 40), PackedInt32Array(37, 40, 39), PackedInt32Array(42, 24, 41), PackedInt32Array(41, 24, 25), PackedInt32Array(41, 43, 42), PackedInt32Array(42, 43, 38), PackedInt32Array(38, 43, 44), PackedInt32Array(38, 44, 40), PackedInt32Array(45, 33, 34), PackedInt32Array(45, 34, 43), PackedInt32Array(43, 34, 44), PackedInt32Array(44, 34, 46)] +vertices = PackedVector3Array(-26.25, 0.499, -29.25, -26.5, 0.499, -30.75, -27.5, 0.499, -30.75, -27.5, 0.499, -27.5, -26.25, 0.499, -26.75, -18, 0.499, -17.5, -19.75, 0.499, -17.5, -19.25, 0.499, -17.25, -16.5, 0.499, -17.25, -13.75, 0.499, -17.25, -13.5, 0.499, -18.5, -17, 0.499, -18.5, -27.5, 0.499, -20.75, -27.5, 0.499, -17.25, -26.75, 0.499, -18.25, -26.25, 0.499, -19, -26.25, 0.499, -21.75, -27.5, 0.499, -24, -26.25, 0.499, -24.25, -11, 0.499, -17.25, -9.75, 0.499, -18.5, -6.25, 0.499, -18.5, -8.25, 0.499, -17.25, -5.5, 0.499, -17.25, -2.5, 0.499, -17.25, -2.5, 0.499, -18.5, -25.75, 0.499, -18.5, -25.5, 0.499, -18.25, -23, 0.499, -18.5, -22, 0.499, -17.25, -24.75, 0.499, -17.25, -20.25, 0.499, -18.5, -21.75, 0.499, -24.25, -24.25, 0.499, -24.25, -24.25, 0.499, -20.25, -21.75, 0.499, -20.25, -11.25, 0.499, -24.25, -13.75, 0.499, -24.25, -13.75, 0.499, -20.25, -11.25, 0.499, -20.25, -3, 0.499, -20.25, -3, 0.499, -24.25, -5.75, 0.499, -24.25, -5.75, 0.499, -20.25, -8.5, 0.499, -20.25, -8.5, 0.499, -24.25, -19, 0.499, -24.25, -19, 0.499, -20.25, -16.5, 0.499, -24.25, -16.5, 0.499, -20.25, -0.25, 0.499, -17.5, 0.75, 0.499, -18, 0.75, 0.499, -19.75, -0.5, 0.499, -19.75, -0.5, 0.499, -9.5, -0.5, 0.499, -6, 0.75, 0.499, -6, 0.75, 0.499, -9.5, 1.75, 0.499, -20.25, 1.75, 0.499, -24.25, -0.75, 0.499, -24.25, -1, 0.499, -20.25, -0.5, 0.499, -13, 0.75, 0.499, -12.75, 0, 0.499, -13.25, -0.5, 0.499, -16.5, -0.25, 0.499, -15.25, 24.25, 0.499, -22, 24.25, 0.499, -24.25, 21.25, 0.499, -24.25, 2.5, 0.499, -19.75, 4.5, 0.499, -24.25, 24.25, 0.499, -10.25, 24.25, 0.499, -12.75, 15.75, 0.499, -24.25, 24.25, 0.499, -19.75, 7.25, 0.499, -24.25, 18.5, 0.499, -24.25, 24.25, 0.499, -17.5, 10, 0.499, -24.25, 24.25, 0.499, -5.5, 24.25, 0.499, -8, 2.5, 0.499, -9.25, 2.5, 0.499, -5.75, 24.25, 0.499, -15, 2.5, 0.499, -16.25, 13, 0.499, -24.25, 2.5, 0.499, -12.75, -21.5, 0.499, -15.5, -24.25, 0.499, -15.5, -24.25, 0.499, -13.25, -24.25, 0.499, 21.75, -24.25, 0.499, 24.25, -21.5, 0.499, 24.25, -2.25, 0.499, -12.75, -2.25, 0.499, -15.5, -5, 0.499, -15.5, -24.25, 0.499, -10.75, -24.25, 0.499, 19.25, -2.25, 0.499, -10, -7.75, 0.499, -15.5, -18.75, 0.499, -15.5, -24.25, 0.499, -8.25, -18.75, 0.499, 24.25, -24.25, 0.499, 16.75, -1.5, 0.499, -3.75, -2.25, 0.499, -4.25, -24.25, 0.499, 4.25, -24.25, 0.499, 6.75, -4.5, 0.499, 24.25, -1.5, 0.499, 24.25, -24.25, 0.499, 9.25, -10.25, 0.499, 24.25, -7.25, 0.499, 24.25, -2.25, 0.499, -7.25, -10.5, 0.499, -15.5, -16, 0.499, -15.5, -24.25, 0.499, -5.75, -16, 0.499, 24.25, -24.25, 0.499, 14.25, -13.25, 0.499, -15.5, -24.25, 0.499, -3.25, -24.25, 0.499, -0.75, -24.25, 0.499, 11.75, -13, 0.499, 24.25, -24.25, 0.499, 1.75, 0.75, 0.499, -4.25, -0.5, 0.499, -4.25, 1.75, 0.499, -3.75, 1.75, 0.499, 24.25, 21.25, 0.499, 24.25, 24.25, 0.499, 24.25, 24.25, 0.499, 20.5, 18.5, 0.499, 24.25, 15.75, 0.499, 24.25, 24.25, 0.499, 16.75, 13, 0.499, 24.25, 7.25, 0.499, 24.25, 24.25, 0.499, 13, 24.25, 0.499, 9.25, 4.5, 0.499, 24.25, 10, 0.499, 24.25, 24.25, 0.499, 1.75, 2.5, 0.499, -4.25, 24.25, 0.499, 5.5, 24.25, 0.499, -2) +polygons = [PackedInt32Array(1, 0, 2), PackedInt32Array(2, 0, 3), PackedInt32Array(3, 0, 4), PackedInt32Array(6, 5, 7), PackedInt32Array(7, 5, 8), PackedInt32Array(5, 11, 8), PackedInt32Array(8, 11, 9), PackedInt32Array(9, 11, 10), PackedInt32Array(14, 13, 15), PackedInt32Array(15, 13, 12), PackedInt32Array(15, 12, 16), PackedInt32Array(18, 17, 4), PackedInt32Array(4, 17, 3), PackedInt32Array(9, 10, 19), PackedInt32Array(19, 10, 20), PackedInt32Array(18, 16, 17), PackedInt32Array(17, 16, 12), PackedInt32Array(23, 22, 21), PackedInt32Array(21, 22, 20), PackedInt32Array(24, 23, 25), PackedInt32Array(25, 23, 21), PackedInt32Array(20, 22, 19), PackedInt32Array(26, 14, 15), PackedInt32Array(14, 26, 27), PackedInt32Array(27, 26, 28), PackedInt32Array(7, 29, 6), PackedInt32Array(6, 29, 31), PackedInt32Array(31, 29, 28), PackedInt32Array(28, 29, 30), PackedInt32Array(28, 30, 27), PackedInt32Array(35, 34, 32), PackedInt32Array(32, 34, 33), PackedInt32Array(39, 38, 36), PackedInt32Array(36, 38, 37), PackedInt32Array(43, 42, 40), PackedInt32Array(40, 42, 41), PackedInt32Array(45, 42, 44), PackedInt32Array(44, 42, 43), PackedInt32Array(47, 35, 46), PackedInt32Array(46, 35, 32), PackedInt32Array(36, 45, 39), PackedInt32Array(39, 45, 44), PackedInt32Array(49, 47, 48), PackedInt32Array(48, 47, 46), PackedInt32Array(38, 49, 37), PackedInt32Array(37, 49, 48), PackedInt32Array(52, 51, 53), PackedInt32Array(53, 51, 50), PackedInt32Array(57, 56, 54), PackedInt32Array(54, 56, 55), PackedInt32Array(53, 61, 52), PackedInt32Array(52, 61, 58), PackedInt32Array(58, 61, 60), PackedInt32Array(58, 60, 59), PackedInt32Array(64, 63, 62), PackedInt32Array(62, 63, 57), PackedInt32Array(62, 57, 54), PackedInt32Array(40, 41, 61), PackedInt32Array(61, 41, 60), PackedInt32Array(66, 65, 50), PackedInt32Array(50, 65, 53), PackedInt32Array(64, 62, 66), PackedInt32Array(66, 62, 65), PackedInt32Array(69, 68, 67), PackedInt32Array(58, 59, 70), PackedInt32Array(70, 59, 71), PackedInt32Array(74, 73, 72), PackedInt32Array(69, 67, 75), PackedInt32Array(70, 71, 76), PackedInt32Array(75, 78, 69), PackedInt32Array(69, 78, 77), PackedInt32Array(70, 76, 79), PackedInt32Array(81, 80, 74), PackedInt32Array(74, 80, 82), PackedInt32Array(82, 80, 83), PackedInt32Array(78, 84, 77), PackedInt32Array(77, 84, 74), PackedInt32Array(79, 86, 70), PackedInt32Array(70, 86, 85), PackedInt32Array(74, 72, 81), PackedInt32Array(82, 87, 74), PackedInt32Array(74, 84, 73), PackedInt32Array(86, 74, 85), PackedInt32Array(85, 74, 87), PackedInt32Array(90, 89, 88), PackedInt32Array(93, 92, 91), PackedInt32Array(96, 95, 94), PackedInt32Array(97, 90, 88), PackedInt32Array(93, 91, 98), PackedInt32Array(94, 99, 96), PackedInt32Array(96, 99, 100), PackedInt32Array(88, 101, 97), PackedInt32Array(97, 101, 102), PackedInt32Array(93, 98, 103), PackedInt32Array(103, 98, 104), PackedInt32Array(106, 105, 107), PackedInt32Array(107, 105, 108), PackedInt32Array(108, 105, 109), PackedInt32Array(109, 105, 110), PackedInt32Array(111, 108, 112), PackedInt32Array(112, 108, 113), PackedInt32Array(109, 113, 108), PackedInt32Array(99, 114, 100), PackedInt32Array(100, 114, 115), PackedInt32Array(102, 101, 117), PackedInt32Array(117, 101, 116), PackedInt32Array(103, 104, 118), PackedInt32Array(118, 104, 119), PackedInt32Array(122, 121, 120), PackedInt32Array(123, 111, 124), PackedInt32Array(124, 111, 112), PackedInt32Array(125, 122, 120), PackedInt32Array(115, 114, 120), PackedInt32Array(120, 114, 106), PackedInt32Array(120, 106, 125), PackedInt32Array(125, 106, 107), PackedInt32Array(117, 116, 121), PackedInt32Array(121, 116, 120), PackedInt32Array(119, 123, 118), PackedInt32Array(118, 123, 124), PackedInt32Array(127, 55, 126), PackedInt32Array(126, 55, 56), PackedInt32Array(126, 128, 127), PackedInt32Array(127, 128, 105), PackedInt32Array(105, 128, 129), PackedInt32Array(105, 129, 110), PackedInt32Array(132, 131, 130), PackedInt32Array(132, 130, 133), PackedInt32Array(132, 133, 134), PackedInt32Array(134, 136, 132), PackedInt32Array(132, 136, 135), PackedInt32Array(137, 140, 138), PackedInt32Array(138, 140, 139), PackedInt32Array(136, 141, 135), PackedInt32Array(135, 141, 138), PackedInt32Array(143, 142, 128), PackedInt32Array(128, 142, 144), PackedInt32Array(138, 141, 137), PackedInt32Array(83, 80, 143), PackedInt32Array(143, 80, 145), PackedInt32Array(144, 139, 128), PackedInt32Array(128, 139, 140), PackedInt32Array(128, 140, 129), PackedInt32Array(143, 145, 142)] geometry_parsed_geometry_type = 1 geometry_collision_mask = 4278190081 agent_height = 2.0 agent_radius = 0.75 +region_min_size = 14.0 +edge_max_length = 4.0 [sub_resource type="PlaneMesh" id="PlaneMesh_nwuu1"] size = Vector2(50, 50) @@ -329,7 +332,7 @@ transform = Transform3D(0.866025, -0.156955, -0.474726, 0.5, 0.271854, 0.82225, environment = SubResource("Environment_pwykw") [node name="GrunkBeast" parent="." instance=ExtResource("2_1lom2")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -26.7, 1.5, -24.3) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.7, 1.5, -18.3) [node name="NavigationRegion3D" type="NavigationRegion3D" parent="."] navigation_mesh = SubResource("NavigationMesh_gyhlh") @@ -383,6 +386,7 @@ process_material = SubResource("ParticleProcessMaterial_m3sro") [node name="SwitchA2" parent="NavigationRegion3D/Corridor1/Hallway1" instance=ExtResource("11_qluxd")] transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.4, 1.5, 4.5) +clean = true [node name="OverheadLight" parent="NavigationRegion3D/Corridor1/Hallway1" instance=ExtResource("12_h6xp0")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, -1.5) @@ -558,5 +562,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 4.5) [node name="LurkPoint2" type="Marker3D" parent="NavigationRegion3D/Corridor1" groups=["LurkPoint"]] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -27, 1.5, -19.5) -[connection signal="activated" from="NavigationRegion3D/Corridor1/Hallway1/SwitchA2" to="NavigationRegion3D/Corridor1/Hallway1/SwitchA2" method="disable"] +[node name="Bulkhead" parent="NavigationRegion3D" instance=ExtResource("27_18csx")] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -1.5, 0, -18) + +[connection signal="activated" from="NavigationRegion3D/Corridor1/Hallway1/SwitchA2" to="NavigationRegion3D/Bulkhead" method="open"] [connection signal="activated" from="NavigationRegion3D/Corridor1/Hallway4/SwitchB1" to="NavigationRegion3D/Corridor1/Hallway4/SwitchB1" method="disable"] diff --git a/src/world/grunk_beast/beast_model.gd b/src/world/grunk_beast/beast_model.gd new file mode 100644 index 0000000..2235bbb --- /dev/null +++ b/src/world/grunk_beast/beast_model.gd @@ -0,0 +1,10 @@ +class_name BeastModel extends Node3D +## Abstract base type for beast model controllers. + + +func set_target_rotation(_theta: float) -> void: + pass # Implemented in derived type + + +func set_move_speed(_speed: float) -> void: + pass # Implemented in derived type diff --git a/src/world/grunk_beast/beast_model.gd.uid b/src/world/grunk_beast/beast_model.gd.uid new file mode 100644 index 0000000..6c55ddf --- /dev/null +++ b/src/world/grunk_beast/beast_model.gd.uid @@ -0,0 +1 @@ +uid://di1bj4ebhtm7p diff --git a/src/world/grunk_beast/behaviors/actions/pursue_target.gd b/src/world/grunk_beast/behaviors/actions/pursue_target.gd index 0b249a2..c74ba20 100644 --- a/src/world/grunk_beast/behaviors/actions/pursue_target.gd +++ b/src/world/grunk_beast/behaviors/actions/pursue_target.gd @@ -11,10 +11,14 @@ class_name PursueTarget extends ActionLeaf func tick(_actor: Node, blackboard: Blackboard) -> int: - @warning_ignore("unsafe_cast") - var target := blackboard.get_value(blackboard_key) as Node3D - if not is_instance_valid(target): + var target: Variant = blackboard.get_value(blackboard_key) + if target is Vector3: + @warning_ignore("unsafe_cast") + nav_agent.target_position = target as Vector3 + elif target is Node3D and is_instance_valid(target): + @warning_ignore("unsafe_cast") + nav_agent.target_position = (target as Node3D).global_position + else: return FAILURE - nav_agent.target_position = target.global_position return SUCCESS if nav_agent.is_navigation_finished() else RUNNING diff --git a/src/world/grunk_beast/behaviors/actions/set_nav_target.gd b/src/world/grunk_beast/behaviors/actions/set_nav_target.gd index 7353ae2..c331ec3 100644 --- a/src/world/grunk_beast/behaviors/actions/set_nav_target.gd +++ b/src/world/grunk_beast/behaviors/actions/set_nav_target.gd @@ -13,7 +13,12 @@ class_name SetNavTarget extends ActionLeaf @onready var nav_agent: NavigationAgent3D = %NavAgent -func tick(_actor: Node, blackboard: Blackboard) -> int: +func tick(actor: Node, blackboard: Blackboard) -> int: + # Bug workaround -- do not update nav target while inside a link! + var beast := actor as GrunkBeast + if beast.traversing_link: + return RUNNING + var value: Variant = blackboard.get_value(blackboard_key) if value is Vector3: @warning_ignore("unsafe_cast") diff --git a/src/world/grunk_beast/grunk_beast.gd b/src/world/grunk_beast/grunk_beast.gd index aac8273..5c849ac 100644 --- a/src/world/grunk_beast/grunk_beast.gd +++ b/src/world/grunk_beast/grunk_beast.gd @@ -2,7 +2,7 @@ class_name GrunkBeast extends CharacterBody3D ## Grunk beast controller #region Constants -const STALKING_SOUND_LIMIT := 20.0 +const STALKING_SOUND_LIMIT := 25.0 #endregion #region Exported Properties @@ -22,6 +22,10 @@ var gravity: Vector3 = ( var pathfinding := true +var traversing_link := false + +@onready var model: BeastModel = %SlutchBeast + @onready var nav_agent: NavigationAgent3D = %NavAgent @onready var nav_probe: NavigationAgent3D = %NavProbe @onready var stalking_timer: Timer = %StalkingTimer @@ -90,6 +94,9 @@ func _physics_process(delta: float) -> void: if not is_on_floor(): velocity += gravity * delta + if motion: + model.set_target_rotation(atan2(motion.x, motion.z)) + move_and_slide() @@ -99,4 +106,13 @@ func on_sound_detected(source: Vector3) -> void: blackboard.set_value("stalking_target", source) stalking_timer.start() + #endregion + + +func _on_link_reached(_details: Dictionary) -> void: + traversing_link = true + + +func _on_waypoint_reached(_details: Dictionary) -> void: + traversing_link = false diff --git a/src/world/grunk_beast/grunk_beast.tscn b/src/world/grunk_beast/grunk_beast.tscn index fd05d6e..6739bb2 100644 --- a/src/world/grunk_beast/grunk_beast.tscn +++ b/src/world/grunk_beast/grunk_beast.tscn @@ -1,11 +1,10 @@ -[gd_scene load_steps=42 format=3 uid="uid://ehf5sg3ahvbf"] +[gd_scene load_steps=35 format=3 uid="uid://ehf5sg3ahvbf"] +[ext_resource type="Script" uid="uid://bukihqt1lybnx" path="res://src/util/frame_skipper.gd" id="2_lak6w"] [ext_resource type="Script" uid="uid://gwwmqwixqqr5" path="res://src/world/grunk_beast/grunk_beast.gd" id="2_qqnhb"] -[ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="4_0gxpq"] +[ext_resource type="PackedScene" uid="uid://cvq81xegbwv87" path="res://src/world/grunk_beast/slutch_beast/slutch_beast.tscn" id="2_xs4mp"] [ext_resource type="Script" uid="uid://cfsiyhhrcua6o" path="res://src/world/game_sound/game_sound_listener.gd" id="5_3gbao"] -[ext_resource type="Texture2D" uid="uid://cm1jrvx7ftx4c" path="res://assets/black.png" id="5_xuag8"] [ext_resource type="Script" uid="uid://bb0t2ovl7wifo" path="res://addons/beehave/nodes/beehave_tree.gd" id="6_d4ex2"] -[ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="6_mbqcc"] [ext_resource type="Script" uid="uid://dme5f24l0edsf" path="res://addons/beehave/blackboard.gd" id="7_cn3ok"] [ext_resource type="Script" uid="uid://cw22yurt5l74k" path="res://addons/beehave/nodes/composites/selector_reactive.gd" id="7_vvw1q"] [ext_resource type="Script" uid="uid://cg016dbe7gs1x" path="res://addons/beehave/nodes/composites/sequence.gd" id="8_0gxpq"] @@ -30,61 +29,6 @@ [ext_resource type="Script" uid="uid://dvnmhlldp23hg" path="res://addons/beehave/nodes/composites/selector_random.gd" id="24_xs4mp"] [ext_resource type="Script" uid="uid://bksvlal4gjhfr" path="res://src/world/grunk_beast/behaviors/actions/sniff.gd" id="26_lak6w"] -[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_faau1"] -width = 256 -height = 256 -depth = 32 -seamless = true -seamless_blend_skirt = 0.5 -noise = ExtResource("6_mbqcc") - -[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_3gbao"] -width = 256 -height = 256 -depth = 32 -seamless = true -seamless_blend_skirt = 0.5 -noise = ExtResource("6_mbqcc") - -[sub_resource type="FastNoiseLite" id="FastNoiseLite_7fplw"] -frequency = 0.0703 - -[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_wffas"] -width = 32 -height = 32 -depth = 128 -noise = SubResource("FastNoiseLite_7fplw") - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_bhjqi"] -resource_local_to_scene = true -render_priority = 0 -shader = ExtResource("4_0gxpq") -shader_parameter/color_1 = Color(0, 0.03, 0.1, 1) -shader_parameter/color_2 = Color(0, 0.1, 0.3, 1) -shader_parameter/emission_color = Color(0.25, 0.88, 1, 1) -shader_parameter/pixellation = 128.0 -shader_parameter/time_pixellation = 30.0 -shader_parameter/roughness = 0.15 -shader_parameter/specular_contribution = 0.8 -shader_parameter/emission_strength = 0.1 -shader_parameter/uv_scale = Vector2(4, 4) -shader_parameter/time_scale = 1.0 -shader_parameter/edge_bleed = 0.25 -shader_parameter/gunk_mask = ExtResource("5_xuag8") -shader_parameter/gunk_noise = SubResource("NoiseTexture3D_faau1") -shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_3gbao") -shader_parameter/jitter_magnitude = 0.6 -shader_parameter/jitter_time_scale = 0.2 -shader_parameter/jitter_noise = SubResource("NoiseTexture3D_wffas") -shader_parameter/vertex_inflation = 0.0 -shader_parameter/inflation_pixellation = 10.0 - -[sub_resource type="CapsuleMesh" id="CapsuleMesh_d4ex2"] -material = SubResource("ShaderMaterial_bhjqi") -radius = 0.45 -radial_segments = 7 -rings = 1 - [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_faau1"] radius = 0.4 @@ -105,16 +49,17 @@ radius = 10.0 [node name="GrunkBeast" type="CharacterBody3D" groups=["GrunkBeast"]] collision_layer = 36 +wall_min_slide_angle = 0.174533 +floor_max_angle = 1.0472 script = ExtResource("2_qqnhb") -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] -mesh = SubResource("CapsuleMesh_d4ex2") +[node name="FrameSkipper" type="Node3D" parent="."] +script = ExtResource("2_lak6w") +frame_skip = 4 -[node name="Label3D" type="Label3D" parent="MeshInstance3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2, 0) -billboard = 2 -no_depth_test = true -text = "SPOOKY!" +[node name="SlutchBeast" parent="FrameSkipper" instance=ExtResource("2_xs4mp")] +unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) [node name="CollisionShape3D" type="CollisionShape3D" parent="."] shape = SubResource("CapsuleShape3D_faau1") @@ -124,6 +69,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0) [node name="NavAgent" type="NavigationAgent3D" parent="Navigation"] unique_name_in_owner = true +path_height_offset = 0.25 path_postprocessing = 1 avoidance_enabled = true debug_enabled = true @@ -278,7 +224,7 @@ metadata/_custom_type_script = "uid://om57w2acvgb7" script = ExtResource("11_mbqcc") mean_time = 4.0 st_dev_time = 0.6 -wait_time = 3.87336 +wait_time = 4.44014 metadata/_custom_type_script = "uid://beyk2xtbjrsg4" [node name="RandomStalkingBehavior" type="Node" parent="GrunkBeastBehavior/StateSelector/StalkingSequence/RandomDelay"] @@ -324,7 +270,7 @@ metadata/_custom_type_script = "uid://cg016dbe7gs1x" script = ExtResource("11_mbqcc") mean_time = 5.0 st_dev_time = 1.0 -wait_time = 5.5859 +wait_time = 6.21238 metadata/_custom_type_script = "uid://beyk2xtbjrsg4" [node name="PickRandomLurkTarget" type="Node" parent="GrunkBeastBehavior/StateSelector/LurkSequence/RandomDelay"] @@ -347,4 +293,6 @@ unique_name_in_owner = true script = ExtResource("7_cn3ok") metadata/_custom_type_script = "uid://dme5f24l0edsf" +[connection signal="link_reached" from="Navigation/NavAgent" to="." method="_on_link_reached"] +[connection signal="waypoint_reached" from="Navigation/NavAgent" to="." method="_on_waypoint_reached"] [connection signal="sound_detected" from="GameSoundListener" to="." method="on_sound_detected"] diff --git a/src/world/procedural_grunk_beast/ik_target.gd b/src/world/grunk_beast/procedural_grunk_beast/ik_target.gd similarity index 100% rename from src/world/procedural_grunk_beast/ik_target.gd rename to src/world/grunk_beast/procedural_grunk_beast/ik_target.gd diff --git a/src/world/procedural_grunk_beast/ik_target.gd.uid b/src/world/grunk_beast/procedural_grunk_beast/ik_target.gd.uid similarity index 100% rename from src/world/procedural_grunk_beast/ik_target.gd.uid rename to src/world/grunk_beast/procedural_grunk_beast/ik_target.gd.uid diff --git a/src/world/procedural_grunk_beast/procedural_grunk_beast.gd b/src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.gd similarity index 100% rename from src/world/procedural_grunk_beast/procedural_grunk_beast.gd rename to src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.gd diff --git a/src/world/procedural_grunk_beast/procedural_grunk_beast.gd.uid b/src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.gd.uid similarity index 100% rename from src/world/procedural_grunk_beast/procedural_grunk_beast.gd.uid rename to src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.gd.uid diff --git a/src/world/procedural_grunk_beast/procedural_grunk_beast.tscn b/src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.tscn similarity index 95% rename from src/world/procedural_grunk_beast/procedural_grunk_beast.tscn rename to src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.tscn index 3bc0e48..5c4b86b 100644 --- a/src/world/procedural_grunk_beast/procedural_grunk_beast.tscn +++ b/src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.tscn @@ -1,12 +1,12 @@ [gd_scene load_steps=16 format=3 uid="uid://d2664rpg4losx"] [ext_resource type="PackedScene" uid="uid://bi5mxt5s4aq1a" path="res://assets/npc/grunk_beast/grunk_beast.gltf" id="1_hoss2"] -[ext_resource type="Script" uid="uid://dkll8s6kwb41r" path="res://src/world/procedural_grunk_beast/start_ik.gd" id="2_qic24"] -[ext_resource type="Script" uid="uid://dgy2ubsj1fotp" path="res://src/world/procedural_grunk_beast/procedural_grunk_beast.gd" id="2_qqnhb"] +[ext_resource type="Script" uid="uid://dkll8s6kwb41r" path="res://src/world/grunk_beast/procedural_grunk_beast/start_ik.gd" id="2_qic24"] +[ext_resource type="Script" uid="uid://dgy2ubsj1fotp" path="res://src/world/grunk_beast/procedural_grunk_beast/procedural_grunk_beast.gd" id="2_qqnhb"] [ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="4_0gxpq"] -[ext_resource type="Script" uid="uid://7is3sa00qejh" path="res://src/world/procedural_grunk_beast/ik_target.gd" id="4_3gbao"] -[ext_resource type="Script" uid="uid://bpyovjodpxjpb" path="res://src/world/procedural_grunk_beast/step_ray.gd" id="4_faau1"] -[ext_resource type="Script" uid="uid://c1gitpy7s78ev" path="res://src/world/procedural_grunk_beast/target_container.gd" id="5_wffas"] +[ext_resource type="Script" uid="uid://7is3sa00qejh" path="res://src/world/grunk_beast/procedural_grunk_beast/ik_target.gd" id="4_3gbao"] +[ext_resource type="Script" uid="uid://bpyovjodpxjpb" path="res://src/world/grunk_beast/procedural_grunk_beast/step_ray.gd" id="4_faau1"] +[ext_resource type="Script" uid="uid://c1gitpy7s78ev" path="res://src/world/grunk_beast/procedural_grunk_beast/target_container.gd" id="5_wffas"] [ext_resource type="Texture2D" uid="uid://cm1jrvx7ftx4c" path="res://assets/black.png" id="5_xuag8"] [ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="6_mbqcc"] diff --git a/src/world/procedural_grunk_beast/start_ik.gd b/src/world/grunk_beast/procedural_grunk_beast/start_ik.gd similarity index 100% rename from src/world/procedural_grunk_beast/start_ik.gd rename to src/world/grunk_beast/procedural_grunk_beast/start_ik.gd diff --git a/src/world/procedural_grunk_beast/start_ik.gd.uid b/src/world/grunk_beast/procedural_grunk_beast/start_ik.gd.uid similarity index 100% rename from src/world/procedural_grunk_beast/start_ik.gd.uid rename to src/world/grunk_beast/procedural_grunk_beast/start_ik.gd.uid diff --git a/src/world/procedural_grunk_beast/step_ray.gd b/src/world/grunk_beast/procedural_grunk_beast/step_ray.gd similarity index 100% rename from src/world/procedural_grunk_beast/step_ray.gd rename to src/world/grunk_beast/procedural_grunk_beast/step_ray.gd diff --git a/src/world/procedural_grunk_beast/step_ray.gd.uid b/src/world/grunk_beast/procedural_grunk_beast/step_ray.gd.uid similarity index 100% rename from src/world/procedural_grunk_beast/step_ray.gd.uid rename to src/world/grunk_beast/procedural_grunk_beast/step_ray.gd.uid diff --git a/src/world/procedural_grunk_beast/target_container.gd b/src/world/grunk_beast/procedural_grunk_beast/target_container.gd similarity index 100% rename from src/world/procedural_grunk_beast/target_container.gd rename to src/world/grunk_beast/procedural_grunk_beast/target_container.gd diff --git a/src/world/procedural_grunk_beast/target_container.gd.uid b/src/world/grunk_beast/procedural_grunk_beast/target_container.gd.uid similarity index 100% rename from src/world/procedural_grunk_beast/target_container.gd.uid rename to src/world/grunk_beast/procedural_grunk_beast/target_container.gd.uid diff --git a/src/world/grunk_beast/slutch_beast/slutch_beast.gd b/src/world/grunk_beast/slutch_beast/slutch_beast.gd new file mode 100644 index 0000000..bdf30f1 --- /dev/null +++ b/src/world/grunk_beast/slutch_beast/slutch_beast.gd @@ -0,0 +1,19 @@ +class_name SlutchBeast extends BeastModel + +@export var theta_acceleration := 4.0 + +@onready var target_theta := global_rotation.y + + +func set_target_rotation(theta: float) -> void: + target_theta = theta + + +func set_move_speed(_speed: float) -> void: + pass # TODO + + +func _process(delta: float) -> void: + global_rotation.y = lerp_angle( + global_rotation.y, target_theta, 1 - exp(-theta_acceleration * delta) + ) diff --git a/src/world/grunk_beast/slutch_beast/slutch_beast.gd.uid b/src/world/grunk_beast/slutch_beast/slutch_beast.gd.uid new file mode 100644 index 0000000..4ee2e80 --- /dev/null +++ b/src/world/grunk_beast/slutch_beast/slutch_beast.gd.uid @@ -0,0 +1 @@ +uid://dhrky2viceb82 diff --git a/src/world/grunk_beast/slutch_beast/slutch_beast.tscn b/src/world/grunk_beast/slutch_beast/slutch_beast.tscn new file mode 100644 index 0000000..8290616 --- /dev/null +++ b/src/world/grunk_beast/slutch_beast/slutch_beast.tscn @@ -0,0 +1,62 @@ +[gd_scene load_steps=11 format=3 uid="uid://cvq81xegbwv87"] + +[ext_resource type="PackedScene" uid="uid://uj7nf8db7sbv" path="res://assets/npc/slutch_beast/slutch.gltf" id="1_ctp72"] +[ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="2_htnl6"] +[ext_resource type="Script" uid="uid://dhrky2viceb82" path="res://src/world/grunk_beast/slutch_beast/slutch_beast.gd" id="2_pm58j"] +[ext_resource type="Texture2D" uid="uid://cm1jrvx7ftx4c" path="res://assets/black.png" id="3_pm58j"] +[ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="4_r4p65"] + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_faau1"] +width = 256 +height = 256 +depth = 32 +seamless = true +seamless_blend_skirt = 0.5 +noise = ExtResource("4_r4p65") + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_3gbao"] +width = 256 +height = 256 +depth = 32 +seamless = true +seamless_blend_skirt = 0.5 +noise = ExtResource("4_r4p65") + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_7fplw"] +frequency = 0.0703 + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_wffas"] +width = 32 +height = 32 +depth = 128 +noise = SubResource("FastNoiseLite_7fplw") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_wlv1q"] +resource_local_to_scene = true +render_priority = 0 +shader = ExtResource("2_htnl6") +shader_parameter/color_1 = Color(0, 0.03, 0.1, 1) +shader_parameter/color_2 = Color(0, 0.1, 0.3, 1) +shader_parameter/emission_color = Color(0.25, 0.88, 1, 1) +shader_parameter/pixellation = 128.0 +shader_parameter/time_pixellation = 30.0 +shader_parameter/roughness = 0.15 +shader_parameter/specular_contribution = 0.7 +shader_parameter/emission_strength = 0.0 +shader_parameter/uv_scale = Vector2(4, 4) +shader_parameter/time_scale = 2.0 +shader_parameter/edge_bleed = 0.25 +shader_parameter/gunk_mask = ExtResource("3_pm58j") +shader_parameter/gunk_noise = SubResource("NoiseTexture3D_faau1") +shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_3gbao") +shader_parameter/jitter_magnitude = 0.6 +shader_parameter/jitter_time_scale = 0.2 +shader_parameter/jitter_noise = SubResource("NoiseTexture3D_wffas") +shader_parameter/vertex_inflation = 0.0 +shader_parameter/inflation_pixellation = 10.0 + +[node name="SlutchBeast" instance=ExtResource("1_ctp72")] +script = ExtResource("2_pm58j") + +[node name="Slutch" parent="." index="0"] +surface_material_override/0 = SubResource("ShaderMaterial_wlv1q") diff --git a/src/world/spook_manager/spook_manager.gd b/src/world/spook_manager/spook_manager.gd index 8c56890..16a46d2 100644 --- a/src/world/spook_manager/spook_manager.gd +++ b/src/world/spook_manager/spook_manager.gd @@ -29,6 +29,7 @@ func spawn_beast() -> void: if not nodes: print_debug("Oh that's why. There aren't any spawn points. Complain to a developer.") return + @warning_ignore("unsafe_cast") spawn_point = nodes.pick_random() as Node3D _spawn_beast_at_point(spawn_point)