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

@@ -29,7 +29,6 @@ public partial class TokenManager : Node
public Token? RequestToken(Node owner) public Token? RequestToken(Node owner)
{ {
if (Tokens.ContainsKey(owner.GetInstanceId())) return null; // Already has a token if (Tokens.ContainsKey(owner.GetInstanceId())) return null; // Already has a token
GD.Print(TokenCount);
if (RequestQueue.Contains(owner.GetInstanceId())) return null; // Already in queue if (RequestQueue.Contains(owner.GetInstanceId())) return null; // Already in queue
RequestQueue.Add(owner.GetInstanceId()); RequestQueue.Add(owner.GetInstanceId());

View File

@@ -56,6 +56,18 @@ use_collision = true
size = Vector3(1, 17.5, 9.5) size = Vector3(1, 17.5, 9.5)
material = ExtResource("3_4m8g1") material = ExtResource("3_4m8g1")
[node name="CSGBox3D109" type="CSGBox3D" parent="Playground/PlaytestArena" index="89" unique_id=167333800]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 50, 24.75, -41.74998)
use_collision = true
size = Vector3(1, 1.5, 9.5)
material = ExtResource("3_4m8g1")
[node name="CSGBox3D112" type="CSGBox3D" parent="Playground/PlaytestArena" index="90" unique_id=2075934946]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45.5, 24.75, -46.999954)
use_collision = true
size = Vector3(10, 1.5, 1)
material = ExtResource("3_4m8g1")
[node name="Targets" type="Node3D" parent="Playground" index="1" unique_id=1727473773] [node name="Targets" type="Node3D" parent="Playground" index="1" unique_id=1727473773]
[node name="FixedDashthroughTarget" parent="Playground/Targets" index="0" unique_id=1291663508 instance=ExtResource("4_4u5eu")] [node name="FixedDashthroughTarget" parent="Playground/Targets" index="0" unique_id=1291663508 instance=ExtResource("4_4u5eu")]
@@ -233,7 +245,7 @@ Target = NodePath("../../../Player")
RMovement = SubResource("Resource_nwk5u") RMovement = SubResource("Resource_nwk5u")
[node name="Enemy24" parent="Playground/GroundedEnemies" index="16" unique_id=2068813971 node_paths=PackedStringArray("Target") instance=ExtResource("7_egib5")] [node name="Enemy24" parent="Playground/GroundedEnemies" index="16" unique_id=2068813971 node_paths=PackedStringArray("Target") instance=ExtResource("7_egib5")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 45, 24.5, -43.336807) transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 45, 24.5, -43.336803)
Target = NodePath("../../../Player") Target = NodePath("../../../Player")
RMovement = SubResource("Resource_nwk5u") RMovement = SubResource("Resource_nwk5u")

View File

@@ -0,0 +1,16 @@
[gd_scene format=3 uid="uid://b2g2gys4dopmn"]
[ext_resource type="PackedScene" uid="uid://55wehh6xombr" path="res://maps/_templates/main_scene_template.tscn" id="1_pxwoj"]
[ext_resource type="PackedScene" uid="uid://y77cdg7gg3y7" path="res://maps/levels/_arenas/playtest_1.tscn" id="2_apgv3"]
[ext_resource type="Material" uid="uid://31aulub2nqov" path="res://assets/materials/greybox/m_greybox.tres" id="3_452yy"]
[node name="Main" unique_id=955321579 instance=ExtResource("1_pxwoj")]
[node name="PlaytestArena" parent="." index="12" unique_id=664535670 instance=ExtResource("2_apgv3")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16, 0, 9.5)
[node name="CSGBox3D108" type="CSGBox3D" parent="PlaytestArena" index="89" unique_id=94297910]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 8.75, 2.25)
use_collision = true
size = Vector3(1, 17.5, 9.5)
material = ExtResource("3_452yy")

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")] [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) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
LookSensitivity = 0.16 LookSensitivity = 0.5
CameraInclineAcceleration = 20.0 CameraInclineAcceleration = 20.0
GroundedCameraIncline = 3.0 GroundedCameraIncline = 3.0
SlidingJitterAmplitude = 0.2 SlidingJitterAmplitude = 0.2

View File

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