From 0cbe3b29f6022b278b2e70f97d2a49c0ac442699 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 24 Feb 2023 19:20:51 +0100 Subject: [PATCH] Make body_instance in Entity virtual. --- modules/entity_spell_system/entities/entity.cpp | 7 +++++++ modules/entity_spell_system/entities/entity.h | 1 + 2 files changed, 8 insertions(+) diff --git a/modules/entity_spell_system/entities/entity.cpp b/modules/entity_spell_system/entities/entity.cpp index c24ab5271..aa93c1f62 100644 --- a/modules/entity_spell_system/entities/entity.cpp +++ b/modules/entity_spell_system/entities/entity.cpp @@ -197,6 +197,10 @@ void Entity::body_set(Node *body) { } void Entity::body_instance(const Ref &data, const int model_index) { + call("_body_instance", data, model_index); +} + +void Entity::_body_instance(const Ref &data, const int model_index) { if (is_queued_for_deletion()) { return; } @@ -7569,7 +7573,10 @@ void Entity::_bind_methods() { ClassDB::bind_method(D_METHOD("get_character_skeleton"), &Entity::get_character_skeleton); ClassDB::bind_method(D_METHOD("set_character_skeleton", "skeleton"), &Entity::set_character_skeleton); + BIND_VMETHOD(MethodInfo("_body_instance", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "EntityData"), PropertyInfo(Variant::INT, "model_index"))); ClassDB::bind_method(D_METHOD("body_instance", "data", "model_index"), &Entity::body_instance); + ClassDB::bind_method(D_METHOD("_body_instance", "data", "model_index"), &Entity::_body_instance); + ClassDB::bind_method(D_METHOD("body_on_changed"), &Entity::body_on_changed); BIND_VMETHOD(MethodInfo("_body_changed")); diff --git a/modules/entity_spell_system/entities/entity.h b/modules/entity_spell_system/entities/entity.h index a43f5cd6d..cefb66e04 100644 --- a/modules/entity_spell_system/entities/entity.h +++ b/modules/entity_spell_system/entities/entity.h @@ -232,6 +232,7 @@ public: void body_set(Node *body); void body_instance(const Ref &data, const int model_index); + void _body_instance(const Ref &data, const int model_index); void body_on_changed(); NodePath get_character_skeleton_path();