Lazy commit: processing stations

This commit is contained in:
Van
2026-06-03 21:46:40 +03:00
parent 3854410041
commit 592bbf9c58
16 changed files with 266 additions and 185 deletions

View File

@@ -5,7 +5,7 @@ local Control = {}
---@param callbackFunc fun(player:Player, controlName:string)
function Control.subcribeOnPress(callbackFunc)
Events.subscribe('control.on_press', callbackFunc)
Events:subscribe('control.on_press', callbackFunc)
end
@@ -13,7 +13,7 @@ end
---@param callbackFunc fun(player:Player, controlName:string, holdTime:number)
function Control.subcribeOnRelease(callbackFunc)
Events.subscribe('control.on_release', callbackFunc)
Events:subscribe('control.on_release', callbackFunc)
end
@@ -21,7 +21,7 @@ end
---@param callbackFunc fun(player:Player, controlName:string, holdTime:number, dtime:number)
function Control.subcribeOnHold(callbackFunc)
Events.subscribe('control.on_hold', callbackFunc)
Events:subscribe('control.on_hold', callbackFunc)
end
@@ -29,7 +29,7 @@ end
---@param callbackFunc fun(player:Player, player_wield_index:number, player_last_wield_index:number)
function Control.subcribeOnWieldChange(callbackFunc)
Events.subscribe('control.on_wield_change', callbackFunc)
Events:subscribe('control.on_wield_change', callbackFunc)
end
@@ -107,19 +107,19 @@ Smc.registerGlobalStepForEachPlayer(0, function(deltaTime, player)
-- on_press
if not lastPressed and nowPressed then
Events.call('control.on_press', key)
Events:call('control.on_press', key)
controlTimer[key] = 0
-- on_release
elseif lastPressed and not nowPressed then
Events.call('control.on_release', key, controlTimer[key])
Events:call('control.on_release', key, controlTimer[key])
controlTimer[key] = 0
-- on_hold
elseif lastPressed and nowPressed then
Events.call('control.on_hold', key, controlTimer[key], deltaTime)
Events:call('control.on_hold', key, controlTimer[key], deltaTime)
controlTimer[key] = controlTimer[key] + deltaTime
end