summaryrefslogtreecommitdiff
path: root/modules/bullet/area_bullet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet/area_bullet.cpp')
-rw-r--r--modules/bullet/area_bullet.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp
index c3bd84c329..b5a7da0c38 100644
--- a/modules/bullet/area_bullet.cpp
+++ b/modules/bullet/area_bullet.cpp
@@ -94,10 +94,9 @@ void AreaBullet::dispatch_callbacks() {
void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer3D::AreaBodyStatus p_status) {
InOutEventCallback &event = eventsCallbacks[static_cast<int>(p_otherObject->getType())];
- Object *areaGodoObject = ObjectDB::get_instance(event.event_callback_id);
- if (!areaGodoObject) {
- event.event_callback_id = ObjectID();
+ if (!event.event_callback.is_valid()) {
+ event.event_callback = Callable();
return;
}
@@ -108,7 +107,8 @@ void AreaBullet::call_event(CollisionObjectBullet *p_otherObject, PhysicsServer3
call_event_res[4] = 0; // self_shape ID
Callable::CallError outResp;
- areaGodoObject->call(event.event_callback_method, (const Variant **)call_event_res_ptr, 5, outResp);
+ Variant ret;
+ event.event_callback.call((const Variant **)call_event_res, 5, ret, outResp);
}
void AreaBullet::scratch() {
@@ -267,13 +267,12 @@ Variant AreaBullet::get_param(PhysicsServer3D::AreaParameter p_param) const {
}
}
-void AreaBullet::set_event_callback(Type p_callbackObjectType, ObjectID p_id, const StringName &p_method) {
+void AreaBullet::set_event_callback(Type p_callbackObjectType, const Callable &p_callback) {
InOutEventCallback &ev = eventsCallbacks[static_cast<int>(p_callbackObjectType)];
- ev.event_callback_id = p_id;
- ev.event_callback_method = p_method;
+ ev.event_callback = p_callback;
/// Set if monitoring
- if (eventsCallbacks[0].event_callback_id.is_valid() || eventsCallbacks[1].event_callback_id.is_valid()) {
+ if (!eventsCallbacks[0].event_callback.is_null() || !eventsCallbacks[1].event_callback.is_null()) {
set_godot_object_flags(get_godot_object_flags() | GOF_IS_MONITORING_AREA);
} else {
set_godot_object_flags(get_godot_object_flags() & (~GOF_IS_MONITORING_AREA));
@@ -281,7 +280,7 @@ void AreaBullet::set_event_callback(Type p_callbackObjectType, ObjectID p_id, co
}
bool AreaBullet::has_event_callback(Type p_callbackObjectType) {
- return eventsCallbacks[static_cast<int>(p_callbackObjectType)].event_callback_id.is_valid();
+ return !eventsCallbacks[static_cast<int>(p_callbackObjectType)].event_callback.is_null();
}
void AreaBullet::on_enter_area(AreaBullet *p_area) {