fix: Fixes spawn entry deserialization (#1693)
This commit is contained in:
parent
7a71e8b340
commit
c42c20aef9
3 changed files with 37 additions and 8 deletions
|
|
@ -31,6 +31,7 @@ public partial class SpawnerEntry
|
|||
[SerializedJsonPropertyName("parameters")]
|
||||
private string _parameters;
|
||||
|
||||
[Tidy]
|
||||
[SerializedJsonIgnore]
|
||||
[SerializableField(5)]
|
||||
private List<ISpawnable> _spawned;
|
||||
|
|
@ -95,10 +96,21 @@ public partial class SpawnerEntry
|
|||
[AfterDeserialization]
|
||||
private void AfterDeserialization()
|
||||
{
|
||||
foreach (var e in Spawned)
|
||||
// This wasn't tidy in the original code, but it is after generating the code.
|
||||
for (var i = Spawned.Count - 1; i >= 0; i--)
|
||||
{
|
||||
e.Spawner = _parent;
|
||||
var e = Spawned[i];
|
||||
if (e == null)
|
||||
{
|
||||
Spawned.RemoveAt(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Spawner = _parent;
|
||||
}
|
||||
}
|
||||
|
||||
Spawned.TrimExcess();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Server.Misc
|
|||
var created = logEntry.Created;
|
||||
var speech = logEntry.Speech;
|
||||
writer.WriteLine(
|
||||
@$"{created.Hour}:{created.Minute:00}:{created.Second:00} - {fromName} ({fromAccount}): '{speech}'"
|
||||
$"{created.Hour}:{created.Minute:00}:{created.Second:00} - {fromName} ({fromAccount}): '{speech}'"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue