Skip to content

Commit

Permalink
Cargo weight modifier update (#1687)
Browse files Browse the repository at this point in the history
* fixes cargo weight mod bottoming to 0 (#53812)

* Remove duplicated entry

Not truly duplicated, but the second entry provides better info and an illustration of use.

Co-authored-by: Dillon Matchett <dillon.matchett@gmail.com>
  • Loading branch information
KheirFerrum and bombasticSlacks committed Jul 6, 2022
1 parent a3aeb2c commit f15b4f8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,6 @@ Vehicle components when installed on a vehicle.
"durability": 200, // How much damage the part can take before breaking
"description": "A wheel." // A description of this vehicle part when installing it
"size": 2000 // If vehicle part has flag "FLUIDTANK" then capacity in mLs, else divide by 4 for volume on space
"cargo_weight_modifier": 100 // Special function to multiplicatively modify item weight on space. Divide by 100 for ratio.
"wheel_width": 9, /* (Optional, default = 0)
* SPECIAL: A part may have at most ONE of the following fields:
* wheel_width = base wheel width in inches
Expand Down
2 changes: 1 addition & 1 deletion src/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6809,7 +6809,7 @@ void vehicle::calc_mass_center( bool use_precalc ) const
m_part_items += j.weight();
}
if( vp.part().info().cargo_weight_modifier != 100 ) {
m_part_items *= vp.part().info().cargo_weight_modifier / 100;
m_part_items *= static_cast<float>( vp.part().info().cargo_weight_modifier ) / 100.0f;
}
m_part += m_part_items;

Expand Down

0 comments on commit f15b4f8

Please sign in to comment.