Skip to content
Permalink
Browse files

Don't remove entities when changing map

  • Loading branch information...
UnknownShadow200 committed Jun 30, 2017
1 parent e018f89 commit fc0b71b4cb195715cd533058f08617667dd572f5
Showing with 7 additions and 21 deletions.
  1. +6 −17 fCraft/Commands/WorldCommands.cs
  2. +0 −3 fCraft/World/Entity.cs
  3. +1 −1 fCraft/World/World.cs
@@ -807,11 +807,8 @@ class BlockDBCounterProcessor : IBlockDBQueryProcessor {
Logger.Log(LogType.UserActivity,
"Gen: Asked {0} to confirm replacing the map of world {1} (\"this map\").",
player.Name, playerWorld.Name);
if (!Entity.AnyIn(player.World)) {
player.Confirm(cmd, "Replace THIS MAP with a generated one ({0})?", templateFullName);
} else {
player.Confirm(cmd, "Replace THIS MAP with a generated one ({0})?&NThis will also remove all the Entities/Bots on the world.", templateFullName);
}

player.Confirm(cmd, "Replace THIS MAP with a generated one ({0})?", templateFullName);
return;
}
} else {
@@ -955,11 +952,8 @@ class BlockDBCounterProcessor : IBlockDBQueryProcessor {
Logger.Log(LogType.UserActivity,
"GenHM: Asked {0} to confirm replacing the map of world {1} (\"this map\").",
player.Name, playerWorld.Name);
if (!Entity.AnyIn(player.World)) {
player.Confirm(cmd, "Replace THIS MAP with a generated one (HeightMap: &9{0}&S)?", url);
} else {
player.Confirm(cmd, "Replace THIS MAP with a generated one (HeightMap: &9{0}&S)?&NThis will also remove all the Entities/Bots on the world.", url);
}

player.Confirm(cmd, "Replace THIS MAP with a generated one (HeightMap: &9{0}&S)?", url);
return;
}

@@ -3411,13 +3405,8 @@ static void WorldClearHandler(Player player, CommandReader cmd)
player.Message("You have no personal worlds by that number: {0}", num); return;
}
if (!cmd.IsConfirmed) {
if (!Entity.AnyIn(player.World)) {
player.Confirm(cmd, "This will reset your personal world: " + mapName +
"&N&cThis cannot be undone!");
} else {
player.Confirm(cmd, "This will reset your personal world: " + mapName +
"&N&cThis cannot be undone!&NThis will also remove all the Entities/Bots on the world.");
}
player.Confirm(cmd, "This will reset your personal world: " + mapName +
"&N&cThis cannot be undone!");
return;
}

@@ -101,9 +101,6 @@ public sealed class Entity {
/// <summary> Enumerable of all entities that are in the given world. </summary>
public static IEnumerable<Entity> AllIn(World world) { return AllIn(world.Name); }

/// <summary> Returns whether any entities exist in the given world. </summary>
public static bool AnyIn(World world) { return AllIn(world).Any(); }

/// <summary> Retrieves the entity who is located in the given world,
/// and whose name caselessly matches the input. </summary>
public static Entity Find(World world, string name) {
@@ -272,7 +272,7 @@ public sealed class World : IClassy {
BlockDB.Clear();
BlockDB.World = newWorld;
}
if (Entity.AnyIn(this)) Entity.RemoveAllIn(this);

foreach ( Player player in Players ) {
player.JoinWorld( newWorld, WorldChangeReason.Rejoin );
}

0 comments on commit fc0b71b

Please sign in to comment.
You can’t perform that action at this time.