fix: Make Trigger call SpatialObject::update

This commit is contained in:
Vsevolod Kremianskii 2020-11-16 13:41:25 +07:00
parent 2418e31de4
commit 0af3ce965a
3 changed files with 3 additions and 2 deletions

View file

@ -776,6 +776,7 @@ void Area::checkTriggersIntersection(SpatialObject &triggerrer) {
if (trigger.distanceTo(position2d) > kMaxDistanceToTestCollision) continue;
if (trigger.isTenant(triggererPtr) || !trigger.isIn(position2d)) continue;
debug(boost::format("Trigger %s triggerred by %s") % trigger.tag() % triggerrer.tag());
trigger.addTenant(triggererPtr);
if (!trigger.linkedToModule().empty()) {

View file

@ -81,11 +81,12 @@ void Trigger::update(float dt) {
tenantsToRemove.insert(tenant);
}
for (auto &tenant : tenantsToRemove) {
_tenants.erase(tenant);
if (!_blueprint->onExit().empty()) {
runScript(_blueprint->onExit(), id(), tenant->id(), -1);
}
_tenants.erase(tenant);
}
SpatialObject::update(dt);
}
bool Trigger::isIn(const glm::vec2 &point) const {

View file

@ -48,7 +48,6 @@ public:
private:
std::shared_ptr<TriggerBlueprint> _blueprint;
std::string _tag;
std::string _transitionDestin;
std::string _linkedToModule;
std::string _linkedTo;