Skip to content

Commit

Permalink
Fix unregister events
Browse files Browse the repository at this point in the history
  • Loading branch information
ScorpioT1000 authored Aug 21, 2024
1 parent 3c13397 commit 53dceea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/inputMovement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ WM("inputMovement", function(import, export, exportDefault)

inputMovementInitTrigger = CreateTrigger()
inputMovementTriggers = {}
inputMovementFixTriggers = {}

local DEFAULT_KEY_MAP = {
FORWARD = OSKEY_W,
Expand Down Expand Up @@ -85,7 +86,7 @@ WM("inputMovement", function(import, export, exportDefault)
BlzTriggerRegisterPlayerKeyEvent(trigger, pl, key, 0, true)
BlzTriggerRegisterPlayerKeyEvent(trigger, pl, key, 0, false)
BlzTriggerRegisterPlayerKeyEvent(trigger, pl, key, 1, true)
BlzTriggerRegisterPlayerKeyEvent(trigger, pl, key, 1, false)
BlzTriggerRegisterPlayerKeyEvent(trigger, pl, key, 1, false)
BlzTriggerRegisterPlayerKeyEvent(trigger, pl, key, 2, true)
BlzTriggerRegisterPlayerKeyEvent(trigger, pl, key, 2, false)
TriggerRegisterPlayerEvent(triggerMouseFix, pl, EVENT_PLAYER_MOUSE_DOWN)
Expand All @@ -94,6 +95,7 @@ WM("inputMovement", function(import, export, exportDefault)
TriggerAddAction(trigger, onUserKeyEvent)
TriggerAddAction(triggerMouseFix, onUserMouseFixEvent)
inputMovementTriggers[id] = trigger
inputMovementFixTriggers[id] = triggerMouseFix
states[pl] = {
FORWARD = Vector3:new(),
BACKWARD = Vector3:new(),
Expand All @@ -111,6 +113,10 @@ WM("inputMovement", function(import, export, exportDefault)
DestroyTrigger(trigger)
end
inputMovementTriggers = {}
for i, trigger in ipairs(inputMovementFixTriggers) do
DestroyTrigger(trigger)
end
inputMovementFixTriggers = {}
states = {}
end

Expand Down

0 comments on commit 53dceea

Please sign in to comment.