fixed weapon loss bug

This commit is contained in:
2026-05-16 13:19:01 +02:00
parent 4cd67023d9
commit b3ae3e37ea
5 changed files with 35 additions and 5 deletions

View File

@@ -307,7 +307,7 @@ debug_color = Color(0, 0.6, 0.701961, 0.341176)
[node name="HeadSystem" parent="." unique_id=1203743757 instance=ExtResource("11_rxwoh")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
LookSensitivity = 0.16
LookSensitivity = 0.5
CameraInclineAcceleration = 20.0
GroundedCameraIncline = 3.0
SlidingJitterAmplitude = 0.2

View File

@@ -455,6 +455,8 @@ public partial class WeaponSystem : RigidBody3D, IForgeEntity
public void PlantInEnemy(Node3D enemy)
{
// GetTree().GetRoot().RemoveChild(this);
// enemy.AddChild(this);
GetTree().GetRoot().CallDeferred(Node.MethodName.RemoveChild, this);
enemy.CallDeferred(Node.MethodName.AddChild, this);
@@ -484,8 +486,9 @@ public partial class WeaponSystem : RigidBody3D, IForgeEntity
// WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 0.2f, 0.2f);
if (PlantObject is Node3D node)
PlantInEnemy(node);
_weaponState.SendEvent("plant");
_weaponState.CallDeferred(StateChart.MethodName.SendEvent, "plant");
// _weaponState.SendEvent("plant");
CallDeferred(Node3D.MethodName.SetGlobalPosition, PlantLocation);
CallDeferred(Node3D.MethodName.LookAt, GlobalTransform.Origin + PlantNormal, Vector3.Up, true);