Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
顯示
檢視
拆分
統一
即時編輯器
隱藏空白變更
摺疊未變更行
關閉換行
比對精度
智能
語法
無
變更外觀
處理
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
10 年前
差異永不過期
清除
匯出
分享
解釋
459 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
454 行
全部複製
762 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
740 行
全部複製
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 =
25
local headLineSize =
22
local headLineFont =
15
local 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
-- rarity name
local line = TooltipLine(5, 12)
local line = TooltipLine(5, 12)
複製
已複製
複製
已複製
line.ltext = "Tech: "..round(obj.averageTech, 1) --lyr_nt
複製
已複製
複製
已複製
line.ctext = tostring(obj.rarity)
line.ctext = tostring(obj.rarity)
複製
已複製
複製
已複製
line.rtext = obj.material.name
line.rcolor = obj.material.color
複製
已複製
複製
已複製
line.ccolor = obj.rarity.color
line.ccolor = obj.rarity.color
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
-- primary stats, one by one
-- primary stats, one by one
local fontSize = 14
local fontSize = 14
local lineHeight = 20
local lineHeight = 20
複製
已複製
複製
已複製
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)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "
Tech"%_t
line.ltext = "
Mining & Salvaging" --lyr_nt
line.rtext = round(obj.
averageTech
, 1)
line.rtext = round(obj.
dps
, 1)
.."/s"
line.icon = "data/textures/icons/
circuitry
.png";
line.icon = "data/textures/icons/
screen-impact
.png";
line.iconColor = iconColor
line.iconColor = iconColor
Text moved with changes to lines 384-387 (65.3% similarity)
tooltip:addLine(line)
tooltip:addLine(line)
--
line
1
--
empty
line
tooltip:addLine(TooltipLine(15, 15))
if obj.damage > 0 then
if obj.continuousBeam then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Damage /s"%_t
line.ltext = "Efficiencies" --lyr_nt
line.rtext = round(obj.dps, 1)
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.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
--line 1
複製
已複製
複製
已複製
else
-- damage
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "
Damage"%_t
line.ltext = "
Efficiency" --lyr_nt
line.rtext = round(obj.
damage, 1)
line.rtext = round(obj.
stoneEfficiency * 100, 1).."%"
if obj.shotsPerFiring > 1
then
line.icon = "data/textures/icons/recycle.png";
line
.r
text =
line.rtext
.. " x" ..
obj.
shotsPerFiring
line.iconColor = iconColor
end
tooltip:addLine(line) --line 2
else --if obj.metalEfficiency > 0
then
local
line
= TooltipLine(lineHeight, fontSize)
line.l
text =
"Salvaging" --lyr_nt
line.rtext
= round(
obj.
dps, 1).."/s"
line.icon = "data/textures/icons/screen-impact.png";
line.icon = "data/textures/icons/screen-impact.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
--line 1
複製
已複製
複製
已複製
-- fire rate
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "
Fire Rate"%_t
line.ltext = "
Efficiency" --lyr_nt
line.rtext = round(obj.
fireRate
, 1)
line.rtext = round(obj.
metalEfficiency * 100
, 1)
.."%"
line.icon = "data/textures/icons/
bullets
.png";
line.icon = "data/textures/icons/
recycle
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
--line 2
end
end
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
if obj.otherForce > 0 then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Push"%_t
line.ltext = "Push"%_t
line.rtext = toReadableValue(obj.otherForce, "N /* unit: Newton*/"%_t)
line.rtext = toReadableValue(obj.otherForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
--line 1 or 2
elseif obj.otherForce < 0 then
elseif obj.otherForce < 0 then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Pull"%_t
line.ltext = "Pull"%_t
line.rtext = toReadableValue(-obj.otherForce, "N /* unit: Newton*/"%_t)
line.rtext = toReadableValue(-obj.otherForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
--line 1 or 2
end
end
if obj.selfForce > 0 then
if obj.selfForce > 0 then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Self Push"%_t
line.ltext = "Self Push"%_t
line.rtext = toReadableValue(obj.selfForce, "N /* unit: Newton*/"%_t)
line.rtext = toReadableValue(obj.selfForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
--line 2
elseif obj.selfForce < 0 then
elseif obj.selfForce < 0 then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Self Pull"%_t
line.ltext = "Self Pull"%_t
line.rtext = toReadableValue(-obj.selfForce, "N /* unit: Newton*/"%_t)
line.rtext = toReadableValue(-obj.selfForce, "N /* unit: Newton*/"%_t)
line.icon = "data/textures/icons/back-forth.png";
line.icon = "data/textures/icons/back-forth.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
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
end
if obj.
stoneEfficiency > 0 and obj.metalEfficiency
> 0 then
if obj.
shieldRepairRate
> 0 then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "
Eff. Stone"%_t
line.ltext = "
Shield Charge" --lyr_nt
line.rtext = round(obj.
stoneEfficiency * 100
, 1)
line.rtext = round(obj.
shieldRepairRate
, 1)
.."/s"
line.icon = "data/textures/icons/
recycle
.png";
line.icon = "data/textures/icons/
health-normal
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
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)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "
Eff. Metal"%_t
line.ltext = "
Tick Damage" --lyr_nt
line.rtext = round(obj.
metalEfficiency * 100
, 1)
line.rtext = round(obj.
damage
, 1)
.."/tick"
line.icon = "data/textures/icons/
recycle
.png";
line.icon = "data/textures/icons/
screen-impact
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
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
elseif obj.stoneEfficiency > 0
then
if lyr.burstFire
then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "
Efficiency"%_t
line.ltext = "
Burst Damage" --lyr_nt
line.rtext = round(
obj.stoneEfficiency * 100
, 1)
line.rtext = round(
lyr.damagePerCycle
, 1)
.."/burst"
line.icon = "data/textures/icons/
recycle
.png";
line.icon = "data/textures/icons/
screen-impact
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
--line 2
else
if obj.metalEfficiency > 0 then
else
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "
Efficiency"%_t
line.ltext = "
Projectile Damage" --lyr_nt
line.rtext =
round(obj.
metalEfficiency * 100
, 1)
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/
recycle
.png";
line.icon = "data/textures/icons/
screen-impact
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
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
end
複製
已複製
複製
已複製
if
obj.hullRepairRate > 0
then
-- fire rate
if
lyr.burstFire
then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "
Hull Dmg /s"%_t
line.ltext = "
Burst Rate" --lyr_nt
line.rtext = round(
obj.hullRepairRate
, 1)
line.rtext = round(
lyr.cycle
, 1)
.."s/burst"
line.icon = "data/textures/icons/
health-normal
.png";
line.icon = "data/textures/icons/
bullets
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
end
else
if obj.shieldRepairRate > 0 then
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext =
"Shield Dmg /s"%_t
line.ltext =
lyr.isBeam and "Tick Rate" or "Fire Rate" --lyr_nt
line.rtext = round(
obj.shieldRepairRate
, 1)
line.rtext = round(
lyr.adjustedFireRate
, 1)
.."/s"
line.icon = "data/textures/icons/
health-normal
.png";
line.icon = "data/textures/icons/
bullets
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
end
end
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Accuracy"%_t
line.ltext = "Accuracy"%_t
line.rtext =
round(obj.accuracy * 100, 1)
line.rtext =
(lyr.isBeam or obj.accuracy == 1) and "Absolute" or
round(obj.accuracy * 100, 1)
.."%"
line.icon = "data/textures/icons/reticule.png";
line.icon = "data/textures/icons/reticule.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
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"
Text moved with changes from lines 429-432 (92.4% similarity)
line.icon = "data/textures/icons/blaster.png";
line.iconColor = iconColor
tooltip:addLine(line)
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Range"%_t
line.ltext = "Range"%_t
line.rtext = round(obj.reach
* 10 /
1000, 2)
line.rtext = round(obj.reach
*10/
1000, 2)
.."km"
line.icon = "data/textures/icons/target-shot.png";
line.icon = "data/textures/icons/target-shot.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))
if obj.coolingType == 1 or obj.coolingType == 2 then
if lyr.usesPower then
local line = TooltipLine(lineHeight, fontSize)
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)
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
複製
已複製
複製
已複製
line.ltext = "Accumulation" --lyr_nt
line.rtext = "+"..round(lyr.energyIncreasePerSecond, 0).."MW/s"
line.icon = "data/textures/icons/electric.png";
line.iconColor = iconColor
tooltip:addLine(line)
複製
已複製
複製
已複製
if obj.coolingType == 2 then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Energy /s"%_t
line.ltext = "Dispersion" --lyr_nt
else
line.rtext = "-"..round(obj.coolingRate, 0).."MW/s"
line.ltext = "Energy /shot"%_t
end
line.rtext = round(obj.baseEnergyPerSecond)
line.icon = "data/textures/icons/electric.png";
line.icon = "data/textures/icons/electric.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 = "
Energy Increase /s"%_t
line.ltext = "
Demand Ratio" --lyr_nt
line.rtext = round(obj.
energyIncreasePerSecond
, 1)
line.rtext = round(obj.
coolingRate/lyr.
energyIncreasePerSecond
).."x"
line.icon = "data/textures/icons/electric.png";
line.icon = "data/textures/icons/electric.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))
end
elseif lyr.drainsEnergy then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Energy Drain" --lyr_nt
line.rtext = round(lyr.heatPerShot+lyr.energyIncreasePerSecond, 1).."MJ/shot"
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 = "Material"%_t
line.ltext = "Accumulation" --lyr_nt
line.rtext = obj.material.name
line.rtext = "+"..round(lyr.energyIncreasePerSecond*lyr.adjustedFireRate, 0).."MJ/s"
line.rcolor = obj.material.color
line.icon = "data/textures/icons/
battery-pack-alt.png";
Text moved with changes from lines 443-445 (92.4% similarity)
line.icon = "data/textures/icons/
metal-bar
.png";
line.iconColor = iconColor
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Dispersion" --lyr_nt
line.rtext = "-"..round(obj.coolingRate, 0).."MJ/s"
line.icon = "data/textures/icons/battery-pack-alt.png";
line.iconColor = iconColor
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Drain Ratio" --lyr_nt
line.rtext = round((obj.coolingRate/lyr.energyIncreasePerSecond)/lyr.adjustedFireRate).."x"
line.icon = "data/textures/icons/battery-pack-alt
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
-- empty line
tooltip:addLine(TooltipLine(15, 15))
elseif lyr.generatesHeat and not lyr.neverOverheats then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Heat Generation" --lyr_nt
line.rtext = "+"..round(lyr.heatPerShot*10, 0).."%/shot"
line.icon = "data/textures/icons/flame.png";
line.iconColor = iconColor
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Overheat Time" --lyr_nt
line.rtext = round(lyr.timeToOverheat, 1).."s"
line.icon = "data/textures/icons/flame.png";
line.iconColor = iconColor
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Heat Dissipation" --lyr_nt
line.rtext = "-"..round(obj.coolingRate*10, 0).."%/s"
line.icon = "data/textures/icons/flame.png";
line.iconColor = iconColor
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Cooldown Time" --lyr_nt
line.rtext = round(lyr.timeToCooldown, 1).."s"
line.icon = "data/textures/icons/flame.png";
line.iconColor = iconColor
Text moved with changes from lines 29-32 (65.3% similarity)
tooltip:addLine(line)
-- empty line
tooltip:addLine(TooltipLine(15, 15))
end
--lyr_test
if lyr_debug then
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "drainTest"
line.rtext = obj.baseEnergyPerSecond/obj.shotsPerSecond+obj.energyIncreasePerSecond
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "numWeapons"
line.rtext = obj.numWeapons and round(obj.numWeapons, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "numVisibleWeapons"
line.rtext = obj.numVisibleWeapons and round(obj.numVisibleWeapons, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "coolingType"
line.rtext = obj.coolingType and round(obj.coolingType, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "coolingTime"
line.rtext = obj.coolingTime and round(obj.coolingTime, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "shootingTime"
line.rtext = obj.shootingTime and round(obj.shootingTime, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "heatPerShot"
line.rtext = obj.heatPerShot and round(obj.heatPerShot, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "dps"
line.rtext = obj.dps and round(obj.dps, 3) or "-"
tooltip:addLine(line)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "damage"
line.rtext = obj.damage and round(obj.damage, 3) or "-"
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
end
end
複製
已複製
複製
已複製
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
-- 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
-- to make sure that the icon of the weapon won't overlap with the stats
local extraLines =
0
local extraLines =
1
local fontSize =
14
local fontSize =
12
local lineHeight =
18
local lineHeight =
15
additional = additional or {}
複製
已複製
複製
已複製
-- one line for flavor text
-- one line for flavor text
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = obj.flavorText
line.ltext = obj.flavorText
line.lcolor = ColorRGB(1.0, 0.7, 0.7)
line.lcolor = ColorRGB(1.0, 0.7, 0.7)
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
extraLines = extraLines + 1
複製
已複製
複製
已複製
local descriptions = obj:getDescriptions()
local descriptions = obj:getDescriptions()
複製
已複製
複製
已複製
for desc, value in pairs(descriptions) do
for desc, value in pairs(descriptions) do
複製
已複製
複製
已複製
if not ignoreList[desc] then
extraLines = extraLines + 1
end
Text moved with changes from lines 253-257 (77.0% similarity)
end
for i = 1, 3 - extraLines do
-- empty line
tooltip:addLine(TooltipLine(lineHeight, fontSize))
end
for desc, value in pairs(descriptions) do
if not ignoreList[desc] then
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
if value == "" then
if value == "" then
line.ltext = desc % _t
line.ltext = desc % _t
else
else
line.ltext = string.format(desc % _t, value)
line.ltext = string.format(desc % _t, value)
end
end
複製
已複製
複製
已複製
local existsAlready
for _, desc in pairs(additional) do
if desc == line.ltext then
existsAlready = true
end
end
if not existsAlready then
複製
已複製
複製
已複製
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
extraLines = extraLines + 1
複製
已複製
複製
已複製
end
end
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
Text moved with changes to lines 514-518 (77.0% similarity)
end
for i = 1, 3 - extraLines do
-- empty line
tooltip:addLine(TooltipLine(15, 15))
end
end
end
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)
複製
已複製
複製
已複製
-- size
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Size"%_t
line.ltext = "Size"%_t
line.rtext = round(turret.size, 1)
line.rtext = round(turret.size, 1)
line.icon = "data/textures/icons/shotgun.png";
line.icon = "data/textures/icons/shotgun.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
-- automatic/independent firing
if turret.automatic then
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Independent Targeting"%_t
line.ltext = "Tracking Speed" --lyr_nt
line.icon = "data/textures/icons/
cog
.png";
line.rtext = round(turret.turningSpeed, 1)
line.icon = "data/textures/icons/
clockwise-rotation
.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
end
-- empty line
tooltip:addLine(TooltipLine(15, 15))
複製
已複製
複製
已複製
-- crew requirements
-- crew requirements
local crew = turret:getCrew()
local crew = turret:getCrew()
複製
已複製
複製
已複製
for crewman, amount in pairs(crew:getMembers()) do
for crewman, amount in pairs(crew:getMembers()) do
複製
已複製
複製
已複製
if amount > 0 then
if amount > 0 then
local profession = crewman.profession
local profession = crewman.profession
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = profession.name
line.ltext = profession.name
line.rtext = round(amount)
line.rtext = round(amount)
line.icon = profession.icon;
line.icon = profession.icon;
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
end
end
end
end
-- empty line
-- empty line
tooltip:addLine(TooltipLine(15, 15))
tooltip:addLine(TooltipLine(15, 15))
local
description
=
{}
local
addBlankLine
=
false
if turret.automatic then
if turret.automatic then
table.insert(description, "
Independent targeting, but deals less damage"%_t)
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
end
複製
已複製
複製
已複製
-- empty line
if addBlankLine then tooltip:addLine(TooltipLine(15, 15)) end
複製
已複製
複製
已複製
fillDescriptions(turret, tooltip, description)
fillDescriptions(turret, tooltip, description)
複製
已複製
複製
已複製
return tooltip
return tooltip
end
end
複製
已複製
複製
已複製
function makeFighterTooltip(fighter)
function makeFighterTooltip(fighter)
複製
已複製
複製
已複製
複製
已複製
複製
已複製
-- create tool tip
-- create tool tip
local tooltip = Tooltip()
local tooltip = Tooltip()
tooltip.icon = fighter.weaponIcon
tooltip.icon = fighter.weaponIcon
複製
已複製
複製
已複製
-- title
-- title
local title = "${weaponPrefix} Fighter"%_t % fighter
local title = "${weaponPrefix} Fighter"%_t % fighter
複製
已複製
複製
已複製
local line = TooltipLine(headLineSize
, headLineFont)
local line = TooltipLine(headLineSize
-5
, headLineFont)
line.ctext = title
line.ctext = title
line.ccolor = fighter.rarity.color
line.ccolor = fighter.rarity.color
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
-- primary stats, one by one
-- primary stats, one by one
local fontSize = 14
local fontSize = 14
local lineHeight = 20
local lineHeight = 20
複製
已複製
複製
已複製
fillWeaponTooltipData(fighter, tooltip)
fillWeaponTooltipData(fighter, tooltip)
複製
已複製
複製
已複製
Text moved with changes to lines 726-733 (90.9% similarity)
-- size
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Size"%_t
line.rtext = round(fighter.volume)
line.icon = "data/textures/icons/fighter.png";
line.iconColor = iconColor
tooltip:addLine(line)
-- empty line
tooltip:addLine(TooltipLine(15, 15))
複製
已複製
複製
已複製
-- durability
-- durability
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Durability"%_t
line.ltext = "Durability"%_t
line.rtext = round(fighter.durability)
line.rtext = round(fighter.durability)
line.icon = "data/textures/icons/health-normal.png";
line.icon = "data/textures/icons/health-normal.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
if fighter.shield > 0 then
複製
已複製
複製
已複製
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Shield"%_t
line.ltext = "Shield"%_t
line.rtext =
round(fighter.durability)
line.rtext =
fighter.shield > 0 and
round(fighter.durability)
or "None"
line.icon = "data/textures/icons/health-normal.png";
line.icon = "data/textures/icons/health-normal.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
tooltip:addLine(line)
複製
已複製
複製
已複製
end
複製
已複製
複製
已複製
-- empty line
-- empty line
tooltip:addLine(TooltipLine(15, 15))
tooltip:addLine(TooltipLine(15, 15))
複製
已複製
複製
已複製
Text moved with changes from lines 386-393 (90.9% similarity)
-- size
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Size"%_t
line.rtext = round(fighter.volume)
line.icon = "data/textures/icons/fighter.png";
line.iconColor = iconColor
tooltip:addLine(line)
複製
已複製
複製
已複製
-- maneuverability
-- maneuverability
local line = TooltipLine(lineHeight, fontSize)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Maneuverability"%_t
line.ltext = "Maneuverability"%_t
line.rtext = round(fighter.turningSpeed, 2)
line.rtext = round(fighter.turningSpeed, 2)
--what's the unit?
line.icon = "data/textures/icons/dodge.png";
line.icon = "data/textures/icons/dodge.png";
line.iconColor = iconColor
line.iconColor = iconColor
tooltip:addLine(line)
toolt
-- velocity
local line = TooltipLine(lineHeight, fontSize)
line.ltext = "Speed"%_t
line.rtext = round(fighter.maxVelocity * 10.0)
Text moved with changes to lines 281-284 (92.4% similarity)
line.icon = "data/textures/icons/afterburn.png";
line.iconColor = iconColor
tooltip:addLine(line)
-- empty line
tooltip:addLine(TooltipLine(15, 15))
-- crew requirements
local pilot = CrewProfession(CrewProfessionType.Pilot)
local line = TooltipLine(lineHeight, fontSize)
line.ltext = pilot.name
line.rtext = round(fighter.crew)
line.icon = pilot.icon
Text moved with changes to lines 338-340 (92.4% similarity)
line.iconColor = iconColor
tooltip:addLine(line)
-- empty line
tooltip:addLine(TooltipLine(15, 15))
fillDescriptions(fighter, tooltip)
return tooltip
end
已保存差異
原始文本
開啟檔案
package.path = package.path .. ";data/scripts/lib/?.lua" package.path = package.path .. ";data/scripts/?.lua" require ("utility") require ("stringutility") local iconColor = ColorRGB(0.5, 0.5, 0.5) local headLineSize = 25 local headLineFont = 15 local function fillWeaponTooltipData(obj, tooltip) -- rarity name local line = TooltipLine(5, 12) line.ctext = tostring(obj.rarity) line.ccolor = obj.rarity.color tooltip:addLine(line) -- primary stats, one by one local fontSize = 14 local lineHeight = 20 local line = TooltipLine(lineHeight, fontSize) line.ltext = "Tech"%_t line.rtext = round(obj.averageTech, 1) line.icon = "data/textures/icons/circuitry.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) if obj.damage > 0 then if obj.continuousBeam then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Damage /s"%_t line.rtext = round(obj.dps, 1) line.icon = "data/textures/icons/screen-impact.png"; line.iconColor = iconColor tooltip:addLine(line) else -- damage local line = TooltipLine(lineHeight, fontSize) line.ltext = "Damage"%_t line.rtext = round(obj.damage, 1) if obj.shotsPerFiring > 1 then 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) line.ltext = "Fire Rate"%_t line.rtext = round(obj.fireRate, 1) line.icon = "data/textures/icons/bullets.png"; line.iconColor = iconColor tooltip:addLine(line) end 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) 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 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) 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) end if obj.stoneEfficiency > 0 and obj.metalEfficiency > 0 then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Eff. Stone"%_t line.rtext = round(obj.stoneEfficiency * 100, 1) line.icon = "data/textures/icons/recycle.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Eff. Metal"%_t line.rtext = round(obj.metalEfficiency * 100, 1) line.icon = "data/textures/icons/recycle.png"; line.iconColor = iconColor tooltip:addLine(line) elseif obj.stoneEfficiency > 0 then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Efficiency"%_t line.rtext = round(obj.stoneEfficiency * 100, 1) line.icon = "data/textures/icons/recycle.png"; line.iconColor = iconColor tooltip:addLine(line) elseif obj.metalEfficiency > 0 then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Efficiency"%_t line.rtext = round(obj.metalEfficiency * 100, 1) line.icon = "data/textures/icons/recycle.png"; line.iconColor = iconColor tooltip:addLine(line) end if obj.hullRepairRate > 0 then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Hull Dmg /s"%_t line.rtext = round(obj.hullRepairRate, 1) line.icon = "data/textures/icons/health-normal.png"; line.iconColor = iconColor tooltip:addLine(line) end if obj.shieldRepairRate > 0 then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Shield Dmg /s"%_t line.rtext = round(obj.shieldRepairRate, 1) line.icon = "data/textures/icons/health-normal.png"; line.iconColor = iconColor tooltip:addLine(line) end local line = TooltipLine(lineHeight, fontSize) line.ltext = "Accuracy"%_t line.rtext = round(obj.accuracy * 100, 1) line.icon = "data/textures/icons/reticule.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Range"%_t line.rtext = round(obj.reach * 10 / 1000, 2) line.icon = "data/textures/icons/target-shot.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) if obj.coolingType == 1 or obj.coolingType == 2 then local line = TooltipLine(lineHeight, fontSize) if obj.coolingType == 2 then line.ltext = "Energy /s"%_t else line.ltext = "Energy /shot"%_t end line.rtext = round(obj.baseEnergyPerSecond) line.icon = "data/textures/icons/electric.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Energy Increase /s"%_t line.rtext = round(obj.energyIncreasePerSecond, 1) line.icon = "data/textures/icons/electric.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) end local line = TooltipLine(lineHeight, fontSize) line.ltext = "Material"%_t line.rtext = obj.material.name line.rcolor = obj.material.color line.icon = "data/textures/icons/metal-bar.png"; line.iconColor = iconColor tooltip:addLine(line) end local function fillDescriptions(obj, tooltip, additional) -- 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 = 0 local fontSize = 14 local lineHeight = 18 additional = additional or {} -- one line for flavor text local line = TooltipLine(lineHeight, fontSize) line.ltext = obj.flavorText line.lcolor = ColorRGB(1.0, 0.7, 0.7) tooltip:addLine(line) extraLines = extraLines + 1 local descriptions = obj:getDescriptions() for desc, value in pairs(descriptions) do local line = TooltipLine(lineHeight, fontSize) if value == "" then line.ltext = desc % _t else line.ltext = string.format(desc % _t, value) end local existsAlready for _, desc in pairs(additional) do if desc == line.ltext then existsAlready = true 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 end function makeTurretTooltip(turret) local tooltip = Tooltip() -- create tool tip tooltip.icon = turret.weaponIcon -- build title local title = "" local weapon = turret.weaponPrefix .. " /* Weapon Prefix*/" weapon = weapon % _t local tbl = {material = turret.material.name, weaponPrefix = weapon} if turret.stoneEfficiency > 0 or turret.metalEfficiency > 0 then if turret.numVisibleWeapons == 1 then title = "${material} ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 2 then title = "Double ${material} ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 3 then title = "Triple ${material} ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 4 then title = "Quad ${material} ${weaponPrefix} Turret"%_t % tbl else title = "Multi ${material} ${weaponPrefix} Turret"%_t % tbl end else if turret.numVisibleWeapons == 1 then title = "${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 2 then title = "Double ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 3 then title = "Triple ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 4 then title = "Quad ${weaponPrefix} Turret"%_t % tbl else title = "Multi ${weaponPrefix} Turret"%_t % tbl end end -- head line local line = TooltipLine(headLineSize, headLineFont) line.ctext = title line.ccolor = turret.rarity.color tooltip:addLine(line) local fontSize = 14; local lineHeight = 20; fillWeaponTooltipData(turret, tooltip) -- size 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 turret.automatic then 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 tooltip:addLine(TooltipLine(15, 15)) -- crew requirements local crew = turret:getCrew() for crewman, amount in pairs(crew:getMembers()) do if amount > 0 then local profession = crewman.profession local line = TooltipLine(lineHeight, fontSize) line.ltext = profession.name line.rtext = round(amount) line.icon = profession.icon; line.iconColor = iconColor tooltip:addLine(line) end 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 end function makeFighterTooltip(fighter) -- create tool tip local tooltip = Tooltip() tooltip.icon = fighter.weaponIcon -- title local title = "${weaponPrefix} Fighter"%_t % fighter local line = TooltipLine(headLineSize, headLineFont) line.ctext = title line.ccolor = fighter.rarity.color tooltip:addLine(line) -- primary stats, one by one local fontSize = 14 local lineHeight = 20 fillWeaponTooltipData(fighter, tooltip) -- size local line = TooltipLine(lineHeight, fontSize) line.ltext = "Size"%_t line.rtext = round(fighter.volume) line.icon = "data/textures/icons/fighter.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) -- 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) if fighter.shield > 0 then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Shield"%_t line.rtext = round(fighter.durability) line.icon = "data/textures/icons/health-normal.png"; line.iconColor = iconColor tooltip:addLine(line) end -- empty line tooltip:addLine(TooltipLine(15, 15)) -- maneuverability local line = TooltipLine(lineHeight, fontSize) 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) line.ltext = "Speed"%_t line.rtext = round(fighter.maxVelocity * 10.0) line.icon = "data/textures/icons/afterburn.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) -- crew requirements local pilot = CrewProfession(CrewProfessionType.Pilot) local line = TooltipLine(lineHeight, fontSize) line.ltext = pilot.name 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
更改後文本
開啟檔案
package.path = package.path .. ";data/scripts/lib/?.lua" package.path = package.path .. ";data/scripts/?.lua" require ("utility") require ("stringutility") local lyr_debug = false local iconColor = ColorRGB(0.5, 0.5, 0.5) local headLineSize = 22 local headLineFont = 16 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) -- primary stats, one by one local fontSize = 14 local lineHeight = 20 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 -- fire rate if lyr.burstFire then 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) line.ltext = "Accuracy"%_t line.rtext = (lyr.isBeam or obj.accuracy == 1) and "Absolute" or round(obj.accuracy * 100, 1).."%" line.icon = "data/textures/icons/reticule.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) 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) local line = TooltipLine(lineHeight, fontSize) 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) -- empty line tooltip:addLine(TooltipLine(15, 15)) if lyr.usesPower then local line = TooltipLine(lineHeight, fontSize) 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) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Accumulation" --lyr_nt line.rtext = "+"..round(lyr.energyIncreasePerSecond, 0).."MW/s" line.icon = "data/textures/icons/electric.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Dispersion" --lyr_nt line.rtext = "-"..round(obj.coolingRate, 0).."MW/s" line.icon = "data/textures/icons/electric.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Demand Ratio" --lyr_nt line.rtext = round(obj.coolingRate/lyr.energyIncreasePerSecond).."x" line.icon = "data/textures/icons/electric.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) elseif lyr.drainsEnergy then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Energy Drain" --lyr_nt line.rtext = round(lyr.heatPerShot+lyr.energyIncreasePerSecond, 1).."MJ/shot" line.icon = "data/textures/icons/battery-pack-alt.png"; line.iconColor = iconColor tooltip:addLine(line) 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) line.ltext = "Dispersion" --lyr_nt line.rtext = "-"..round(obj.coolingRate, 0).."MJ/s" line.icon = "data/textures/icons/battery-pack-alt.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Drain Ratio" --lyr_nt line.rtext = round((obj.coolingRate/lyr.energyIncreasePerSecond)/lyr.adjustedFireRate).."x" line.icon = "data/textures/icons/battery-pack-alt.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) elseif lyr.generatesHeat and not lyr.neverOverheats then local line = TooltipLine(lineHeight, fontSize) line.ltext = "Heat Generation" --lyr_nt line.rtext = "+"..round(lyr.heatPerShot*10, 0).."%/shot" line.icon = "data/textures/icons/flame.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Overheat Time" --lyr_nt line.rtext = round(lyr.timeToOverheat, 1).."s" line.icon = "data/textures/icons/flame.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Heat Dissipation" --lyr_nt line.rtext = "-"..round(obj.coolingRate*10, 0).."%/s" line.icon = "data/textures/icons/flame.png"; line.iconColor = iconColor tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Cooldown Time" --lyr_nt line.rtext = round(lyr.timeToCooldown, 1).."s" line.icon = "data/textures/icons/flame.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) end --lyr_test if lyr_debug then local line = TooltipLine(lineHeight, fontSize) line.ltext = "drainTest" line.rtext = obj.baseEnergyPerSecond/obj.shotsPerSecond+obj.energyIncreasePerSecond tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "numWeapons" line.rtext = obj.numWeapons and round(obj.numWeapons, 3) or "-" tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "numVisibleWeapons" line.rtext = obj.numVisibleWeapons and round(obj.numVisibleWeapons, 3) or "-" tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "coolingType" line.rtext = obj.coolingType and round(obj.coolingType, 3) or "-" tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "coolingTime" line.rtext = obj.coolingTime and round(obj.coolingTime, 3) or "-" tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "shootingTime" line.rtext = obj.shootingTime and round(obj.shootingTime, 3) or "-" tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "heatPerShot" line.rtext = obj.heatPerShot and round(obj.heatPerShot, 3) or "-" tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "dps" line.rtext = obj.dps and round(obj.dps, 3) or "-" tooltip:addLine(line) local line = TooltipLine(lineHeight, fontSize) line.ltext = "damage" line.rtext = obj.damage and round(obj.damage, 3) or "-" 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 end 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 -- one line for flavor text local line = TooltipLine(lineHeight, fontSize) line.ltext = obj.flavorText line.lcolor = ColorRGB(1.0, 0.7, 0.7) tooltip:addLine(line) local descriptions = obj:getDescriptions() for desc, value in pairs(descriptions) do if not ignoreList[desc] then extraLines = extraLines + 1 end end for i = 1, 3 - extraLines do -- empty line tooltip:addLine(TooltipLine(lineHeight, fontSize)) end for desc, value in pairs(descriptions) do if not ignoreList[desc] then local line = TooltipLine(lineHeight, fontSize) if value == "" then line.ltext = desc % _t else line.ltext = string.format(desc % _t, value) end tooltip:addLine(line) end end end function makeTurretTooltip(turret) local tooltip = Tooltip() local description = {} -- create tool tip tooltip.icon = turret.weaponIcon -- build title local title = "" local weapon = turret.weaponPrefix .. " /* Weapon Prefix*/" weapon = weapon % _t local tbl = {material = turret.material.name, weaponPrefix = weapon} if turret.stoneEfficiency > 0 or turret.metalEfficiency > 0 then if turret.numVisibleWeapons == 1 then title = "${material} ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 2 then title = "Double ${material} ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 3 then title = "Triple ${material} ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 4 then title = "Quad ${material} ${weaponPrefix} Turret"%_t % tbl else title = "Multi ${material} ${weaponPrefix} Turret"%_t % tbl end else if turret.numVisibleWeapons == 1 then title = "${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 2 then title = "Double ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 3 then title = "Triple ${weaponPrefix} Turret"%_t % tbl elseif turret.numVisibleWeapons == 4 then title = "Quad ${weaponPrefix} Turret"%_t % tbl else title = "Multi ${weaponPrefix} Turret"%_t % tbl end end -- head line local line = TooltipLine(headLineSize-5, headLineFont) line.ctext = title line.ccolor = turret.rarity.color tooltip:addLine(line) local fontSize = 14 local lineHeight = 20 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() for crewman, amount in pairs(crew:getMembers()) do if amount > 0 then local profession = crewman.profession local line = TooltipLine(lineHeight, fontSize) line.ltext = profession.name line.rtext = round(amount) line.icon = profession.icon; line.iconColor = iconColor tooltip:addLine(line) end end -- empty line tooltip:addLine(TooltipLine(15, 15)) local addBlankLine = false 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 -- empty line if addBlankLine then tooltip:addLine(TooltipLine(15, 15)) end fillDescriptions(turret, tooltip, description) return tooltip end function makeFighterTooltip(fighter) -- create tool tip local tooltip = Tooltip() tooltip.icon = fighter.weaponIcon -- title local title = "${weaponPrefix} Fighter"%_t % fighter local line = TooltipLine(headLineSize-5, headLineFont) line.ctext = title line.ccolor = fighter.rarity.color tooltip:addLine(line) -- primary stats, one by one 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) local line = TooltipLine(lineHeight, fontSize) line.ltext = "Shield"%_t line.rtext = fighter.shield > 0 and round(fighter.durability) or "None" line.icon = "data/textures/icons/health-normal.png"; line.iconColor = iconColor tooltip:addLine(line) -- empty line tooltip:addLine(TooltipLine(15, 15)) -- size local line = TooltipLine(lineHeight, fontSize) line.ltext = "Size"%_t line.rtext = round(fighter.volume) line.icon = "data/textures/icons/fighter.png"; line.iconColor = iconColor tooltip:addLine(line) -- maneuverability local line = TooltipLine(lineHeight, fontSize) line.ltext = "Maneuverability"%_t line.rtext = round(fighter.turningSpeed, 2) --what's the unit? line.icon = "data/textures/icons/dodge.png"; line.iconColor = iconColor tooltip:addLine(line) -- velocity 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) -- crew requirements local pilot = CrewProfession(CrewProfessionType.Pilot) local line = TooltipLine(lineHeight, fontSize) line.ltext = pilot.name 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
尋找差異