Permalink
Browse files

player display: allow for hidden traits

Add support for hidden traits that are not displayed in the '@' menu.
  • Loading branch information...
mlangsdorf committed Jan 4, 2019
1 parent 8f23ec8 commit cef174f2b7225f587874f42397e95a9a251785cc
Showing with 11 additions and 4 deletions.
  1. +2 −0 doc/JSON_INFO.md
  2. +1 −1 src/character.h
  3. +2 −0 src/mutation.h
  4. +1 −0 src/mutation_data.cpp
  5. +4 −2 src/newcharacter.cpp
  6. +1 −1 src/player_display.cpp
@@ -585,6 +585,8 @@ Mods can modify this via `add:traits` and `remove:traits`.
"valid": false, // Can be mutated ingame (default: true)
"purifiable": false, //Sets if the mutation be purified (default: true)
"profession": true, //Trait is a starting profession special trait. (default: false)
"debug": false, //Trait is for debug purposes (default: false)
"player_display": true, //Trait is displayed in the `@` player display menu
"initial_ma_styles" : [ "style_centipede", "style_venom_snake" ], //List of starting martial arts types. One of the list is selectable at start. Only works at character creation.
"category": ["MUTCAT_BIRD", "MUTCAT_INSECT"], // Categories containing this mutation
"prereqs": ["SKIN_ROUGH"], // Needs these mutations before you can mutate toward this mutation
@@ -707,7 +707,7 @@ class Character : public Creature, public visitable<Character>
/** Get the idents of all base traits. */
std::vector<trait_id> get_base_traits() const;
/** Get the idents of all traits/mutations. */
std::vector<trait_id> get_mutations() const;
std::vector<trait_id> get_mutations( bool include_hidden = true ) const;
const std::bitset<NUM_VISION_MODES> &get_vision_modes() const {
return vision_mode_cache;
}
@@ -95,6 +95,8 @@ struct mutation_branch {
bool profession;
//True if the mutation is obtained through the debug menu
bool debug;
// True if the mutation should be displayed in the `@` menu
bool player_display = true;
// Whether it has positive as well as negative effects.
bool mixed_effect = false;
bool startingtrait = false;
@@ -282,6 +282,7 @@ void mutation_branch::load( JsonObject &jsobj )
new_mut.threshold = jsobj.get_bool( "threshold", false );
new_mut.profession = jsobj.get_bool( "profession", false );
new_mut.debug = jsobj.get_bool( "debug", false );
new_mut.player_display = jsobj.get_bool( "player_display", true );

auto vr = jsobj.get_array( "vitamin_rates" );
while( vr.has_more() ) {
@@ -2433,11 +2433,13 @@ std::vector<trait_id> Character::get_base_traits() const
return std::vector<trait_id>( my_traits.begin(), my_traits.end() );
}

std::vector<trait_id> Character::get_mutations() const
std::vector<trait_id> Character::get_mutations( bool include_hidden ) const
{
std::vector<trait_id> result;
for( auto &t : my_mutations ) {
result.push_back( t.first );
if( include_hidden || t.first.obj().player_display ) {
result.push_back( t.first );
}
}
return result;
}
@@ -317,7 +317,7 @@ Strength - 4; Dexterity - 4; Intelligence - 4; Perception - 4" ) );

unsigned effect_win_size_y = 1 + unsigned( effect_name.size() );

std::vector<trait_id> traitslist = get_mutations();
std::vector<trait_id> traitslist = get_mutations( false );
unsigned trait_win_size_y = 1 + unsigned( traitslist.size() );

std::vector<bionic> bionicslist = *my_bionics;

0 comments on commit cef174f

Please sign in to comment.