diff --git a/locals/Log.csv b/locals/Log.csv index f0ca0bd..ac47c50 100644 --- a/locals/Log.csv +++ b/locals/Log.csv @@ -37,4 +37,8 @@ log_found_item_types,从文件中找到{0}个物品类型,Found {0} item types i log_register_item,注册物品类型{0}结果为{1},Registered item type {0}; results in {1},登録されたアイテム・タイプ {0} の結果は {1} です。 log_error_when_open_item_regs_dir,尝试打开物品信息目录时发生错误,Error when opening itemRegs dir,アイテム情報カタログを開こうとしてエラーが発生しました。 log_wrong_custom_arg,不匹配的参数:类型为{0}而值为{1},Mismatched parameter: type {0} and value {1},パラメータの不一致:型{0}と値{1}。 -log_item_container_is_null,物品容器为空,Item container is null,アイテム・コンテナが空です \ No newline at end of file +log_item_container_is_null,物品容器为空,Item container is null,アイテム・コンテナが空です +log_item_has_no_owner,物品没有所有者,Item has no owner,アイテムに所有者がいません +log_no_damage_between_camps,没有阵营之间的伤害,No damage between camps,陣営間のダメージはありません +log_contact_damage_disabled_during_collision,在碰撞期间禁用接触伤害,Contact damage disabled during collision,衝突中に接触ダメージが無効になります +log_owner_of_the_item_is_not_character,物品的所有者不是角色,The owner of the item is not a character,アイテムの所有者はキャラクターではありません \ No newline at end of file diff --git a/project.godot b/project.godot index c455129..fa06aa6 100644 --- a/project.godot +++ b/project.godot @@ -147,7 +147,6 @@ hotbar_previous={ [internationalization] locale/translations=PackedStringArray("res://locals/DeathInfo.en.translation", "res://locals/DeathInfo.ja.translation", "res://locals/DeathInfo.zh.translation", "res://locals/InputMapping.en.translation", "res://locals/InputMapping.ja.translation", "res://locals/InputMapping.zh.translation", "res://locals/Log.en.translation", "res://locals/Log.ja.translation", "res://locals/Log.zh.translation", "res://locals/Slogan.en.translation", "res://locals/Slogan.ja.translation", "res://locals/Slogan.zh.translation", "res://locals/UI.en.translation", "res://locals/UI.ja.translation", "res://locals/UI.zh.translation", "res://locals/Item.en.translation", "res://locals/Item.ja.translation", "res://locals/Item.zh.translation", "res://locals/Action.en.translation", "res://locals/Action.ja.translation", "res://locals/Action.zh.translation", "res://locals/Misc.en.translation", "res://locals/Misc.ja.translation", "res://locals/Misc.zh.translation") -locale/test="en" [layer_names] diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index 072bb1e..4250e06 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -679,6 +679,8 @@ public partial class CharacterTemplate : CharacterBody2D return; } + pickAbleTemplate.Sleeping = false; + pickAbleTemplate.Owner = this; pickAbleTemplate.Picked = false; var timer = new Timer(); pickAbleTemplate.AddChild(timer); @@ -694,7 +696,6 @@ public partial class CharacterTemplate : CharacterBody2D pickAbleTemplate.SetCollisionMaskValue(Config.LayerNumber.Platform, true); timer.QueueFree(); }; - pickAbleTemplate.Sleeping = false; //Setting an initial speed of 0 for items here prevents the problem of throwing items too fast. //在这里给物品设置一个为0的初始速度,可防止扔出物品时速度过快的问题。 pickAbleTemplate.LinearVelocity = Vector2.Zero; diff --git a/scripts/pickable/PickAbleTemplate.cs b/scripts/pickable/PickAbleTemplate.cs index bf2b40c..a52c4ac 100644 --- a/scripts/pickable/PickAbleTemplate.cs +++ b/scripts/pickable/PickAbleTemplate.cs @@ -2,6 +2,7 @@ using ColdMint.scripts.camp; using ColdMint.scripts.character; using ColdMint.scripts.damage; +using ColdMint.scripts.debug; using ColdMint.scripts.inventory; using Godot; @@ -116,12 +117,20 @@ public partial class PickAbleTemplate : RigidBody2D, IItem { if (!EnableContactInjury) { + LogCat.LogWarning("contact_damage_disabled_during_collision"); return; } + if (Owner == null) + { + LogCat.LogWarning("item_has_no_owner"); + return; + } + if (Owner is not CharacterTemplate ownerCharacterTemplate) { + LogCat.LogWarning("owner_of_the_item_is_not_character"); return; } @@ -131,6 +140,7 @@ public partial class PickAbleTemplate : RigidBody2D, IItem CampManager.GetCamp(characterTemplate.CampId)); if (!canCauseHarm) { + LogCat.Log("no_damage_between_camps"); return; } diff --git a/scripts/projectile/ProjectileTemplate.cs b/scripts/projectile/ProjectileTemplate.cs index 57e2434..80a3ad1 100644 --- a/scripts/projectile/ProjectileTemplate.cs +++ b/scripts/projectile/ProjectileTemplate.cs @@ -1,5 +1,4 @@ using System; - using ColdMint.scripts.camp; using ColdMint.scripts.character; using ColdMint.scripts.damage; @@ -66,10 +65,10 @@ public partial class ProjectileTemplate : CharacterBody2D Area2D.Monitoring = true; Area2D.BodyEntered += OnBodyEnter; Area2D.BodyExited += OnBodyExited; - Durability = GetMeta("Durability", "1").AsDouble(); - MaxDamage = GetMeta("MaxDamage", "7").AsInt32(); - MinDamage = GetMeta("MinDamage", "5").AsInt32(); - DamageType = GetMeta("DamageType", Config.DamageType.Physical).AsInt32(); + Durability = GetMeta("Durability", "1").AsDouble(); + MaxDamage = GetMeta("MaxDamage", "7").AsInt32(); + MinDamage = GetMeta("MinDamage", "5").AsInt32(); + DamageType = GetMeta("DamageType", Config.DamageType.Physical).AsInt32(); KnockbackForce = GetMeta("Knockback", Vector2.Zero).AsVector2(); //life(ms) //子弹的存在时间(毫秒) @@ -130,7 +129,7 @@ public partial class ProjectileTemplate : CharacterBody2D //First get the owner's camp and compare it with the target camp //先获取主人的阵营与目标阵营进行比较 var canCauseHarm = CampManager.CanCauseHarm(CampManager.GetCamp(ownerCharacterTemplate.CampId), - CampManager.GetCamp(characterTemplate.CampId)); + CampManager.GetCamp(characterTemplate.CampId)); return canCauseHarm; } @@ -230,7 +229,9 @@ public partial class ProjectileTemplate : CharacterBody2D /// 当子弹离开节点时 /// /// - protected virtual void OnBodyExited(Node2D node) { } + protected virtual void OnBodyExited(Node2D node) + { + } /// diff --git a/scripts/weapon/WeaponTemplate.cs b/scripts/weapon/WeaponTemplate.cs index 1fc0aa7..4ae56ed 100644 --- a/scripts/weapon/WeaponTemplate.cs +++ b/scripts/weapon/WeaponTemplate.cs @@ -48,8 +48,6 @@ public abstract partial class WeaponTemplate : PickAbleTemplate /// [Export] private Vector2 _recoil; - public override void _Ready() { } - /// /// Discharge of the weapon /// 武器开火