Skip to content

Commit

Permalink
Fix monitoring status of Area2D
Browse files Browse the repository at this point in the history
  • Loading branch information
volzhs committed Apr 3, 2017
1 parent 12749dd commit 73f53a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scene/2d/area_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,19 @@ void Area2D::_notification(int p_what) {

switch (p_what) {

case NOTIFICATION_READY: {

is_ready = true;
} break;
case NOTIFICATION_EXIT_TREE: {

monitoring_stored = monitoring;
set_enable_monitoring(false);
_clear_monitoring();
} break;
case NOTIFICATION_ENTER_TREE: {

set_enable_monitoring(monitoring_stored);
if (is_ready)
set_enable_monitoring(monitoring_stored);
} break;
}
}
Expand Down Expand Up @@ -646,7 +650,8 @@ Area2D::Area2D()
monitorable = false;
collision_mask = 1;
layer_mask = 1;
monitoring_stored = true;
monitoring_stored = false;
is_ready = false;
set_enable_monitoring(true);
set_monitorable(true);
}
Expand Down
1 change: 1 addition & 0 deletions scene/2d/area_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Area2D : public CollisionObject2D {
bool monitoring_stored;
bool monitorable;
bool locked;
bool is_ready;

void _body_inout(int p_status, const RID &p_body, int p_instance, int p_body_shape, int p_area_shape);

Expand Down

0 comments on commit 73f53a7

Please sign in to comment.