From eb408a62bbcf3e68b021e79b0d448565f7b35789 Mon Sep 17 00:00:00 2001 From: Rendo Date: Thu, 17 Jul 2025 11:44:10 +0500 Subject: [PATCH] Fixed links --- scripts/LinearProjectile.cs | 2 +- scripts/SettingsSerializer.cs | 14 ++++++-------- scripts/audio/AudioSlider.cs | 8 ++++---- scripts/gui/PrototypeWindow.cs | 4 ++-- scripts/gui/ShovelButton.cs | 6 +++--- scripts/gui/ZombieLevelPreviewer.cs | 2 +- scripts/gui/seedpackets/ChoosableHandler.cs | 2 +- scripts/level/LeftBoundaryMarker.cs | 2 +- scripts/level/PlantField.cs | 8 ++++---- scripts/level/RightBoundaryMarker.cs | 2 +- scripts/level/SunSpawner.cs | 8 ++++---- scripts/level/zombe_spawners/RowSpawner.cs | 2 +- scripts/level/zombe_spawners/ZombieSequencer.cs | 2 +- scripts/plants/PlantEyesightLimiter.cs | 2 +- scripts/plants/ThreepeaterShooter.cs | 4 ++-- scripts/plants/behaviours/AloeBehaviour.cs | 4 ++-- scripts/systems/effects/GarlicEffect.cs | 8 ++++---- scripts/zombies/ZombieMover.cs | 2 +- 18 files changed, 40 insertions(+), 42 deletions(-) diff --git a/scripts/LinearProjectile.cs b/scripts/LinearProjectile.cs index 6aefbf7..343cd8c 100644 --- a/scripts/LinearProjectile.cs +++ b/scripts/LinearProjectile.cs @@ -25,7 +25,7 @@ public partial class LinearProjectile : Area2D, IProjectile public override void _PhysicsProcess(double delta) { - Translate(Transform.X * _speed * (float)delta * Utility.TileWidth); + Translate(Transform.X * _speed * (float)delta * FieldParams.TileWidth); } public void OnAreaEntered(Area2D area) diff --git a/scripts/SettingsSerializer.cs b/scripts/SettingsSerializer.cs index 35b7caa..b9e637c 100644 --- a/scripts/SettingsSerializer.cs +++ b/scripts/SettingsSerializer.cs @@ -1,6 +1,4 @@ using Godot; -using Newlon; -using System; public partial class SettingsSerializer : Node { @@ -12,12 +10,12 @@ public partial class SettingsSerializer : Node var access = FileAccess.Open(CFG_PATH, FileAccess.ModeFlags.Read); - Utility.SFX = float.Parse(access.GetLine().Split(" ")[1]); - Utility.Music = float.Parse(access.GetLine().Split(" ")[1]); - Utility.Splash = bool.Parse(access.GetLine().Split(" ")[1]); + Settings.SFX = float.Parse(access.GetLine().Split(" ")[1]); + Settings.Music = float.Parse(access.GetLine().Split(" ")[1]); + Settings.Splash = bool.Parse(access.GetLine().Split(" ")[1]); - AudioServer.SetBusVolumeDb(0, Mathf.LinearToDb((float)Utility.SFX)); - AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Utility.Music)); + AudioServer.SetBusVolumeDb(0, Mathf.LinearToDb((float)Settings.SFX)); + AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Settings.Music)); access.Close(); } @@ -25,7 +23,7 @@ public partial class SettingsSerializer : Node { var access = FileAccess.Open(CFG_PATH, FileAccess.ModeFlags.Write); access.Resize(0); - access.StoreString(string.Format("SFX {0}\nMusic {1}\nSplash {2}\n", Utility.SFX,Utility.Music,Utility.Splash)); + access.StoreString(string.Format("SFX {0}\nMusic {1}\nSplash {2}\n", Settings.SFX,Settings.Music,Settings.Splash)); access.Close(); } diff --git a/scripts/audio/AudioSlider.cs b/scripts/audio/AudioSlider.cs index f0e04f2..034e1ef 100644 --- a/scripts/audio/AudioSlider.cs +++ b/scripts/audio/AudioSlider.cs @@ -15,11 +15,11 @@ public partial class AudioSlider : HSlider DragEnded += OnDragEnded; if (affects == TYPE.SFX) { - SetValueNoSignal(Utility.SFX); + SetValueNoSignal(Settings.SFX); } else { - SetValueNoSignal(Utility.Music); + SetValueNoSignal(Settings.Music); } } @@ -29,12 +29,12 @@ public partial class AudioSlider : HSlider { if (affects == TYPE.SFX) { - Utility.SFX = Value; + Settings.SFX = Value; AudioServer.SetBusVolumeDb(2, Mathf.LinearToDb((float)Value)); } else { - Utility.Music = Value; + Settings.Music = Value; AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Value)); } } diff --git a/scripts/gui/PrototypeWindow.cs b/scripts/gui/PrototypeWindow.cs index 39ba7d9..95d5e64 100644 --- a/scripts/gui/PrototypeWindow.cs +++ b/scripts/gui/PrototypeWindow.cs @@ -5,8 +5,8 @@ public partial class PrototypeWindow : AcceptDialog { public override void _Ready() { - if (Utility.Splash) return; - Utility.Splash = true; + if (Settings.Splash) return; + Settings.Splash = true; PopupCentered(); } } diff --git a/scripts/gui/ShovelButton.cs b/scripts/gui/ShovelButton.cs index de04638..deae0a4 100644 --- a/scripts/gui/ShovelButton.cs +++ b/scripts/gui/ShovelButton.cs @@ -22,15 +22,15 @@ public partial class ShovelButton : TextureButton if (@event.IsActionPressed("primary_action") && ButtonPressed) { - var checkedPosition = (PoolContainer.Instance.Plants.GetGlobalMousePosition() / Utility.Tile).Ceil() * Utility.Tile - new Vector2(20, 14); + var checkedPosition = (PoolContainer.Instance.Plants.GetGlobalMousePosition() / FieldParams.Tile).Ceil() * FieldParams.Tile - new Vector2(20, 14); - for (int i = Utility.LayersCount - 1; i >= 0; i--) + for (int i = FieldParams.LayersCount - 1; i >= 0; i--) { if (PoolContainer.Instance.EntityField[i].TryGetValue(checkedPosition, out var entity) && entity is RuntimePlantData plantData) { plantData.Kill(); - PoolContainer.Instance.SpawnParticles(particles, plantData.GlobalPosition + Vector2.Down * Utility.TileHeight / 2.0f); + PoolContainer.Instance.SpawnParticles(particles, plantData.GlobalPosition + Vector2.Down * FieldParams.TileHeight / 2.0f); break; } diff --git a/scripts/gui/ZombieLevelPreviewer.cs b/scripts/gui/ZombieLevelPreviewer.cs index e999f9d..32eed45 100644 --- a/scripts/gui/ZombieLevelPreviewer.cs +++ b/scripts/gui/ZombieLevelPreviewer.cs @@ -32,7 +32,7 @@ public partial class ZombieLevelPreviewer : Node2D var spawned = zombie.Scene.Instantiate(); spawned.DisableBrain(); AddChild(spawned); - spawned.Position += new Vector2(rng_x*Utility.TileWidth, rng_y*Utility.TileHeight); + spawned.Position += new Vector2(rng_x*FieldParams.TileWidth, rng_y*FieldParams.TileHeight); } } public List FindUnique() diff --git a/scripts/gui/seedpackets/ChoosableHandler.cs b/scripts/gui/seedpackets/ChoosableHandler.cs index d766856..7af1730 100644 --- a/scripts/gui/seedpackets/ChoosableHandler.cs +++ b/scripts/gui/seedpackets/ChoosableHandler.cs @@ -8,7 +8,7 @@ public class ChoosableHandler : SeedpacketHandler, ISeedpacketPress public void Pressed() { - if (LevelGUIElements.Instance.SeedpacketsHotbar.GetChildCount() >= Utility.MaxSeedpackets) return; + if (LevelGUIElements.Instance.SeedpacketsHotbar.GetChildCount() >= PlayerInfo.MaxSeedpackets) return; _owner.disablePacket = true; var hotbarSeedpacket = Seedpacket.Prefab.Instantiate(); diff --git a/scripts/level/LeftBoundaryMarker.cs b/scripts/level/LeftBoundaryMarker.cs index 6f9411a..56182a7 100644 --- a/scripts/level/LeftBoundaryMarker.cs +++ b/scripts/level/LeftBoundaryMarker.cs @@ -5,7 +5,7 @@ public partial class LeftBoundaryMarker : Marker2D { public override void _Ready() { - Utility.LeftFieldBoundary = (Vector2I)GlobalPosition; + FieldParams.LeftFieldBoundary = (Vector2I)GlobalPosition; QueueFree(); } diff --git a/scripts/level/PlantField.cs b/scripts/level/PlantField.cs index e82c9b1..d8a1059 100644 --- a/scripts/level/PlantField.cs +++ b/scripts/level/PlantField.cs @@ -50,10 +50,10 @@ public partial class PlantField : Node2D _plantSetter.GlobalPosition = mouse_pos; // Getting position in grid coordinates - var expected_pos = (_plantSetter.GlobalPosition / Utility.Tile).Ceil() * Utility.Tile - new Vector2(20, 14); + var expected_pos = (_plantSetter.GlobalPosition / FieldParams.Tile).Ceil() * FieldParams.Tile - new Vector2(20, 14); // Checking for boundaries - bool inBoundary = expected_pos.X > Utility.LeftFieldBoundary.X && expected_pos.X < Utility.RightFieldBoundary.X && expected_pos.Y > Utility.LeftFieldBoundary.Y && expected_pos.Y < Utility.RightFieldBoundary.Y; + bool inBoundary = expected_pos.X > FieldParams.LeftFieldBoundary.X && expected_pos.X < FieldParams.RightFieldBoundary.X && expected_pos.Y > FieldParams.LeftFieldBoundary.Y && expected_pos.Y < FieldParams.RightFieldBoundary.Y; bool canPlace = _resource != null @@ -92,14 +92,14 @@ public partial class PlantField : Node2D { var plant = _resource.Scene.Instantiate(); PoolContainer.Instance.Plants.AddChild(plant); - plant.GlobalPosition = (_plantSetter.GlobalPosition / Utility.Tile).Ceil() * Utility.Tile - new Vector2(20, 14); + plant.GlobalPosition = (_plantSetter.GlobalPosition / FieldParams.Tile).Ceil() * FieldParams.Tile - new Vector2(20, 14); plant.Resource = (PlantResource)_resource; PoolContainer.Instance.EntityField[_resource.Layer].Add(plant.GlobalPosition, plant); RuntimeLevelData.Instance.SpendSun(_resource.Cost); - PoolContainer.Instance.SpawnParticles(particles, plant.GlobalPosition + Vector2.Down * Utility.TileHeight/2.0f); + PoolContainer.Instance.SpawnParticles(particles, plant.GlobalPosition + Vector2.Down * FieldParams.TileHeight/2.0f); player.Play(); diff --git a/scripts/level/RightBoundaryMarker.cs b/scripts/level/RightBoundaryMarker.cs index a477fdb..7ecf036 100644 --- a/scripts/level/RightBoundaryMarker.cs +++ b/scripts/level/RightBoundaryMarker.cs @@ -5,7 +5,7 @@ public partial class RightBoundaryMarker : Marker2D { public override void _Ready() { - Utility.RightFieldBoundary = (Vector2I)GlobalPosition; + FieldParams.RightFieldBoundary = (Vector2I)GlobalPosition; QueueFree(); } diff --git a/scripts/level/SunSpawner.cs b/scripts/level/SunSpawner.cs index 8bfb473..2f68ddd 100644 --- a/scripts/level/SunSpawner.cs +++ b/scripts/level/SunSpawner.cs @@ -14,16 +14,16 @@ public partial class SunSpawner : Node public void Spawn() { - float x = GD.Randf()*9*Utility.TileWidth; + float x = GD.Randf()*9*FieldParams.TileWidth; uint y = GD.Randi() % 5; var sun = SunScene.Instantiate(); PoolContainer.Instance.Projectiles.AddChild(sun); - sun.GlobalPosition = new Vector2(Utility.LeftFieldBoundary.X + x, -90); + sun.GlobalPosition = new Vector2(FieldParams.LeftFieldBoundary.X + x, -90); var moveTween = CreateTween(); - moveTween.TweenProperty(sun,"global_position", new Vector2(Utility.LeftFieldBoundary.X + x, - Utility.LeftFieldBoundary.Y + Utility.TileHeight * y + Utility.TileHeight/2.0f),9-y); + moveTween.TweenProperty(sun,"global_position", new Vector2(FieldParams.LeftFieldBoundary.X + x, + FieldParams.LeftFieldBoundary.Y + FieldParams.TileHeight * y + FieldParams.TileHeight/2.0f),9-y); } } diff --git a/scripts/level/zombe_spawners/RowSpawner.cs b/scripts/level/zombe_spawners/RowSpawner.cs index 4c3ce40..27699a6 100644 --- a/scripts/level/zombe_spawners/RowSpawner.cs +++ b/scripts/level/zombe_spawners/RowSpawner.cs @@ -37,7 +37,7 @@ public partial class RowSpawner : Node2D RuntimeZombieData zombie = resource.Scene.Instantiate(); PoolContainer.Instance.Zombies.AddChild(zombie); - zombie.GlobalPosition = new Vector2(GlobalPosition.X, Utility.LeftFieldBoundary.Y + lane * Utility.TileHeight); + zombie.GlobalPosition = new Vector2(GlobalPosition.X, FieldParams.LeftFieldBoundary.Y + lane * FieldParams.TileHeight); runner.AddZombie(zombie); } diff --git a/scripts/level/zombe_spawners/ZombieSequencer.cs b/scripts/level/zombe_spawners/ZombieSequencer.cs index 7c0f1c6..e9fe451 100644 --- a/scripts/level/zombe_spawners/ZombieSequencer.cs +++ b/scripts/level/zombe_spawners/ZombieSequencer.cs @@ -61,7 +61,7 @@ public partial class ZombieSequencer : Node2D RuntimeZombieData zombie = GameRegistry.GetZombieByName(id).Scene.Instantiate(); PoolContainer.Instance.Zombies.AddChild(zombie); - zombie.GlobalPosition = new Vector2(GlobalPosition.X, Utility.RightFieldBoundary.Y - (lane - 1) * Utility.TileHeight); + zombie.GlobalPosition = new Vector2(GlobalPosition.X, FieldParams.RightFieldBoundary.Y - (lane - 1) * FieldParams.TileHeight); } public void Add(string id) diff --git a/scripts/plants/PlantEyesightLimiter.cs b/scripts/plants/PlantEyesightLimiter.cs index bf093f5..43cc59c 100644 --- a/scripts/plants/PlantEyesightLimiter.cs +++ b/scripts/plants/PlantEyesightLimiter.cs @@ -8,7 +8,7 @@ public partial class PlantEyesightLimiter : CollisionShape2D { if (Shape is SegmentShape2D segment) { - segment.B = new Vector2(Utility.RightFieldBoundary.X - GlobalPosition.X+Utility.TileWidth/2.0f, 0); + segment.B = new Vector2(FieldParams.RightFieldBoundary.X - GlobalPosition.X+FieldParams.TileWidth/2.0f, 0); } } } \ No newline at end of file diff --git a/scripts/plants/ThreepeaterShooter.cs b/scripts/plants/ThreepeaterShooter.cs index 61773ab..0b74f24 100644 --- a/scripts/plants/ThreepeaterShooter.cs +++ b/scripts/plants/ThreepeaterShooter.cs @@ -9,7 +9,7 @@ public partial class ThreepeaterShooter : Shooter { for(int i = -1; i <= 1; i++) { - if (GetParent().GlobalPosition.Y+i*Utility.TileHeight >= Utility.RightFieldBoundary.Y || GetParent().GlobalPosition.Y+i*Utility.TileHeight <= Utility.LeftFieldBoundary.Y) + if (GetParent().GlobalPosition.Y+i*FieldParams.TileHeight >= FieldParams.RightFieldBoundary.Y || GetParent().GlobalPosition.Y+i*FieldParams.TileHeight <= FieldParams.LeftFieldBoundary.Y) continue; var instance = _projectile.Instantiate(); @@ -19,7 +19,7 @@ public partial class ThreepeaterShooter : Shooter if(i != 0) { var tween = CreateTween().SetEase(Tween.EaseType.Out).SetTrans(Tween.TransitionType.Sine); - tween.TweenProperty(instance,"position:y",instance.Position.Y+i*Utility.TileHeight,0.5); + tween.TweenProperty(instance,"position:y",instance.Position.Y+i*FieldParams.TileHeight,0.5); } } } diff --git a/scripts/plants/behaviours/AloeBehaviour.cs b/scripts/plants/behaviours/AloeBehaviour.cs index 574a860..c994365 100644 --- a/scripts/plants/behaviours/AloeBehaviour.cs +++ b/scripts/plants/behaviours/AloeBehaviour.cs @@ -19,7 +19,7 @@ public partial class AloeBehaviour : BaseBehaviour { _tree.Set("parameters/Tree/conditions/charged",_charge); - var checkPos = GetParent().GlobalPosition + Vector2.Right * Utility.TileWidth; + var checkPos = GetParent().GlobalPosition + Vector2.Right * FieldParams.TileWidth; if(_charge && PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData)) { if((float)plantData.HP / (float)plantData.MaxHP < _hpTreshold) @@ -33,7 +33,7 @@ public partial class AloeBehaviour : BaseBehaviour public void Heal() { - var checkPos = GetParent().GlobalPosition + Vector2.Right * Utility.TileWidth; + var checkPos = GetParent().GlobalPosition + Vector2.Right * FieldParams.TileWidth; if (PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData)) { plantData.Heal(1200 + 0.5f * plantData.MaxHP, GetParent()); diff --git a/scripts/systems/effects/GarlicEffect.cs b/scripts/systems/effects/GarlicEffect.cs index 0900ff6..f8966ab 100644 --- a/scripts/systems/effects/GarlicEffect.cs +++ b/scripts/systems/effects/GarlicEffect.cs @@ -25,11 +25,11 @@ public partial class GarlicEffect : Effect if(target is RuntimeZombieData zombieData) { int mult; - if((int)zombieData.GlobalPosition.Y/Utility.TileHeight <= 2) + if((int)zombieData.GlobalPosition.Y/FieldParams.TileHeight <= 2) { mult = 1; } - else if((int)zombieData.GlobalPosition.Y/Utility.TileHeight >= 6) + else if((int)zombieData.GlobalPosition.Y/FieldParams.TileHeight >= 6) { mult = -1; } @@ -46,8 +46,8 @@ public partial class GarlicEffect : Effect } zombieData.AbleToEat = false; var tween = zombieData.CreateTween(); - tween.TweenProperty(zombieData,"position:y",zombieData.GlobalPosition.Y + Utility.TileHeight * mult, Duration); - tween.Parallel().TweenProperty(zombieData, "position:x", zombieData.GlobalPosition.X - Utility.TileHeight * tilesWalked, Duration); + tween.TweenProperty(zombieData,"position:y",zombieData.GlobalPosition.Y + FieldParams.TileHeight * mult, Duration); + tween.Parallel().TweenProperty(zombieData, "position:x", zombieData.GlobalPosition.X - FieldParams.TileHeight * tilesWalked, Duration); tween.TweenCallback(Callable.From(() => {zombieData.AbleToEat = true;})); } } diff --git a/scripts/zombies/ZombieMover.cs b/scripts/zombies/ZombieMover.cs index 60a81e5..dab4031 100644 --- a/scripts/zombies/ZombieMover.cs +++ b/scripts/zombies/ZombieMover.cs @@ -19,7 +19,7 @@ public partial class ZombieMover : Node { _zombie.Position -= _zombie.Transform.X * (float)delta - * Utility.TileWidth + * FieldParams.TileWidth * GetParent().LocalTimescale * _speed.GetValue() * _speedControlMult;