Skip to content

Commit

Permalink
Merge pull request #146 from klliio/plant-growth-rate
Browse files Browse the repository at this point in the history
Add adjustable plant harvest and growth speed options
  • Loading branch information
AtomicFox556 committed Feb 5, 2024
2 parents 0ce1c5d + a7df006 commit 97a5480
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/json/itemgroups/Clothing_Gear/costumes.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
{ "item": "robe", "prob": 10 },
{ "item": "samghati", "prob": 1 },
{ "item": "haori", "prob": 1 },
{ "item": "suit_bostonchan", "prob": 20 }
{ "item": "suit_bostonchan", "prob": 20 }
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ struct conditional_t {
void set_is_on_terrain_with_flag( const JsonObject &jo, const std::string &member,
bool is_npc = false );
void set_is_in_field( const JsonObject &jo, const std::string &member, bool is_npc = false );
void set_has_wielded_with_weapon_category( const JsonObject &jo, const std::string &member, bool is_npc = false );
void set_has_wielded_with_weapon_category( const JsonObject &jo, const std::string &member,
bool is_npc = false );
void set_one_in_chance( const JsonObject &jo, const std::string &member );
void set_query( const JsonObject &jo, const std::string &member, bool is_npc = false );
void set_x_in_y_chance( const JsonObject &jo, std::string_view member );
Expand Down
2 changes: 1 addition & 1 deletion src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7973,7 +7973,7 @@ void map::grow_plant( const tripoint &p )
const time_duration plantEpoch = seed->get_plant_epoch();
if( seed->age() >= plantEpoch * furn.plant->growth_multiplier &&
!furn.has_flag( ter_furn_flag::TFLAG_GROWTH_HARVEST ) ) {
if( seed->age() < plantEpoch * 2 ) {
if( seed->age() < plantEpoch * 2 * furn.plant->growth_multiplier ) {
if( has_flag_furn( ter_furn_flag::TFLAG_GROWTH_SEEDLING, p ) ) {
return;
}
Expand Down
4 changes: 3 additions & 1 deletion src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "iexamine_actors.h"
#include "item_group.h"
#include "json.h"
#include "options.h"
#include "output.h"
#include "rng.h"
#include "string_formatter.h"
Expand Down Expand Up @@ -466,7 +467,8 @@ bool furn_workbench_info::load( const JsonObject &jsobj, const std::string_view
}

plant_data::plant_data() : transform( furn_str_id::NULL_ID() ), base( furn_str_id::NULL_ID() ),
growth_multiplier( 1.0f ), harvest_multiplier( 1.0f ) {}
growth_multiplier( get_option<float>( "PLANT_GROWTH_RATE" ) ),
harvest_multiplier( get_option<float>( "HARVEST_MULTIPLIER" ) ) {}

bool plant_data::load( const JsonObject &jsobj, const std::string_view member )
{
Expand Down
14 changes: 13 additions & 1 deletion src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3041,7 +3041,7 @@ void options_manager::add_options_world_default()
to_translation( "Multiplier for experience gained from practicing skills and reading books. 0.5 is half as fast as default, 2 is twice as fast, 0 disables skill training except for NPC training. Higher value makes characters train skills faster." ),
0.00f, 100.00f, 1.00f, 0.01f
);

add( "PROFICIENCY_TRAINING_SPEED", "world_default", to_translation( "Proficiency training speed" ),
to_translation( "Scales experience gained from practicing proficiencies. 0.5 is half as fast as default, 2.0 is twice as fast, 0.0 disables proficiency training except for NPC training." ),
0.0, 100.0, 1.0, 0.1
Expand Down Expand Up @@ -3145,6 +3145,18 @@ void options_manager::add_options_world_default()

add_empty_line();

add( "PLANT_GROWTH_RATE", "world_default", to_translation( "Plant growth speed multiplier" ),
to_translation( "Multiplier for how fast plants grow in relation to their base speed. 0.5 is twice as fast, 2 is half as fast. Higher values make plants grow slower. Exteme values may yield unexpected results." ),
0.00f, 100.00f, 1.00f, 0.01f
);

add( "HARVEST_MULTIPLIER", "world_default", to_translation( "Plant harvest multiplier" ),
to_translation( "Multiplier for how much is harvested from a plant. A higher value has higher yields from crops." ),
0.01f, 100.00f, 1.00f, 0.01f
);

add_empty_line();

add( "PLAYER_HEALING_RATE", "world_default", to_translation( "Player heal speed multiplier" ),
to_translation( "Multiplier for base speed at which player character heals damage, further modified by many other factors. 0.5 is half as fast as default, 2 is twice as fast, 0 disables natural healing. Higher value makes player character recover lost HP faster." ),
0.00f, 100.00f, 1.00f, 0.01f
Expand Down

0 comments on commit 97a5480

Please sign in to comment.