diff --git a/project.godot b/project.godot index 23294a5..c8d0ffe 100644 --- a/project.godot +++ b/project.godot @@ -120,10 +120,10 @@ locale/translations=PackedStringArray("res://translations/plants.en.translation" [layer_names] 2d_physics/layer_1="Reserved" -2d_physics/layer_2="Plants LD" -2d_physics/layer_3="Plants Full" -2d_physics/layer_4="Zombies LD" -2d_physics/layer_5="Zombies Full" +2d_physics/layer_2="Plants Dummy" +2d_physics/layer_3="Plants True" +2d_physics/layer_4="Zombies Dummy" +2d_physics/layer_5="Zombies True" 2d_physics/layer_7="FallLine" 2d_physics/layer_8="FallParticles" diff --git a/resources/levels/balance_and_spawn_test.tres b/resources/levels/balance_and_spawn_test.tres index 3487575..eaeba09 100644 --- a/resources/levels/balance_and_spawn_test.tres +++ b/resources/levels/balance_and_spawn_test.tres @@ -1,5 +1,6 @@ -[gd_resource type="Resource" script_class="AdventureLevelResource" load_steps=30 format=3 uid="uid://ctbue7dex4umy"] +[gd_resource type="Resource" script_class="AdventureLevelResource" load_steps=31 format=3 uid="uid://ctbue7dex4umy"] +[ext_resource type="PackedScene" uid="uid://b5x35v3w2u8dx" path="res://scenes/entities/plants/potato_mine.tscn" id="1_5e1dl"] [ext_resource type="Script" uid="uid://bximdujbkj2n4" path="res://addons/pvzadventure/AdventureLevelResource.cs" id="1_46lr8"] [ext_resource type="Script" uid="uid://cw7yc3i2lgcja" path="res://addons/pvzadventure/WaveEvent.cs" id="2_otfbt"] [ext_resource type="Script" uid="uid://7rptlb5qr3b6" path="res://addons/pvzadventure/WaveData.cs" id="3_cugtx"] @@ -130,4 +131,4 @@ wavePercentage = 0.5 standardWaveDelay = 15.0 initialWaveDelay = 20.0 waves = [SubResource("Resource_qsvr4"), SubResource("Resource_otfbt"), SubResource("Resource_nv3y4"), SubResource("Resource_mt5r8"), SubResource("Resource_kugcf"), SubResource("Resource_oyvhx"), SubResource("Resource_k4k25"), SubResource("Resource_oxbea"), SubResource("Resource_5cdj6")] -initialScenes = Array[PackedScene]([null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]) +initialScenes = Array[PackedScene]([null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null, null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null, null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null, null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null, null, ExtResource("1_5e1dl"), null, null, null, null, null, null, null]) diff --git a/resources/plants/Cucumber.tres b/resources/plants/Cucumber.tres index 73c491f..ba71dcf 100644 --- a/resources/plants/Cucumber.tres +++ b/resources/plants/Cucumber.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://cl5bsa2unhcl0"] +[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://ciewunnfalrbb"] [ext_resource type="Script" uid="uid://cyenlko1knygw" path="res://scripts/resources/PlantResource.cs" id="1_jrx81"] [ext_resource type="Texture2D" uid="uid://bt76iudw2qgnv" path="res://assets/sprites/atlases/plants/cumbucer.png" id="1_tdg4d"] diff --git a/resources/plants/Nerdus.tres b/resources/plants/Nerdus.tres index beb0d1d..3f8c8a5 100644 --- a/resources/plants/Nerdus.tres +++ b/resources/plants/Nerdus.tres @@ -1,4 +1,4 @@ -[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://do7m0lfki5ere"] +[gd_resource type="Resource" script_class="PlantResource" load_steps=5 format=3 uid="uid://8edvnmwu4tyn"] [ext_resource type="Texture2D" uid="uid://b06e8xhdy77d1" path="res://assets/sprites/atlases/plants/nerdus.png" id="1_of51r"] [ext_resource type="PackedScene" uid="uid://k5aj2slxar7w" path="res://scenes/entities/plants/nerdus.tscn" id="2_0i6qf"] diff --git a/scenes/entities/plants/aloe.tscn b/scenes/entities/plants/aloe.tscn index af96d9d..95e85da 100644 --- a/scenes/entities/plants/aloe.tscn +++ b/scenes/entities/plants/aloe.tscn @@ -95,6 +95,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"] size = Vector2(22, 32) [node name="Aloe" instance=ExtResource("1_n25yi")] +internal_id = "aloe" MaxHP = 30.0 [node name="Sprite2D" parent="." index="0"] diff --git a/scenes/entities/plants/cucumber.tscn b/scenes/entities/plants/cucumber.tscn index bd8256d..385ed6e 100644 --- a/scenes/entities/plants/cucumber.tscn +++ b/scenes/entities/plants/cucumber.tscn @@ -28,23 +28,6 @@ _data = { &"RESET": SubResource("Animation_n1xkd") } -[sub_resource type="Animation" id="Animation_ig0op"] -length = 0.666675 -loop_mode = 2 -step = 0.0833333 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite2D:frame") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 1, -"values": [10, 11, 12, 13, 14] -} - [sub_resource type="Animation" id="Animation_d45iq"] length = 0.833342 step = 0.0833333 @@ -75,6 +58,23 @@ tracks/1/keys = { }] } +[sub_resource type="Animation" id="Animation_ig0op"] +length = 0.666675 +loop_mode = 2 +step = 0.0833333 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1), +"update": 1, +"values": [10, 11, 12, 13, 14] +} + [sub_resource type="AnimationLibrary" id="AnimationLibrary_n1xkd"] _data = { &"attack": SubResource("Animation_d45iq"), @@ -124,6 +124,7 @@ height = 48.0 size = Vector2(26, 600) [node name="Cucumber" instance=ExtResource("1_65f4u")] +internal_id = "cucumber" MaxHP = 30.0 [node name="Sprite2D" parent="." index="0"] diff --git a/scenes/entities/plants/garlic.tscn b/scenes/entities/plants/garlic.tscn index 25ac97e..f8eb8cb 100644 --- a/scenes/entities/plants/garlic.tscn +++ b/scenes/entities/plants/garlic.tscn @@ -60,6 +60,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"] size = Vector2(32, 29) [node name="Garlic" instance=ExtResource("1_5i0e6")] +internal_id = "garlic" MaxHP = 200.0 [node name="Sprite2D" parent="." index="0"] diff --git a/scenes/entities/plants/nerdus.tscn b/scenes/entities/plants/nerdus.tscn index 2e5e6c4..96d3e36 100644 --- a/scenes/entities/plants/nerdus.tscn +++ b/scenes/entities/plants/nerdus.tscn @@ -26,57 +26,6 @@ _data = { &"RESET": SubResource("Animation_ga4vy") } -[sub_resource type="Animation" id="Animation_yxvnw"] -length = 1.16668 -loop_mode = 2 -step = 0.0833333 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite2D:frame") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), -"update": 1, -"values": [0, 1, 2, 3, 4, 5] -} - -[sub_resource type="Animation" id="Animation_o12iv"] -length = 1.16668 -loop_mode = 2 -step = 0.0833333 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite2D:frame") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1), -"update": 1, -"values": [7, 8, 9, 10, 11, 12, 13] -} - -[sub_resource type="Animation" id="Animation_6e60l"] -length = 1.16668 -loop_mode = 2 -step = 0.0833333 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite2D:frame") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1), -"update": 1, -"values": [14, 15, 16, 17, 18, 19, 20] -} - [sub_resource type="Animation" id="Animation_v7ffp"] length = 0.500008 step = 0.0833333 @@ -107,6 +56,36 @@ tracks/1/keys = { }] } +[sub_resource type="Animation" id="Animation_6a4q1"] +length = 0.500008 +step = 0.0833333 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), +"update": 1, +"values": [35, 36, 37, 38, 39, 40] +} +tracks/1/type = "method" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Hurtbox") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0.416667), +"transitions": PackedFloat32Array(1), +"values": [{ +"args": [], +"method": &"ReturnAllDamage" +}] +} + [sub_resource type="Animation" id="Animation_rb7ob"] length = 0.500008 step = 0.0833333 @@ -137,8 +116,9 @@ tracks/1/keys = { }] } -[sub_resource type="Animation" id="Animation_6a4q1"] -length = 0.500008 +[sub_resource type="Animation" id="Animation_yxvnw"] +length = 1.16668 +loop_mode = 2 step = 0.0833333 tracks/0/type = "value" tracks/0/imported = false @@ -147,24 +127,44 @@ tracks/0/path = NodePath("Sprite2D:frame") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667), +"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333), "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), "update": 1, -"values": [35, 36, 37, 38, 39, 40] +"values": [0, 1, 2, 3, 4, 5] } -tracks/1/type = "method" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Hurtbox") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0.416667), -"transitions": PackedFloat32Array(1), -"values": [{ -"args": [], -"method": &"ReturnAllDamage" -}] + +[sub_resource type="Animation" id="Animation_6e60l"] +length = 1.16668 +loop_mode = 2 +step = 0.0833333 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1), +"update": 1, +"values": [14, 15, 16, 17, 18, 19, 20] +} + +[sub_resource type="Animation" id="Animation_o12iv"] +length = 1.16668 +loop_mode = 2 +step = 0.0833333 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.166667, 0.333333, 0.5, 0.666667, 0.833333, 1), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1), +"update": 1, +"values": [7, 8, 9, 10, 11, 12, 13] } [sub_resource type="AnimationLibrary" id="AnimationLibrary_pddnl"] @@ -252,6 +252,7 @@ radius = 24.0 size = Vector2(73, 48) [node name="Nerdus" instance=ExtResource("1_8ui1h")] +internal_id = "nerdus" MaxHP = 200.0 [node name="Sprite2D" parent="." index="0"] diff --git a/scenes/entities/plants/peashooter.tscn b/scenes/entities/plants/peashooter.tscn index ef8888c..b676b47 100644 --- a/scenes/entities/plants/peashooter.tscn +++ b/scenes/entities/plants/peashooter.tscn @@ -73,6 +73,7 @@ resource_local_to_scene = true size = Vector2(20, 44) [node name="Peashooter" instance=ExtResource("1_pyk3o")] +internal_id = "peashooter" MaxHP = 30.0 [node name="Sprite2D" parent="." index="0"] diff --git a/scenes/entities/plants/potato_mine.tscn b/scenes/entities/plants/potato_mine.tscn index 0c0876c..9ccb7aa 100644 --- a/scenes/entities/plants/potato_mine.tscn +++ b/scenes/entities/plants/potato_mine.tscn @@ -78,6 +78,7 @@ size = Vector2(15, 27) size = Vector2(22, 19) [node name="Potato mine" instance=ExtResource("1_dj7ul")] +internal_id = "potatomine" MaxHP = 20.0 [node name="Sprite2D" parent="." index="0"] diff --git a/scenes/entities/plants/snowpea.tscn b/scenes/entities/plants/snowpea.tscn index 97fd65c..3f10926 100644 --- a/scenes/entities/plants/snowpea.tscn +++ b/scenes/entities/plants/snowpea.tscn @@ -63,6 +63,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"] resource_local_to_scene = true [node name="Snowpea" instance=ExtResource("1_lp85e")] +internal_id = "snowpea" [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_ytrm0") diff --git a/scenes/entities/plants/spikeweed.tscn b/scenes/entities/plants/spikeweed.tscn index 76f5221..4cec7dc 100644 --- a/scenes/entities/plants/spikeweed.tscn +++ b/scenes/entities/plants/spikeweed.tscn @@ -36,6 +36,7 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"] size = Vector2(49, 38) [node name="Spikeweed" instance=ExtResource("1_vmbvr")] +internal_id = "spikeweed" MaxHP = 30.0 [node name="Sprite2D" parent="." index="0"] @@ -54,9 +55,8 @@ tree_root = SubResource("AnimationNodeBlendTree_63okc") parameters/TimeScale/scale = 1.0 parameters/Tree/blend_position = 0 -[node name="Behaviour" type="Node" parent="." index="3" node_paths=PackedStringArray("_tree")] +[node name="Behaviour" type="Node" parent="." index="3"] script = ExtResource("3_uhpn7") -_tree = NodePath("../AnimationTree") [node name="Hitbox" parent="." index="4"] collision_layer = 4 diff --git a/scenes/entities/plants/sunflower.tscn b/scenes/entities/plants/sunflower.tscn index 528f936..ab4040a 100644 --- a/scenes/entities/plants/sunflower.tscn +++ b/scenes/entities/plants/sunflower.tscn @@ -66,12 +66,14 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"] size = Vector2(26, 48) [node name="Sunflower" instance=ExtResource("1_bikjn")] +internal_id = "sunflower" MaxHP = 30.0 [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_fwcda") hframes = 9 vframes = 2 +frame = 3 [node name="AnimationPlayer" parent="." index="1"] libraries = { diff --git a/scenes/entities/plants/threepeater.tscn b/scenes/entities/plants/threepeater.tscn index e297737..a14b9a1 100644 --- a/scenes/entities/plants/threepeater.tscn +++ b/scenes/entities/plants/threepeater.tscn @@ -135,6 +135,7 @@ resource_local_to_scene = true resource_local_to_scene = true [node name="Threepeater" instance=ExtResource("1_muntu")] +internal_id = "threepeater" [node name="Sprite2D" parent="." index="0"] position = Vector2(6, -13) diff --git a/scenes/entities/plants/wallnut.tscn b/scenes/entities/plants/wallnut.tscn index 9fd5ce4..dd822c1 100644 --- a/scenes/entities/plants/wallnut.tscn +++ b/scenes/entities/plants/wallnut.tscn @@ -38,13 +38,14 @@ node_connections = [&"TimeScale", 0, &"Tree", &"output", 0, &"TimeScale"] size = Vector2(33, 46) [node name="Wallnut" instance=ExtResource("1_fluxn")] +internal_id = "wallnut" MaxHP = 600.0 [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_o5tda") hframes = 12 vframes = 3 -frame = 9 +frame = 10 [node name="AnimationPlayer" parent="." index="1"] libraries = { diff --git a/scenes/templates/standard_players_house.tscn b/scenes/templates/standard_players_house.tscn index 27ba02b..bf96ecf 100644 --- a/scenes/templates/standard_players_house.tscn +++ b/scenes/templates/standard_players_house.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://bu0dh5ct387xu"] +[gd_scene load_steps=17 format=3 uid="uid://bu0dh5ct387xu"] [ext_resource type="PackedScene" uid="uid://dd3yegl1xo44m" path="res://scenes/templates/level_template.tscn" id="1_vdv3d"] [ext_resource type="Texture2D" uid="uid://b0tb2hjum40aw" path="res://assets/sprites/background_summer.png" id="3_lsqv3"] @@ -7,6 +7,7 @@ [ext_resource type="Script" uid="uid://puqxp2xeg1r2" path="res://scripts/level/LevelRunner.cs" id="5_vbgdr"] [ext_resource type="PackedScene" uid="uid://c668qnmmpli5r" path="res://scenes/gui/wave_progress.tscn" id="6_yw4uo"] [ext_resource type="Script" uid="uid://bc3s06ejbotma" path="res://scripts/gui/ZombieLevelPreviewer.cs" id="7_8ajos"] +[ext_resource type="Script" uid="uid://b31mnk4enldc4" path="res://scripts/level/InitialPackedSceneSpawner.cs" id="8_pqj5f"] [sub_resource type="Animation" id="Animation_vbgdr"] resource_name = "CYS_Sequence" @@ -342,8 +343,12 @@ fadeAnimation = NodePath("../GameOverScreen/AnimationPlayer") [node name="CollisionShape2D" parent="Checkbox" index="0"] shape = SubResource("WorldBoundaryShape2D_yw4uo") +[node name="InitialSpawner" type="Node" parent="." index="18"] +script = ExtResource("8_pqj5f") + [connection signal="OnLevelStateChanged" from="Data" to="SunSpawner/Timer" method="OnLevelStateChanged"] [connection signal="OnLevelStateChanged" from="Data" to="ZombieLevelPrevewer" method="OnLevelStateChanged"] +[connection signal="OnLevelStateChanged" from="Data" to="InitialSpawner" method="OnLevelStateChanged"] [connection signal="FinalWaveInitiated" from="LevelRunner" to="MainAnimationPlayer" method="play" binds= ["FW_Sequence"]] [connection signal="HugeWaveApproachingCallback" from="LevelRunner" to="MainAnimationPlayer" method="play" binds= ["HW_Sequence"]] [connection signal="HugeWaveInitiated" from="LevelRunner" to="GUI/WaveProgress" method="OnHugeWaveApproached"] diff --git a/scripts/LevelStateBrainDisabler.cs b/scripts/LevelStateBrainDisabler.cs new file mode 100644 index 0000000..a962117 --- /dev/null +++ b/scripts/LevelStateBrainDisabler.cs @@ -0,0 +1,19 @@ +using Godot; +using Newlon.Components; +using Newlon.Components.Level; + +[GlobalClass] +public partial class LevelStateBrainDisabler : Node +{ + public override void _Ready() + { + RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged; + } + public void OnLevelStateChanged(RuntimeLevelData.LevelStates state) + { + if (state == RuntimeLevelData.LevelStates.Game) + { + GetParent().EnableBrain(); + } + } +} diff --git a/scripts/LevelStateBrainDisabler.cs.uid b/scripts/LevelStateBrainDisabler.cs.uid new file mode 100644 index 0000000..4de2e7b --- /dev/null +++ b/scripts/LevelStateBrainDisabler.cs.uid @@ -0,0 +1 @@ +uid://ldjyga3rbqoj diff --git a/scripts/level/InitialPackedSceneSpawner.cs b/scripts/level/InitialPackedSceneSpawner.cs new file mode 100644 index 0000000..1dfd00d --- /dev/null +++ b/scripts/level/InitialPackedSceneSpawner.cs @@ -0,0 +1,59 @@ +using Godot; +using Newlon.Components; +using Newlon.Components.Level; +using Newlon.Components.Plants; +using Newlon.Components.Zombies; + +public partial class InitialPackedSceneSpawner : Node +{ + public void OnLevelStateChanged(RuntimeLevelData.LevelStates state) + { + if (state == RuntimeLevelData.LevelStates.ChooseYourSeeds) + { + for (int i = 0; i < RuntimeLevelData.LevelResource.initialScenes.Count; i++) + { + var packed = RuntimeLevelData.LevelResource.initialScenes[i]; + if (packed == null) continue; + var scene = packed.Instantiate(); + + if (scene is Node2D node) + { + int x = i % 9; + int y = i / 9; + var position = FieldParams.LeftFieldBoundary + new Vector2((x + 0.5f) * FieldParams.TileWidth, (y + 0.5f) * FieldParams.TileHeight); + + if (node is Entity entity) + { + var brainDisabler = new LevelStateBrainDisabler(); + entity.DisableBrain(); + entity.AddChild(brainDisabler); + + if (entity is RuntimeZombieData) + { + PoolContainer.Instance.Structures.AddChild(node); + node.GlobalPosition = position; + } + else if (entity is RuntimePlantData plant) + { + PoolContainer.Instance.Plants.AddChild(plant); + node.GlobalPosition = position; + PoolContainer.Instance.EntityField[GameRegistry.GetPlantByName(plant.internal_id).Layer].Add(plant.GlobalPosition, plant); + } + else + { + PoolContainer.Instance.Structures.AddChild(entity); + node.GlobalPosition = position; + PoolContainer.Instance.EntityField[1].Add(entity.GlobalPosition, entity); + } + } + else + { + PoolContainer.Instance.Structures.AddChild(node); + } + + } + + } + } + } +} diff --git a/scripts/level/InitialPackedSceneSpawner.cs.uid b/scripts/level/InitialPackedSceneSpawner.cs.uid new file mode 100644 index 0000000..66197a9 --- /dev/null +++ b/scripts/level/InitialPackedSceneSpawner.cs.uid @@ -0,0 +1 @@ +uid://b31mnk4enldc4 diff --git a/scripts/level/PoolContainer.cs b/scripts/level/PoolContainer.cs index 22a73d1..2b6e582 100644 --- a/scripts/level/PoolContainer.cs +++ b/scripts/level/PoolContainer.cs @@ -24,7 +24,7 @@ public partial class PoolContainer : Node2D public static PoolContainer Instance { get; private set; } public Dictionary[] EntityField = { new(), new(), new() }; - public override void _Ready() + public override void _EnterTree() { Instance = this; } diff --git a/scripts/plants/RuntimePlantData.cs b/scripts/plants/RuntimePlantData.cs index 6968e5d..d5b8b7b 100644 --- a/scripts/plants/RuntimePlantData.cs +++ b/scripts/plants/RuntimePlantData.cs @@ -9,6 +9,8 @@ namespace Newlon.Components.Plants; public partial class RuntimePlantData : Entity { + [Export] + public string internal_id; public int Line { get; set; } public PlantResource Resource; private AudioStream eatenSound = ResourceLoader.Load("res://assets/audio/sfx/gulp.mp3"); diff --git a/translations/gui.en.translation b/translations/gui.en.translation index 1613f4b..23b0fe9 100644 Binary files a/translations/gui.en.translation and b/translations/gui.en.translation differ diff --git a/translations/gui.ru.translation b/translations/gui.ru.translation index 966f144..48ad9ac 100644 Binary files a/translations/gui.ru.translation and b/translations/gui.ru.translation differ diff --git a/translations/plants.en.translation b/translations/plants.en.translation index fdff9b2..d431b30 100644 Binary files a/translations/plants.en.translation and b/translations/plants.en.translation differ diff --git a/translations/plants.ru.translation b/translations/plants.ru.translation index 228d448..dc540f9 100644 Binary files a/translations/plants.ru.translation and b/translations/plants.ru.translation differ diff --git a/translations/zombies.en.translation b/translations/zombies.en.translation index e020dc1..88a3679 100644 Binary files a/translations/zombies.en.translation and b/translations/zombies.en.translation differ diff --git a/translations/zombies.ru.translation b/translations/zombies.ru.translation index 15340f2..3598bc4 100644 Binary files a/translations/zombies.ru.translation and b/translations/zombies.ru.translation differ