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> </div>
<div class="sheet-tab-content sheet-help"> <div class="sheet-tab-content sheet-help">
<h3>Character Sheet Version 1.1.15</h3> <h3>Character Sheet Version 1.1.16</h3>
<br> <br>
<h4>Assigning Attributes To Tokens</h4> <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 <p style="margin-left: 10px; margin-top: 5px;">To represent the core character attributes on a token so they can be
@@ -14094,41 +14094,84 @@
}); });
}); });
// Total Weight // 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() { 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) {
getAttrs(["weightright", "weightleft", "fixedcombatweight", "repeatingarmourweight", "repeatingweaponweight", // In order to calculate encumberance we need to know STR and END which is easy, but also need to know
"current-Strength", "current-Endurance", "skilllevel-Athletics", "armour-mass", "armour-carried"], function(values) { // 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"
];
// Grab our attrs to check weight against, then remove from values so we can tot up equipment weight // Get our specialities and their modifier to re-create the inline formula
const carryCapacity = parseInt(values["current-Strength"]) + parseInt(values["current-Endurance"]) + parseInt(values["skilllevel-Athletics"]); getSectionIDs("repeating_athleticsspec", function (idarr) {
const armourMass = parseFloat(values["armour-mass"]) * parseFloat(values["armour-carried"]); for (let i=0; i<idarr.length; i++) {
delete values["current-Strength"]; attrs.push("repeating_athleticsspec_" + idarr[i] + "_skillspeciality-athleticsspec");
delete values["current-Endurance"]; attrs.push("repeating_athleticsspec_" + idarr[i] + "_skilllevel-athleticsspec");
delete values["skilllevel-Athletics"];
delete values["armour-mass"];
delete values["armour-carried"];
const tw = Object.values(values).reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
const tiw = parseFloat(values.weightleft) + parseFloat(values.weightright)
// Calculate encumberance, Armour is only 25% of its weight for encumberance purposes, knock it off and re-calc
const totalArmourWeight = parseFloat(values.repeatingarmourweight) + armourMass;
let totalEncumberanceWeight = tw; // (tw - totalArmourWeight) + (totalArmourWeight * 0.25);
totalEncumberanceWeight = totalEncumberanceWeight.toFixed(2); //Math.round(totalEncumberanceWeight * 10) / 10;
let encumbered = totalEncumberanceWeight > carryCapacity ? "Yes" : "No";
// If the total gear weight is TWICE our capacity, then signal the DM-2 on physical actions
if(totalEncumberanceWeight > carryCapacity * 2) {
encumbered = "Yes (DM-2)";
} }
//console.log("carryCapacity: " + carryCapacity); getAttrs(attrs, function(values) {
setAttrs({ // Work out our carry capacity, STR and END are easy
totalweight: tw.toFixed(1), let carryCapacity = parseInt(values["current-Strength"]) + parseInt(values["current-Endurance"]);
totalitemweight: tiw,
encumbered: encumbered, // See if we have an Athletics sub-specialty in Strength AND/OR Endurance, so iterate over 'values'
carrycapacity: "" + totalEncumberanceWeight + "/" + carryCapacity, // keys and see what we've got
totalequipmentweight: tiw.toFixed(2) 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 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"];
const tw = Object.values(values).reduce((a, b) => parseFloat(a) + parseFloat(b), 0);
const tiw = parseFloat(values.weightleft) + parseFloat(values.weightright)
// Calculate encumberance, Armour is only 25% of its weight for encumberance purposes, knock it off and re-calc
const totalArmourWeight = parseFloat(values.repeatingarmourweight) + armourMass;
let totalEncumberanceWeight = tw; // (tw - totalArmourWeight) + (totalArmourWeight * 0.25);
totalEncumberanceWeight = totalEncumberanceWeight.toFixed(2); //Math.round(totalEncumberanceWeight * 10) / 10;
let encumbered = totalEncumberanceWeight > carryCapacity ? "Yes" : "No";
// If the total gear weight is TWICE our capacity, then signal the DM-2 on physical actions
if(totalEncumberanceWeight > carryCapacity * 2) {
encumbered = "Yes (DM-2)";
}
//console.log("carryCapacity: " + carryCapacity);
setAttrs({
totalweight: tw.toFixed(1),
totalitemweight: tiw,
encumbered: encumbered,
carrycapacity: "" + totalEncumberanceWeight + "/" + carryCapacity,
totalequipmentweight: tiw.toFixed(2)
});
}); });
}); });
}); });
@@ -14182,6 +14225,9 @@
let taw = fcw + parseFloat(values["repeatingarmourweight"]); let taw = fcw + parseFloat(values["repeatingarmourweight"]);
let tww = 0; let tww = 0;
for (let i=1; i<=6; i++) { 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]); tww += parseFloat(values["weapon_weight-" + i]) * parseInt(values["weapon_carried-" + i]);
} }
fcw += tww; fcw += tww;
@@ -14245,6 +14291,9 @@
getAttrs(attrs, function (values) { getAttrs(attrs, function (values) {
for (var i=0; i<idarr.length; i++) { 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"]) * total += parseFloat(values["repeating_weapons_" + idarr[i] + "_weapon_weight-rep"]) *
parseFloat(values["repeating_weapons_" + idarr[i] + "_weapon_carried-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"] = armourProtection;
attrs[prefix + slotId + "_reparmour-protection-laser"] = armourProtectionLaser; attrs[prefix + slotId + "_reparmour-protection-laser"] = armourProtectionLaser;
attrs[prefix + slotId + "_reparmour-rads"] = armourRad; 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 + "_reparmour-RequiredSkill"] = armourSkill;
attrs[prefix + slotId + "_reparmornotes"] = armourDesc; attrs[prefix + slotId + "_reparmornotes"] = armourDesc;
} }
@@ -19424,7 +19473,7 @@
attrs["weapon_damage-" + nextWeaponSlot] = compendiumData["Damage"]; attrs["weapon_damage-" + nextWeaponSlot] = compendiumData["Damage"];
attrs["weapon_tl-" + nextWeaponSlot] = compendiumData["TL"]; attrs["weapon_tl-" + nextWeaponSlot] = compendiumData["TL"];
attrs["weapon_range-" + nextWeaponSlot] = compendiumData["Range"]; 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_magazine-" + nextWeaponSlot] = compendiumData["Magazine"];
attrs["weapon_auto-" + nextWeaponSlot] = compendiumData["Auto"]; attrs["weapon_auto-" + nextWeaponSlot] = compendiumData["Auto"];
attrs["weapon_automode" + nextWeaponSlot] = "Single"; 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 - 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 - 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 - 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) ![Image](Official%20Mongoose%20Publishing%20Traveller%202nd%20Edition.png)