diff --git a/isometric-park-fna/Engines/Spawners/DialogSpawner.cs b/isometric-park-fna/Engines/Spawners/DialogSpawner.cs --- a/isometric-park-fna/Engines/Spawners/DialogSpawner.cs +++ b/isometric-park-fna/Engines/Spawners/DialogSpawner.cs @@ -15,6 +15,7 @@ using Encompass; using TraceryNet; using Ink.Runtime; +using JM.LinqFaster; namespace isometricparkfna.Spawners { @@ -68,11 +69,15 @@ protected override void Spawn(in SpawnDialogMessage message) { - Logging.Spy(this.Story.currentChoices.Count(), "Count"); - Logging.Spy(this.Story.canContinue, "CanContinue"); + Logging.Info(String.Format("Count: {0}", this.Story.currentChoices.Count())); + Logging.Info(String.Format("Cancontinue: {0}", this.Story.canContinue)); var index = 0; + var path = message.Path; + var matching_dialog_entites = ReadEntities() + .SelectWhereF(e => GetComponent(e), + e => e.StartingKnot == path); //If there are no existing dialog: if(ReadEntities().Length == 0 && this.Story.currentChoices.Count() == 0 @@ -91,6 +96,7 @@ AddComponent(newDialog, new DialogComponent { + StartingKnot = message.Path, Knot = message.Path, CurrentDialog = this.Grammar.Flatten(dialog), CurrentSpeaker = this.Grammar.Flatten(speaker).Trim(), @@ -114,12 +120,14 @@ Logging.Success("Spawned new dialog."); SendMessage(new GameRateMessage { paused = true }); } - else + else if (matching_dialog_entites.Length == 0) + { Logging.Debug("Creating new Dialog without hydrating."); var newDialog = CreateEntity(); AddComponent(newDialog, new DialogComponent { + StartingKnot = message.Path, Knot = message.Path }); AddComponent(newDialog, new WindowTypeComponent {