diff --git a/src/cell.cpp b/src/cell.cpp index 1e26bc8..cc972c0 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -46,15 +46,6 @@ Size2 Cell::getSpriteSize() const { return _spriteSize; } void Cell::_ready() { _cellState = this->get_node("CellState"); _mitochondria = this->get_node("Mitochondria"); - if (!_mitochondria) { - ERR_PRINT("Mitochondria node not found or not of type Mitochondria!"); - } else { - if (!_mitochondria->is_class("Mitochondria")) { - ERR_PRINT("Node named 'Mitochondria' is not of type Mitochondria!"); - } else { - ERR_PRINT("Node named 'Mitochondria' is of type Mitochondria"); - } - } } void Cell::_process(double delta) { @@ -62,13 +53,6 @@ void Cell::_process(double delta) { if (Engine::get_singleton()->is_editor_hint()) return; - if (!_mitochondria) { - _cellState->setAlive(false); // kill cell - this->set_linear_damp(10.0); - ERR_PRINT("Mitochondria node is not initialized!"); - return; - } - if (_cellState->getAlive()) { // Living Cell behavior diff --git a/src/mitochondria.cpp b/src/mitochondria.cpp index 0fe1882..ae5d7d9 100644 --- a/src/mitochondria.cpp +++ b/src/mitochondria.cpp @@ -6,7 +6,7 @@ void Mitochondria::_bind_methods() { ClassDB::bind_method(D_METHOD("add_nutrients", "amount"), &Mitochondria::addNutrients); ClassDB::bind_method(D_METHOD("decrement_nutrients", "amount"), &Mitochondria::decrementNutrients); ClassDB::bind_method(D_METHOD("get_nutrients"), &Mitochondria::getNutrients); - ClassDB::bind_method(D_METHOD("set_nutrients", "level"), &Mitochondria::getNutrients); + ClassDB::bind_method(D_METHOD("set_nutrients", "level"), &Mitochondria::setNutrients); ClassDB::add_property("Mitochondria", PropertyInfo(Variant::FLOAT, "nutrients"), "set_nutrients", "get_nutrients"); } diff --git a/src/register_types.cpp b/src/register_types.cpp index e4e8f32..e2be0c4 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -4,6 +4,7 @@ #include "cell_spawner.hpp" #include "cell_state.hpp" #include "fps_counter.hpp" +#include "mitochondria.hpp" #include "start_button.hpp" #include "stats_counter.hpp" @@ -22,6 +23,7 @@ void initialize_gdextension_module(ModuleInitializationLevel p_level) { ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); + ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); }