Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhardcode water_source to allow arbitrary liquid fields #75786

Closed
NetSysFire opened this issue Aug 18, 2024 · 1 comment · Fixed by #76366
Closed

Unhardcode water_source to allow arbitrary liquid fields #75786

NetSysFire opened this issue Aug 18, 2024 · 1 comment · Fixed by #76366
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Good First Issue This is a good first issue for a new contributor <Suggestion / Discussion> Talk it out before implementing

Comments

@NetSysFire
Copy link
Member

Is your feature request related to a problem? Please describe.

Right now only sewage, liquid cacao(?!), water and salt water have working liquid sources because they are hardcoded:

Cataclysm-DDA/src/map.cpp

Lines 5772 to 5795 in 711754c

item map::water_from( const tripoint_bub_ms &p ) const
{
weather_manager &weather = get_weather();
if( has_flag( ter_furn_flag::TFLAG_SALT_WATER, p ) ) {
item ret( "salt_water", calendar::turn, item::INFINITE_CHARGES );
ret.set_item_temperature( std::max( weather.get_temperature( p.raw() ),
temperatures::cold ) );
return ret;
}
if( has_flag( ter_furn_flag::TFLAG_CHOCOLATE, p ) ) {
item ret( "liquid_cacao", calendar::turn, item::INFINITE_CHARGES );
ret.set_item_temperature( std::max( weather.get_temperature( p.raw() ),
temperatures::cold ) );
return ret;
}
const ter_id terrain_id = ter( p );
if( terrain_id == ter_t_sewage ) {
item ret( "water_sewage", calendar::turn, item::INFINITE_CHARGES );
ret.set_item_temperature( std::max( weather.get_temperature( p.raw() ),
temperatures::cold ) );
return ret;
}

Solution you would like.

Rename water_source into liquid_source. Do mind the compatibility as some things do use water_source and must be adapted for the new thing. Make it an examine actor and allow an argument to specify the liquid item to be dispensed.
Also handle finite liquid sources appropriately.

Describe alternatives you have considered.

No response

Additional context

No response

@NetSysFire NetSysFire added Good First Issue This is a good first issue for a new contributor <Suggestion / Discussion> Talk it out before implementing [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. labels Aug 18, 2024
@NetSysFire NetSysFire changed the title Unhardcode water_source to allow arbitary liquid fields Unhardcode water_source to allow arbitrary liquid fields Aug 18, 2024
@Standing-Storm
Copy link
Contributor

Standing-Storm commented Aug 18, 2024

This is what's stopping me from letting people take the black liquid from the MoM map special pools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Good First Issue This is a good first issue for a new contributor <Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants