0
0
mirror of https://gitlab.com/YuukiPS/GC-Resources.git synced 2025-04-29 09:35:48 +00:00
GC-Resources/Resources/Scripts/Gadget/OneStroke_Test.lua
KingRainbow44 b77f8d326e
Revert "The Great De-Local'ifying of Lua Scripts"
This reverts commit 54223c3d4857544a2cc9b94a9e10377596e367e4.
2023-08-29 21:33:58 -04:00

65 lines
1.8 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function OnClientExecuteReq(context, param1, param2, param3)
if param1 == 0 then
ScriptLib.SetGadgetState(context, GadgetState.Default)
end
if param1 == 101 then
ScriptLib.SetGadgetState(context, 101)
end
if param1 == 102 then
ScriptLib.SetGadgetState(context, 102)
end
if param1 == 201 then
if CheckGroupChallengeState(context) then
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
end
end
if param1 == 202 then
if CheckGroupChallengeState(context) then
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
end
end
if param1 == 203 then
ScriptLib.SetGadgetState(context, GadgetState.GearAction1)
end
if param1 == 204 then
if CheckGroupChallengeState(context) then
ScriptLib.SetGadgetState(context, GadgetState.GearAction2)
end
end
if param1 == 901 then
ScriptLib.SetGadgetState(context, GadgetState.Action01)
end
if param1 == 902 then
ScriptLib.SetGadgetState(context, GadgetState.Action02)
end
if param1 == 903 then
ScriptLib.SetGadgetState(context, GadgetState.Action03)
end
end
-- 当格子被踩时先检查Group状态
function CheckGroupChallengeState(context)
ScriptLib.PrintContextLog(context,"CheckGroupChallengeState")
--challenge_state 0-等待开始 1-正在进行 2-完成 3-失败流程中
local state = ScriptLib.GetGroupVariableValue(context, "challenge_state")
if state == 1 then
--ScriptLib.PrintContextLog(context,"Cube Set Active Check Ok")
return true
elseif state == 0 then
if ScriptLib.GetContextGadgetConfigId(context) == ScriptLib.GetGroupVariableValue(context, "starter_id") then
--ScriptLib.PrintContextLog(context,"Cube Set Active Check Ok for Starter")
return true
else
--ScriptLib.PrintContextLog(context,"Cube Pressed Before Challenge But Not Starter")
return false
end
end
return false
end