diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index 72ddc62..18c5429 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using ColdMint.scripts.camp; using ColdMint.scripts.damage; +using ColdMint.scripts.debug; using ColdMint.scripts.health; using ColdMint.scripts.inventory; using ColdMint.scripts.utils; @@ -433,6 +434,21 @@ public partial class CharacterTemplate : CharacterBody2D /// protected virtual void OnDie(DamageTemplate damageTemplate) { + //If the attacker is not empty and the role name is not empty, then the role death message is printed + //如果攻击者不为空,且角色名不为空,那么打印角色死亡信息 + if (damageTemplate.Attacker != null && !string.IsNullOrEmpty(CharacterName)) + { + if (damageTemplate.Attacker is CharacterTemplate characterTemplate && + !string.IsNullOrEmpty(characterTemplate.CharacterName)) + { + LogCat.LogWithFormat("death_info", CharacterName, characterTemplate.CharacterName); + } + else + { + LogCat.LogWithFormat("death_info", CharacterName, damageTemplate.Attacker.Name); + } + } + QueueFree(); } diff --git a/scripts/map/PlayerSpawn.cs b/scripts/map/PlayerSpawn.cs index e313fc0..ce8273d 100644 --- a/scripts/map/PlayerSpawn.cs +++ b/scripts/map/PlayerSpawn.cs @@ -1,6 +1,5 @@ using ColdMint.scripts.character; using ColdMint.scripts.debug; -using ColdMint.scripts.loader.sceneLoader; using ColdMint.scripts.map.events; using Godot; @@ -33,6 +32,7 @@ public partial class PlayerSpawn : Marker2D GameSceneNodeHolder.Player.Position = GlobalPosition; return; } + if (GameSceneNodeHolder.PlayerContainer == null) { return; @@ -50,6 +50,7 @@ public partial class PlayerSpawn : Marker2D return; } + player.ItemContainer = GameSceneNodeHolder.HotBar; GameSceneNodeHolder.PlayerContainer.AddChild(player); GameSceneNodeHolder.Player = player; player.Position = GlobalPosition;