Thrown items no longer have collision damage.
扔出的物品不再具有碰撞伤害。
This commit is contained in:
parent
fc1a12acd0
commit
891986f706
|
@ -37,7 +37,6 @@ log_wrong_custom_arg,不匹配的参数:类型为{0}而值为{1},Mismatched pa
|
|||
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,アイテムの所有者はキャラクターではありません
|
||||
log_try_to_open_state_machine_that_is_on,尝试打开处于运行状态的状态机。,Try to open a state machine that is on.,実行中のステートマシンを開こうとしています。
|
||||
log_state_machine_does_not_specify_context,状态机没有指定上下文。,The state machine does not specify a context.,ステートマシンはコンテキストを指定していません。
|
||||
|
@ -103,8 +102,6 @@ log_dll_does_not_register_lifecycle_processor,位于{0}的dll文件,未注册
|
|||
log_mod_lifecycle_handler_not_implement_interface,位于{0}的dll文件,生命周期处理器未实现IModLifecycleHandler接口。,"The DLL file located at {0}, the lifecycle processor does not implement the IModLifecycleHandler interface.",{0}にあるDLLファイル、ライフサイクルプロセッサはIModLifecycleHandlerインターフェースを実装していません。
|
||||
log_dll_no_parameterless_constructor,位于{0}的dll文件,没有无参构造函数。,"The DLL file located at {0} does not have a parameterless constructor.",{0}にあるDLLファイルにはパラメータのないコンストラクタがありません。
|
||||
log_dll_type_length,位于{0}的dll文件内,共包含{1}个类型。,"The DLL file located at {0} contains a total of {1} types.",{0}にあるDLLファイルには合計{1}個のタイプが含まれています。
|
||||
log_item_pickup_disables_collision_damage,物品捡起禁用碰撞伤害。,Item pickup disables collision damage.,アイテムのピックアップが衝突によるダメージを無効にする
|
||||
log_item_thrown_restore_collision_damage,物品扔出恢复碰撞伤害。,Item Throw restores collision damage.,アイテム投げは衝突ダメージを回復する。
|
||||
log_after_no_longer_in_contact_with_any_tiles,不再与任何瓦片接触后,可以造成伤害。,"After no longer coming into contact with any tiles, it can cause damage",タイルと接触しなくなった後、損傷を引き起こす可能性があります。
|
||||
log_contact_with_tiles_disables_damage,与瓦片接触禁用伤害。,"Disabling damage on contact with tiles",タイルとの接触によるダメージの無効化
|
||||
log_hide_all_node,隐藏{0}个节点。,Hide {0} nodes.,{0}ノードを非表示にします。
|
||||
|
|
|
|
@ -1,13 +1,9 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://cj36fjtrlo03t"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cj36fjtrlo03t"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/inventory/ResignationCertificate.cs" id="1_nydte"]
|
||||
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="2_ei0j2"]
|
||||
[ext_resource type="Texture2D" uid="uid://dyfqdpdlq286h" path="res://sprites/projectile/resignationCertificate.png" id="3_jwff2"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ujexv"]
|
||||
radius = 6.0
|
||||
height = 21.0
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_xnc20"]
|
||||
radius = 6.0
|
||||
height = 21.0
|
||||
|
@ -19,14 +15,6 @@ angular_damp = -1.0
|
|||
script = ExtResource("1_nydte")
|
||||
FiringIntervalAsMillisecond = 1000
|
||||
|
||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 102
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"]
|
||||
position = Vector2(1, 0.5)
|
||||
shape = SubResource("CapsuleShape2D_ujexv")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(1, 0.5)
|
||||
shape = SubResource("CapsuleShape2D_xnc20")
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://m3tkjcbrrhfj"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://m3tkjcbrrhfj"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/spell/NodeSpawnOnKillCharacterSpell.cs" id="1_gg5rs"]
|
||||
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="2_83n3c"]
|
||||
[ext_resource type="Texture2D" uid="uid://mb5yijtw7sw5" path="res://sprites/projectile/x3.png" id="3_thtsv"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_3eq4k"]
|
||||
size = Vector2(30, 30)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i3lbq"]
|
||||
size = Vector2(30, 31)
|
||||
|
||||
|
@ -17,13 +14,6 @@ angular_damp = -1.0
|
|||
script = ExtResource("1_gg5rs")
|
||||
_packedScenePath = "res://prefab/entitys/BlackenedAboriginalWarrior.tscn"
|
||||
|
||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 102
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"]
|
||||
shape = SubResource("RectangleShape2D_3eq4k")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -0.5)
|
||||
shape = SubResource("RectangleShape2D_i3lbq")
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://crthy8a50a4t"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://crthy8a50a4t"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/spell/SpellPickAble.cs" id="1_v0grp"]
|
||||
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="4_ffr2k"]
|
||||
[ext_resource type="Texture2D" uid="uid://bbcjkyrsx88av" path="res://sprites/projectile/curseOfTheUndead.png" id="4_y6nkf"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_qgdry"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_akp3k"]
|
||||
|
||||
[node name="curseOfTheUndead" type="RigidBody2D"]
|
||||
|
@ -15,14 +13,6 @@ angular_damp = -1.0
|
|||
script = ExtResource("1_v0grp")
|
||||
_projectilePath = "res://prefab/projectile/curseOfTheUndead.tscn"
|
||||
|
||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 102
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"]
|
||||
position = Vector2(0, -0.5)
|
||||
shape = SubResource("CircleShape2D_qgdry")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -0.625)
|
||||
shape = SubResource("CircleShape2D_akp3k")
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://cg75t3fw5c6er"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cg75t3fw5c6er"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/spell/MultipleFireSpell.cs" id="1_cnhod"]
|
||||
[ext_resource type="Texture2D" uid="uid://mb5yijtw7sw5" path="res://sprites/projectile/x3.png" id="3_b3s8h"]
|
||||
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="4_ffr2k"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_3eq4k"]
|
||||
size = Vector2(30, 30)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i3lbq"]
|
||||
size = Vector2(30, 31)
|
||||
|
||||
|
@ -16,13 +13,6 @@ collision_mask = 34
|
|||
angular_damp = -1.0
|
||||
script = ExtResource("1_cnhod")
|
||||
|
||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 102
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"]
|
||||
shape = SubResource("RectangleShape2D_3eq4k")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -0.5)
|
||||
shape = SubResource("RectangleShape2D_i3lbq")
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://bq5d2w22wnxrf"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bq5d2w22wnxrf"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/inventory/Packsack.cs" id="1_slakl"]
|
||||
[ext_resource type="Texture2D" uid="uid://di0sw4rgd26y0" path="res://sprites/PortableBackpacks.png" id="2_l0fbh"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_brthl"]
|
||||
size = Vector2(21, 29)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xqyue"]
|
||||
size = Vector2(21, 29)
|
||||
|
||||
|
@ -15,14 +12,6 @@ collision_mask = 38
|
|||
script = ExtResource("1_slakl")
|
||||
NumberSlots = 30
|
||||
|
||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 102
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"]
|
||||
position = Vector2(-2.5, 1.5)
|
||||
shape = SubResource("RectangleShape2D_brthl")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-2.5, 1.5)
|
||||
shape = SubResource("RectangleShape2D_xqyue")
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://cg2jmn7cs8m2c"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cg2jmn7cs8m2c"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/weapon/ProjectileWeapon.cs" id="1_w4b6p"]
|
||||
[ext_resource type="Texture2D" uid="uid://pf2ilanjwino" path="res://sprites/weapon/BeginnerStaff_Icon.png" id="2_ip8xd"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4g1mkvjf7uns" path="res://sprites/weapon/BeginnerStaff.png" id="3_rhhwp"]
|
||||
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="4_p12sk"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_obcq2"]
|
||||
size = Vector2(48, 5)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_14m1g"]
|
||||
size = Vector2(48, 5)
|
||||
|
||||
|
@ -21,14 +18,6 @@ FiringIntervalAsMillisecond = 300
|
|||
_recoilStrength = 5
|
||||
UniqueIcon = ExtResource("2_ip8xd")
|
||||
|
||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 102
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"]
|
||||
position = Vector2(26, 0.5)
|
||||
shape = SubResource("RectangleShape2D_obcq2")
|
||||
|
||||
[node name="StaffOfTheUndead2" type="Sprite2D" parent="."]
|
||||
position = Vector2(30, 0)
|
||||
texture = ExtResource("3_rhhwp")
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://g1jrthe4ojdd"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://g1jrthe4ojdd"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/weapon/MeleeWeapon.cs" id="1_snmy1"]
|
||||
[ext_resource type="Texture2D" uid="uid://wt50kx6bup51" path="res://sprites/weapon/StaffNecromancy.png" id="3_cm7e6"]
|
||||
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="4_qimud"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_obcq2"]
|
||||
size = Vector2(49, 5)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_14m1g"]
|
||||
size = Vector2(49, 5.25)
|
||||
|
||||
|
@ -19,14 +16,6 @@ collision_mask = 34
|
|||
angular_damp = -1.0
|
||||
script = ExtResource("1_snmy1")
|
||||
|
||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 102
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"]
|
||||
position = Vector2(25.5, 0.5)
|
||||
shape = SubResource("RectangleShape2D_obcq2")
|
||||
|
||||
[node name="StaffOfTheUndead2" type="Sprite2D" parent="."]
|
||||
position = Vector2(30, 0)
|
||||
texture = ExtResource("3_cm7e6")
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://dnnn2xyayiehk"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dnnn2xyayiehk"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://wt50kx6bup51" path="res://sprites/weapon/StaffNecromancy.png" id="1_ms3us"]
|
||||
[ext_resource type="Script" path="res://scripts/weapon/ProjectileWeapon.cs" id="1_w8hhv"]
|
||||
[ext_resource type="Texture2D" uid="uid://dg5vwprt66w4j" path="res://sprites/weapon/StaffNecromancy_Icon.png" id="3_31iau"]
|
||||
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="4_ffr2k"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_obcq2"]
|
||||
size = Vector2(49, 5)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_14m1g"]
|
||||
size = Vector2(49, 5.25)
|
||||
|
||||
|
@ -22,15 +19,6 @@ FiringIntervalAsMillisecond = 300
|
|||
_recoilStrength = 5
|
||||
UniqueIcon = ExtResource("3_31iau")
|
||||
|
||||
[node name="DamageArea2D" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 8
|
||||
collision_mask = 102
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageArea2D"]
|
||||
position = Vector2(25.5, 0.5)
|
||||
shape = SubResource("RectangleShape2D_obcq2")
|
||||
|
||||
[node name="StaffOfTheUndead2" type="Sprite2D" parent="."]
|
||||
position = Vector2(30, 0)
|
||||
texture = ExtResource("1_ms3us")
|
||||
|
|
|
@ -70,11 +70,6 @@ public partial class CharacterTemplate : CharacterBody2D
|
|||
}
|
||||
|
||||
protected const float JumpVelocity = -240;
|
||||
|
||||
//How long it takes for an item to recover from a collision with the ground and platform after being thrown (in seconds)
|
||||
//物品被扔出后多长时间恢复与地面和平台的碰撞(单位:秒)
|
||||
private readonly double _itemCollisionRecoveryTime = 0.045f;
|
||||
|
||||
public string? ReadOnlyCharacterName => TranslationServerUtils.Translate(CharacterName);
|
||||
|
||||
[Export] public string? CharacterName;
|
||||
|
@ -442,8 +437,6 @@ public partial class CharacterTemplate : CharacterBody2D
|
|||
pickAbleTemplate.Picked = true;
|
||||
pickAbleTemplate.Freeze = true;
|
||||
pickAbleTemplate.DisabledCollisionShape2D();
|
||||
pickAbleTemplate.EnableContactInjury = false;
|
||||
LogCat.Log("item_pickup_disables_collision_damage", LogCat.LogLabel.ContactInjury);
|
||||
}
|
||||
|
||||
if (pickAbleItemNode2D is ProjectileWeapon projectileWeapon)
|
||||
|
@ -812,20 +805,6 @@ public partial class CharacterTemplate : CharacterBody2D
|
|||
pickAbleTemplate.LinearVelocity = Vector2.Zero;
|
||||
pickAbleTemplate.EnabledCollisionShape2D();
|
||||
pickAbleTemplate.Freeze = false;
|
||||
var timer = new Timer();
|
||||
pickAbleTemplate.AddChild(timer);
|
||||
timer.WaitTime = _itemCollisionRecoveryTime;
|
||||
timer.Autostart = true;
|
||||
timer.OneShot = true;
|
||||
timer.Timeout += () =>
|
||||
{
|
||||
//We cannot immediately resume the physical collision when the weapon is discharged, which will cause the weapon to collide with the ground and platform earlier, preventing the weapon from flying.
|
||||
//仍出武器时,我们不能立即恢复物理碰撞,立即恢复会导致武器更早的与地面和平台碰撞,阻止武器的飞行。
|
||||
pickAbleTemplate.EnableContactInjury = true;
|
||||
LogCat.Log("item_thrown_restore_collision_damage", LogCat.LogLabel.ContactInjury);
|
||||
timer.QueueFree();
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,15 +53,6 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
|||
/// </summary>
|
||||
public new Node2D? Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Enabled contact injury</para>
|
||||
/// <para>启用接触伤害</para>
|
||||
/// </summary>
|
||||
public virtual bool EnableContactInjury { get; set; }
|
||||
|
||||
[Export] private int _minContactInjury = 1;
|
||||
[Export] private int _maxContactInjury = 2;
|
||||
|
||||
public string Description
|
||||
{
|
||||
get
|
||||
|
@ -73,24 +64,6 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
|||
|
||||
public int Quantity { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// <para>The number of tile maps that come into contact with this item</para>
|
||||
/// <para>与此物品接触的瓦片地图数量</para>
|
||||
/// </summary>
|
||||
private int _tileMapNumber;
|
||||
|
||||
/// <summary>
|
||||
/// <para>This area represents the collision range of the weapon, and when other nodes enter this area, they will deal damage.</para>
|
||||
/// <para>这个区域表示武器的碰撞范围,当其他节点进入此区域时,会造成伤害。</para>
|
||||
/// </summary>
|
||||
private Area2D? _damageArea2D;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Damage collision shape</para>
|
||||
/// <para>伤害的碰撞形状</para>
|
||||
/// </summary>
|
||||
private CollisionShape2D? _damageAreaCollisionShape2D;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Whether the item is currently picked up</para>
|
||||
/// <para>当前物品是否被捡起了</para>
|
||||
|
@ -218,10 +191,6 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
|||
{
|
||||
return;
|
||||
}
|
||||
_damageArea2D = GetNode<Area2D>("DamageArea2D");
|
||||
_damageAreaCollisionShape2D = _damageArea2D.GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
_damageArea2D.BodyEntered += OnBodyEnter;
|
||||
_damageArea2D.BodyExited += OnBodyExited;
|
||||
_tipLabel = GetNodeOrNull<Label>("TipLabel");
|
||||
_collisionShape2D = GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
InputPickable = true;
|
||||
|
@ -232,100 +201,6 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
|||
_loadedResource = true;
|
||||
}
|
||||
|
||||
private void OnBodyExited(Node node)
|
||||
{
|
||||
if (Picked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//If it leaves the ground or walls.
|
||||
//如果离开了地面或墙壁。
|
||||
if (node is TileMapLayer)
|
||||
{
|
||||
_tileMapNumber--;
|
||||
if (_tileMapNumber == 0)
|
||||
{
|
||||
//No longer in contact with any shingles can cause injury
|
||||
//不再与任何瓦片接触后,可以造成伤害
|
||||
EnableContactInjury = true;
|
||||
LogCat.Log("after_no_longer_in_contact_with_any_tiles", LogCat.LogLabel.ContactInjury);
|
||||
SetCollisionMaskValue(Config.LayerNumber.Player, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Use objects to smash enemies</para>
|
||||
/// <para>使用物品砸敌人</para>
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
private void OnBodyEnter(Node node)
|
||||
{
|
||||
if (Picked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (node is TileMapLayer)
|
||||
{
|
||||
_tileMapNumber++;
|
||||
EnableContactInjury = false;
|
||||
LogCat.Log("contact_with_tiles_disables_damage", LogCat.LogLabel.ContactInjury);
|
||||
//Items can be pushed by the player when they are on the ground
|
||||
//当物品在地面上时,可被玩家推动
|
||||
SetCollisionMaskValue(Config.LayerNumber.Player, true);
|
||||
}
|
||||
else if (node is CharacterTemplate characterTemplate)
|
||||
{
|
||||
if (!EnableContactInjury)
|
||||
{
|
||||
LogCat.LogWarning("contact_damage_disabled_during_collision", LogCat.LogLabel.ContactInjury);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Owner == null)
|
||||
{
|
||||
LogCat.LogWarning("item_has_no_owner", LogCat.LogLabel.PickAbleTemplate);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Owner is not CharacterTemplate ownerCharacterTemplate)
|
||||
{
|
||||
LogCat.LogWarning("owner_of_the_item_is_not_character", LogCat.LogLabel.PickAbleTemplate);
|
||||
return;
|
||||
}
|
||||
|
||||
//Determine if your side can cause damage
|
||||
//判断所属的阵营是否可以造成伤害
|
||||
var canCauseHarm = CampManager.CanCauseHarm(CampManager.GetCamp(ownerCharacterTemplate.CampId),
|
||||
CampManager.GetCamp(characterTemplate.CampId));
|
||||
if (!canCauseHarm)
|
||||
{
|
||||
LogCat.Log("no_damage_between_camps", LogCat.LogLabel.PickAbleTemplate);
|
||||
return;
|
||||
}
|
||||
|
||||
//If allowed to cause harm
|
||||
//如果允许造成伤害
|
||||
var damage = new Damage
|
||||
{
|
||||
MaxDamage = Math.Abs(_maxContactInjury),
|
||||
MinDamage = Math.Abs(_minContactInjury),
|
||||
Attacker = ownerCharacterTemplate
|
||||
};
|
||||
damage.CreateDamage();
|
||||
damage.MoveLeft = LinearVelocity.X < 0;
|
||||
damage.Type = Config.DamageType.Physical;
|
||||
characterTemplate.Damage(damage);
|
||||
//Reduce speed after hitting enemies.
|
||||
//击中敌人后减少速度。
|
||||
LinearVelocity *= 1 - Config.ThrownItemsHitEnemiesReduceSpeedByPercentage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void _MouseEnter()
|
||||
{
|
||||
if (Picked)
|
||||
|
@ -381,10 +256,6 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
|||
{
|
||||
_collisionShape2D.Disabled = true;
|
||||
}
|
||||
if (_damageAreaCollisionShape2D != null)
|
||||
{
|
||||
_damageAreaCollisionShape2D.Disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -397,10 +268,6 @@ public partial class PickAbleTemplate : RigidBody2D, IItem
|
|||
{
|
||||
_collisionShape2D.Disabled = false;
|
||||
}
|
||||
if (_damageAreaCollisionShape2D != null)
|
||||
{
|
||||
_damageAreaCollisionShape2D.Disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -18,16 +18,6 @@ public partial class SpellPickAble : PickAbleTemplate, ISpell
|
|||
[Export]
|
||||
private string? _projectilePath;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Spells do no collision damage</para>
|
||||
/// <para>法术没有碰撞伤害</para>
|
||||
/// </summary>
|
||||
public override bool EnableContactInjury
|
||||
{
|
||||
get => false;
|
||||
set { }
|
||||
}
|
||||
|
||||
private PackedScene? _projectileScene;
|
||||
public sealed override void _Ready()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user