Editing Module:UnitData

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 10: Line 10:
 
 
 
return string.format("%.0f", amount * 100) .. "%"
 
return string.format("%.0f", amount * 100) .. "%"
end
 
 
local function appendHeatInfo(frame, ud, currentStr)
 
local args = {subbox = "yes"}
 
args.header1 = "Heat Up"
 
args.label2 = "Heat Per Shot (%)"
 
args.data2 = ud.heatPerShot
 
args.label3 = "Heat Decay (%/s)"
 
args.data3 = ud.heatDecay
 
args.label4 = "Heat Max Slow (%)"
 
args.data4 = ud.heatMaxSlow
 
local tbl = {title = "infobox", args = args}
 
currentStr = currentStr .. frame:expandTemplate({title = "Infobox", args = args})
 
return currentStr
 
 
end
 
end
  
Line 56: Line 42:
 
u.weaponIDs = nil
 
u.weaponIDs = nil
 
u.shieldIDs = nil
 
u.shieldIDs = nil
u.drones = nil
 
 
 
 
return tbl
 
return tbl
Line 68: Line 53:
 
 
 
local result = ''
 
local result = ''
if ud.drones then
 
for index, entry in ipairs(ud.drones) do
 
local args = {
 
drone = "[[" .. entry.drone .. "]]",
 
maxdrones = entry.maxDrones,
 
range = entry.range,
 
interval = entry.interval,
 
spawnsize = entry.spawnSize,
 
buildtime = entry.buildTime,
 
maxbuilding = entry.maxBuilding
 
}
 
result = result .. frame:expandTemplate(unit.getAbilityInfoboxTemplate("drone", args))
 
end
 
end
 
 
 
if ud.buildSpeed then  
 
if ud.buildSpeed then  
 
result = result .. frame:expandTemplate(unit.getAbilityInfoboxTemplate("construction", {buildpower = ud.buildSpeed}))
 
result = result .. frame:expandTemplate(unit.getAbilityInfoboxTemplate("construction", {buildpower = ud.buildSpeed}))
 
end
 
end
if ud.transportLightSpeed or ud.transportMediumSpeed or ud.transportHeavySpeed then
+
if ud.transportCapacity then
 
local light = ud.transportLightSpeed
 
local light = ud.transportLightSpeed
local medium = ud.transportMediumSpeed
+
local medium = cp.transportMediumSpeed
local heavy = ud.transportHeavySpeed
+
local heavy = cp.transportHeavySpeed
 
local args = {}
 
local args = {}
if light then args.light = light .. "%" end
+
if light then args.light = toPercent(light) end
if medium then args.medium = medium .. "%" end
+
if medium then args.medium = toPercent(medium) end
if heavy then args.heavy = heavy .. "%" end
+
if heavy then args.heavy = toPercent(heavy) end
 
result = result .. frame:expandTemplate(unit.getAbilityInfoboxTemplate("transport", args))
 
result = result .. frame:expandTemplate(unit.getAbilityInfoboxTemplate("transport", args))
 
end
 
end
if ud.canCloak or ud.idleCloak then
+
if ud.cloakCost or ud.idleCloak then
 
local args = {}
 
local args = {}
 
if (ud.cloakCost or 0) > 0 then
 
if (ud.cloakCost or 0) > 0 then
 
args.upkeepidle = ud.cloakCost
 
args.upkeepidle = ud.cloakCost
args.upkeepmobile = (ud.cloakCostMoving ~= ud.cloakCost) and ud.cloakCostMoving or nil
+
args.upkeepmobile = ud.cloakCostMoving
elseif ud.idleCloak then
+
elseif ud.idle_cloak then
 
args.customdata1 = "Only when idle"
 
args.customdata1 = "Only when idle"
 
args.customdata2 = "Free and automated"
 
args.customdata2 = "Free and automated"
Line 130: Line 100:
 
if ud.radarDistance or ud.jammerDistance then
 
if ud.radarDistance or ud.jammerDistance then
 
local args = {}
 
local args = {}
if ud.jammerDistance then
+
if ud.radardistancejam then
if not ud.radarDistance then
+
if not ud.radardistance then
 
args.name = "Radar Jammer"
 
args.name = "Radar Jammer"
 
end
 
end
 
args.jam = ud.jammerDistance
 
args.jam = ud.jammerDistance
 
end
 
end
if ud.radarDistance then
+
if ud.radardistance then
 
args.radar = ud.radarDistance
 
args.radar = ud.radarDistance
 
end
 
end
Line 142: Line 112:
 
end
 
end
 
if ud.jumpRange then
 
if ud.jumpRange then
local args = {range = ud.jumpRange, reload = ud.jumpReload, speed = ud.jumpSpeed, midairjump = ud.midairJump and "Yes" or "No"}
+
local args = {range = ud.jumpRange, reload = ud.jumpReload, speed = ud.jumpSpeed, midairjump = ud.midairJump}
 
result = result .. frame:expandTemplate(unit.getAbilityInfoboxTemplate("jump", args))
 
result = result .. frame:expandTemplate(unit.getAbilityInfoboxTemplate("jump", args))
 
end
 
end
Line 148: Line 118:
 
local args = {}
 
local args = {}
 
if ud.idleRegenTime then
 
if ud.idleRegenTime then
args.idleregen = ud.idleRegen
+
if unitDef.idletime > 0 then
args.timetoenable = ud.idleRegenTime
+
args.idleregen = ud.idleRegen
elseif ud.combatRegen then
+
args.timetoenable = ud.idleRegenTime
args.combatregen = ud.combatRegen
+
else
 +
args.combatregen = ud.combatRegen
 +
end
 
end
 
end
 
if ud.waterRegen then
 
if ud.waterRegen then
Line 169: Line 141:
 
if ud.armorDamageReduction then
 
if ud.armorDamageReduction then
 
local args = {reduction = ud.armorDamageReduction .. '%'}
 
local args = {reduction = ud.armorDamageReduction .. '%'}
 +
abilities = abilities .. "\n\t" .. writeHeaderLine("Infobox zkability armored")
 
if ud.armorForceClose then
 
if ud.armorForceClose then
 
args.special1 = "Forced for " .. ud.armorForceClose .. "s on damage"
 
args.special1 = "Forced for " .. ud.armorForceClose .. "s on damage"
Line 220: Line 193:
 
end
 
end
 
 
if ud.heatPerShot then
+
return result or ''
result = appendHeatInfo(frame, ud, result)
 
end
 
 
if result == '' then result = "None" end
 
return result
 
 
end
 
end
  

Please note that all contributions to Zero-K are considered to be released under the Creative Commons Attribution-ShareAlike (see Zero-K:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Templates used on this page: