diff --git a/scenes/units/abstract/controlled_ant_unit.tscn b/scenes/units/abstract/controlled_ant_unit.tscn index ce1f4ce..4b91dfc 100644 --- a/scenes/units/abstract/controlled_ant_unit.tscn +++ b/scenes/units/abstract/controlled_ant_unit.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=9 format=3 uid="uid://lbs0vilymbum"] +[gd_scene load_steps=10 format=3 uid="uid://lbs0vilymbum"] [ext_resource type="PackedScene" uid="uid://cidd3q2tet7ku" path="res://scenes/units/abstract/controlled_unit.tscn" id="1_66kao"] +[ext_resource type="Script" path="res://scripts/units/abstract/controlled_ant_unit.gd" id="2_77pj2"] [ext_resource type="PackedScene" uid="uid://bi231xk2sp410" path="res://assets/models/ant.glb" id="2_e21vo"] [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_jem3o"] @@ -28,6 +29,7 @@ transitions = ["Start", "locomotion", SubResource("AnimationNodeStateMachineTran height = 0.5 [node name="ControlledAntUnit" instance=ExtResource("1_66kao")] +script = ExtResource("2_77pj2") [node name="AntModel" parent="." index="0" instance=ExtResource("2_e21vo")] diff --git a/scenes/units/abstract/controlled_unit.tscn b/scenes/units/abstract/controlled_unit.tscn index c5f5c64..0813f5f 100644 --- a/scenes/units/abstract/controlled_unit.tscn +++ b/scenes/units/abstract/controlled_unit.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=5 format=3 uid="uid://cidd3q2tet7ku"] [ext_resource type="PackedScene" uid="uid://c70vx0utm5knp" path="res://scenes/units/abstract/unit.tscn" id="1_iivmb"] -[ext_resource type="Script" path="res://scripts/units/controlled_unit.gd" id="2_ruawn"] +[ext_resource type="Script" path="res://scripts/units/abstract/controlled_unit.gd" id="2_ruawn"] [ext_resource type="Material" uid="uid://bghl8uypb17xy" path="res://resources/materials/indicators/select_indicator_mat.tres" id="3_3totu"] [sub_resource type="QuadMesh" id="QuadMesh_4fevy"] diff --git a/scenes/units/abstract/unit.tscn b/scenes/units/abstract/unit.tscn index a54ee4f..719d197 100644 --- a/scenes/units/abstract/unit.tscn +++ b/scenes/units/abstract/unit.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=6 format=3 uid="uid://c70vx0utm5knp"] -[ext_resource type="Script" path="res://scripts/units/unit.gd" id="1_ulhs6"] +[ext_resource type="Script" path="res://scripts/units/abstract/unit.gd" id="1_ulhs6"] [ext_resource type="Material" uid="uid://f0nlf4tdpvbd" path="res://resources/materials/indicators/hover_indicator_mat.tres" id="2_uk1jy"] [ext_resource type="Script" path="res://scripts/sound_effects_player.gd" id="3_wl62h"] diff --git a/scenes/units/ant_gatherer.tscn b/scenes/units/ant_gatherer.tscn index 180d19a..f312b17 100644 --- a/scenes/units/ant_gatherer.tscn +++ b/scenes/units/ant_gatherer.tscn @@ -12,15 +12,8 @@ radius = 15.0 script = ExtResource("2_7pblm") [node name="Skeleton3D" parent="AntModel/Armature" index="0"] -bones/4/rotation = Quaternion(0.587858, -5.43255e-07, -3.94772e-07, 0.808964) -bones/6/rotation = Quaternion(0.330686, -3.0116e-14, -4.44141e-07, 0.943741) -bones/9/rotation = Quaternion(0.587858, 5.43255e-07, 3.94772e-07, 0.808964) -bones/11/rotation = Quaternion(0.330686, 3.0116e-14, 4.44141e-07, 0.943741) -bones/14/rotation = Quaternion(4.60304e-08, 0.0294697, 0.999566, -5.43234e-07) bones/14/scale = Vector3(1, 1, 1) -bones/15/rotation = Quaternion(4.55913e-08, 0.0294697, 0.999566, -4.34329e-07) bones/15/scale = Vector3(1, 1, 1) -bones/16/rotation = Quaternion(4.55913e-08, 0.0294697, 0.999566, -4.34329e-07) bones/16/scale = Vector3(1, 1, 1) bones/18/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566) bones/19/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566) @@ -30,23 +23,11 @@ bones/22/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566) bones/23/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566) bones/24/rotation = Quaternion(0.0294712, -6.21995e-15, 4.35675e-07, 0.999566) bones/25/rotation = Quaternion(0.0294712, -5.33139e-15, 4.35675e-07, 0.999566) -bones/26/rotation = Quaternion(-0.221628, 0.221633, -0.671475, 0.671477) -bones/27/rotation = Quaternion(0.583948, -8.29882e-08, 2.36539e-06, 0.811791) bones/27/scale = Vector3(1, 1, 1) -bones/28/rotation = Quaternion(-0.84146, 6.60837e-08, -6.26108e-06, 0.54032) -bones/30/rotation = Quaternion(0.583949, -2.24752e-07, 2.46641e-06, 0.811791) -bones/31/rotation = Quaternion(-0.84146, 1.69298e-07, -6.42962e-06, 0.54032) bones/32/scale = Vector3(1, 1, 1) -bones/34/rotation = Quaternion(-0.841459, 1.31575e-07, -6.3826e-06, 0.540321) bones/34/scale = Vector3(1, 1, 1) -bones/35/rotation = Quaternion(-0.221628, -0.221633, 0.671475, 0.671477) -bones/36/rotation = Quaternion(0.583948, 8.29882e-08, -2.36539e-06, 0.811791) bones/36/scale = Vector3(1, 1, 1) -bones/37/rotation = Quaternion(-0.84146, -6.60837e-08, 6.26108e-06, 0.54032) -bones/39/rotation = Quaternion(0.583949, 2.24752e-07, -2.46641e-06, 0.811791) -bones/40/rotation = Quaternion(-0.84146, -1.69298e-07, 6.42962e-06, 0.54032) bones/41/scale = Vector3(1, 1, 1) -bones/43/rotation = Quaternion(-0.841459, -1.31575e-07, 6.3826e-06, 0.540321) bones/43/scale = Vector3(1, 1, 1) [node name="GathererMesh" parent="AntModel/Armature/Skeleton3D" index="0"] diff --git a/scripts/units/abstract/controlled_ant_unit.gd b/scripts/units/abstract/controlled_ant_unit.gd new file mode 100644 index 0000000..cd00226 --- /dev/null +++ b/scripts/units/abstract/controlled_ant_unit.gd @@ -0,0 +1,9 @@ +extends ControlledUnit +class_name ControlledAntUnit + +@onready var skeleton: Skeleton3D = $AntModel/Armature/Skeleton3D + + +func _ready() -> void: + assert(skeleton != null, "skeleton missing!") + super._ready() diff --git a/scripts/units/controlled_unit.gd b/scripts/units/abstract/controlled_unit.gd similarity index 100% rename from scripts/units/controlled_unit.gd rename to scripts/units/abstract/controlled_unit.gd diff --git a/scripts/units/unit.gd b/scripts/units/abstract/unit.gd similarity index 100% rename from scripts/units/unit.gd rename to scripts/units/abstract/unit.gd diff --git a/scripts/units/ant_gatherer.gd b/scripts/units/ant_gatherer.gd index 00f8715..c48e0f7 100644 --- a/scripts/units/ant_gatherer.gd +++ b/scripts/units/ant_gatherer.gd @@ -1,4 +1,4 @@ -extends ControlledUnit +extends ControlledAntUnit class_name AntGatherer enum State { @@ -13,7 +13,6 @@ const MAX_CARRY: int = 8 var state: State = State.WANDERING @onready var gathering: Gathering = $Gathering -@onready var skeleton: Skeleton3D = $AntModel/Armature/Skeleton3D static func get_cost() -> int: @@ -22,7 +21,6 @@ static func get_cost() -> int: func _ready() -> void: assert(gathering != null, "gathering missing!") - assert(skeleton != null, "skeleton missing!") super._ready() moving_started.connect(_on_moving_started) moving_ended.connect(_on_moving_ended) diff --git a/scripts/units/ant_nitwit.gd b/scripts/units/ant_nitwit.gd index 7b32430..42ac20e 100644 --- a/scripts/units/ant_nitwit.gd +++ b/scripts/units/ant_nitwit.gd @@ -1,4 +1,4 @@ -extends ControlledUnit +extends ControlledAntUnit class_name AntNitwit enum State { @@ -12,7 +12,6 @@ const ITEM_BONE_NAME = "Nitwit_item_" var state: State = State.WANDERING @onready var gathering: Gathering = $Gathering -@onready var skeleton: Skeleton3D = $AntModel/Armature/Skeleton3D static func get_cost() -> int: @@ -21,7 +20,6 @@ static func get_cost() -> int: func _ready() -> void: assert(gathering != null, "gathering missing!") - assert(skeleton != null, "skeleton missing!") super._ready() moving_started.connect(_on_moving_started) moving_ended.connect(_on_moving_ended)