PlaneMap now tracks all tangibles, including those on nowhere plane.

This commit is contained in:
2021-03-25 15:34:43 -04:00
parent e06bae63f7
commit 3e424f3fa6
5 changed files with 36 additions and 59 deletions

View File

@@ -53,7 +53,7 @@ World::World() {
Tangible::Tangible(World *w, int64_t id) : world_(w), id_player_pool_(&w->id_global_pool_) {
plane_item_.set_id(id);
w->plane_map_.track(&plane_item_);
plane_item_.track(&w->plane_map_);
}
void Tangible::update_plane_item() {
@@ -160,11 +160,14 @@ void World::tangible_delete(lua_State *L, int64_t id) {
LS.result();
}
std::vector<int64_t> World::get_near(int64_t player_id, float radius) {
std::vector<int64_t> World::get_near(int64_t player_id, float radius, bool exclude_nowhere) {
Tangible *player = tangible_get(player_id);
// Find out where's the center of the world.
std::string plane = player->anim_queue_.get_plane();
if (exclude_nowhere && (plane == "nowhere")) {
return std::vector<int64_t>();
}
util::XYZ xyz = player->anim_queue_.get_xyz();
return plane_map_.scan_radius(plane, xyz.x, xyz.y, radius, player_id);