Changed the code to support Moose Color Enumeration

This commit is contained in:
Wingthor 2017-05-22 14:37:21 +02:00
parent 824431ae94
commit 473735dcd7

View File

@ -327,31 +327,24 @@ do -- TASK_CARGO
self:__RouteToDeploy( 1.0, DeployZone ) self:__RouteToDeploy( 1.0, DeployZone )
end end
--- ¤TASL_CARGP --- ¤TASK_CARGO
--@return SmokeCole --@return SmokeColor
function TASK_CARGO:GetSmokeColor () function TASK_CARGO:GetSmokeColor ()
return self.SmokeColor return self.SmokeColor
end end
---#TASK_CARGO ---#TASK_CARGO
--@param Color Might be Blue, Red or Green --@param Color Might be Blue, Red or Green
function TASK_CARGO:SetSmokeColor(Color) function TASK_CARGO:SetSmokeColor(SmokeColor)
-- Makes sure Coloe is set -- Makes sure Coloe is set
if Color == nil then if SmokeColor == nil then
Color = "Red" -- Make sure a default color is exist self:F2(SmokeColor)
else self.SmokeColor = SMOKECOLOR.Red -- Make sure a default color is exist
local ValidColors = {"Red", "Blue", "Green"} elseif type(SmokeColor) == "number" then
for index,value in ipairs (ValidColors) do if SmokeColor > 0 and SmokeColor <=5 then -- Make sure number is within ragne, assuming first enum is one
if value == Color then self.SmokeColor = SMOKECOLOR.SmokeColor
self.SmokeColor = value
break
end
-- Color is invalid, set it green as signal
self.SmokeColor = "Green"
BASE:E("Invalid color is set using GREEN")
end end
end end
self.SmokeColor = Color
end end
--- ---