From 7458d5749cd1eadbfeaaff4d89fda6790d03b6f3 Mon Sep 17 00:00:00 2001 From: rogo Date: Mon, 5 May 2025 20:10:02 +0200 Subject: [PATCH] imrpvoed water behavior --- Scripts/Chunk.cs | 3 --- Scripts/Elements/Liquid.cs | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Scripts/Chunk.cs b/Scripts/Chunk.cs index 9436fc3..7f175aa 100644 --- a/Scripts/Chunk.cs +++ b/Scripts/Chunk.cs @@ -158,9 +158,6 @@ public class Chunk { swapTo.Moved(); if (swapTo.IsEmpty()) swapTo.ActivateNeighbors(); - - // TODO: - // if either "what" or "swapTo" is empty, re-activate all neighbors of the now empty ones } public override string ToString() { diff --git a/Scripts/Elements/Liquid.cs b/Scripts/Elements/Liquid.cs index f3f61bc..d7b18aa 100644 --- a/Scripts/Elements/Liquid.cs +++ b/Scripts/Elements/Liquid.cs @@ -29,10 +29,10 @@ public abstract class Liquid : Element { else if (Chunk.IsEmpty(Position + randomDirection * VERTICAL_OPPOSITE)) Chunk.Swap(this, Position + randomDirection * VERTICAL_OPPOSITE); - else if (Chunk.IsEmpty(Position + randomDirection)) - Chunk.Swap(this, Position + Vector2I.Right + randomDirection); - else if (Chunk.IsEmpty(Position - randomDirection)) - Chunk.Swap(this, Position + Vector2I.Right + randomDirection * VERTICAL_OPPOSITE); + else if (Chunk.IsEmpty(Position + 2 * randomDirection)) + Chunk.Swap(this, Position + 2 * randomDirection); + else if (Chunk.IsEmpty(Position - 2 * randomDirection * VERTICAL_OPPOSITE)) + Chunk.Swap(this, Position - 2 * randomDirection * VERTICAL_OPPOSITE); } public override void ActivateNeighbors() {