fix weapon breaking when hitting dead enemy

pull/3/head
John Montagu, the 4th Earl of Sandvich 2023-06-27 20:29:04 -07:00
parent 12e62da20a
commit a276424749
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
3 changed files with 12 additions and 9 deletions

View File

@ -28,6 +28,8 @@ public partial class Hurtbox : BoundingBox, IFaction
float knockback, float knockback,
Vector2 knockbackOrigin = default, Vector2 knockbackOrigin = default,
Vector2 knockbackVector = default) Vector2 knockbackVector = default)
{
if (inflictor is not null)
{ {
EmitSignal( EmitSignal(
SignalName.ReceivedDamage, SignalName.ReceivedDamage,
@ -37,3 +39,4 @@ public partial class Hurtbox : BoundingBox, IFaction
knockbackOrigin, knockbackVector); knockbackOrigin, knockbackVector);
} }
} }
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Godot.NET.Sdk/4.1.0-beta.1"> <Project Sdk="Godot.NET.Sdk/4.1.0-dev">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading> <EnableDynamicLoading>true</EnableDynamicLoading>

View File

@ -47,13 +47,13 @@ ui_down={
} }
roll={ roll={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"canceled":false,"pressed":false,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"pressed":false,"double_click":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null)
] ]
} }
attack1={ attack1={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
] ]
} }
equip={ equip={