/trunk/RDX/Designs/Variables
name = "Variable: Fractional mana (fm)"; |
title = "Vars Frac Power"; |
category = VFLI.i18n("Variables"); |
test = true; |
multiple = true; |
IsPossible = function(state) |
if not state:Slot("DesignFrame") then return nil; end |
return true; |
end; |
ApplyFeature = function(desc, state) |
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) code:AppendCode([[ |
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) |
if desc.test then |
code:AppendCode([[ |
local ]] .. desc.name .. [[, ]] .. desc.name .. [[_i = 0.5, 0.5; |
]]); |
else |
code:AppendCode([[ |
local ]] .. desc.name .. [[, ]] .. desc.name .. [[_i = unit:FracPower(]] .. desc.powertype .. [[); |
]]); |
]]); |
end |
end); |
local mux = state:GetContainingWindowState():GetSlotValue("Multiplexer"); |
local mask = mux:GetPaintMask("POWER"); |
name = "Variable: Number power"; |
title = "Vars Number Power"; |
category = VFLI.i18n("Variables"); |
test = true; |
multiple = true; |
IsPossible = function(state) |
if not state:Slot("DesignFrame") then return nil; end |
return true; |
end; |
ApplyFeature = function(desc, state) |
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) code:AppendCode([[ |
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) |
if desc.test then |
code:AppendCode([[ |
local ]] .. desc.name .. [[, ]] .. desc.name .. [[_i = 3, 3; |
]]); |
else |
code:AppendCode([[ |
local ]] .. desc.name .. [[, ]] .. desc.name .. [[_i = unit:Power(]] .. desc.powertype .. [[) or 0; |
]]); |
]]); |
end |
end); |
local mux = state:GetContainingWindowState():GetSlotValue("Multiplexer"); |
local mask = mux:GetPaintMask("POWER"); |