-390 Removals
+703 Additions
package.path = package.path .. ";data/scripts/lib/?.lua"package.path = package.path .. ";data/scripts/lib/?.lua"
package.path = package.path .. ";data/scripts/?.lua"package.path = package.path .. ";data/scripts/?.lua"
require ("utility")require ("utility")
require ("stringutility")require ("stringutility")
local lyr_debug = false
local iconColor = ColorRGB(0.5, 0.5, 0.5)local iconColor = ColorRGB(0.5, 0.5, 0.5)
local headLineSize = 25local headLineSize = 22
local headLineFont = 15local headLineFont = 16
local function fillWeaponTooltipData(obj, tooltip)local function fillWeaponTooltipData(obj, tooltip)
local lyr = {}
lyr.generatesHeat = obj.maxHeat == 10
lyr.usesPower = obj.coolingType == 2
lyr.drainsEnergy = obj.coolingType == 1
lyr.burstFire = obj.shootingTime < 2
lyr.isBeam = obj.continuousBeam
lyr.isProjectile = not lyr.isBeam
lyr.activeWeapons = obj.simultaneousShooting and obj.numWeapons > 1 and obj.numWeapons or 1
lyr.projectilePerTurret = lyr.activeWeapons * obj.shotsPerFiring
lyr.damage = lyr.projectilePerTurret * obj.damage --lyr.damagePerShot
lyr.adjustedFireRate = obj.fireRate
if lyr.usesPower or lyr.drainsEnergy then
lyr.heatPerShot = lyr.activeWeapons * obj.heatPerShot
lyr.energyIncreasePerSecond = lyr.activeWeapons*obj.energyIncreasePerSecond
elseif lyr.generatesHeat then
lyr.coolingRate = obj.coolingRate
lyr.coolingPerShot = lyr.coolingRate/obj.fireRate
lyr.heatPerShot = lyr.activeWeapons * obj.heatPerShot
lyr.accumulatedHeat = lyr.heatPerShot
--lyr.timeToCooldown
lyr.timeToOverheat = 0
lyr.shotsToOverheat = 1
lyr.timePerShot = 1/ obj.fireRate
lyr.uptimeRatio = 1
lyr.adjustedHeatPerShot = lyr.heatPerShot - lyr.coolingPerShot
lyr.adjustedMaxHeat = obj.maxHeat - lyr.heatPerShot
lyr.neverOverheats = false
lyr.instantlyOverheats = false
--lyr.coolingEfficiency
if lyr.heatPerShot >= obj.maxHeat then
lyr.instantlyOverheats = true
elseif lyr.coolingPerShot >= lyr.heatPerShot then
lyr.neverOverheats = true
else
lyr.shotsToOverheat = math.ceil( lyr.adjustedMaxHeat / lyr.adjustedHeatPerShot ) +1
lyr.accumulatedHeat = lyr.accumulatedHeat + ( lyr.shotsToOverheat -1) * lyr.adjustedHeatPerShot
lyr.timeToOverheat = lyr.timeToOverheat + ( lyr.shotsToOverheat -1) * lyr.timePerShot
end
lyr.timeToCooldown = lyr.accumulatedHeat / lyr.coolingRate
lyr.cycle = lyr.timeToCooldown + lyr.timeToOverheat
if lyr.instantlyOverheats then
if lyr.timePerShot <= lyr.timeToCooldown then
lyr.adjustedFireRate = 1/ lyr.timeToCooldown
end
elseif not lyr.neverOverheats then
lyr.uptimeRatio = lyr.timeToOverheat / (lyr.cycle)
end
--lyr.coolingEfficiency = lyr.adjustedFireRate / obj.fireRate *100
lyr.coolingEfficiency = lyr.coolingPerShot / (lyr.heatPerShot*lyr.adjustedFireRate)
lyr.damagePerCycle = lyr.shotsToOverheat * lyr.damage
lyr.dps = lyr.damagePerCycle / lyr.cycle
end
-- rarity name
local line = TooltipLine(5, 12)
line.ltext = "Tech: "..round(obj.averageTech, 1) --lyr_nt
line.ctext = tostring(obj.rarity)
line.rtext = obj.material.name
line.rcolor = obj.material.color
line.ccolor = obj.rarity.color
tooltip:addLine(line)
-- rarity name -- primary stats, one by one
local line = TooltipLine(5, 12) local fontSize = 14
line.ctext = tostring(obj.rarity) local lineHeight = 20
line.ccolor = obj.rarity.color
tooltip:addLine(line) tooltip:addLine(TooltipLine(25,15))
if lyr.isBeam then --beam weapons: teslaGun, repairBeam, laser, forceGun, salvagingLaser, miningLaser
if obj.stoneEfficiency > 0 or obj.metalEfficiency > 0 then
if obj.stoneEfficiency > 0 and obj.metalEfficiency > 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Mining & Salvaging" --lyr_nt
line.rtext = round(obj.dps, 1).."/s"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Efficiencies" --lyr_nt
line.rtext = round(obj.stoneEfficiency * 100, 1).."% & "..round(obj.metalEfficiency * 100, 1).."%"
line.icon = "data/textures/icons/recycle.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
elseif obj.stoneEfficiency > 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Mining" --lyr_nt
line.rtext = round(obj.dps, 1).."/s"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Efficiency" --lyr_nt
line.rtext = round(obj.stoneEfficiency * 100, 1).."%"
line.icon = "data/textures/icons/recycle.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
else --if obj.metalEfficiency > 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Salvaging" --lyr_nt
line.rtext = round(obj.dps, 1).."/s"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Efficiency" --lyr_nt
line.rtext = round(obj.metalEfficiency * 100, 1).."%"
line.icon = "data/textures/icons/recycle.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
end
elseif obj.otherForce ~= 0 or obj.selfForce ~= 0 then
-- if obj.otherForce == 0 or obj.selfForce == 0 then
-- tooltip:addLine(TooltipLine(lineHeight, fontSize)) --line 1
-- end
if obj.otherForce > 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Push"%_t
line.rtext = toReadableValue(obj.otherForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1 or 2
elseif obj.otherForce < 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Pull"%_t
line.rtext = toReadableValue(-obj.otherForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1 or 2
end
if obj.selfForce > 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Self Push"%_t
line.rtext = toReadableValue(obj.selfForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
elseif obj.selfForce < 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Self Pull"%_t
line.rtext = toReadableValue(-obj.selfForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
end
elseif obj.hullRepairRate > 0 or obj.shieldRepairRate > 0 then
-- if obj.hullRepairRate == 0 or obj.shieldRepairRate == 0 then
-- tooltip:addLine(TooltipLine(lineHeight, fontSize)) --line 1
-- end
if obj.hullRepairRate > 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Hull Repair" --lyr_nt
line.rtext = round(obj.hullRepairRate, 1).."/s"
line.icon = "data/textures/icons/health-normal.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1 or 2
end
if obj.shieldRepairRate > 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Shield Charge" --lyr_nt
line.rtext = round(obj.shieldRepairRate, 1).."/s"
line.icon = "data/textures/icons/health-normal.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
end
else --if obj.damage > 0
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Continuous Damage" --lyr_nt
line.rtext = round(obj.dps, 1).."/s"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Tick Damage" --lyr_nt
line.rtext = round(obj.damage, 1).."/tick"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
end
else --projectile weapons: railGun, lightningGun, rocketLauncher, cannon, plasmaGun, bolter, chainGun
if lyr.generatesHeat and not lyr.neverOverheats then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Weighted Damage" --lyr_nt
line.rtext = round(lyr.dps, 1).."/s"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1
if lyr.burstFire then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Burst Damage" --lyr_nt
line.rtext = round(lyr.damagePerCycle, 1).."/burst"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
else
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Projectile Damage" --lyr_nt
line.rtext = lyr.projectilePerTurret > 1 and lyr.projectilePerTurret.."x"..round(obj.damage, 1).."/shot" or round(obj.damage, 1).."/shot"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
end
else
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Sustained Damage" --lyr_nt
line.rtext = round(obj.dps, 1).."/s"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 1
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Projectile Damage" --lyr_nt
line.rtext = lyr.projectilePerTurret > 1 and lyr.projectilePerTurret.."x"..round(obj.damage, 1).."/shot" or round(obj.damage, 1).."/shot"
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line) --line 2
end
end
-- primary stats, one by one -- fire rate
local fontSize = 14 if lyr.burstFire then
local lineHeight = 20 local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Burst Rate" --lyr_nt
line.rtext = round(lyr.cycle, 1).."s/burst"
line.icon = "data/textures/icons/bullets.png";
line.iconColor = iconColor
tooltip:addLine(line)
else
local line = TooltipLine(lineHeight, fontSize)
line.ltext = lyr.isBeam and "Tick Rate" or "Fire Rate" --lyr_nt
line.rtext = round(lyr.adjustedFireRate, 1).."/s"
line.icon = "data/textures/icons/bullets.png";
line.iconColor = iconColor
tooltip:addLine(line)
end
local line = TooltipLine(lineHeight, fontSize) local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Tech"%_t line.ltext = "Accuracy"%_t
line.rtext = round(obj.averageTech, 1) line.rtext = (lyr.isBeam or obj.accuracy == 1) and "Absolute" or round(obj.accuracy * 100, 1).."%"
line.icon = "data/textures/icons/circuitry.png"; line.icon = "data/textures/icons/reticule.png";
line.iconColor = iconColor line.iconColor = iconColor
tooltip:addLine(line) tooltip:addLine(line)
-- empty line local line = TooltipLine(lineHeight, fontSize)
tooltip:addLine(TooltipLine(15, 15)) line.ltext = "Velocity" --lyr_nt
line.rtext = (lyr.isBeam or obj.shotSpeed > obj.reach*60) and "Instant" or round(obj.shotSpeed*10, 0).."m/s"
line.icon = "data/textures/icons/blaster.png";
line.iconColor = iconColor
tooltip:addLine(line)
if obj.damage > 0 then local line = TooltipLine(lineHeight, fontSize)
if obj.continuousBeam then line.ltext = "Range"%_t
line.rtext = round(obj.reach*10/1000, 2).."km"
line.icon = "data/textures/icons/target-shot.png";
line.iconColor = iconColor
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize) -- empty line
line.ltext = "Damage /s"%_t tooltip:addLine(TooltipLine(15, 15))
line.rtext = round(obj.dps, 1)
line.icon = "data/textures/icons/screen-impact.png"; if lyr.usesPower then
line.iconColor = iconColor local line = TooltipLine(lineHeight, fontSize)
tooltip:addLine(line) line.ltext = "Power Demand" --lyr_nt
line.rtext = round(lyr.heatPerShot+lyr.energyIncreasePerSecond, 1).."MW/s"
line.icon = "data/textures/icons/electric.png";
line.iconColor = iconColor
tooltip:addLine(line)
else local line = TooltipLine(lineHeight, fontSize)
-- damage line.ltext = "Accumulation" --lyr_nt
local line = TooltipLine(lineHeight, fontSize) line.rtext = "+"..round(lyr.energyIncreasePerSecond, 0).."MW/s"
line.ltext = "Damage"%_t line.icon = "data/textures/icons/electric.png";
line.rtext = round(obj.damage, 1) line.iconColor = iconColor
if obj.shotsPerFiring > 1 then tooltip:addLine(line)
line.rtext = line.rtext .. " x" .. obj.shotsPerFiring
end
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
tooltip:addLine(line)
-- fire rate local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize) line.ltext = "Dispersion" --lyr_nt
line.ltext = "Fire Rate"%_t line.rtext = "-"..round(obj.coolingRate, 0).."MW/s"
line.rtext = round(obj.fireRate, 1) line.icon = "data/textures/icons/electric.png";
line.icon = "data/textures/icons/bullets.png"; line.iconColor = iconColor
line.iconColor = iconColor tooltip:addLine(line)
tooltip:addLine(line)
end
end
if obj.otherForce > 0 then local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize) line.ltext = "Demand Ratio" --lyr_nt
line.ltext = "Push"%_t line.rtext = round(obj.coolingRate/lyr.energyIncreasePerSecond).."x"
line.rtext = toReadableValue(obj.otherForce, "N /* unit: Newton*/"%_t) line.icon = "data/textures/icons/electric.png";
line.icon = "data/textures/icons/back-forth.png"; line.iconColor = iconColor
line.iconColor = iconColor tooltip:addLine(line)
tooltip:addLine(line)
elseif obj.otherForce < 0 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Pull"%_t
line.rtext = toReadableValue(-obj.otherForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
tooltip:addLine(line)
end
if obj.selfForce > 0 then -- empty line
local line = TooltipLine(lineHeight, fontSize) tooltip:addLine(TooltipLine(15, 15))
line.ltext = "Self Push"%_t elseif lyr.drainsEnergy then
line.rtext = toReadableValue(obj.selfForce, "N /* unit: Newton*/"%_t) local line = TooltipLine(lineHeight, fontSize)
line.icon = "data/textures/icons/back-forth.png"; line.ltext = "Energy Drain" --lyr_nt
line.iconColor = iconColor line.rtext = round(lyr.heatPerShot+lyr.energyIncreasePerSecond, 1).."MJ/shot"
tooltip:addLine(line) line.icon = "data/textures/icons/battery-pack-alt.png";
elseif obj.selfForce < 0 then line.iconColor = iconColor
local line = TooltipLine(lineHeight, fontSize) tooltip:addLine(line)
line.ltext = "Self Pull"%_t
line.rtext = toReadableValue(-obj.selfForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
tooltip:addLine(line)
end
if obj.stoneEfficiency > 0 and obj.metalEfficiency > 0 then local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Accumulation" --lyr_nt
line.rtext = "+"..round(lyr.energyIncreasePerSecond*lyr.adjustedFireRate, 0).."MJ/s"
line.icon = "data/textures/icons/battery-pack-alt.png";
line.iconColor = iconColor
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize) local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Eff. Stone"%_t line.ltext = "Dispersion" --lyr_nt
line.rtext = round(obj.stoneEfficiency * 100, 1) line.rtext = "-"..round(obj.coolingRate, 0).."MJ/s"
line.icon = "data/textures/icons/recycle.png"; line.icon = "data/textures/icons/battery-pack-alt.png";
line.iconColor = iconColor line.iconColor = iconColor
tooltip:addLine(line) tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize) local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Eff. Metal"%_t line.ltext = "Drain Ratio" --lyr_nt
line.rtext = round(obj.metalEfficiency * 100, 1) line.rtext = round((obj.coolingRate/lyr.energyIncreasePerSecond)/lyr.adjustedFireRate).."x"
line.icon = "data/textures/icons/recycle.png"; line.icon = "data/textures/icons/battery-pack-alt.png";
line.iconColor = iconColor line.iconColor = iconColor
tooltip:addLine(line) tooltip:addLine(line)
elseif obj.stoneEfficiency > 0 then -- empty line
local line = TooltipLine(lineHeight, fontSize) tooltip:addLine(TooltipLine(15, 15))
line.ltext = "Efficiency"%_t elseif lyr.generatesHeat and not lyr.neverOverheats then
line.rtext = round(obj.stoneEfficiency * 100, 1) local line = TooltipLine(lineHeight, fontSize)
line.icon = "data/textures/icons/recycle.png"; line.ltext = "Heat Generation" --lyr_nt
line.iconColor = iconColor line.rtext = "+"..round(lyr.heatPerShot*10, 0).."%/shot"
tooltip:addLine(line) line.icon = "data/textures/icons/flame.png";
elseif obj.metalEfficiency > 0 then line.iconColor = iconColor
local line = TooltipLine(lineHeight, fontSize) tooltip:addLine(line)
line.ltext = "Efficiency"%_t
line.rtext = round(obj.metalEfficiency * 100, 1) local line = TooltipLine(lineHeight, fontSize)
line.icon = "data/textures/icons/recycle.png"; line.ltext = "Overheat Time" --lyr_nt
line.iconColor = iconColor line.rtext = round(lyr.timeToOverheat, 1).."s"
tooltip:addLine(line) line.icon = "data/textures/icons/flame.png";
end line.iconColor = iconColor
tooltip:addLine(line)
if obj.hullRepairRate > 0 then
local line = TooltipLine(lineHeight, fontSize) local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Hull Dmg /s"%_t line.ltext = "Heat Dissipation" --lyr_nt
line.rtext = round(obj.hullRepairRate, 1) line.rtext = "-"..round(obj.coolingRate*10, 0).."%/s"
line.icon = "data/textures/icons/health-normal.png"; line.icon = "data/textures/icons/flame.png";
line.iconColor = iconColor line.iconColor = iconColor
tooltip:addLine(line) tooltip:addLine(line)
end
local line = TooltipLine(lineHeight, fontSize)
if obj.shieldRepairRate > 0 then line.ltext = "Cooldown Time" --lyr_nt
local line = TooltipLine(lineHeight, fontSize) line.rtext = round(lyr.timeToCooldown, 1).."s"
line.ltext = "Shield Dmg /s"%_t line.icon = "data/textures/icons/flame.png";
line.rtext = round(obj.shieldRepairRate, 1) line.iconColor = iconColor
line.icon = "data/textures/icons/health-normal.png"; tooltip:addLine(line)
line.iconColor = iconColor
tooltip:addLine(line) -- empty line
end tooltip:addLine(TooltipLine(15, 15))
end
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Accuracy"%_t --lyr_test
line.rtext = round(obj.accuracy * 100, 1) if lyr_debug then
line.icon = "data/textures/icons/reticule.png"; local line = TooltipLine(lineHeight, fontSize)
line.iconColor = iconColor line.ltext = "drainTest"
tooltip:addLine(line) line.rtext = obj.baseEnergyPerSecond/obj.shotsPerSecond+obj.energyIncreasePerSecond
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Range"%_t local line = TooltipLine(lineHeight, fontSize)
line.rtext = round(obj.reach * 10 / 1000, 2) line.ltext = "numWeapons"
line.icon = "data/textures/icons/target-shot.png"; line.rtext = obj.numWeapons and round(obj.numWeapons, 3) or "-"
line.iconColor = iconColor tooltip:addLine(line)
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
-- empty line line.ltext = "numVisibleWeapons"
tooltip:addLine(TooltipLine(15, 15)) line.rtext = obj.numVisibleWeapons and round(obj.numVisibleWeapons, 3) or "-"
tooltip:addLine(line)
if obj.coolingType == 1 or obj.coolingType == 2 then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize) line.ltext = "coolingType"
line.rtext = obj.coolingType and round(obj.coolingType, 3) or "-"
if obj.coolingType == 2 then tooltip:addLine(line)
line.ltext = "Energy /s"%_t
else local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Energy /shot"%_t line.ltext = "coolingTime"
end line.rtext = obj.coolingTime and round(obj.coolingTime, 3) or "-"
line.rtext = round(obj.baseEnergyPerSecond) tooltip:addLine(line)
line.icon = "data/textures/icons/electric.png";
line.iconColor = iconColor local line = TooltipLine(lineHeight, fontSize)
tooltip:addLine(line) line.ltext = "shootingTime"
line.rtext = obj.shootingTime and round(obj.shootingTime, 3) or "-"
local line = TooltipLine(lineHeight, fontSize) tooltip:addLine(line)
line.ltext = "Energy Increase /s"%_t
line.rtext = round(obj.energyIncreasePerSecond, 1) local line = TooltipLine(lineHeight, fontSize)
line.icon = "data/textures/icons/electric.png"; line.ltext = "heatPerShot"
line.iconColor = iconColor line.rtext = obj.heatPerShot and round(obj.heatPerShot, 3) or "-"
tooltip:addLine(line) tooltip:addLine(line)
-- empty line local line = TooltipLine(lineHeight, fontSize)
tooltip:addLine(TooltipLine(15, 15)) line.ltext = "dps"
end line.rtext = obj.dps and round(obj.dps, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Material"%_t local line = TooltipLine(lineHeight, fontSize)
line.rtext = obj.material.name line.ltext = "damage"
line.rcolor = obj.material.color line.rtext = obj.damage and round(obj.damage, 3) or "-"
line.icon = "data/textures/icons/metal-bar.png"; tooltip:addLine(line)
line.iconColor = iconColor
tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize)
line.ltext = "heat"
line.rtext = obj.heat and round(obj.heat, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "requiredShootingEnergy"
line.rtext = obj.requiredShootingEnergy and round(obj.requiredShootingEnergy, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "fireRate"
line.rtext = obj.fireRate and round(obj.fireRate, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "maxHeat"
line.rtext = obj.maxHeat and round(obj.maxHeat, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "coolingRate"
line.rtext = obj.coolingRate and round(obj.coolingRate, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "baseEnergyPerSecond"
line.rtext = obj.baseEnergyPerSecond and round(obj.baseEnergyPerSecond, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "energyIncreasePerSecond"
line.rtext = obj.energyIncreasePerSecond and round(obj.energyIncreasePerSecond, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "firingsPerSecond"
line.rtext = obj.firingsPerSecond and round(obj.firingsPerSecond, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "shotsPerSecond"
line.rtext = obj.shotsPerSecond and round(obj.shotsPerSecond, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "shotsPerFiring"
line.rtext = obj.shotsPerFiring and round(obj.shotsPerFiring, 3) or "-"
tooltip:addLine(line)
tooltip:addLine(TooltipLine(15, 15))
end
--lyr_test
endend
local function fillDescriptions(obj, tooltip, additional)local function fillDescriptions(obj, tooltip)
local ignoreList = {["Burst Fire"] = true, ["Consumes Energy"] = true, ["Overheats"] = true}
--local ignoreList = {}
-- now count the lines, as there will have to be lines inserted
-- to make sure that the icon of the weapon won't overlap with the stats
local extraLines = 1
local fontSize = 12
local lineHeight = 15
-- now count the lines, as there will have to be lines inserted -- one line for flavor text
-- to make sure that the icon of the weapon won't overlap with the stats local line = TooltipLine(lineHeight, fontSize)
local extraLines = 0 line.ltext = obj.flavorText
local fontSize = 14 line.lcolor = ColorRGB(1.0, 0.7, 0.7)
local lineHeight = 18 tooltip:addLine(line)
additional = additional or {}
-- one line for flavor text local descriptions = obj:getDescriptions()
local line = TooltipLine(lineHeight, fontSize)
line.ltext = obj.flavorText
line.lcolor = ColorRGB(1.0, 0.7, 0.7)
tooltip:addLine(line)
extraLines = extraLines + 1 for desc, value in pairs(descriptions) do
if not ignoreList[desc] then
extraLines = extraLines + 1
end
end
local descriptions = obj:getDescriptions() for i = 1, 3 - extraLines do
-- empty line
tooltip:addLine(TooltipLine(lineHeight, fontSize))
end
for desc, value in pairs(descriptions) do for desc, value in pairs(descriptions) do
local line = TooltipLine(lineHeight, fontSize) if not ignoreList[desc] then
local line = TooltipLine(lineHeight, fontSize)
if value == "" then
line.ltext = desc % _t if value == "" then
else line.ltext = desc % _t
line.ltext = string.format(desc % _t, value) else
end line.ltext = string.format(desc % _t, value)
end
local existsAlready
for _, desc in pairs(additional) do tooltip:addLine(line)
if desc == line.ltext then end
existsAlready = true end
end
end
if not existsAlready then
tooltip:addLine(line)
extraLines = extraLines + 1
end
end
if obj.seeker then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Seeker Missiles"%_t
tooltip:addLine(line)
extraLines = extraLines + 1
end
for _, text in pairs(additional) do
local line = TooltipLine(lineHeight, fontSize)
line.ltext = text
tooltip:addLine(line)
extraLines = extraLines + 1
end
for i = 1, 3 - extraLines do
-- empty line
tooltip:addLine(TooltipLine(15, 15))
end
endend
function makeTurretTooltip(turret)function makeTurretTooltip(turret)
local tooltip = Tooltip() local tooltip = Tooltip()
local description = {}
-- create tool tip -- create tool tip
tooltip.icon = turret.weaponIcon tooltip.icon = turret.weaponIcon
-- build title -- build title
local title = "" local title = ""
local weapon = turret.weaponPrefix .. " /* Weapon Prefix*/" local weapon = turret.weaponPrefix .. " /* Weapon Prefix*/"
weapon = weapon % _t weapon = weapon % _t
local tbl = {material = turret.material.name, weaponPrefix = weapon} local tbl = {material = turret.material.name, weaponPrefix = weapon}
if turret.stoneEfficiency > 0 or turret.metalEfficiency > 0 then if turret.stoneEfficiency > 0 or turret.metalEfficiency > 0 then
if turret.numVisibleWeapons == 1 then if turret.numVisibleWeapons == 1 then
title = "${material} ${weaponPrefix} Turret"%_t % tbl title = "${material} ${weaponPrefix} Turret"%_t % tbl
elseif turret.numVisibleWeapons == 2 then elseif turret.numVisibleWeapons == 2 then
title = "Double ${material} ${weaponPrefix} Turret"%_t % tbl title = "Double ${material} ${weaponPrefix} Turret"%_t % tbl
elseif turret.numVisibleWeapons == 3 then elseif turret.numVisibleWeapons == 3 then
title = "Triple ${material} ${weaponPrefix} Turret"%_t % tbl title = "Triple ${material} ${weaponPrefix} Turret"%_t % tbl
elseif turret.numVisibleWeapons == 4 then elseif turret.numVisibleWeapons == 4 then
title = "Quad ${material} ${weaponPrefix} Turret"%_t % tbl title = "Quad ${material} ${weaponPrefix} Turret"%_t % tbl
else else
title = "Multi ${material} ${weaponPrefix} Turret"%_t % tbl title = "Multi ${material} ${weaponPrefix} Turret"%_t % tbl
end end
else else
if turret.numVisibleWeapons == 1 then if turret.numVisibleWeapons == 1 then
title = "${weaponPrefix} Turret"%_t % tbl title = "${weaponPrefix} Turret"%_t % tbl
elseif turret.numVisibleWeapons == 2 then elseif turret.numVisibleWeapons == 2 then
title = "Double ${weaponPrefix} Turret"%_t % tbl title = "Double ${weaponPrefix} Turret"%_t % tbl
elseif turret.numVisibleWeapons == 3 then elseif turret.numVisibleWeapons == 3 then
title = "Triple ${weaponPrefix} Turret"%_t % tbl title = "Triple ${weaponPrefix} Turret"%_t % tbl
elseif turret.numVisibleWeapons == 4 then elseif turret.numVisibleWeapons == 4 then
title = "Quad ${weaponPrefix} Turret"%_t % tbl title = "Quad ${weaponPrefix} Turret"%_t % tbl
else else
title = "Multi ${weaponPrefix} Turret"%_t % tbl title = "Multi ${weaponPrefix} Turret"%_t % tbl
end end
end end
-- head line -- head line
local line = TooltipLine(headLineSize, headLineFont) local line = TooltipLine(headLineSize-5, headLineFont)
line.ctext = title line.ctext = title
line.ccolor = turret.rarity.color line.ccolor = turret.rarity.color
tooltip:addLine(line) tooltip:addLine(line)
local fontSize = 14; local fontSize = 14
local lineHeight = 20; local lineHeight = 20
fillWeaponTooltipData(turret, tooltip) fillWeaponTooltipData(turret, tooltip)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Size"%_t
line.rtext = round(turret.size, 1)
line.icon = "data/textures/icons/shotgun.png";
line.iconColor = iconColor
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Tracking Speed" --lyr_nt
line.rtext = round(turret.turningSpeed, 1)
line.icon = "data/textures/icons/clockwise-rotation.png";
line.iconColor = iconColor
tooltip:addLine(line)
-- crew requirements
local crew = turret:getCrew()
-- size for crewman, amount in pairs(crew:getMembers()) do
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Size"%_t
line.rtext = round(turret.size, 1)
line.icon = "data/textures/icons/shotgun.png";
line.iconColor = iconColor
tooltip:addLine(line)
-- automatic/independent firing if amount > 0 then
if turret.automatic then local profession = crewman.profession
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Independent Targeting"%_t
line.icon = "data/textures/icons/cog.png";
line.iconColor = iconColor
tooltip:addLine(line)
end
-- empty line local line = TooltipLine(lineHeight, fontSize)
tooltip:addLine(TooltipLine(15, 15)) line.ltext = profession.name
line.rtext = round(amount)
line.icon = profession.icon;
line.iconColor = iconColor
tooltip:addLine(line)
-- crew requirements end
local crew = turret:getCrew() end
-- empty line
tooltip:addLine(TooltipLine(15, 15))
local addBlankLine = false
for crewman, amount in pairs(crew:getMembers()) do if turret.automatic then
local line = TooltipLine(lineHeight, fontSize+2)
line.ltext = "Independent Targeting" --lyr_nt
line.lcolor = ColorRGB(0.6, 1.0, 0.0)
line.icon = "data/textures/icons/processor.png";
line.iconColor = iconColor
tooltip:addLine(line)
--table.insert(description, "Programmable Turret: Can be set to fire automatically")
addBlankLine = true
end
if turret.simultaneousShooting and turret.numWeapons > 1 then
local line = TooltipLine(lineHeight, fontSize+2)
line.ltext = "Synchronized Weapons" --lyr_nt
line.lcolor = ColorRGB(0.45, 1.0, 0.15)
line.icon = "data/textures/icons/missile-pod.png";
line.iconColor = iconColor
tooltip:addLine(line)
--table.insert(description, "Synchronized Weapons: Fires all weapons at the same time")
addBlankLine = true
end
if turret.shotsPerFiring > 1 then
local line = TooltipLine(lineHeight, fontSize+2)
line.ltext = "Multiple Projectiles" --lyr_nt
line.lcolor = ColorRGB(0.30, 1.0, 0.3)
line.icon = "data/textures/icons/missile-swarm.png";
line.iconColor = iconColor
tooltip:addLine(line)
--table.insert(description, "Multiple Projectiles: Weapons fire multiple projectiles")
addBlankLine = true
end
--if turret.shootingTime == 1 then
if turret.shootingTime < 2 then
local line = TooltipLine(lineHeight, fontSize+2)
line.ltext = "Burst Fire" --lyr_nt
line.lcolor = ColorRGB(0.15, 1.0, 0.45)
line.icon = "data/textures/icons/bullets.png";
line.iconColor = iconColor
tooltip:addLine(line)
--table.insert(description, "Burst Fire: Fires rapidly for a second, then cools down")
addBlankLine = true
end
if turret.seeker then
local line = TooltipLine(lineHeight, fontSize+2)
line.ltext = "Guided Missiles" --lyr_nt
line.lcolor = ColorRGB(0.0, 1.0, 0.6)
line.icon = "data/textures/icons/rocket-thruster.png";
line.iconColor = iconColor
tooltip:addLine(line)
--table.insert(description, "Guided Missiles: Missiles track the targets")
addBlankLine = true
end
if amount > 0 then -- empty line
local profession = crewman.profession if addBlankLine then tooltip:addLine(TooltipLine(15, 15)) end
local line = TooltipLine(lineHeight, fontSize) fillDescriptions(turret, tooltip, description)
line.ltext = profession.name
line.rtext = round(amount)
line.icon = profession.icon;
line.iconColor = iconColor
tooltip:addLine(line)
end return tooltip
end
-- empty line
tooltip:addLine(TooltipLine(15, 15))
local description = {}
if turret.automatic then
table.insert(description, "Independent targeting, but deals less damage"%_t)
end
fillDescriptions(turret, tooltip, description)
return tooltip
endend
function makeFighterTooltip(fighter)function makeFighterTooltip(fighter)
-- create tool tip
local tooltip = Tooltip()
tooltip.icon = fighter.weaponIcon
-- create tool tip -- title
local tooltip = Tooltip() local title = "${weaponPrefix} Fighter"%_t % fighter
tooltip.icon = fighter.weaponIcon
-- title local line = TooltipLine(headLineSize-5, headLineFont)
local title = "${weaponPrefix} Fighter"%_t % fighter line.ctext = title
line.ccolor = fighter.rarity.color
tooltip:addLine(line)
local line = TooltipLine(headLineSize, headLineFont) -- primary stats, one by one
line.ctext = title local fontSize = 14
line.ccolor = fighter.rarity.color local lineHeight = 20
tooltip:addLine(line)
-- primary stats, one by one fillWeaponTooltipData(fighter, tooltip)
local fontSize = 14
local lineHeight = 20
fillWeaponTooltipData(fighter, tooltip) -- durability
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Durability"%_t
line.rtext = round(fighter.durability)
line.icon = "data/textures/icons/health-normal.png";
line.iconColor = iconColor
tooltip:addLine(line)
-- size local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize) line.ltext = "Shield"%_t
line.ltext = "Size"%_t line.rtext = fighter.shield > 0 and round(fighter.durability) or "None"
line.rtext = round(fighter.volume) line.icon = "data/textures/icons/health-normal.png";
line.icon = "data/textures/icons/fighter.png"; line.iconColor = iconColor
line.iconColor = iconColor tooltip:addLine(line)
tooltip:addLine(line)
-- empty line -- empty line
tooltip:addLine(TooltipLine(15, 15)) tooltip:addLine(TooltipLine(15, 15))
-- durability -- size
local line = TooltipLine(lineHeight, fontSize) local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Durability"%_t line.ltext = "Size"%_t
line.rtext = round(fighter.durability) line.rtext = round(fighter.volume)
line.icon = "data/textures/icons/health-normal.png"; line.icon = "data/textures/icons/fighter.png";
line.iconColor = iconColor line.iconColor = iconColor
tooltip:addLine(line) tooltip:addLine(line)
if fighter.shield > 0 then -- maneuverability
local line = TooltipLine(lineHeight, fontSize) local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Shield"%_t line.ltext = "Maneuverability"%_t
line.rtext = round(fighter.durability) line.rtext = round(fighter.turningSpeed, 2) --what's the unit?
line.icon = "data/textures/icons/health-normal.png"; line.icon = "data/textures/icons/dodge.png";
line.iconColor = iconColor line.iconColor = iconColor
tooltip:addLine(line) tooltip:addLine(line)
end
-- empty line -- velocity
tooltip:addLine(TooltipLine(15, 15)) local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Speed"%_t
line.rtext = round(fighter.maxVelocity * 10.0).."m/s" --lyr_nt
line.icon = "data/textures/icons/afterburn.png";
line.iconColor = iconColor
tooltip:addLine(line)
-- maneuverability -- crew requirements
local line = TooltipLine(lineHeight, fontSize) local pilot = CrewProfession(CrewProfessionType.Pilot)
line.ltext = "Maneuverability"%_t
line.rtext = round(fighter.turningSpeed, 2)
line.icon = "data/textures/icons/dodge.png";
line.iconColor = iconColor
tooltip:addLine(line)
-- velocity local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize) line.ltext = pilot.name
line.ltext = "Speed"%_t line.rtext = round(fighter.crew)
line.rtext = round(fighter.maxVelocity * 10.0) line.icon = pilot.icon
line.icon = "data/textures/icons/afterburn.png"; line.iconColor = iconColor
line.iconColor = iconColor tooltip:addLine(line)
tooltip:addLine(line)
-- empty line -- empty line
tooltip:addLine(TooltipLine(15, 15)) tooltip:addLine(TooltipLine(15, 15))
-- crew requirements fillDescriptions(fighter, tooltip)
local pilot = CrewProfession(CrewProfessionType.Pilot)
local line = TooltipLine(lineHeight, fontSize) return tooltip
line.ltext = pilot.nameend
line.rtext = round(fighter.crew)
line.icon = pilot.icon
line.iconColor = iconColor
tooltip:addLine(line)
-- empty line
tooltip:addLine(TooltipLine(15, 15))
fillDescriptions(fighter, tooltip)
return tooltip
end
Editor
Original Text
Changed Text
Recommended videos