From 64688252f08315d13c471c706dca25577f53115c Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Sun, 2 Jun 2024 22:25:07 +0800 Subject: [PATCH] =?UTF-8?q?Fixed=20an=20issue=20where=20players=20could=20?= =?UTF-8?q?not=20pick=20up=20items.=20=E4=BF=AE=E5=A4=8D=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=8B=BE=E8=B5=B7=E7=89=A9=E5=93=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/character/CharacterTemplate.cs | 16 ++++++++++++++++ scripts/map/PlayerSpawn.cs | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) 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;