diff --git a/src/projects/Command Post/assets/character/attacker/attacker_character.gd b/src/projects/Command Post/assets/character/attacker/attacker_character.gd new file mode 100644 index 0000000..06e80ef --- /dev/null +++ b/src/projects/Command Post/assets/character/attacker/attacker_character.gd @@ -0,0 +1 @@ +class_name AttackerCharacter extends Character diff --git a/src/projects/Command Post/assets/character/attacker/attacker_character.tscn b/src/projects/Command Post/assets/character/attacker/attacker_character.tscn new file mode 100644 index 0000000..5420882 --- /dev/null +++ b/src/projects/Command Post/assets/character/attacker/attacker_character.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=7 format=3 uid="uid://cc3xcu8ipc6mu"] + +[ext_resource type="Script" path="res://assets/character/attacker/attacker_character.gd" id="1_t1ra7"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_liwfn"] + +[sub_resource type="BoxMesh" id="BoxMesh_h3hrr"] +material = SubResource("StandardMaterial3D_liwfn") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lrkyl"] + +[sub_resource type="BoxMesh" id="BoxMesh_5nwng"] +material = SubResource("StandardMaterial3D_lrkyl") +size = Vector3(0.5, 0.5, 0.5) + +[sub_resource type="BoxShape3D" id="BoxShape3D_00y5t"] +size = Vector3(1, 2, 1) + +[node name="attacker_character" type="Area3D"] +script = ExtResource("1_t1ra7") +faction = 1 +body_color = Color(0.85098, 0.00784314, 0, 1) +eye_color = Color(1, 0.356863, 0.290196, 1) + +[node name="body_mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0) +mesh = SubResource("BoxMesh_h3hrr") + +[node name="eye_mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.66878, -0.407032) +mesh = SubResource("BoxMesh_5nwng") + +[node name="collision" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +shape = SubResource("BoxShape3D_00y5t") + +[node name="gun" type="Marker3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.2) diff --git a/src/projects/Command Post/assets/character/base/character.gd b/src/projects/Command Post/assets/character/base/character.gd new file mode 100644 index 0000000..9d15df3 --- /dev/null +++ b/src/projects/Command Post/assets/character/base/character.gd @@ -0,0 +1,24 @@ +class_name Character extends Area3D + + +@export var faction: Enums.Faction +@export var body_color: Color +@export var eye_color: Color +@export var target: Character + +@onready var body_mesh = $body_mesh +@onready var eye_mesh = $eye_mesh + + + +func _ready(): + var body_mat = StandardMaterial3D.new() + body_mat.albedo_color = body_color + body_mesh.material_override = body_mat + + var eye_mat = StandardMaterial3D.new() + eye_mat.albedo_color = eye_color + eye_mat.emission_enabled = true + eye_mat.set_emission(eye_color) + eye_mesh.material_override = eye_mat + diff --git a/src/projects/Command Post/assets/character/base/character.tscn b/src/projects/Command Post/assets/character/base/character.tscn new file mode 100644 index 0000000..042a009 --- /dev/null +++ b/src/projects/Command Post/assets/character/base/character.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=7 format=3 uid="uid://cy2bstu6fom0r"] + +[ext_resource type="Script" path="res://assets/character/base/character.gd" id="1_ujxfn"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xjg4n"] + +[sub_resource type="BoxMesh" id="BoxMesh_h3hrr"] +material = SubResource("StandardMaterial3D_xjg4n") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vs3tt"] + +[sub_resource type="BoxMesh" id="BoxMesh_5nwng"] +material = SubResource("StandardMaterial3D_vs3tt") +size = Vector3(0.5, 0.5, 0.5) + +[sub_resource type="BoxShape3D" id="BoxShape3D_00y5t"] +size = Vector3(1, 2, 1) + +[node name="character" type="Area3D"] +script = ExtResource("1_ujxfn") +eye_color = Color(1, 1, 1, 1) + +[node name="body_mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0) +mesh = SubResource("BoxMesh_h3hrr") + +[node name="eye_mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.66878, -0.407032) +mesh = SubResource("BoxMesh_5nwng") + +[node name="collision" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +shape = SubResource("BoxShape3D_00y5t") + +[node name="gun" type="Marker3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.2) diff --git a/src/projects/Command Post/assets/character/defender/defender_character.gd b/src/projects/Command Post/assets/character/defender/defender_character.gd new file mode 100644 index 0000000..9ea0571 --- /dev/null +++ b/src/projects/Command Post/assets/character/defender/defender_character.gd @@ -0,0 +1 @@ +class_name DefenderCharacter extends Character diff --git a/src/projects/Command Post/assets/character/defender/defender_character.tscn b/src/projects/Command Post/assets/character/defender/defender_character.tscn new file mode 100644 index 0000000..02777c8 --- /dev/null +++ b/src/projects/Command Post/assets/character/defender/defender_character.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=5 format=3 uid="uid://bijsg61uyql4t"] + +[ext_resource type="Script" path="res://assets/character/defender/defender_character.gd" id="1_8ab7l"] + +[sub_resource type="BoxMesh" id="BoxMesh_h3hrr"] + +[sub_resource type="BoxMesh" id="BoxMesh_5nwng"] +size = Vector3(0.5, 0.5, 0.5) + +[sub_resource type="BoxShape3D" id="BoxShape3D_00y5t"] +size = Vector3(1, 2, 1) + +[node name="defender_character" type="Area3D"] +script = ExtResource("1_8ab7l") +faction = 2 +body_color = Color(0.341176, 0.415686, 0.839216, 1) +eye_color = Color(0.513726, 0.592157, 0.929412, 1) + +[node name="body_mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0) +mesh = SubResource("BoxMesh_h3hrr") + +[node name="eye_mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.66878, -0.407032) +mesh = SubResource("BoxMesh_5nwng") + +[node name="collision" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +shape = SubResource("BoxShape3D_00y5t") + +[node name="gun" type="Marker3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.2) diff --git a/src/projects/Command Post/assets/character/non_aligned/non_aligned_character.gd b/src/projects/Command Post/assets/character/non_aligned/non_aligned_character.gd new file mode 100644 index 0000000..75b7eb7 --- /dev/null +++ b/src/projects/Command Post/assets/character/non_aligned/non_aligned_character.gd @@ -0,0 +1 @@ +class_name NonAlignedCharacter extends Character diff --git a/src/projects/Command Post/assets/character/non_aligned/non_aligned_character.tscn b/src/projects/Command Post/assets/character/non_aligned/non_aligned_character.tscn new file mode 100644 index 0000000..bd98536 --- /dev/null +++ b/src/projects/Command Post/assets/character/non_aligned/non_aligned_character.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=7 format=3 uid="uid://6ngrwq73dgcn"] + +[ext_resource type="Script" path="res://assets/character/non_aligned/non_aligned_character.gd" id="1_re3fi"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xjg4n"] + +[sub_resource type="BoxMesh" id="BoxMesh_h3hrr"] +material = SubResource("StandardMaterial3D_xjg4n") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vs3tt"] + +[sub_resource type="BoxMesh" id="BoxMesh_5nwng"] +material = SubResource("StandardMaterial3D_vs3tt") +size = Vector3(0.5, 0.5, 0.5) + +[sub_resource type="BoxShape3D" id="BoxShape3D_00y5t"] +size = Vector3(1, 2, 1) + +[node name="non_aligned_character" type="Area3D"] +script = ExtResource("1_re3fi") +faction = -1 +body_color = Color(0.254902, 0.294118, 0.176471, 1) +eye_color = Color(0.647059, 0.584314, 0.490196, 1) + +[node name="body_mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0) +mesh = SubResource("BoxMesh_h3hrr") + +[node name="eye_mesh" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.66878, -0.407032) +mesh = SubResource("BoxMesh_5nwng") + +[node name="collision" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +shape = SubResource("BoxShape3D_00y5t") + +[node name="gun" type="Marker3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.2) diff --git a/src/projects/Command Post/assets/cp/command_post.gd b/src/projects/Command Post/assets/cp/command_post.gd new file mode 100644 index 0000000..19a5f81 --- /dev/null +++ b/src/projects/Command Post/assets/cp/command_post.gd @@ -0,0 +1,46 @@ +class_name CommandPost extends Node3D + + +@onready var spawn_points = $spawn_points + +var spawns: Array; +var spawn_ring_index = 0 +var spawn_ring_end = -1 + +var contested: bool = false + + +func _ready(): + _set_spawn_data() + + +func _set_spawn_data(): + for sp in spawn_points.get_children(): + if sp is SpawnPoint: + spawns.append(sp) + + spawn_ring_end = spawns.size() - 1 + +func _get_spawn() -> SpawnPoint: + var sp = spawns[spawn_ring_index] + spawn_ring_index += 1 + + if spawn_ring_index > spawn_ring_end: + spawn_ring_index = 0 + + return sp + + +func spawn(spawn_entity: PackedScene = null): + if not spawn_entity: return + + var sp = _get_spawn() + var entity = spawn_entity.instantiate() + + $"/root".add_child(entity) +# entity.global_position = sp.global_position +# entity.basis = sp.basis + + entity.global_position = sp.global_position + entity.look_at(sp.get_node("direction").global_position, Vector3.UP) + entity.rotation.x = sp.rotation.x diff --git a/src/projects/Command Post/assets/cp/command_post.tscn b/src/projects/Command Post/assets/cp/command_post.tscn new file mode 100644 index 0000000..5730ec5 --- /dev/null +++ b/src/projects/Command Post/assets/cp/command_post.tscn @@ -0,0 +1,40 @@ +[gd_scene load_steps=6 format=3 uid="uid://ctbug001xo01q"] + +[ext_resource type="Script" path="res://assets/cp/command_post.gd" id="1_vqafl"] +[ext_resource type="PackedScene" uid="uid://cay4mruy6x2ql" path="res://assets/cp/spawn_point.tscn" id="2_b7wsq"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fyc46"] + +[sub_resource type="BoxMesh" id="BoxMesh_perwq"] +material = SubResource("StandardMaterial3D_fyc46") +size = Vector3(0.5, 0.5, 0.5) + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_b611m"] +height = 0.639439 + +[node name="command_post" type="Node3D"] +script = ExtResource("1_vqafl") + +[node name="cp_status" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.280104, 0) +mesh = SubResource("BoxMesh_perwq") + +[node name="area" type="Area3D" parent="cp_status"] + +[node name="capture_region" type="CollisionShape3D" parent="cp_status/area"] +transform = Transform3D(4, 0, 0, 0, 4, 0, 0, 0, 4, 0, 1.2, 0) +shape = SubResource("CylinderShape3D_b611m") + +[node name="spawn_points" type="Node3D" parent="."] + +[node name="SpawnPoint" parent="spawn_points" instance=ExtResource("2_b7wsq")] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -2, 0, 0) + +[node name="SpawnPoint2" parent="spawn_points" instance=ExtResource("2_b7wsq")] +transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 2) + +[node name="SpawnPoint3" parent="spawn_points" instance=ExtResource("2_b7wsq")] +transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 2, 0, 0) + +[node name="SpawnPoint4" parent="spawn_points" instance=ExtResource("2_b7wsq")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2) diff --git a/src/projects/Command Post/assets/cp/controllers/CommandPostController.gd b/src/projects/Command Post/assets/cp/controllers/CommandPostController.gd new file mode 100644 index 0000000..8b47ebc --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/CommandPostController.gd @@ -0,0 +1,34 @@ +class_name CommandPostController extends Node3D + + +@export var team: Enums.Faction; +@export var spawn_entity: PackedScene = null +@export var cp_color: Color + + +func _on_child_entered_tree(cp: CommandPost): + var new_mat = StandardMaterial3D.new() + new_mat.albedo_color = cp_color + new_mat.emission_enabled = true + + new_mat.set_emission(cp_color) + cp.get_node("cp_status").material_override = new_mat + +func _on_child_exiting_tree(_cp: CommandPost): + pass + + +func do_spawn(): + var spawners = self.get_children() + if spawners.size() == 0: return + + var target = null + for spawn in spawners: + if spawn.contested: + target = spawn + + if not target: + randomize() + target = spawners[ randi() % len(spawners) ] + + target.spawn(spawn_entity) diff --git a/src/projects/Command Post/assets/cp/controllers/attacker/CommandPostAttackers.gd b/src/projects/Command Post/assets/cp/controllers/attacker/CommandPostAttackers.gd new file mode 100644 index 0000000..668c6d5 --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/attacker/CommandPostAttackers.gd @@ -0,0 +1,5 @@ +class_name CommandPostAttackers extends CommandPostController + + +func _ready(): + MessageBus.spawn_attacker.connect(do_spawn) diff --git a/src/projects/Command Post/assets/cp/controllers/attacker/command_post_attackers.tscn b/src/projects/Command Post/assets/cp/controllers/attacker/command_post_attackers.tscn new file mode 100644 index 0000000..c32b859 --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/attacker/command_post_attackers.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://viqdvqrnn5c7"] + +[ext_resource type="Script" path="res://assets/cp/controllers/attacker/CommandPostAttackers.gd" id="1_71i6h"] +[ext_resource type="PackedScene" uid="uid://cc3xcu8ipc6mu" path="res://assets/character/attacker/attacker_character.tscn" id="2_itmdl"] + +[node name="CommandPostAttackers" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0) +script = ExtResource("1_71i6h") +team = 1 +spawn_entity = ExtResource("2_itmdl") +cp_color = Color(0.87451, 0.160784, 0.105882, 1) + +[connection signal="child_entered_tree" from="." to="." method="_on_child_entered_tree"] +[connection signal="child_exiting_tree" from="." to="." method="_on_child_exiting_tree"] diff --git a/src/projects/Command Post/assets/cp/controllers/command_post_controller.tscn b/src/projects/Command Post/assets/cp/controllers/command_post_controller.tscn new file mode 100644 index 0000000..960fd4a --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/command_post_controller.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://fjmd7edm67ps"] + +[ext_resource type="Script" path="res://assets/cp/controllers/CommandPostController.gd" id="1_ljrld"] + +[node name="CommandPostController" type="Node3D"] +script = ExtResource("1_ljrld") +cp_color = Color(0.766158, 2.56056e-05, 0.553493, 1) diff --git a/src/projects/Command Post/assets/cp/controllers/defender/CommandPostDefenders.gd b/src/projects/Command Post/assets/cp/controllers/defender/CommandPostDefenders.gd new file mode 100644 index 0000000..bce5771 --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/defender/CommandPostDefenders.gd @@ -0,0 +1,5 @@ +class_name CommandPostDefenders extends CommandPostController + + +func _ready(): + MessageBus.spawn_defender.connect(do_spawn) diff --git a/src/projects/Command Post/assets/cp/controllers/defender/command_post_defenders.tscn b/src/projects/Command Post/assets/cp/controllers/defender/command_post_defenders.tscn new file mode 100644 index 0000000..496a9ce --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/defender/command_post_defenders.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://d3wabfyfccfs8"] + +[ext_resource type="Script" path="res://assets/cp/controllers/defender/CommandPostDefenders.gd" id="1_t3jlv"] +[ext_resource type="PackedScene" uid="uid://bijsg61uyql4t" path="res://assets/character/defender/defender_character.tscn" id="2_7efxs"] + +[node name="CommandPostDefenders" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0) +script = ExtResource("1_t3jlv") +team = 2 +spawn_entity = ExtResource("2_7efxs") +cp_color = Color(0.262745, 0.501961, 0.709804, 1) + +[connection signal="child_entered_tree" from="." to="." method="_on_child_entered_tree"] +[connection signal="child_exiting_tree" from="." to="." method="_on_child_exiting_tree"] diff --git a/src/projects/Command Post/assets/cp/controllers/neutral/CommandPostNeutral.gd b/src/projects/Command Post/assets/cp/controllers/neutral/CommandPostNeutral.gd new file mode 100644 index 0000000..f8cb7a6 --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/neutral/CommandPostNeutral.gd @@ -0,0 +1,5 @@ +class_name CommandPostNeutral extends CommandPostController + + +func _ready(): + pass diff --git a/src/projects/Command Post/assets/cp/controllers/neutral/command_post_neutral.tscn b/src/projects/Command Post/assets/cp/controllers/neutral/command_post_neutral.tscn new file mode 100644 index 0000000..3f849bf --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/neutral/command_post_neutral.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=2 format=3 uid="uid://dqx5s14sb162x"] + +[ext_resource type="Script" path="res://assets/cp/controllers/neutral/CommandPostNeutral.gd" id="1_tfbyg"] + +[node name="CommandPostNeutral" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0) +script = ExtResource("1_tfbyg") +cp_color = Color(0.454902, 0.454902, 0.454902, 1) + +[connection signal="child_entered_tree" from="." to="." method="_on_child_entered_tree"] +[connection signal="child_exiting_tree" from="." to="." method="_on_child_exiting_tree"] diff --git a/src/projects/Command Post/assets/cp/controllers/nonaligned/command_post_non_aligned.gd b/src/projects/Command Post/assets/cp/controllers/nonaligned/command_post_non_aligned.gd new file mode 100644 index 0000000..4ff49ca --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/nonaligned/command_post_non_aligned.gd @@ -0,0 +1,5 @@ +class_name CommandPostNonAligned extends CommandPostController + + +func _ready(): + MessageBus.spawn_nonaligned.connect(do_spawn) diff --git a/src/projects/Command Post/assets/cp/controllers/nonaligned/command_post_non_aligned.tscn b/src/projects/Command Post/assets/cp/controllers/nonaligned/command_post_non_aligned.tscn new file mode 100644 index 0000000..1ef3e4b --- /dev/null +++ b/src/projects/Command Post/assets/cp/controllers/nonaligned/command_post_non_aligned.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://c8sqb7smoc253"] + +[ext_resource type="Script" path="res://assets/cp/controllers/nonaligned/command_post_non_aligned.gd" id="1_dqg0t"] +[ext_resource type="PackedScene" uid="uid://6ngrwq73dgcn" path="res://assets/character/non_aligned/non_aligned_character.tscn" id="2_txjnm"] + +[node name="CommandPostNonAligned" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0) +script = ExtResource("1_dqg0t") +team = -1 +spawn_entity = ExtResource("2_txjnm") +cp_color = Color(0.662745, 0.423529, 0, 1) + +[connection signal="child_entered_tree" from="." to="." method="_on_child_entered_tree"] +[connection signal="child_exiting_tree" from="." to="." method="_on_child_exiting_tree"] diff --git a/src/projects/Command Post/assets/cp/spawn_point.gd b/src/projects/Command Post/assets/cp/spawn_point.gd new file mode 100644 index 0000000..90875d0 --- /dev/null +++ b/src/projects/Command Post/assets/cp/spawn_point.gd @@ -0,0 +1 @@ +class_name SpawnPoint extends Marker3D diff --git a/src/projects/Command Post/assets/cp/spawn_point.tscn b/src/projects/Command Post/assets/cp/spawn_point.tscn new file mode 100644 index 0000000..b7d18f5 --- /dev/null +++ b/src/projects/Command Post/assets/cp/spawn_point.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=3 uid="uid://cay4mruy6x2ql"] + +[ext_resource type="Script" path="res://assets/cp/spawn_point.gd" id="1_qqm08"] + +[node name="SpawnPoint" type="Marker3D"] +script = ExtResource("1_qqm08") + +[node name="direction" type="RayCast3D" parent="."] +transform = Transform3D(0.5, 0, 0, 0, -2.18557e-08, -0.5, 0, 0.5, -2.18557e-08, 0, 0.5, -0.5) diff --git a/src/projects/Command Post/data/enums.gd b/src/projects/Command Post/data/enums.gd new file mode 100644 index 0000000..577e431 --- /dev/null +++ b/src/projects/Command Post/data/enums.gd @@ -0,0 +1,9 @@ +extends Node + + +enum Faction { + NEUTRAL, + ATTACKER, + DEFENDER, + NONALIGNED = -1 +} diff --git a/src/projects/Command Post/data/game_managers/assault/GameManagerAssault.gd b/src/projects/Command Post/data/game_managers/assault/GameManagerAssault.gd new file mode 100644 index 0000000..fc0c1b8 --- /dev/null +++ b/src/projects/Command Post/data/game_managers/assault/GameManagerAssault.gd @@ -0,0 +1,6 @@ +class_name GameManagerAssault extends GameManager + + + +func _physics_process(_delta): + super._physics_process(_delta) diff --git a/src/projects/Command Post/data/game_managers/assault/game_manager_assault.tscn b/src/projects/Command Post/data/game_managers/assault/game_manager_assault.tscn new file mode 100644 index 0000000..55fe0f8 --- /dev/null +++ b/src/projects/Command Post/data/game_managers/assault/game_manager_assault.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=3 uid="uid://0l5bb77bjxh1"] + +[ext_resource type="Script" path="res://data/game_managers/assault/GameManagerAssault.gd" id="1_3de00"] + +[node name="GameManagerAssault" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0) +script = ExtResource("1_3de00") +attacker_spawn_pool = 32 +defender_spawn_pool = 32 +non_aligned_spawn_pool = 32 diff --git a/src/projects/Command Post/data/game_managers/ctf/GameManagerCTF.gd b/src/projects/Command Post/data/game_managers/ctf/GameManagerCTF.gd new file mode 100644 index 0000000..8d38032 --- /dev/null +++ b/src/projects/Command Post/data/game_managers/ctf/GameManagerCTF.gd @@ -0,0 +1,6 @@ +class_name GameManagerCTF extends GameManager + + + +func _physics_process(_delta): + super._physics_process(_delta) diff --git a/src/projects/Command Post/data/game_managers/ctf/game_manager_ctf.tscn b/src/projects/Command Post/data/game_managers/ctf/game_manager_ctf.tscn new file mode 100644 index 0000000..6609d2c --- /dev/null +++ b/src/projects/Command Post/data/game_managers/ctf/game_manager_ctf.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://yc16c57cvxed"] + +[ext_resource type="Script" path="res://data/game_managers/ctf/GameManagerCTF.gd" id="1_8hqtg"] + +[node name="GameManagerCTF" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0) +script = ExtResource("1_8hqtg") diff --git a/src/projects/Command Post/data/game_managers/game_manager.gd b/src/projects/Command Post/data/game_managers/game_manager.gd new file mode 100644 index 0000000..0b8dbf9 --- /dev/null +++ b/src/projects/Command Post/data/game_managers/game_manager.gd @@ -0,0 +1,70 @@ +class_name GameManager extends Node3D + + +@export var attacker_spawn_pool: int = 100 +@export var defender_spawn_pool: int = 100 +@export var non_aligned_spawn_pool: int = 100 + +@export var attacker_max_active: int = 8 +@export var defender_max_active: int = 8 +@export var non_aligned_max_active: int = 8 + +var event_queue: Array = [] + +var attacker_current_active: int = 0 +var defender_current_active: int = 0 +var non_aligned_current_active: int = 0 + + +func _ready(): + MessageBus.game_tree_loaded.connect(_game_tree_loaded) + MessageBus.entity_diead.connect(_game_tree_loaded) + + +func _game_tree_loaded(): + pass + + +func _process(_delta): + pass + +func _physics_process(_delta): + if event_queue.size() == 0: + check_spawn_counts() + return + + var event = event_queue.pop_back() + event.call(null) + + +func entity_diead(entity: Character): + if entity.faction == Enums.Faction.ATTACKER: + attacker_current_active -= 1 + attacker_spawn_pool -= 1 + elif entity.faction == Enums.Faction.DEFENDER: + defender_current_active -= 1 + defender_spawn_pool -= 1 + elif entity.faction == Enums.Faction.NONALIGNED: + non_aligned_current_active -= 1 + non_aligned_spawn_pool -= 1 + +func check_spawn_counts(): + if attacker_spawn_pool > 0 && attacker_current_active < attacker_max_active: + event_queue.append(spawn_attacker) + if defender_spawn_pool > 0 && defender_current_active < defender_max_active: + event_queue.append(spawn_defender) + if non_aligned_spawn_pool > 0 && non_aligned_current_active < non_aligned_max_active: + event_queue.append(spawn_nonaligned) + + +var spawn_attacker = func spawn_attacker(_data): + attacker_current_active += 1 + MessageBus.spawn_attacker.emit() + +var spawn_defender = func spawn_defender(_data): + defender_current_active += 1 + MessageBus.spawn_defender.emit() + +var spawn_nonaligned = func spawn_nonaligned(_data): + non_aligned_current_active += 1 + MessageBus.spawn_nonaligned.emit() diff --git a/src/projects/Command Post/data/game_managers/game_manager.tscn b/src/projects/Command Post/data/game_managers/game_manager.tscn new file mode 100644 index 0000000..154d98b --- /dev/null +++ b/src/projects/Command Post/data/game_managers/game_manager.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://fttl5l83hgkx"] + +[ext_resource type="Script" path="res://data/game_managers/game_manager.gd" id="1_ok0hn"] + +[node name="game_manager" type="Node3D"] +script = ExtResource("1_ok0hn") diff --git a/src/projects/Command Post/data/game_managers/heros/GameManagerHeros.gd b/src/projects/Command Post/data/game_managers/heros/GameManagerHeros.gd new file mode 100644 index 0000000..00a031d --- /dev/null +++ b/src/projects/Command Post/data/game_managers/heros/GameManagerHeros.gd @@ -0,0 +1,6 @@ +class_name GameManagerHeros extends GameManager + + + +func _physics_process(_delta): + super._physics_process(_delta) diff --git a/src/projects/Command Post/data/game_managers/heros/game_manager_heros.tscn b/src/projects/Command Post/data/game_managers/heros/game_manager_heros.tscn new file mode 100644 index 0000000..ec98ed5 --- /dev/null +++ b/src/projects/Command Post/data/game_managers/heros/game_manager_heros.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://c68qnbgmxxjgy"] + +[ext_resource type="Script" path="res://data/game_managers/heros/GameManagerHeros.gd" id="1_hdicy"] + +[node name="GameManagerHeros" type="Node3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0) +script = ExtResource("1_hdicy") diff --git a/src/projects/Command Post/icon.svg b/src/projects/Command Post/icon.svg new file mode 100644 index 0000000..b370ceb --- /dev/null +++ b/src/projects/Command Post/icon.svg @@ -0,0 +1 @@ + diff --git a/src/projects/Command Post/icon.svg.import b/src/projects/Command Post/icon.svg.import new file mode 100644 index 0000000..26be911 --- /dev/null +++ b/src/projects/Command Post/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://be86tss6tck6q" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +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/limit=-1 +roughness/mode=0 +roughness/src_normal="" +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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/src/projects/Command Post/project.godot b/src/projects/Command Post/project.godot new file mode 100644 index 0000000..fa96d77 --- /dev/null +++ b/src/projects/Command Post/project.godot @@ -0,0 +1,20 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="Command Post" +config/features=PackedStringArray("4.1", "Forward Plus") +config/icon="res://icon.svg" + +[autoload] + +MessageBus="*res://scripts/message_bus.gd" +Enums="*res://data/enums.gd" diff --git a/src/projects/Command Post/scripts/message_bus.gd b/src/projects/Command Post/scripts/message_bus.gd new file mode 100644 index 0000000..3443a9b --- /dev/null +++ b/src/projects/Command Post/scripts/message_bus.gd @@ -0,0 +1,9 @@ +extends Node + + +signal register_command_post +signal spawn_defender +signal spawn_attacker +signal spawn_nonaligned +signal game_tree_loaded +signal entity_diead diff --git a/src/projects/Command Post/world.tscn b/src/projects/Command Post/world.tscn new file mode 100644 index 0000000..c76936b --- /dev/null +++ b/src/projects/Command Post/world.tscn @@ -0,0 +1,86 @@ +[gd_scene load_steps=13 format=3 uid="uid://oi1rlj4a58gr"] + +[ext_resource type="PackedScene" uid="uid://0l5bb77bjxh1" path="res://data/game_managers/assault/game_manager_assault.tscn" id="1_170qh"] +[ext_resource type="PackedScene" uid="uid://ctbug001xo01q" path="res://assets/cp/command_post.tscn" id="1_i3oxs"] +[ext_resource type="PackedScene" uid="uid://dqx5s14sb162x" path="res://assets/cp/controllers/neutral/command_post_neutral.tscn" id="3_460gl"] +[ext_resource type="PackedScene" uid="uid://viqdvqrnn5c7" path="res://assets/cp/controllers/attacker/command_post_attackers.tscn" id="4_v0ljc"] +[ext_resource type="PackedScene" uid="uid://d3wabfyfccfs8" path="res://assets/cp/controllers/defender/command_post_defenders.tscn" id="5_djntp"] +[ext_resource type="PackedScene" uid="uid://c8sqb7smoc253" path="res://assets/cp/controllers/nonaligned/command_post_non_aligned.tscn" id="6_o56jr"] + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_diy8s"] +sky_top_color = Color(0.219608, 0.486275, 0.580392, 1) +sky_horizon_color = Color(0.466667, 0.698039, 0.764706, 1) + +[sub_resource type="Sky" id="Sky_dptxk"] +sky_material = SubResource("ProceduralSkyMaterial_diy8s") +radiance_size = 5 + +[sub_resource type="Environment" id="Environment_qf0ml"] +background_mode = 2 +sky = SubResource("Sky_dptxk") +ambient_light_source = 3 +reflected_light_source = 2 +glow_enabled = true + +[sub_resource type="NavigationMesh" id="NavigationMesh_s8xsv"] +vertices = PackedVector3Array(-55.75, 0.5, -63.5, -63.5, 0.5, -63.5, -63.5, 0.5, -55.75, -63.5, 0.5, 55.5, -63.5, 0.5, 63.5, -55.75, 0.5, 63.5, 63.5, 0.5, -55.75, 63.5, 0.5, -63.5, 55.5, 0.5, -63.5, 55.5, 0.5, 63.5, 63.5, 0.5, 63.5, 63.5, 0.5, 55.5, -47.75, 0.5, -63.5, -55.75, 0.5, -63.5, -63.5, 0.5, -55.75, -63.5, 0.5, -47.75, -63.5, 0.5, 55.5, -55.75, 0.5, 63.5, -47.75, 0.5, 63.5, -63.5, 0.5, 47.5, 63.5, 0.5, -47.75, 63.5, 0.5, -55.75, 55.5, 0.5, -63.5, 47.5, 0.5, -63.5, 47.5, 0.5, 63.5, 55.5, 0.5, 63.5, 63.5, 0.5, 55.5, -63.5, 0.5, 3.8147e-06, -63.5, 0.5, 7.75, -8, 0.5, 63.5, 23.75, 0.5, 63.5, 63.5, 0.5, 31.75, 63.5, 0.5, 23.75, 15.75, 0.5, 63.5, 63.5, 0.5, -8, 63.5, 0.5, -16, 15.75, 0.5, -63.5, 7.75, 0.5, -63.5, 47.5, 0.5, 63.5, 63.5, 0.5, 55.5, 63.5, 0.5, 47.5, 39.5, 0.5, 63.5, -39.75, 0.5, -63.5, -47.75, 0.5, -63.5, -63.5, 0.5, -47.75, -63.5, 0.5, -39.75, -63.5, 0.5, 47.5, -47.75, 0.5, 63.5, -39.75, 0.5, 63.5, -63.5, 0.5, 39.5, 63.5, 0.5, -39.75, 63.5, 0.5, -47.75, 47.5, 0.5, -63.5, 39.5, 0.5, -63.5, -16, 0.5, -63.5, -24, 0.5, -63.5, -63.5, 0.5, -24, -63.5, 0.5, -16, -63.5, 0.5, 23.75, -24, 0.5, 63.5, -16, 0.5, 63.5, -63.5, 0.5, 15.75, 63.5, 0.5, -8, 7.75, 0.5, -63.5, 3.8147e-06, 0.5, -63.5, 63.5, 0.5, 3.8147e-06, 63.5, 0.5, -16, 63.5, 0.5, -24, 23.75, 0.5, -63.5, 15.75, 0.5, -63.5, 39.5, 0.5, 63.5, 63.5, 0.5, 47.5, 63.5, 0.5, 39.5, 31.75, 0.5, 63.5, -63.5, 0.5, 31.75, -63.5, 0.5, 39.5, -39.75, 0.5, 63.5, -31.75, 0.5, 63.5, 63.5, 0.5, -39.75, 39.5, 0.5, -63.5, 31.75, 0.5, -63.5, 63.5, 0.5, -31.75, -31.75, 0.5, -63.5, -39.75, 0.5, -63.5, -63.5, 0.5, -39.75, -63.5, 0.5, -31.75, 63.5, 0.5, 3.8147e-06, 3.8147e-06, 0.5, -63.5, -63.5, 0.5, 3.8147e-06, -8, 0.5, 63.5, 3.8147e-06, 0.5, 63.5, 63.5, 0.5, 7.75, 15.75, 0.5, 63.5, 63.5, 0.5, 23.75, 63.5, 0.5, 15.75, 7.75, 0.5, 63.5, 31.75, 0.5, 63.5, 63.5, 0.5, 39.5, 63.5, 0.5, 31.75, 23.75, 0.5, 63.5, 3.8147e-06, 0.5, -63.5, -8, 0.5, -63.5, -63.5, 0.5, -8, -63.5, 0.5, 3.8147e-06, 7.75, 0.5, 63.5, 63.5, 0.5, 15.75, 63.5, 0.5, 7.75, 3.8147e-06, 0.5, 63.5, -63.5, 0.5, 31.75, -31.75, 0.5, 63.5, -24, 0.5, 63.5, -63.5, 0.5, 23.75, 63.5, 0.5, -24, 63.5, 0.5, -31.75, 31.75, 0.5, -63.5, 23.75, 0.5, -63.5, -24, 0.5, -63.5, -31.75, 0.5, -63.5, -63.5, 0.5, -31.75, -63.5, 0.5, -24, -8, 0.5, -63.5, -16, 0.5, -63.5, -63.5, 0.5, -16, -63.5, 0.5, -8, -63.5, 0.5, 15.75, -16, 0.5, 63.5, -8, 0.5, 63.5, -63.5, 0.5, 7.75) +polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(5, 4, 3), PackedInt32Array(8, 7, 6), PackedInt32Array(11, 10, 9), PackedInt32Array(13, 12, 14), PackedInt32Array(14, 12, 15), PackedInt32Array(17, 16, 18), PackedInt32Array(18, 16, 19), PackedInt32Array(21, 20, 22), PackedInt32Array(22, 20, 23), PackedInt32Array(26, 25, 24), PackedInt32Array(29, 28, 27), PackedInt32Array(31, 30, 32), PackedInt32Array(32, 30, 33), PackedInt32Array(35, 34, 36), PackedInt32Array(36, 34, 37), PackedInt32Array(39, 38, 40), PackedInt32Array(40, 38, 41), PackedInt32Array(43, 42, 44), PackedInt32Array(44, 42, 45), PackedInt32Array(47, 46, 48), PackedInt32Array(48, 46, 49), PackedInt32Array(51, 50, 52), PackedInt32Array(52, 50, 53), PackedInt32Array(55, 54, 56), PackedInt32Array(56, 54, 57), PackedInt32Array(59, 58, 60), PackedInt32Array(60, 58, 61), PackedInt32Array(63, 62, 64), PackedInt32Array(64, 62, 65), PackedInt32Array(67, 66, 68), PackedInt32Array(68, 66, 69), PackedInt32Array(71, 70, 72), PackedInt32Array(72, 70, 73), PackedInt32Array(75, 74, 76), PackedInt32Array(76, 74, 77), PackedInt32Array(79, 78, 80), PackedInt32Array(80, 78, 81), PackedInt32Array(83, 82, 84), PackedInt32Array(84, 82, 85), PackedInt32Array(91, 90, 86), PackedInt32Array(86, 90, 89), PackedInt32Array(86, 89, 88), PackedInt32Array(86, 88, 87), PackedInt32Array(93, 92, 94), PackedInt32Array(94, 92, 95), PackedInt32Array(97, 96, 98), PackedInt32Array(98, 96, 99), PackedInt32Array(101, 100, 102), PackedInt32Array(102, 100, 103), PackedInt32Array(105, 104, 106), PackedInt32Array(106, 104, 107), PackedInt32Array(109, 108, 110), PackedInt32Array(110, 108, 111), PackedInt32Array(113, 112, 114), PackedInt32Array(114, 112, 115), PackedInt32Array(117, 116, 118), PackedInt32Array(118, 116, 119), PackedInt32Array(121, 120, 122), PackedInt32Array(122, 120, 123), PackedInt32Array(125, 124, 126), PackedInt32Array(126, 124, 127)] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_y1euo"] +albedo_color = Color(0.447059, 0.403922, 0.321569, 1) + +[sub_resource type="PlaneMesh" id="PlaneMesh_d1xkw"] +material = SubResource("StandardMaterial3D_y1euo") +size = Vector2(128, 128) +subdivide_width = 50 +subdivide_depth = 50 + +[node name="world" type="Node3D"] +metadata/_edit_lock_ = true + +[node name="sky" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_qf0ml") + +[node name="sun" type="DirectionalLight3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 0.849165, 0.528127, 0, -0.528127, 0.849165, 0, 5, 0) +metadata/_edit_lock_ = true + +[node name="ground_nav" type="NavigationRegion3D" parent="."] +navigation_mesh = SubResource("NavigationMesh_s8xsv") + +[node name="ground" type="MeshInstance3D" parent="ground_nav"] +mesh = SubResource("PlaneMesh_d1xkw") +skeleton = NodePath("../..") + +[node name="camera" type="Camera3D" parent="."] +transform = Transform3D(0.384326, -0.718956, 0.579134, 0, 0.627313, 0.778767, -0.923197, -0.2993, 0.241093, 11.7269, 15.7692, 4.88189) +current = true + +[node name="GameManagerAssault" parent="." instance=ExtResource("1_170qh")] +attacker_max_active = 3 +defender_max_active = 3 +non_aligned_max_active = 3 + +[node name="CommandPostNeutral" parent="." instance=ExtResource("3_460gl")] +metadata/_edit_lock_ = true + +[node name="command_post" parent="CommandPostNeutral" instance=ExtResource("1_i3oxs")] +transform = Transform3D(1.19209e-07, 0, -1, 0, 1, 0, 1, 0, 1.19209e-07, 0, -5, 0) + +[node name="CommandPostNonAligned" parent="." instance=ExtResource("6_o56jr")] +metadata/_edit_lock_ = true + +[node name="command_post" parent="CommandPostNonAligned" instance=ExtResource("1_i3oxs")] +transform = Transform3D(2.98023e-08, 0, -1, 0, 1, 0, 1, 0, 2.98023e-08, -16, -5, 0) + +[node name="CommandPostAttackers" parent="." instance=ExtResource("4_v0ljc")] +metadata/_edit_lock_ = true + +[node name="command_post" parent="CommandPostAttackers" instance=ExtResource("1_i3oxs")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, -5, 11) + +[node name="CommandPostDefenders" parent="." instance=ExtResource("5_djntp")] +metadata/_edit_lock_ = true + +[node name="command_post" parent="CommandPostDefenders" instance=ExtResource("1_i3oxs")] +transform = Transform3D(-0.866025, 0, 0.5, 0, 1, 0, -0.5, 0, -0.866025, 7, -5, -11)