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/FireSprayController.lua
KingRainbow44 b77f8d326e
Revert "The Great De-Local'ifying of Lua Scripts"
This reverts commit 54223c3d4857544a2cc9b94a9e10377596e367e4.
2023-08-29 21:33:58 -04:00

45 lines
1.6 KiB
Lua

function OnBeHurt(context, element_type, unkParam, is_host)
local state = ScriptLib.GetGadgetState(context)
if state == GadgetState.GearStop then
if element_type == ElementType.Fire then
local value = ScriptLib.GetGearStartValue(context)
value = value + 1
if value >= 1 then
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
ScriptLib.SetGearStartValue(context, 1)
else
ScriptLib.SetGearStartValue(context, value)
end
elseif element_type == ElementType.Ice then
ScriptLib.ResetGadgetState(context, GadgetState.GearStop)
end
elseif state == GadgetState.GearStart then
if element_type == ElementType.Ice then
local value = ScriptLib.GetGearStopValue(context)
value = value + 1
if value >= 1 then
ScriptLib.SetGadgetState(context, GadgetState.GearStop)
ScriptLib.SetGearStopValue(context, 1)
else
ScriptLib.SetGearStopValue(context, value)
end
end
end
end
function OnClientExecuteReq(context, param1, param2, param3)
if param1 == 1 then
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
end
end
function OnTimer(context, now)
local state = ScriptLib.GetGadgetState(context)
if state == GadgetState.GearStop then
local start_time = ScriptLib.GetGadgetStateBeginTime(context)
if now >= start_time + 4 then
ScriptLib.SetGadgetState(context, GadgetState.GearStart)
ScriptLib.SetGearStopValue(context, 0)
end
end
end