improved overwrite
This commit is contained in:
@@ -70,14 +70,15 @@ public class Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if not empty and overwrite not allowed:
|
// 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;
|
return;
|
||||||
|
else if (!Elements[x,y].IsEmpty()) {
|
||||||
|
Elements[x, y].Chunk.RemoveFromChunk(Elements[x, y]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Type type = typeof(T);
|
Type type = typeof(T);
|
||||||
object o = Activator.CreateInstance(type, x, y, this);
|
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] = o as Element;
|
||||||
Elements[x, y].Active = true;
|
Elements[x, y].Active = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user