Stop event from firing multiple times for the same scenario
A card can collide with the area more than once; many of the campaign memory bags caused a double collision on placement, and it would happen if the user picked up or flipped the card. This would cause any behavior that triggered from the event to each time, so suppress further events which don't actually change the scenario.
This commit is contained in:
parent
7339646ae7
commit
45a5870121
@ -20,12 +20,14 @@ end
|
|||||||
function onCollisionEnter(collisionInfo)
|
function onCollisionEnter(collisionInfo)
|
||||||
local object = collisionInfo.collision_object
|
local object = collisionInfo.collision_object
|
||||||
if object.getName() == "Scenario" then
|
if object.getName() == "Scenario" then
|
||||||
log("Collision: " .. object.getGUID())
|
if currentScenario ~= object.getDescription() then
|
||||||
currentScenario = object.getDescription()
|
currentScenario = object.getDescription()
|
||||||
fireScenarioChangedEvent()
|
fireScenarioChangedEvent()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function fireScenarioChangedEvent()
|
function fireScenarioChangedEvent()
|
||||||
|
log("Firing")
|
||||||
playAreaApi.onScenarioChanged(currentScenario)
|
playAreaApi.onScenarioChanged(currentScenario)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user