Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Changes the unit info feature to include many more stats, and do a much better job at hiding useless information
- // If you are installing this script with the R26 mod loader, it is recommended you use the online installation so in case this gets updated, you will always have the newest version. To use online mods, you need the raw URL: https://pastebin.com/raw/tSR1HQVi
- // - - - - - - - - - - - - - - - - - - - -
- /* Changelog (note i am from the US so dates are in month/day/year format)
- 2/2/2020
- - Initial release
- - Some unit changes
- - Fixed issue with shield stat disappearing when a ship with shield generators runs out of shield
- 2/3/2020
- - Changed Brawling Value image to rank14.png (skull icon)
- - Reused instant.png (old BV icon) as hp*dps (basically brawling value with the cost factor removed)
- - Changed energy image to rank12.png (thicker, easier to see lightning bolt)
- 5/15/2020
- - Added ship name, shows only one ship is selected
- - Made quantity hide if one ship is selected
- - - - - - - - - - - - - - - - - - - - - */
- buildBar.selectedInfo = function() {
- var cost, j, len, name, stat, stats, unit, units;
- units = commander.selection;
- cost = units.reduce((function(acc, unit) {
- return acc + unit.cost;
- }), 0);
- name = null;
- if (units.length > 0 && units.every(function(u) {
- return u.spec.name === units[0].spec.name;
- })) {
- name = units[0].spec.name || null;
- }
- stats = {};
- stat = function(icon, unit, value, maxValue, opts) {
- if (maxValue == null) {
- maxValue = 0;
- }
- if (opts == null) {
- opts = {
- hideZero: false,
- largest: false,
- sum: true,
- hideMultiple: false,
- fixed: 1,
- };
- }
- if (opts.hideZero && value === 0) {
- return;
- }
- if (!stats[icon]) {
- return stats[icon] = {
- value: value,
- maxValue: maxValue,
- unit: unit,
- fixed: opts.fixed,
- count: 1
- };
- } else {
- if (opts.hideMultiple) {
- stats[icon].hidden = true;
- } else if (opts.largest) {
- stats[icon].value = Math.max(stats[icon].value, value);
- stats[icon].maxValue = Math.max(stats[icon].maxValue, maxValue);
- } else {
- stats[icon].value += value;
- stats[icon].maxValue += maxValue;
- }
- if (!opts.sum && !opts.largest) {
- return stats[icon].count++;
- }
- }
- };
- for (j = 0, len = units.length; j < len; j++) {
- unit = units[j];
- if (commander.selection[0].name != "") {
- stat("letters.png", " " + unit.name, 0, 0, {
- hideMultiple: true,
- fixed: 0
- });
- } else {
- stat("letters.png", " Unnamed ship", 0, 0, {
- hideMultiple: true,
- fixed: 0
- });
- }
- if (units.length > 1) {
- stat("count.png", "", 1, 0, {
- sum: true,
- fixed: 0
- });
- }
- stat("cost.png", "$", unit.cost, 0, {
- sum: true,
- fixed: 0
- });
- stat("rank/rank14.png", "BV", unit.hp * unit.weaponDPS * 16 / unit.cost, unit.maxHP * unit.weaponDPS * 16 / unit.cost, {
- sum: false,
- hideZero: true,
- fixed: 0
- });
- stat("instant.png", "hp*dps", unit.hp * unit.weaponDPS * 16, unit.maxHP * unit.weaponDPS * 16, {
- sum: true,
- hideZero: true,
- fixed: 0
- });
- stat("armor.png", "hp", unit.hp, unit.maxHP, {
- sum: true,
- fixed: 0
- });
- if(unit.maxShield>0){
- stat("shield.png", "sh", unit.shield, unit.maxShield, {
- sum: true,
- fixed: 0
- });
- stat("symmetry.png", "sh/s", unit.genShield * 16, 0, {
- fixed: 0,
- sum: true
- });
- stat("armor2.png", "hp+sh", unit.hp+unit.shield, unit.maxHP+unit.maxShield, {
- fixed: 0,
- sum: true
- });
- }
- stat("burnDamage.png", "d", unit.burn, 0, {
- hideZero: true
- });
- if(unit.weaponDPS > 0) {
- stat("dps.png", "dps", unit.weaponDPS * 16);
- stat("damage.png", "d", unit.weaponDamage);
- }
- stat("range.png", "m", unit.weaponRange, 0, {
- largest: true,
- fixed: 0,
- hideZero: true
- });
- stat("rank/rank12.png", "K e", unit.energy/1000, unit.storeEnergy/1000, {
- sum: true,
- fixed: 0
- });
- if(unit.genEnergy > 2.6) {
- stat("energyGen.png", "e/s", unit.genEnergy*16, 0, {
- sum: true,
- fixed: 0
- });
- }
- stat("energyMove.png", "e/s", unit.moveEnergy * 16, 0, {
- sum: true
- });
- stat("energyFire.png", "e/s", unit.fireEnergy * 16, 0, {
- sum: true,
- hideZero: true
- });
- stat("speed.png", "m/s", unit.maxSpeed * 16, 0, {
- sum: false
- });
- stat("turnSpeed.png", "°/s", unit.turnSpeed * 180 / Math.PI * 16, 0, {
- hideMultiple: true,
- fixed: 0
- });
- stat("mass.png", "T", unit.mass, 0, {
- hideMultiple: true,
- fixed: 0
- });
- stat("arc360.png", "m radius", unit.radius, 0, {
- hideMultiple: true,
- fixed: 0
- });
- stat("cloak.png", "T", unit.cloak, unit.mass, {
- hideZero: true,
- fixed: 0
- });
- stat("jump.png", "m", unit.jump, unit.jumpDistance, {
- hideZero: true,
- largest: true,
- fixed: 0
- });
- }
- return {
- name: name,
- cost: cost,
- stats: stats
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement