From da292e4d9ad680d0acd03b79ac6a3d73518d7a35 Mon Sep 17 00:00:00 2001 From: Davi Date: Sun, 1 Dec 2019 15:15:45 -0500 Subject: [PATCH 1/2] Make monster carry weight 1/5th of body weight Previously, carry weight calculation for monsters was the same as for humans, using a 5 tier size system, where monsters were placed in tiers based on their weight. This caused a few problems: - Tier 5 too small in some cases (e.g. cows could only carry 52 kg) - Tier 1 too big in some cases (e.g. chickens carrying 3x body weight) - Tiers too granular; increase of a single kg could double carry weight --- src/monster.cpp | 5 +++++ src/monster.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/monster.cpp b/src/monster.cpp index 653a337f1d29e..10a90e5d6fc17 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -2547,6 +2547,11 @@ units::mass monster::get_weight() const return units::operator*( type->weight, get_size() / type->size ); } +units::mass monster::weight_capacity() const +{ + return type->weight / 5; +} + units::volume monster::get_volume() const { return units::operator*( type->volume, get_size() / type->size ); diff --git a/src/monster.h b/src/monster.h index 43e456a1060b7..266b0a29ede6a 100644 --- a/src/monster.h +++ b/src/monster.h @@ -107,6 +107,7 @@ class monster : public Creature void spawn( const tripoint &p ); m_size get_size() const override; units::mass get_weight() const override; + units::mass weight_capacity() const override; units::volume get_volume() const; int get_hp( hp_part ) const override; int get_hp() const override; From 499e228a9a55cb545d092579f32c19c52886f7ee Mon Sep 17 00:00:00 2001 From: DaviBones Date: Sun, 1 Dec 2019 16:15:32 -0500 Subject: [PATCH 2/2] Use existing member variable instead of literal Co-Authored-By: anothersimulacrum --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 10a90e5d6fc17..794024768f800 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -2549,7 +2549,7 @@ units::mass monster::get_weight() const units::mass monster::weight_capacity() const { - return type->weight / 5; + return type->weight * type->mountable_weight_ratio; } units::volume monster::get_volume() const