From 521198cf36a37682d5a4ecef98f286a3862afd8c Mon Sep 17 00:00:00 2001 From: MylesScholz Date: Sat, 25 May 2024 13:47:29 -0700 Subject: [PATCH] Godot error fixes --- src/cell.cpp | 4 ++-- src/cell_environment.cpp | 1 - src/cell_spawner.cpp | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cell.cpp b/src/cell.cpp index a16854c..9d06894 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -260,7 +260,7 @@ void Cell::_ready() { this->set_pickable(true); - CellMembrane *cellMembrane = this->get_node("CellMembrane"); + CellMembrane *cellMembrane = Object::cast_to(this->get_node_or_null("CellMembrane")); if (cellMembrane) { _spriteSize = cellMembrane->getSpriteSize(); cellMembrane->connect("cell_growth", Callable(this, "_on_cell_growth")); @@ -291,7 +291,7 @@ void Cell::_process(double delta) { // Living Cell behavior // Kill Cells without CellMembranes - CellMembrane *cellMembrane = this->get_node("CellMembrane"); + CellMembrane *cellMembrane = Object::cast_to(this->get_node_or_null("CellMembrane")); if (!cellMembrane) { _cellState->setAlive(false); this->emit_signal("cell_death", this); diff --git a/src/cell_environment.cpp b/src/cell_environment.cpp index 771bda9..c5aa389 100644 --- a/src/cell_environment.cpp +++ b/src/cell_environment.cpp @@ -95,7 +95,6 @@ void CellEnvironment::addCell(Cell *cell) { void CellEnvironment::removeCell(Cell *cell) { _lineageGraph.removeVertex(cell); - this->remove_child(cell); cell->resetCollisions(); cell->queue_free(); } diff --git a/src/cell_spawner.cpp b/src/cell_spawner.cpp index 1965d6e..14e60d5 100644 --- a/src/cell_spawner.cpp +++ b/src/cell_spawner.cpp @@ -185,9 +185,6 @@ void CellSpawner::_on_cell_reproduction(Cell *cell) { cell->emit_signal("cell_death", cell); cell->clearStatsOnDeath(cell); - childCell->connect("cell_death", Callable(cellEnvironment, "_on_cell_death")); - secondCell->connect("cell_death", Callable(cellEnvironment, "_on_cell_death")); - // Check for Nuclei and if present, attach reproduction signal Nucleus *nucleus = cellObject->get_node("Nucleus"); if (nucleus)