From 05584b9d28ec48251064cb80f78d78882c046eb1 Mon Sep 17 00:00:00 2001 From: Sofia Date: Wed, 29 Jul 2026 19:51:10 +0300 Subject: [PATCH] Attempt to fix double goals --- rust/src/goal.rs | 5 ++++- rust/src/player/ball.rs | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rust/src/goal.rs b/rust/src/goal.rs index 2ec4f6d..7331c09 100644 --- a/rust/src/goal.rs +++ b/rust/src/goal.rs @@ -38,7 +38,10 @@ impl IArea3D for Goal { impl Goal { fn on_enter(&self, node: Gd) { - if let Ok(_) = node.try_cast::() { + if let Ok(mut ball) = node.try_cast::() + && !ball.bind().entered_goal + { + ball.bind_mut().entered_goal = true; if let Some(mut game) = Game::singleton() { let teams = game .bind() diff --git a/rust/src/player/ball.rs b/rust/src/player/ball.rs index 4913bbc..bb19074 100644 --- a/rust/src/player/ball.rs +++ b/rust/src/player/ball.rs @@ -12,6 +12,7 @@ use crate::{ #[class(base=RigidBody3D, init)] pub struct Ball { pub dropper: Option, + pub entered_goal: bool, alive_for: f64,