summaryrefslogtreecommitdiff
path: root/scripts/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Entities')
-rw-r--r--scripts/Entities/Actors/Actor.cs24
-rw-r--r--scripts/Entities/Actors/Enemy.cs4
2 files changed, 21 insertions, 7 deletions
diff --git a/scripts/Entities/Actors/Actor.cs b/scripts/Entities/Actors/Actor.cs
index 71a32a5..c68cc2b 100644
--- a/scripts/Entities/Actors/Actor.cs
+++ b/scripts/Entities/Actors/Actor.cs
@@ -106,7 +106,16 @@ public partial class Actor : Entity, ISaveable
EmitSignal(SignalName.HealthChanged, Hp, MaxHp);
if (hp <= 0)
{
- Die();
+ bool inLoading = true;
+
+ // Se o ator morrer, porém não estiver em um SceneTree,
+ // Quer dizer que este ator já estava morto e estamos carregando
+ // um save.
+ if (IsInsideTree())
+ {
+ inLoading = false;
+ }
+ Die(inLoading);
}
}
}
@@ -234,7 +243,7 @@ public partial class Actor : Entity, ISaveable
Men = definition.Men;
}
- public virtual void Die()
+ public virtual void Die(bool inLoading)
{
//⠀⠀⠀⠀⢠⣤⣤⣤⢠⣤⣤⣤⣤⣄⢀⣠⣤⣤⣄⠀⠀⠀⢀⣠⣤⣤⣄⠀⣤⣤⠀⠀⣠⣤⣤⣤⣤⣤⡄⢠⣤⣤⣤⣄⠀⠀
//⠀⠀⠀⠀⠈⢹⣿⠉⠈⠉⣿⣿⠉⠉⢾⣿⣉⣉⠙⠀⠀⢀⣾⡟⠉⠉⣿⣧⢸⣿⡄⢠⣿⠏⣿⣿⣉⣉⡁⢸⣿⡏⢉⣿⡷⠀
@@ -273,14 +282,19 @@ public partial class Actor : Entity, ISaveable
deathMessage = $"{DisplayName} morreu!";
}
- MessageLogData.Instance.AddMessage(deathMessage);
+ if (!inLoading)
+ {
+ MessageLogData.Instance.AddMessage(deathMessage);
+ DisplayName = $"Restos mortais de {DisplayName}";
+
+ EmitSignal(SignalName.Died);
+ }
+
Texture = definition.deathTexture;
BlocksMovement = false;
Type = EntityType.CORPSE;
- DisplayName = $"Restos mortais de {DisplayName}";
MapData.UnregisterBlockingEntity(this);
- EmitSignal(SignalName.Died);
}
public new Dictionary<string, Variant> GetSaveData()
diff --git a/scripts/Entities/Actors/Enemy.cs b/scripts/Entities/Actors/Enemy.cs
index 4994534..b4f5e68 100644
--- a/scripts/Entities/Actors/Enemy.cs
+++ b/scripts/Entities/Actors/Enemy.cs
@@ -52,11 +52,11 @@ public partial class Enemy : Actor, ISaveable
}
}
- public override void Die()
+ public override void Die(bool inLoading)
{
Soul.QueueFree();
Soul = null;
- base.Die();
+ base.Die(inLoading);
}
public new Dictionary<string, Variant> GetSaveData()