Skip to content

Commit

Permalink
feat: add support for transforming and regrowing harvestable furnitur…
Browse files Browse the repository at this point in the history
…e, harvested state for cattails (#5445)

* Commit for remote

* Go ahead and save the bees thing for later, finishing touches

* Document, also name tweak

* Update external_tileset.md
  • Loading branch information
chaosvolt authored Sep 28, 2024
1 parent b89e87b commit 3a81ca5
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 15 deletions.
4 changes: 3 additions & 1 deletion data/json/external_tileset/External_Tileset_DP_Normal.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
{ "id": [ "cannon_scrap_shot", "overlay_wielded_cannon_scrap_shot" ], "fg": 58 },
{ "id": [ "cannon_canister_shot", "overlay_wielded_cannon_canister_shot" ], "fg": 59 },
{ "id": [ "cannon_round_ball", "overlay_wielded_cannon_round_ball" ], "fg": 60 },
{ "id": [ "cannon_explosive_shell", "overlay_wielded_cannon_explosive_shell" ], "fg": 61 }
{ "id": [ "cannon_explosive_shell", "overlay_wielded_cannon_explosive_shell" ], "fg": 61 },
{ "id": "f_cattails_harvested", "fg": 62 },
{ "id": "f_cattails_harvested_season_winter", "fg": 63 }
],
"sprite_width": 32,
"sprite_height": 32
Expand Down
Binary file modified data/json/external_tileset/External_Tileset_DP_Normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion data/json/furniture_and_terrain/furniture-flora.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@
{
"type": "furniture",
"id": "f_cattails",
"name": "cattails",
"name": "harvested cattails",
"description": "This useful plant is available all year round. Many parts of the plant are edible.",
"symbol": "i",
"color": "brown",
"move_cost_mod": 1,
"required_str": -1,
"flags": [ "TRANSPARENT", "TINY", "FLAMMABLE_ASH", "NOCOLLIDE", "ORGANIC" ],
"examine_action": "harvest_furn",
"transforms_into": "f_cattails_harvested",
"harvest_by_season": [
{ "seasons": [ "winter" ], "entries": [ { "drop": "cattail_rhizome" } ] },
{
Expand All @@ -121,6 +122,19 @@
],
"bash": { "str_min": 2, "str_max": 6, "sound": "crunch.", "sound_fail": "whish." }
},
{
"type": "furniture",
"id": "f_cattails_harvested",
"copy-from": "f_cattails",
"name": "cattails",
"description": "This useful plant has been stripped of most of its stalks, and the easier-to-reach rhizomes have all been pulled up.",
"symbol": "i",
"color": "brown",
"extend": { "flags": [ "HARVESTED" ] },
"examine_action": "harvest_furn",
"transforms_into": "f_cattails",
"harvest_by_season": [ ]
},
{
"type": "furniture",
"id": "f_black_eyed_susan",
Expand Down
10 changes: 5 additions & 5 deletions data/json/npcs/missiondef.json
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,12 @@
"id": "MISSION_LEARN_ABOUT_CATTAIL_JELLY",
"type": "mission_definition",
"name": { "str": "Gather Cattail Stalks" },
"description": "Gather <color_light_blue>80 cattail stalks</color> from the swamp and bring them back to <color_light_red>learn how to craft cattail jelly</color>. Raise your <color_light_blue>survival skill to at least 1</color> by harvesting cattail stalks. <color_light_blue>Bring back the provided bag</color> as well.",
"description": "Gather <color_light_blue>20 cattail stalks</color> from the swamp and bring them back to <color_light_red>learn how to craft cattail jelly</color>. Raise your <color_light_blue>survival skill to at least 1</color> by harvesting cattail stalks or other plants. <color_light_blue>Bring back the provided bag</color> as well.",
"goal": "MGOAL_CONDITION",
"goal_condition": {
"and": [
{ "u_has_item": "duffelbag" },
{ "u_has_items": { "item": "cattail_stalk", "count": 80 } },
{ "u_has_items": { "item": "cattail_stalk", "count": 20 } },
{ "u_has_skill": { "skill": "survival", "level": 1 } }
]
},
Expand All @@ -811,16 +811,16 @@
},
"end": {
"effect": [
{ "u_sell_item": "cattail_stalk", "count": 80 },
{ "u_sell_item": "cattail_stalk", "count": 20 },
{ "u_sell_item": "duffelbag" },
{ "npc_consume_item": "cattail_stalk", "count": 80 },
{ "npc_consume_item": "cattail_stalk", "count": 20 },
{ "u_learn_recipe": "cattail_jelly" },
{ "u_buy_item": "cattail_jelly", "container": "bag_zipper", "count": 7 }
]
},
"dialogue": {
"describe": "Medical services are a little sparse following <the_cataclysm>, but people have been surviving using their wits and the bounty of Mother Nature for a long time. Care to learn a little?",
"offer": "Did you know that cattails are a source of a jelly that works as an antiseptic and analgesic? Something like that is likely to be mighty helpful out here. I want you to take this bag, head to the nearest swamp, collect 80 cattail stalks, and bring them back here. In exchange, I'll show you how to harvest the jelly.",
"offer": "Did you know that cattails are a source of a jelly that works as an antiseptic and analgesic? Something like that is likely to be mighty helpful out here. I want you to take this bag, head to the nearest swamp, collect 20 cattail stalks, and bring them back here. In exchange, I'll show you how to harvest the jelly.",
"accepted": "Great! This bag should be big enough to hold all of the stalks we'll need. Don't forget to bring it back.",
"rejected": "Your loss.",
"advice": "The cattails grow in the fresh water in swamps. You can't miss them.",
Expand Down
2 changes: 1 addition & 1 deletion data/json/regional_map_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"f_sunflower": 1,
"f_mustard": 1
},
"f_region_water_plant": { "f_cattails": 15, "f_lilypad": 1, "f_lotus": 5 }
"f_region_water_plant": { "f_cattails": 6, "f_lilypad": 3, "f_lotus": 3 }
}
},
"river_scale": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Links to relevant pull requests, for content covered below:
- Pirate Flag: [#5375](https://github.com/cataclysmbnteam/Cataclysm-BN/pull/5375)
- Makeshift cannons and canister shot:
[#5398](https://github.com/cataclysmbnteam/Cataclysm-BN/pull/5398)

- Harvested cattails: [#5445](https://github.com/cataclysmbnteam/Cataclysm-BN/pull/5445)
- Niter beds: [#5446](https://github.com/cataclysmbnteam/Cataclysm-BN/pull/5446)

## Undead People
Expand Down Expand Up @@ -96,6 +96,7 @@ Ultica are planned for the future.
- Jolly Roger, item and worn sprite. Item specific to BN.
- Makeshift cannon, item and vehiclepart sprite. Item specific to BN.
- Explosive cannonshells and sprites for readied cannon ammo. Items specific to BN.
- Harvested state for cattails, including winter variation. Furniture specific to BN.

### External_Tileset_DP_terrain_normal.png

Expand Down
10 changes: 6 additions & 4 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ static bool harvest_common( player &p, const tripoint &examp, bool furn, bool ne
const auto hid = here.get_harvest( examp );
if( hid.is_null() || hid->empty() ) {
if( !auto_forage ) {
p.add_msg_if_player( m_info, _( "Nothing can be harvested from this plant in current season." ) );
p.add_msg_if_player( m_info, _( "Nothing can be harvested from this currently." ) );
}
if( p.manual_examine ) {
iexamine::none( p, examp );
Expand Down Expand Up @@ -2032,7 +2032,8 @@ void iexamine::harvest_furn_nectar( player &p, const tripoint &examp )
bool auto_forage = get_option<bool>( "AUTO_FEATURES" ) &&
get_option<std::string>( "AUTO_FORAGING" ) == "both";
if( harvest_common( p, examp, true, true, auto_forage ) ) {
get_map().furn_set( examp, f_null );
map &here = get_map();
get_map().furn_set( examp, here.get_furn_transforms_into( examp ) );
}
}

Expand All @@ -2041,7 +2042,8 @@ void iexamine::harvest_furn( player &p, const tripoint &examp )
bool auto_forage = get_option<bool>( "AUTO_FEATURES" ) &&
get_option<std::string>( "AUTO_FORAGING" ) == "both";
if( harvest_common( p, examp, true, false, auto_forage ) ) {
get_map().furn_set( examp, f_null );
map &here = get_map();
get_map().furn_set( examp, here.get_furn_transforms_into( examp ) );
}
}

Expand Down Expand Up @@ -2073,7 +2075,7 @@ void iexamine::harvest_ter( player &p, const tripoint &examp )
*/
void iexamine::harvested_plant( player &p, const tripoint &examp )
{
p.add_msg_if_player( m_info, _( "Nothing can be harvested from this plant in current season" ) );
p.add_msg_if_player( m_info, _( "Nothing can be harvested from this currently." ) );
iexamine::none( p, examp );
}

Expand Down
10 changes: 8 additions & 2 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7499,14 +7499,20 @@ void map::grow_plant( const tripoint &p )
void map::restock_fruits( const tripoint &p, const time_duration &time_since_last_actualize )
{
const auto &ter = this->ter( p ).obj();
if( !ter.has_flag( TFLAG_HARVESTED ) ) {
const auto &furn = this->furn( p ).obj();
if( !ter.has_flag( TFLAG_HARVESTED ) && !furn.has_flag( TFLAG_HARVESTED ) ) {
return; // Already harvestable. Do nothing.
}
// Make it harvestable again if the last actualization was during a different season or year.
const time_point last_touched = calendar::turn - time_since_last_actualize;
if( season_of_year( calendar::turn ) != season_of_year( last_touched ) ||
time_since_last_actualize >= calendar::season_length() ) {
ter_set( p, ter.transforms_into );
if( ter.has_flag( TFLAG_HARVESTED ) ) {
ter_set( p, ter.transforms_into );
}
if( furn.has_flag( TFLAG_HARVESTED ) ) {
furn_set( p, furn.transforms_into );
}
}
}

Expand Down

0 comments on commit 3a81ca5

Please sign in to comment.