Skip to content

Commit

Permalink
fix(UI): farming zone activity warns if it is too cold (cataclysmbnte…
Browse files Browse the repository at this point in the history
…am#4347)

fix: farming zone activity warns if it is too cold
  • Loading branch information
ekaratzas authored Mar 14, 2024
1 parent 6ae1617 commit e6bcde7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/activity_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ enum class do_activity_reason : int {
NEEDS_HARVESTING, // For farming - tile is harvestable now.
NEEDS_PLANTING, // For farming - tile can be planted
NEEDS_TILLING, // For farming - tile can be tilled
NEEDS_WARM_WEATHER, // For farming - need warm weather to plant
BLOCKING_TILE, // Something has made it's way onto the tile, so the activity cannot proceed
NEEDS_CHOPPING, // There is wood there to be chopped
NEEDS_TREE_CHOPPING, // There is a tree there that needs to be chopped
Expand Down
8 changes: 6 additions & 2 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1632,10 +1632,11 @@ static activity_reason_info can_do_activity_there( const activity_id &act, playe
return activity_reason_info::fail( do_activity_reason::NEEDS_TILLING );
}
} else if( seed.is_valid() &&
here.has_flag_ter_or_furn( seed->seed->required_terrain_flag, src_loc ) &&
warm_enough_to_plant( src_loc ) ) {
here.has_flag_ter_or_furn( seed->seed->required_terrain_flag, src_loc ) ) {
if( here.has_items( src_loc ) ) {
return activity_reason_info::fail( do_activity_reason::BLOCKING_TILE );
} else if( !warm_enough_to_plant( src_loc ) ) {
return activity_reason_info::fail( do_activity_reason::NEEDS_WARM_WEATHER );
} else {
// do we have the required seed on our person?
// If its a farm zone with no specified seed, and we've checked for tilling and harvesting.
Expand Down Expand Up @@ -2714,12 +2715,15 @@ static requirement_check_result generic_multi_activity_check_requirement( player
reason == do_activity_reason::NO_ZONE ||
reason == do_activity_reason::ALREADY_DONE ||
reason == do_activity_reason::BLOCKING_TILE ||
reason == do_activity_reason::NEEDS_WARM_WEATHER ||
reason == do_activity_reason::UNKNOWN_ACTIVITY ) {
// we can discount this tile, the work can't be done.
if( reason == do_activity_reason::DONT_HAVE_SKILL ) {
p.add_msg_if_player( m_info, _( "You don't have the skill for this task." ) );
} else if( reason == do_activity_reason::BLOCKING_TILE ) {
p.add_msg_if_player( m_info, _( "There is something blocking the location for this task." ) );
} else if( reason == do_activity_reason::NEEDS_WARM_WEATHER ) {
p.add_msg_if_player( m_info, _( "It is too cold to plant anything now." ) );
}
return SKIP_LOCATION;
} else if( reason == do_activity_reason::NO_COMPONENTS ||
Expand Down

0 comments on commit e6bcde7

Please sign in to comment.