From 891986f70602b3d1ea99cab5289d662234dbac6d Mon Sep 17 00:00:00 2001 From: Cold-Mint Date: Fri, 11 Oct 2024 10:22:28 +0800 Subject: [PATCH] =?UTF-8?q?Thrown=20items=20no=20longer=20have=20collision?= =?UTF-8?q?=20damage.=20=E6=89=94=E5=87=BA=E7=9A=84=E7=89=A9=E5=93=81?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E5=85=B7=E6=9C=89=E7=A2=B0=E6=92=9E=E4=BC=A4?= =?UTF-8?q?=E5=AE=B3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locals/Log.csv | 3 - prefab/items/resignationCertificate.tscn | 14 +-- prefab/magics/curse.tscn | 12 +- prefab/magics/curseOfTheUndead.tscn | 12 +- prefab/magics/x3.tscn | 12 +- prefab/packsacks/PortableBackpacks.tscn | 13 +-- prefab/weapons/BeginnerStaff.tscn | 13 +-- prefab/weapons/IronAxe.tscn | 13 +-- prefab/weapons/StaffNecromancy.tscn | 14 +-- scripts/character/CharacterTemplate.cs | 21 ---- scripts/pickable/PickAbleTemplate.cs | 135 +---------------------- scripts/spell/SpellPickAble.cs | 10 -- 12 files changed, 9 insertions(+), 263 deletions(-) diff --git a/locals/Log.csv b/locals/Log.csv index 39eaa49..7f6d04c 100644 --- a/locals/Log.csv +++ b/locals/Log.csv @@ -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}ノードを非表示にします。 diff --git a/prefab/items/resignationCertificate.tscn b/prefab/items/resignationCertificate.tscn index 99a037a..b5a016f 100644 --- a/prefab/items/resignationCertificate.tscn +++ b/prefab/items/resignationCertificate.tscn @@ -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") diff --git a/prefab/magics/curse.tscn b/prefab/magics/curse.tscn index 4b9f97d..8986580 100644 --- a/prefab/magics/curse.tscn +++ b/prefab/magics/curse.tscn @@ -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") diff --git a/prefab/magics/curseOfTheUndead.tscn b/prefab/magics/curseOfTheUndead.tscn index 6bd1640..3e5535b 100644 --- a/prefab/magics/curseOfTheUndead.tscn +++ b/prefab/magics/curseOfTheUndead.tscn @@ -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") diff --git a/prefab/magics/x3.tscn b/prefab/magics/x3.tscn index 2a136dd..1f23761 100644 --- a/prefab/magics/x3.tscn +++ b/prefab/magics/x3.tscn @@ -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") diff --git a/prefab/packsacks/PortableBackpacks.tscn b/prefab/packsacks/PortableBackpacks.tscn index 0e0dff1..548d191 100644 --- a/prefab/packsacks/PortableBackpacks.tscn +++ b/prefab/packsacks/PortableBackpacks.tscn @@ -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") diff --git a/prefab/weapons/BeginnerStaff.tscn b/prefab/weapons/BeginnerStaff.tscn index ef4e660..d6956b5 100644 --- a/prefab/weapons/BeginnerStaff.tscn +++ b/prefab/weapons/BeginnerStaff.tscn @@ -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") diff --git a/prefab/weapons/IronAxe.tscn b/prefab/weapons/IronAxe.tscn index f17afba..9922c3f 100644 --- a/prefab/weapons/IronAxe.tscn +++ b/prefab/weapons/IronAxe.tscn @@ -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") diff --git a/prefab/weapons/StaffNecromancy.tscn b/prefab/weapons/StaffNecromancy.tscn index 938ba57..35dd763 100644 --- a/prefab/weapons/StaffNecromancy.tscn +++ b/prefab/weapons/StaffNecromancy.tscn @@ -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") diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index d228b9d..0af663b 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -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; } diff --git a/scripts/pickable/PickAbleTemplate.cs b/scripts/pickable/PickAbleTemplate.cs index f542831..1747e77 100644 --- a/scripts/pickable/PickAbleTemplate.cs +++ b/scripts/pickable/PickAbleTemplate.cs @@ -53,15 +53,6 @@ public partial class PickAbleTemplate : RigidBody2D, IItem /// public new Node2D? Owner { get; set; } - /// - /// Enabled contact injury - /// 启用接触伤害 - /// - 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; - /// - /// The number of tile maps that come into contact with this item - /// 与此物品接触的瓦片地图数量 - /// - private int _tileMapNumber; - - /// - /// This area represents the collision range of the weapon, and when other nodes enter this area, they will deal damage. - /// 这个区域表示武器的碰撞范围,当其他节点进入此区域时,会造成伤害。 - /// - private Area2D? _damageArea2D; - - /// - /// Damage collision shape - /// 伤害的碰撞形状 - /// - private CollisionShape2D? _damageAreaCollisionShape2D; - /// /// Whether the item is currently picked up /// 当前物品是否被捡起了 @@ -218,10 +191,6 @@ public partial class PickAbleTemplate : RigidBody2D, IItem { return; } - _damageArea2D = GetNode("DamageArea2D"); - _damageAreaCollisionShape2D = _damageArea2D.GetNode("CollisionShape2D"); - _damageArea2D.BodyEntered += OnBodyEnter; - _damageArea2D.BodyExited += OnBodyExited; _tipLabel = GetNodeOrNull