Fixed an issue where items can be thrown without collision damage.
解决物品扔出后没有碰撞伤害的问题。
This commit is contained in:
parent
2dd5525adf
commit
2f4ecd9938
|
@ -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,アイテム・コンテナが空です
|
||||
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,アイテムの所有者はキャラクターではありません
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
|||
/// <para>当子弹离开节点时</para>
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
protected virtual void OnBodyExited(Node2D node) { }
|
||||
protected virtual void OnBodyExited(Node2D node)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -48,8 +48,6 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
|||
/// </remarks>
|
||||
[Export] private Vector2 _recoil;
|
||||
|
||||
public override void _Ready() { }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Discharge of the weapon</para>
|
||||
/// <para>武器开火</para>
|
||||
|
|
Loading…
Reference in New Issue
Block a user