Destroy central item when placing card

This commit is contained in:
Nikita Lisitsa 2024-08-20 18:33:32 +03:00
parent 9bde6bbed3
commit 9f2697d87d

View file

@ -1442,6 +1442,13 @@ namespace gmtk
map_.put_card(transformer_to_card(t->type));
t->type = *n;
active_card_ = std::nullopt;
auto e = map_.world->index<path_index>().get(selected_->down());
if (auto o = map_.world->get(e).get_if<occupied>())
{
map_.world->destroy(o->entity);
map_.world->detach<occupied>(e);
}
}
}
}
@ -1493,6 +1500,13 @@ namespace gmtk
{
active_card_ = std::nullopt;
built_sound();
auto e = map_.world->index<path_index>().get(selected_->down());
if (auto o = map_.world->get(e).get_if<occupied>())
{
map_.world->destroy(o->entity);
map_.world->detach<occupied>(e);
}
}
if (built && tutorial_state_ <= 3)