Skip to content

Commit

Permalink
feat: Use ValueObject activation
Browse files Browse the repository at this point in the history
  • Loading branch information
Quenty committed Jan 17, 2025
1 parent dca25af commit 65d09e1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/actionmanager/src/Client/BaseAction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local ContextActionService = game:GetService("ContextActionService")
local Signal = require("Signal")
local Maid = require("Maid")
local EnabledMixin = require("EnabledMixin")
local ValueObject = require("ValueObject")

local BaseAction = {}
BaseAction.__index = BaseAction
Expand All @@ -35,9 +36,7 @@ function BaseAction.new(actionData)
self.Activated = self._maid:Add(Signal.new()) -- :Fire(actionMaid, ... (activateData))
self.Deactivated = self._maid:Add(Signal.new()) -- :Fire()

self.IsActivatedValue = Instance.new("BoolValue")
self.IsActivatedValue.Value = false
self._maid:GiveTask(self.IsActivatedValue)
self.IsActivatedValue = self._maid:Add(ValueObject.new(false, "boolean"))

self:InitEnabledMixin()

Expand Down Expand Up @@ -101,12 +100,6 @@ function BaseAction:_updateShortcuts()
if self:IsEnabled() then
ContextActionService:BindAction(self._contextActionKey, function(_, userInputState, _)
if userInputState == Enum.UserInputState.Begin then
if self._actionData.CanActivateShortcutCallback then
if not self._actionData.CanActivateShortcutCallback() then
return
end
end

self:ToggleActivate()
end
end, false, unpack(shortcuts))
Expand Down

0 comments on commit 65d09e1

Please sign in to comment.