improved overwrite

This commit is contained in:
2025-06-28 14:35:16 +02:00
parent b0b5e95eda
commit 4220e94e38

View File

@@ -70,14 +70,15 @@ public class Chunk {
}
// check if not empty and overwrite not allowed:
if (!Elements[x,y].IsEmpty() && !Main.Instance.AllowOverwrite) {
if (!Elements[x,y].IsEmpty() && !Main.Instance.AllowOverwrite)
return;
else if (!Elements[x,y].IsEmpty()) {
Elements[x, y].Chunk.RemoveFromChunk(Elements[x, y]);
}
Type type = typeof(T);
object o = Activator.CreateInstance(type, x, y, this);
Elements[x, y].Chunk.RemoveFromChunk(Elements[x, y]);
Elements[x, y] = o as Element;
Elements[x, y].Active = true;
}