Merge pull request #15181 from Mongoose-Publishing/master

[Mongoose Traveller 2e Official] - Version 1.1.16 - Encumberance And Equipment Weight Fixes
This commit is contained in:
Morgdalaine
2026-06-11 13:10:15 -05:00
committed by GitHub
2 changed files with 87 additions and 35 deletions
@@ -13059,7 +13059,7 @@
</div>
</div>
<div class="sheet-tab-content sheet-help">
<h3>Character Sheet Version 1.1.15</h3>
<h3>Character Sheet Version 1.1.16</h3>
<br>
<h4>Assigning Attributes To Tokens</h4>
<p style="margin-left: 10px; margin-top: 5px;">To represent the core character attributes on a token so they can be
@@ -14094,17 +14094,59 @@
});
});
// Total Weight
on("change:weightright change:weightleft change:fixedcombatweight change:repeatingarmourweight change:repeatingweaponweight change:current-Strength change:current-Endurance change:injury-Strength change:injury-Endurance change:skilllevel-Athletics change:armour-mass sheet:opened", function() {
getAttrs(["weightright", "weightleft", "fixedcombatweight", "repeatingarmourweight", "repeatingweaponweight",
"current-Strength", "current-Endurance", "skilllevel-Athletics", "armour-mass", "armour-carried"], function(values) {
on("change:weightright change:weightleft change:fixedcombatweight change:repeatingarmourweight change:repeatingweaponweight change:current-Strength change:current-Endurance change:injury-Strength change:injury-Endurance change:repeating_athleticsspec change:armour-mass sheet:opened", function(event) {
// In order to calculate encumberance we need to know STR and END which is easy, but also need to know
// the Athletics 'sub-skills' and check for strength or endurance specialities
let attrs = [
"weightright", "weightleft",
"fixedcombatweight",
"repeatingarmourweight", "repeatingweaponweight",
"current-Strength", "current-Endurance",
"skilllevel-Athletics", "skillCharacteristicDM-Athletics", "skillmodifier-Athletics",
"armour-mass", "armour-carried"
];
// Get our specialities and their modifier to re-create the inline formula
getSectionIDs("repeating_athleticsspec", function (idarr) {
for (let i=0; i<idarr.length; i++) {
attrs.push("repeating_athleticsspec_" + idarr[i] + "_skillspeciality-athleticsspec");
attrs.push("repeating_athleticsspec_" + idarr[i] + "_skilllevel-athleticsspec");
}
getAttrs(attrs, function(values) {
// Work out our carry capacity, STR and END are easy
let carryCapacity = parseInt(values["current-Strength"]) + parseInt(values["current-Endurance"]);
// See if we have an Athletics sub-specialty in Strength AND/OR Endurance, so iterate over 'values'
// keys and see what we've got
for (const [key, value] of Object.entries(values)) {
if(key.includes("repeating_athleticsspec")) {
if(key.includes("_skillspeciality-athleticsspec")) {
// Looking for Strength or Endurance so need a bit of trimming and case matching
let specialty = values[key].trim().toUpperCase();
console.log("- Processing specialty: " + specialty);
if(specialty.includes("STR") || specialty.includes("END")) {
// Calculate the mod from our various values
carryCapacity += +values[key.replace("_skillspeciality-athleticsspec", "_skilllevel-athleticsspec")];
}
}
// Need to delete these from the values object as we sum up below
delete values[key];
delete values[key.replace("_skillspeciality-athleticsspec", "_skilllevel-athleticsspec")]
}
}
// Grab our attrs to check weight against, then remove from values so we can tot up equipment weight
const carryCapacity = parseInt(values["current-Strength"]) + parseInt(values["current-Endurance"]) + parseInt(values["skilllevel-Athletics"]);
const armourMass = parseFloat(values["armour-mass"]) * parseFloat(values["armour-carried"]);
delete values["current-Strength"];
delete values["current-Endurance"];
delete values["skilllevel-Athletics"];
delete values["skillCharacteristicDM-Athletics"];
delete values["skillmodifier-Athletics"];
delete values["armour-mass"];
delete values["armour-carried"];
@@ -14132,6 +14174,7 @@
});
});
});
});
// Left equipment weight
on("change:repeating_othergear:massleft change:repeating_othergear:quantityleft change:repeating_othergear:equippedleft xxxsheet:opened", function() {
@@ -14182,6 +14225,9 @@
let taw = fcw + parseFloat(values["repeatingarmourweight"]);
let tww = 0;
for (let i=1; i<=6; i++) {
if(isNaN(values["weapon_weight-" + i])) {
values["weapon_weight-" + i] = 0;
}
tww += parseFloat(values["weapon_weight-" + i]) * parseInt(values["weapon_carried-" + i]);
}
fcw += tww;
@@ -14245,6 +14291,9 @@
getAttrs(attrs, function (values) {
for (var i=0; i<idarr.length; i++) {
if(isNaN(values["repeating_weapons_" + idarr[i] + "_weapon_weight-rep"])) {
values["repeating_weapons_" + idarr[i] + "_weapon_weight-rep"] = 0;
}
total += parseFloat(values["repeating_weapons_" + idarr[i] + "_weapon_weight-rep"]) *
parseFloat(values["repeating_weapons_" + idarr[i] + "_weapon_carried-rep"]);
}
@@ -19318,7 +19367,7 @@
attrs[prefix + slotId + "_reparmour-protection"] = armourProtection;
attrs[prefix + slotId + "_reparmour-protection-laser"] = armourProtectionLaser;
attrs[prefix + slotId + "_reparmour-rads"] = armourRad;
attrs[prefix + slotId + "_reparmour-mass"] = armourMass;
attrs[prefix + slotId + "_reparmour-mass"] = isNaN(armourMass) ? 0 : armourMass;
attrs[prefix + slotId + "_reparmour-RequiredSkill"] = armourSkill;
attrs[prefix + slotId + "_reparmornotes"] = armourDesc;
}
@@ -19424,7 +19473,7 @@
attrs["weapon_damage-" + nextWeaponSlot] = compendiumData["Damage"];
attrs["weapon_tl-" + nextWeaponSlot] = compendiumData["TL"];
attrs["weapon_range-" + nextWeaponSlot] = compendiumData["Range"];
attrs["weapon_weight-" + nextWeaponSlot] = compendiumData["KG"];
attrs["weapon_weight-" + nextWeaponSlot] = isNaN(compendiumData["KG"]) ? 0 : compendiumData["KG"];
attrs["weapon_magazine-" + nextWeaponSlot] = compendiumData["Magazine"];
attrs["weapon_auto-" + nextWeaponSlot] = compendiumData["Auto"];
attrs["weapon_automode" + nextWeaponSlot] = "Single";
+4 -1
View File
@@ -149,7 +149,10 @@ This is the Official Mongoose Traveller 2nd Edition Character Sheet
- Made robot PC skills panel show/hide via checkbox
- Improve armour encumbrance check for battle dress and powered suits where the armour weight is effectively zero rather than 25% when worn
- Fixed issues with equipment, weapons and armour weight calculations and triggering events
-
### Version 1.1.16
- Fixed bad compendium item weight/mass by checking for NaN
- Fixed encumberance carry capacity for Athletics specialties
![Image](Official%20Mongoose%20Publishing%20Traveller%202nd%20Edition.png)