fix: Fixes exporting spawners. (#1826)
This commit is contained in:
parent
99e33d0463
commit
5a65a6b8ea
1 changed files with 15 additions and 10 deletions
|
|
@ -71,18 +71,23 @@ public class ExportSpawnersCommand : BaseCommand
|
|||
var spawnRecords = new List<DynamicJson>(list.Count);
|
||||
for (var i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i] is BaseSpawner spawner)
|
||||
// Not a spawner, not on a valid map, or is in a container
|
||||
if (list[i] is not BaseSpawner spawner || spawner.Map == Map.Internal || spawner.Parent != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(spawner.Name) && spawner.Name.StartsWith(
|
||||
condition,
|
||||
StringComparison.OrdinalIgnoreCase
|
||||
))
|
||||
{
|
||||
var dynamicJson = DynamicJson.Create(spawner.GetType());
|
||||
spawner.ToJson(dynamicJson, options);
|
||||
spawnRecords.Add(dynamicJson);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(spawner.Name) && !spawner.Name.StartsWith(
|
||||
condition,
|
||||
StringComparison.OrdinalIgnoreCase
|
||||
))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var dynamicJson = DynamicJson.Create(spawner.GetType());
|
||||
spawner.ToJson(dynamicJson, options);
|
||||
spawnRecords.Add(dynamicJson);
|
||||
}
|
||||
|
||||
if (spawnRecords.Count == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue