Attempt to fix double goals

This commit is contained in:
Sofia 2026-07-29 19:51:10 +03:00
parent f8422a9d53
commit 05584b9d28
2 changed files with 5 additions and 1 deletions

View File

@ -38,7 +38,10 @@ impl IArea3D for Goal {
impl Goal {
fn on_enter(&self, node: Gd<Node3D>) {
if let Ok(_) = node.try_cast::<Ball>() {
if let Ok(mut ball) = node.try_cast::<Ball>()
&& !ball.bind().entered_goal
{
ball.bind_mut().entered_goal = true;
if let Some(mut game) = Game::singleton() {
let teams = game
.bind()

View File

@ -12,6 +12,7 @@ use crate::{
#[class(base=RigidBody3D, init)]
pub struct Ball {
pub dropper: Option<u16>,
pub entered_goal: bool,
alive_for: f64,