summaryrefslogtreecommitdiff
path: root/scene/2d/area_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/area_2d.cpp')
-rw-r--r--scene/2d/area_2d.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index eef8c58f78..b99c4c88bf 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "area_2d.h"
+
#include "scene/scene_string_names.h"
#include "servers/audio_server.h"
#include "servers/physics_2d_server.h"
@@ -171,8 +172,8 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
E->get().rc = 0;
E->get().in_tree = node && node->is_inside_tree();
if (node) {
- node->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree, make_binds(objid));
- node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree, make_binds(objid));
+ node->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_body_enter_tree), make_binds(objid));
+ node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_body_exit_tree), make_binds(objid));
if (E->get().in_tree) {
emit_signal(SceneStringNames::get_singleton()->body_entered, node);
}
@@ -198,8 +199,8 @@ void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, i
if (E->get().rc == 0) {
if (node) {
- node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree);
- node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree);
+ node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_body_enter_tree));
+ node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_body_exit_tree));
if (E->get().in_tree)
emit_signal(SceneStringNames::get_singleton()->body_exited, obj);
}
@@ -273,8 +274,8 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i
E->get().rc = 0;
E->get().in_tree = node && node->is_inside_tree();
if (node) {
- node->connect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree, make_binds(objid));
- node->connect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree, make_binds(objid));
+ node->connect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_area_enter_tree), make_binds(objid));
+ node->connect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_area_exit_tree), make_binds(objid));
if (E->get().in_tree) {
emit_signal(SceneStringNames::get_singleton()->area_entered, node);
}
@@ -300,8 +301,8 @@ void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, i
if (E->get().rc == 0) {
if (node) {
- node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree);
- node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree);
+ node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_area_enter_tree));
+ node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_area_exit_tree));
if (E->get().in_tree)
emit_signal(SceneStringNames::get_singleton()->area_exited, obj);
}
@@ -333,12 +334,11 @@ void Area2D::_clear_monitoring() {
Object *obj = ObjectDB::get_instance(E->key());
Node *node = Object::cast_to<Node>(obj);
- if (!node) //node may have been deleted in previous frame or at other legiminate point
+ if (!node) //node may have been deleted in previous frame or at other legitimate point
continue;
- //ERR_CONTINUE(!node);
- node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_body_enter_tree);
- node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_body_exit_tree);
+ node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_body_enter_tree));
+ node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_body_exit_tree));
if (!E->get().in_tree)
continue;
@@ -363,12 +363,11 @@ void Area2D::_clear_monitoring() {
Object *obj = ObjectDB::get_instance(E->key());
Node *node = Object::cast_to<Node>(obj);
- if (!node) //node may have been deleted in previous frame or at other legiminate point
+ if (!node) //node may have been deleted in previous frame or at other legitimate point
continue;
- //ERR_CONTINUE(!node);
- node->disconnect_compat(SceneStringNames::get_singleton()->tree_entered, this, SceneStringNames::get_singleton()->_area_enter_tree);
- node->disconnect_compat(SceneStringNames::get_singleton()->tree_exiting, this, SceneStringNames::get_singleton()->_area_exit_tree);
+ node->disconnect(SceneStringNames::get_singleton()->tree_entered, callable_mp(this, &Area2D::_area_enter_tree));
+ node->disconnect(SceneStringNames::get_singleton()->tree_exiting, callable_mp(this, &Area2D::_area_exit_tree));
if (!E->get().in_tree)
continue;
@@ -584,13 +583,6 @@ void Area2D::_validate_property(PropertyInfo &property) const {
}
void Area2D::_bind_methods() {
-
- ClassDB::bind_method(D_METHOD("_body_enter_tree", "id"), &Area2D::_body_enter_tree);
- ClassDB::bind_method(D_METHOD("_body_exit_tree", "id"), &Area2D::_body_exit_tree);
-
- ClassDB::bind_method(D_METHOD("_area_enter_tree", "id"), &Area2D::_area_enter_tree);
- ClassDB::bind_method(D_METHOD("_area_exit_tree", "id"), &Area2D::_area_exit_tree);
-
ClassDB::bind_method(D_METHOD("set_space_override_mode", "space_override_mode"), &Area2D::set_space_override_mode);
ClassDB::bind_method(D_METHOD("get_space_override_mode"), &Area2D::get_space_override_mode);