Skip to content

Commit

Permalink
Print an error message when bullet ID is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
jondewoo authored and samdze committed Jul 23, 2023
1 parent 1cef42b commit 6436b7f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addons/native_bullets/src/bullets_pool.inl
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ void AbstractBulletsPool<Kit, BulletType>::set_bullet_property(BulletID id, Stri
if(collisions_enabled)
Physics2DServer::get_singleton()->area_set_shape_transform(shared_area, bullet->shape_index, bullet->transform);
}
} else {
const String description = "Invalid BulletID: {0},{1},{2}";
Godot::print_error(description.format(Array::make(id.index, id.cycle, id.set)), __func__, __FILE__, __LINE__);
}
}

Expand All @@ -323,6 +326,9 @@ Variant AbstractBulletsPool<Kit, BulletType>::get_bullet_property(BulletID id, S
int32_t bullet_index = shapes_to_indices[id.index - starting_shape_index];

return bullets[bullet_index]->get(property);
} else {
const String description = "Invalid BulletID: {0},{1},{2}";
Godot::print_error(description.format(Array::make(id.index, id.cycle, id.set)), __func__, __FILE__, __LINE__);
}
return Variant();
}

0 comments on commit 6436b7f

Please sign in to comment.