From 6308195224b9ef44499bb4af1d5dad476ea65090 Mon Sep 17 00:00:00 2001 From: rogo Date: Sat, 2 Dec 2023 20:10:19 +0100 Subject: [PATCH] cleanup --- Scripts/Elements/Element.cs | 7 +++---- Scripts/Elements/Water.cs | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Scripts/Elements/Element.cs b/Scripts/Elements/Element.cs index fa953d9..9a3cd00 100644 --- a/Scripts/Elements/Element.cs +++ b/Scripts/Elements/Element.cs @@ -47,15 +47,14 @@ public class Element { protected virtual void Tick() { Vector2I randomDirection = RandomDirectionDown(); - if (Level.IsEmpty(Position + Vector2I.Down)) { + if (Level.IsEmpty(Position + Vector2I.Down)) Level.Swap(this, Position + Vector2I.Down); - } else if (Level.IsEmpty(Position + randomDirection)) { + else if (Level.IsEmpty(Position + randomDirection)) Level.Swap(this, Position + randomDirection); - } else if (Level.IsEmpty(Position + randomDirection * VERTICAL_OPPOSITE)) { + else if (Level.IsEmpty(Position + randomDirection * VERTICAL_OPPOSITE)) Level.Swap(this, Position + randomDirection * VERTICAL_OPPOSITE); - } if (GD.Randi() % MAX_DIFFUSE_SPEED > DiffuseSpeed) return; // ascend slower diff --git a/Scripts/Elements/Water.cs b/Scripts/Elements/Water.cs index 930b9ad..566d2c3 100644 --- a/Scripts/Elements/Water.cs +++ b/Scripts/Elements/Water.cs @@ -23,15 +23,13 @@ public class Water : Solid { if (randomDirection.Y != 0) randomDirection *= Vector2I.Left * (int)(GD.Randi() % MAX_VERTICAL_SPREAD); - if (Level.IsEmpty(Position + Vector2I.Down)) { + if (Level.IsEmpty(Position + Vector2I.Down)) Level.Swap(this, Position + Vector2I.Down); - } else if (Level.IsEmpty(Position + randomDirection)) { + else if (Level.IsEmpty(Position + randomDirection)) Level.Swap(this, Position + Vector2I.Right * randomDirection); - } else if (Level.IsEmpty(Position + randomDirection)) { + else if (Level.IsEmpty(Position + randomDirection)) Level.Swap(this, Position + Vector2I.Right * randomDirection * VERTICAL_OPPOSITE); - - } } }