Fixed links

This commit is contained in:
Rendo 2025-07-17 11:44:10 +05:00
commit eb408a62bb
18 changed files with 40 additions and 42 deletions

View file

@ -25,7 +25,7 @@ public partial class LinearProjectile : Area2D, IProjectile
public override void _PhysicsProcess(double delta) 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) public void OnAreaEntered(Area2D area)

View file

@ -1,6 +1,4 @@
using Godot; using Godot;
using Newlon;
using System;
public partial class SettingsSerializer : Node public partial class SettingsSerializer : Node
{ {
@ -12,12 +10,12 @@ public partial class SettingsSerializer : Node
var access = FileAccess.Open(CFG_PATH, FileAccess.ModeFlags.Read); var access = FileAccess.Open(CFG_PATH, FileAccess.ModeFlags.Read);
Utility.SFX = float.Parse(access.GetLine().Split(" ")[1]); Settings.SFX = float.Parse(access.GetLine().Split(" ")[1]);
Utility.Music = float.Parse(access.GetLine().Split(" ")[1]); Settings.Music = float.Parse(access.GetLine().Split(" ")[1]);
Utility.Splash = bool.Parse(access.GetLine().Split(" ")[1]); Settings.Splash = bool.Parse(access.GetLine().Split(" ")[1]);
AudioServer.SetBusVolumeDb(0, Mathf.LinearToDb((float)Utility.SFX)); AudioServer.SetBusVolumeDb(0, Mathf.LinearToDb((float)Settings.SFX));
AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Utility.Music)); AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Settings.Music));
access.Close(); access.Close();
} }
@ -25,7 +23,7 @@ public partial class SettingsSerializer : Node
{ {
var access = FileAccess.Open(CFG_PATH, FileAccess.ModeFlags.Write); var access = FileAccess.Open(CFG_PATH, FileAccess.ModeFlags.Write);
access.Resize(0); 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(); access.Close();
} }

View file

@ -15,11 +15,11 @@ public partial class AudioSlider : HSlider
DragEnded += OnDragEnded; DragEnded += OnDragEnded;
if (affects == TYPE.SFX) if (affects == TYPE.SFX)
{ {
SetValueNoSignal(Utility.SFX); SetValueNoSignal(Settings.SFX);
} }
else else
{ {
SetValueNoSignal(Utility.Music); SetValueNoSignal(Settings.Music);
} }
} }
@ -29,12 +29,12 @@ public partial class AudioSlider : HSlider
{ {
if (affects == TYPE.SFX) if (affects == TYPE.SFX)
{ {
Utility.SFX = Value; Settings.SFX = Value;
AudioServer.SetBusVolumeDb(2, Mathf.LinearToDb((float)Value)); AudioServer.SetBusVolumeDb(2, Mathf.LinearToDb((float)Value));
} }
else else
{ {
Utility.Music = Value; Settings.Music = Value;
AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Value)); AudioServer.SetBusVolumeDb(1, Mathf.LinearToDb((float)Value));
} }
} }

View file

@ -5,8 +5,8 @@ public partial class PrototypeWindow : AcceptDialog
{ {
public override void _Ready() public override void _Ready()
{ {
if (Utility.Splash) return; if (Settings.Splash) return;
Utility.Splash = true; Settings.Splash = true;
PopupCentered(); PopupCentered();
} }
} }

View file

@ -22,15 +22,15 @@ public partial class ShovelButton : TextureButton
if (@event.IsActionPressed("primary_action") && ButtonPressed) 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) if (PoolContainer.Instance.EntityField[i].TryGetValue(checkedPosition, out var entity) && entity is RuntimePlantData plantData)
{ {
plantData.Kill(); 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; break;
} }

View file

@ -32,7 +32,7 @@ public partial class ZombieLevelPreviewer : Node2D
var spawned = zombie.Scene.Instantiate<RuntimeZombieData>(); var spawned = zombie.Scene.Instantiate<RuntimeZombieData>();
spawned.DisableBrain(); spawned.DisableBrain();
AddChild(spawned); 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<ZombieResource> FindUnique() public List<ZombieResource> FindUnique()

View file

@ -8,7 +8,7 @@ public class ChoosableHandler : SeedpacketHandler, ISeedpacketPress
public void Pressed() public void Pressed()
{ {
if (LevelGUIElements.Instance.SeedpacketsHotbar.GetChildCount() >= Utility.MaxSeedpackets) return; if (LevelGUIElements.Instance.SeedpacketsHotbar.GetChildCount() >= PlayerInfo.MaxSeedpackets) return;
_owner.disablePacket = true; _owner.disablePacket = true;
var hotbarSeedpacket = Seedpacket.Prefab.Instantiate<Seedpacket>(); var hotbarSeedpacket = Seedpacket.Prefab.Instantiate<Seedpacket>();

View file

@ -5,7 +5,7 @@ public partial class LeftBoundaryMarker : Marker2D
{ {
public override void _Ready() public override void _Ready()
{ {
Utility.LeftFieldBoundary = (Vector2I)GlobalPosition; FieldParams.LeftFieldBoundary = (Vector2I)GlobalPosition;
QueueFree(); QueueFree();
} }

View file

@ -50,10 +50,10 @@ public partial class PlantField : Node2D
_plantSetter.GlobalPosition = mouse_pos; _plantSetter.GlobalPosition = mouse_pos;
// Getting position in grid coordinates // 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 // 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 bool canPlace = _resource != null
@ -92,14 +92,14 @@ public partial class PlantField : Node2D
{ {
var plant = _resource.Scene.Instantiate<RuntimePlantData>(); var plant = _resource.Scene.Instantiate<RuntimePlantData>();
PoolContainer.Instance.Plants.AddChild(plant); 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; plant.Resource = (PlantResource)_resource;
PoolContainer.Instance.EntityField[_resource.Layer].Add(plant.GlobalPosition, plant); PoolContainer.Instance.EntityField[_resource.Layer].Add(plant.GlobalPosition, plant);
RuntimeLevelData.Instance.SpendSun(_resource.Cost); 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(); player.Play();

View file

@ -5,7 +5,7 @@ public partial class RightBoundaryMarker : Marker2D
{ {
public override void _Ready() public override void _Ready()
{ {
Utility.RightFieldBoundary = (Vector2I)GlobalPosition; FieldParams.RightFieldBoundary = (Vector2I)GlobalPosition;
QueueFree(); QueueFree();
} }

View file

@ -14,16 +14,16 @@ public partial class SunSpawner : Node
public void Spawn() public void Spawn()
{ {
float x = GD.Randf()*9*Utility.TileWidth; float x = GD.Randf()*9*FieldParams.TileWidth;
uint y = GD.Randi() % 5; uint y = GD.Randi() % 5;
var sun = SunScene.Instantiate<Sun>(); var sun = SunScene.Instantiate<Sun>();
PoolContainer.Instance.Projectiles.AddChild(sun); 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(); var moveTween = CreateTween();
moveTween.TweenProperty(sun,"global_position", new Vector2(Utility.LeftFieldBoundary.X + x, moveTween.TweenProperty(sun,"global_position", new Vector2(FieldParams.LeftFieldBoundary.X + x,
Utility.LeftFieldBoundary.Y + Utility.TileHeight * y + Utility.TileHeight/2.0f),9-y); FieldParams.LeftFieldBoundary.Y + FieldParams.TileHeight * y + FieldParams.TileHeight/2.0f),9-y);
} }
} }

View file

@ -37,7 +37,7 @@ public partial class RowSpawner : Node2D
RuntimeZombieData zombie = resource.Scene.Instantiate<RuntimeZombieData>(); RuntimeZombieData zombie = resource.Scene.Instantiate<RuntimeZombieData>();
PoolContainer.Instance.Zombies.AddChild(zombie); 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); runner.AddZombie(zombie);
} }

View file

@ -61,7 +61,7 @@ public partial class ZombieSequencer : Node2D
RuntimeZombieData zombie = GameRegistry.GetZombieByName(id).Scene.Instantiate<RuntimeZombieData>(); RuntimeZombieData zombie = GameRegistry.GetZombieByName(id).Scene.Instantiate<RuntimeZombieData>();
PoolContainer.Instance.Zombies.AddChild(zombie); 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) public void Add(string id)

View file

@ -8,7 +8,7 @@ public partial class PlantEyesightLimiter : CollisionShape2D
{ {
if (Shape is SegmentShape2D segment) 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);
} }
} }
} }

View file

@ -9,7 +9,7 @@ public partial class ThreepeaterShooter : Shooter
{ {
for(int i = -1; i <= 1; i++) for(int i = -1; i <= 1; i++)
{ {
if (GetParent<Node2D>().GlobalPosition.Y+i*Utility.TileHeight >= Utility.RightFieldBoundary.Y || GetParent<Node2D>().GlobalPosition.Y+i*Utility.TileHeight <= Utility.LeftFieldBoundary.Y) if (GetParent<Node2D>().GlobalPosition.Y+i*FieldParams.TileHeight >= FieldParams.RightFieldBoundary.Y || GetParent<Node2D>().GlobalPosition.Y+i*FieldParams.TileHeight <= FieldParams.LeftFieldBoundary.Y)
continue; continue;
var instance = _projectile.Instantiate<Node2D>(); var instance = _projectile.Instantiate<Node2D>();
@ -19,7 +19,7 @@ public partial class ThreepeaterShooter : Shooter
if(i != 0) if(i != 0)
{ {
var tween = CreateTween().SetEase(Tween.EaseType.Out).SetTrans(Tween.TransitionType.Sine); 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);
} }
} }
} }

View file

@ -19,7 +19,7 @@ public partial class AloeBehaviour : BaseBehaviour
{ {
_tree.Set("parameters/Tree/conditions/charged",_charge); _tree.Set("parameters/Tree/conditions/charged",_charge);
var checkPos = GetParent<Node2D>().GlobalPosition + Vector2.Right * Utility.TileWidth; var checkPos = GetParent<Node2D>().GlobalPosition + Vector2.Right * FieldParams.TileWidth;
if(_charge && PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData)) if(_charge && PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData))
{ {
if((float)plantData.HP / (float)plantData.MaxHP < _hpTreshold) if((float)plantData.HP / (float)plantData.MaxHP < _hpTreshold)
@ -33,7 +33,7 @@ public partial class AloeBehaviour : BaseBehaviour
public void Heal() public void Heal()
{ {
var checkPos = GetParent<Node2D>().GlobalPosition + Vector2.Right * Utility.TileWidth; var checkPos = GetParent<Node2D>().GlobalPosition + Vector2.Right * FieldParams.TileWidth;
if (PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData)) if (PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData))
{ {
plantData.Heal(1200 + 0.5f * plantData.MaxHP, GetParent()); plantData.Heal(1200 + 0.5f * plantData.MaxHP, GetParent());

View file

@ -25,11 +25,11 @@ public partial class GarlicEffect : Effect
if(target is RuntimeZombieData zombieData) if(target is RuntimeZombieData zombieData)
{ {
int mult; int mult;
if((int)zombieData.GlobalPosition.Y/Utility.TileHeight <= 2) if((int)zombieData.GlobalPosition.Y/FieldParams.TileHeight <= 2)
{ {
mult = 1; mult = 1;
} }
else if((int)zombieData.GlobalPosition.Y/Utility.TileHeight >= 6) else if((int)zombieData.GlobalPosition.Y/FieldParams.TileHeight >= 6)
{ {
mult = -1; mult = -1;
} }
@ -46,8 +46,8 @@ public partial class GarlicEffect : Effect
} }
zombieData.AbleToEat = false; zombieData.AbleToEat = false;
var tween = zombieData.CreateTween(); var tween = zombieData.CreateTween();
tween.TweenProperty(zombieData,"position:y",zombieData.GlobalPosition.Y + Utility.TileHeight * mult, Duration); tween.TweenProperty(zombieData,"position:y",zombieData.GlobalPosition.Y + FieldParams.TileHeight * mult, Duration);
tween.Parallel().TweenProperty(zombieData, "position:x", zombieData.GlobalPosition.X - Utility.TileHeight * tilesWalked, Duration); tween.Parallel().TweenProperty(zombieData, "position:x", zombieData.GlobalPosition.X - FieldParams.TileHeight * tilesWalked, Duration);
tween.TweenCallback(Callable.From(() => {zombieData.AbleToEat = true;})); tween.TweenCallback(Callable.From(() => {zombieData.AbleToEat = true;}));
} }
} }

View file

@ -19,7 +19,7 @@ public partial class ZombieMover : Node
{ {
_zombie.Position -= _zombie.Transform.X _zombie.Position -= _zombie.Transform.X
* (float)delta * (float)delta
* Utility.TileWidth * FieldParams.TileWidth
* GetParent<RuntimeZombieData>().LocalTimescale * GetParent<RuntimeZombieData>().LocalTimescale
* _speed.GetValue() * _speed.GetValue()
* _speedControlMult; * _speedControlMult;