Skip to content

Commit fc0b71b

Browse files
Don't remove entities when changing map
1 parent e018f89 commit fc0b71b

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

fCraft/Commands/WorldCommands.cs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -807,11 +807,8 @@ private static void GenHandler(Player player, CommandReader cmd) {
807807
Logger.Log(LogType.UserActivity,
808808
"Gen: Asked {0} to confirm replacing the map of world {1} (\"this map\").",
809809
player.Name, playerWorld.Name);
810-
if (!Entity.AnyIn(player.World)) {
811-
player.Confirm(cmd, "Replace THIS MAP with a generated one ({0})?", templateFullName);
812-
} else {
813-
player.Confirm(cmd, "Replace THIS MAP with a generated one ({0})?&NThis will also remove all the Entities/Bots on the world.", templateFullName);
814-
}
810+
811+
player.Confirm(cmd, "Replace THIS MAP with a generated one ({0})?", templateFullName);
815812
return;
816813
}
817814
} else {
@@ -955,11 +952,8 @@ private static void GenHMHandler(Player player, CommandReader cmd) {
955952
Logger.Log(LogType.UserActivity,
956953
"GenHM: Asked {0} to confirm replacing the map of world {1} (\"this map\").",
957954
player.Name, playerWorld.Name);
958-
if (!Entity.AnyIn(player.World)) {
959-
player.Confirm(cmd, "Replace THIS MAP with a generated one (HeightMap: &9{0}&S)?", url);
960-
} else {
961-
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);
962-
}
955+
956+
player.Confirm(cmd, "Replace THIS MAP with a generated one (HeightMap: &9{0}&S)?", url);
963957
return;
964958
}
965959

@@ -3411,13 +3405,8 @@ static void MWReset(Player player, CommandReader cmd) {
34113405
player.Message("You have no personal worlds by that number: {0}", num); return;
34123406
}
34133407
if (!cmd.IsConfirmed) {
3414-
if (!Entity.AnyIn(player.World)) {
3415-
player.Confirm(cmd, "This will reset your personal world: " + mapName +
3416-
"&N&cThis cannot be undone!");
3417-
} else {
3418-
player.Confirm(cmd, "This will reset your personal world: " + mapName +
3419-
"&N&cThis cannot be undone!&NThis will also remove all the Entities/Bots on the world.");
3420-
}
3408+
player.Confirm(cmd, "This will reset your personal world: " + mapName +
3409+
"&N&cThis cannot be undone!");
34213410
return;
34223411
}
34233412

fCraft/World/Entity.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ public static IEnumerable<Entity> AllIn(string worldName) {
101101
/// <summary> Enumerable of all entities that are in the given world. </summary>
102102
public static IEnumerable<Entity> AllIn(World world) { return AllIn(world.Name); }
103103

104-
/// <summary> Returns whether any entities exist in the given world. </summary>
105-
public static bool AnyIn(World world) { return AllIn(world).Any(); }
106-
107104
/// <summary> Retrieves the entity who is located in the given world,
108105
/// and whose name caselessly matches the input. </summary>
109106
public static Entity Find(World world, string name) {

fCraft/World/World.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public World ChangeMap( [NotNull] Map newMap ) {
272272
BlockDB.Clear();
273273
BlockDB.World = newWorld;
274274
}
275-
if (Entity.AnyIn(this)) Entity.RemoveAllIn(this);
275+
276276
foreach ( Player player in Players ) {
277277
player.JoinWorld( newWorld, WorldChangeReason.Rejoin );
278278
}

0 commit comments

Comments
 (0)