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)
|
||||
local object = collisionInfo.collision_object
|
||||
if object.getName() == "Scenario" then
|
||||
log("Collision: " .. object.getGUID())
|
||||
currentScenario = object.getDescription()
|
||||
fireScenarioChangedEvent()
|
||||
if currentScenario ~= object.getDescription() then
|
||||
currentScenario = object.getDescription()
|
||||
fireScenarioChangedEvent()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function fireScenarioChangedEvent()
|
||||
log("Firing")
|
||||
playAreaApi.onScenarioChanged(currentScenario)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user