[gd_scene format=3 uid="uid://1s2obm2l4f1a"] [ext_resource type="PackedScene" uid="uid://hirlnhjbqv2u" path="res://assets/characters/bot.blend" id="1_882u1"] [ext_resource type="Script" uid="uid://csqsliec0twij" path="res://scripts/damage_area.gd" id="2_41oev"] [ext_resource type="Script" uid="uid://cfr2fxpk46n0b" path="res://scripts/weapon_parent.gd" id="3_3hb37"] [ext_resource type="PackedScene" uid="uid://bjrst6dj2vtud" path="res://behaviours/trees/enemy_behaviours.tscn" id="3_we7g8"] [ext_resource type="PackedScene" uid="uid://ljmtmtljlyoc" path="res://objects/debug_label.tscn" id="4_2ld5k"] [ext_resource type="PackedScene" uid="uid://deuif6d8spece" path="res://objects/awareness_area.tscn" id="4_we7g8"] [sub_resource type="GDScript" id="GDScript_882u1"] resource_name = "EnemyBody" script/source = "extends CharacterBody3D signal damaged(amount : int, source : Node3D) @export var health : int = 6 @export var path : Array[Marker3D] @onready var anim := %AnimationPlayer as AnimationPlayer var hurt_high : bool = false var target : Node3D = null var patrol_target : int = 0 var blinded : int = 0 func set_blinded(value : bool): blinded += 1 if value else -1 func _ready(): damaged.connect(_damaged) func _damaged(amount : int, source : Node3D): hurt_high = true target = source health -= amount if health <= 0: %WeaponParent.drop_weapon() func _physics_process(delta : float): var motion := anim.get_root_motion_position() velocity = (motion.x * global_basis.x + motion.z * global_basis.z) / delta velocity += get_gravity() * delta move_and_slide() func equip_weapon(weapon : Area3D): %WeaponParent.set_weapon(weapon) func get_current_weapon_type() -> String: return \"\" if %WeaponParent.weapon == null else %WeaponParent.weapon.animations func find_targets() -> Array[Node3D]: return $AwarenessArea.aware if blinded == 0 else Array([], TYPE_OBJECT, \"Node3D\", Node3D) func weapon_filter(node : Node3D): return node.can_interact() func find_weapons() -> Array[Node3D]: return $ItemAwareness.aware.filter(weapon_filter) if blinded == 0 else [] func wants_jab_attack() -> bool: return target and target.global_position.distance_to(global_position) < 1.5 " [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_41oev"] albedo_color = Color(0.36862746, 0.5686275, 1, 1) [sub_resource type="BoxShape3D" id="BoxShape3D_we7g8"] size = Vector3(0.33496094, 0.5253906, 0.26367188) [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_882u1"] radius = 0.2133789 [sub_resource type="CylinderShape3D" id="CylinderShape3D_we7g8"] height = 3.3642578 radius = 9.955078 [node name="Enemy" unique_id=629825830 groups=["EnemyHitbox"] instance=ExtResource("1_882u1")] collision_layer = 2 collision_mask = 3 script = SubResource("GDScript_882u1") [node name="Mesh" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(750883464) index="0" unique_id=233192374] material_override = SubResource("StandardMaterial3D_41oev") [node name="HandR" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(750883464) index="1" unique_id=957498611] transform = Transform3D(0.015967373, -0.083946444, 0.9963424, -0.17989334, -0.98045003, -0.07972447, 0.9835564, -0.17796235, -0.030756809, 0.27221423, 0.7951686, 0.024477992) bone_name = "hand.r" bone_idx = 10 [node name="DamageAreaR" type="Area3D" parent="Character/Skeleton3D/HandR" index="0" unique_id=999461654 node_paths=PackedStringArray("source")] collision_layer = 0 collision_mask = 2 monitoring = false monitorable = false script = ExtResource("2_41oev") source = NodePath("../../../..") damage_group = "PlayerHitbox" [node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/HandR/DamageAreaR" index="0" unique_id=1459089003] transform = Transform3D(1.0000031, -4.61936e-07, -9.126961e-08, -1.1920929e-07, 1.0000024, 1.8626451e-09, -7.4505806e-08, 4.703179e-07, 1, 9.433925e-05, 0.10188866, -0.010492891) shape = SubResource("BoxShape3D_we7g8") debug_color = Color(0.9966913, 0, 0.17880186, 1) [node name="WeaponParent" type="Node3D" parent="Character/Skeleton3D/HandR" index="1" unique_id=1382605988] unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.7755576e-16, 0.10578142, 2.095476e-09) script = ExtResource("3_3hb37") damage_group = "PlayerHitbox" [node name="HandL" type="BoneAttachment3D" parent="Character/Skeleton3D" parent_id_path=PackedInt32Array(750883464) index="2" unique_id=1761081841] transform = Transform3D(-0.039434362, 0.07924447, -0.9960749, 0.12679999, -0.9883944, -0.083653376, -0.99114394, -0.12960118, 0.028928574, -0.2710728, 0.7714727, 0.0945672) bone_name = "hand.l" bone_idx = 7 [node name="DamageAreaL" type="Area3D" parent="Character/Skeleton3D/HandL" index="0" unique_id=607683055 node_paths=PackedStringArray("source")] collision_layer = 0 collision_mask = 2 monitoring = false monitorable = false script = ExtResource("2_41oev") source = NodePath("../../../..") damage_group = "PlayerHitbox" [node name="CollisionShape3D" type="CollisionShape3D" parent="Character/Skeleton3D/HandL/DamageAreaL" index="0" unique_id=2069345419] transform = Transform3D(1.0000169, -1.5795231e-06, -3.874302e-07, 8.046627e-07, 1.0000216, -3.7252903e-07, -8.046627e-07, 8.046627e-07, 1.0000148, -4.8220158e-05, 0.101875365, -0.010286808) shape = SubResource("BoxShape3D_we7g8") debug_color = Color(0.9966913, 0, 0.17880186, 1) [node name="AnimationPlayer" parent="." index="1" unique_id=1278488642] unique_name_in_owner = true root_motion_track = NodePath("Character/Skeleton3D:root") [node name="CollisionShape3D" type="CollisionShape3D" parent="." index="2" unique_id=283680831] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) shape = SubResource("CapsuleShape3D_882u1") [node name="DebugLabel" parent="." index="3" unique_id=1911478572 instance=ExtResource("4_2ld5k")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2257917, 0) [node name="BehaviourTree" parent="." index="4" unique_id=82050956 instance=ExtResource("3_we7g8")] [node name="AwarenessArea" parent="." index="5" unique_id=986494999 instance=ExtResource("4_we7g8")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0324535, 0) [node name="CollisionShape3D" parent="AwarenessArea" index="0" unique_id=2035583636] shape = SubResource("CylinderShape3D_we7g8") [node name="ItemAwareness" parent="." index="6" unique_id=697341779 instance=ExtResource("4_we7g8")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0324535, 0) collision_mask = 1 target_group = "WeaponPickup" [node name="CollisionShape3D" parent="ItemAwareness" index="0" unique_id=2035583636] shape = SubResource("CylinderShape3D_we7g8") [editable path="AwarenessArea"] [editable path="ItemAwareness"]