Skip to content

Commit

Permalink
Unhardcode bio_heatsink and bio_climate (CleverRaven#47713)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramza13 authored and KorGgenT committed Jul 4, 2021
1 parent eb2f77f commit b432d6f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion data/json/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@
"act_cost": "100 J",
"react_cost": "100 J",
"time": 1,
"flags": [ "BIONIC_TOGGLED" ]
"flags": [ "BIONIC_TOGGLED" ],
"active_flags": [ "CLIMATE_CONTROL" ]
},
{
"id": "bio_cloak",
Expand Down Expand Up @@ -582,6 +583,7 @@
[ "foot_r", 1 ]
],
"flags": [ "BIONIC_TOGGLED", "BIONIC_NPC_USABLE" ],
"active_flags": [ "HEATSINK" ],
"act_cost": "1 kJ",
"react_cost": "1 kJ",
"time": 1
Expand Down
2 changes: 2 additions & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1549,3 +1549,5 @@ Gun fault flags:
- ```ALARMCLOCK``` You always can set alarms.
- ```PARAIMMUNE``` You are immune to parasites.
- ```IMMUNE_SPOIL``` You are immune to negative outcomes from spoiled food.
- ```CLIMATE_CONTROL``` You are resistant to extreme temperatures.
- ```HEATSINK``` You are resistant to extreme heat.
10 changes: 5 additions & 5 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,10 @@ static const trait_id trait_WOOLALLERGY( "WOOLALLERGY" );

static const bionic_id bio_ads( "bio_ads" );
static const bionic_id bio_blaster( "bio_blaster" );
static const bionic_id bio_climate( "bio_climate" );
static const bionic_id bio_voice( "bio_voice" );
static const bionic_id bio_flashlight( "bio_flashlight" );
static const bionic_id bio_gills( "bio_gills" );
static const bionic_id bio_ground_sonar( "bio_ground_sonar" );
static const bionic_id bio_heatsink( "bio_heatsink" );
static const bionic_id bio_hydraulics( "bio_hydraulics" );
static const bionic_id bio_jointservo( "bio_jointservo" );
static const bionic_id bio_laser( "bio_laser" );
Expand Down Expand Up @@ -387,13 +385,15 @@ static const json_character_flag json_flag_BLIND( "BLIND" );
static const json_character_flag json_flag_BULLET_IMMUNE( "BULLET_IMMUNE" );
static const json_character_flag json_flag_CLAIRVOYANCE( "CLAIRVOYANCE" );
static const json_character_flag json_flag_CLAIRVOYANCE_PLUS( "CLAIRVOYANCE_PLUS" );
static const json_character_flag json_flag_CLIMATE_CONTROL( "CLIMATE_CONTROL" );
static const json_character_flag json_flag_COLD_IMMUNE( "COLD_IMMUNE" );
static const json_character_flag json_flag_CUT_IMMUNE( "CUT_IMMUNE" );
static const json_character_flag json_flag_DEAF( "DEAF" );
static const json_character_flag json_flag_ELECTRIC_IMMUNE( "ELECTRIC_IMMUNE" );
static const json_character_flag json_flag_ENHANCED_VISION( "ENHANCED_VISION" );
static const json_character_flag json_flag_EYE_MEMBRANE( "EYE_MEMBRANE" );
static const json_character_flag json_flag_HEATPROOF( "HEATPROOF" );
static const json_character_flag json_flag_HEATSINK( "HEATSINK" );
static const json_character_flag json_flag_IMMUNE_HEARING_DAMAGE( "IMMUNE_HEARING_DAMAGE" );
static const json_character_flag json_flag_INFRARED( "INFRARED" );
static const json_character_flag json_flag_NIGHT_VISION( "NIGHT_VISION" );
Expand Down Expand Up @@ -4558,7 +4558,7 @@ bool Character::in_climate_control()
{
bool regulated_area = false;
// Check
if( has_active_bionic( bio_climate ) ) {
if( has_flag( json_flag_CLIMATE_CONTROL ) ) {
return true;
}
map &here = get_map();
Expand Down Expand Up @@ -6440,7 +6440,7 @@ void Character::update_bodytemp()
const bool has_sleep = has_effect( effect_sleep );
const bool has_sleep_state = has_sleep || in_sleep_state();
const bool heat_immune = has_flag( json_flag_HEATPROOF );
const bool has_heatsink = has_bionic( bio_heatsink ) || is_wearing( itype_rm13_armor_on ) ||
const bool has_heatsink = has_flag( json_flag_HEATSINK ) || is_wearing( itype_rm13_armor_on ) ||
heat_immune;
const bool has_common_cold = has_effect( effect_common_cold );
const bool has_climate_control = in_climate_control();
Expand Down Expand Up @@ -7458,7 +7458,7 @@ bool Character::is_immune_field( const field_type_id &fid ) const
return is_elec_immune();
}
if( ft.has_fire ) {
return has_active_bionic( bio_heatsink ) || is_wearing( itype_rm13_armor_on );
return has_flag( json_flag_HEATSINK ) || is_wearing( itype_rm13_armor_on );
}
if( ft.has_acid ) {
return !is_on_ground() && get_env_resist( body_part_foot_l ) >= 15 &&
Expand Down
8 changes: 4 additions & 4 deletions src/map_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ static const itype_id itype_rock( "rock" );

static const species_id species_FUNGUS( "FUNGUS" );

static const bionic_id bio_heatsink( "bio_heatsink" );

static const efftype_id effect_badpoison( "badpoison" );
static const efftype_id effect_blind( "blind" );
static const efftype_id effect_corroding( "corroding" );
Expand All @@ -93,6 +91,8 @@ static const trait_id trait_M_SKIN3( "M_SKIN3" );
static const trait_id trait_THRESH_MARLOSS( "THRESH_MARLOSS" );
static const trait_id trait_THRESH_MYCUS( "THRESH_MYCUS" );

static const json_character_flag json_flag_HEATSINK( "HEATSINK" );

using namespace map_field_processing;

void map::create_burnproducts( const tripoint &p, const item &fuel, const units::mass &burned_mass )
Expand Down Expand Up @@ -1472,7 +1472,7 @@ void map::player_in_field( player &u )
}
if( ft == fd_fire ) {
// Heatsink or suit prevents ALL fire damage.
if( !u.has_active_bionic( bio_heatsink ) && !u.is_wearing( itype_rm13_armor_on ) ) {
if( !u.has_flag( json_flag_HEATSINK ) && !u.is_wearing( itype_rm13_armor_on ) ) {

// To modify power of a field based on... whatever is relevant for the effect.
int adjusted_intensity = cur.get_field_intensity();
Expand Down Expand Up @@ -1587,7 +1587,7 @@ void map::player_in_field( player &u )
if( !inside ) {
// Fireballs can't touch you inside a car.
// Heatsink or suit stops fire.
if( !u.has_active_bionic( bio_heatsink ) &&
if( !u.has_flag( json_flag_HEATSINK ) &&
!u.is_wearing( itype_rm13_armor_on ) ) {
u.add_msg_player_or_npc( m_bad, _( "You're torched by flames!" ),
_( "<npcname> is torched by flames!" ) );
Expand Down

0 comments on commit b432d6f

Please sign in to comment.