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

Air conditioning re-push (screw you github) #1066

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -261,6 +261,8 @@ void game::start_game()
u.dex_cur = u.dex_max;
nextspawn = int(turn);
temperature = 65; // Springtime-appropriate?
u.next_climate_control_check=0; // Force recheck at startup
u.last_climate_control_ret=false;

//Load NPCs. Set nearby npcs to active.
load_npcs();
@@ -57,6 +57,8 @@ player::player()
prof = profession::has_initialized() ? profession::generic() : NULL; //workaround for a potential structural limitation, see player::create
moves = 100;
oxygen = 0;
next_climate_control_check=0;
last_climate_control_ret=false;
active_mission = -1;
in_vehicle = false;
style_selected = "null";
@@ -497,7 +499,7 @@ void player::update_bodytemp(game *g)
// BIONICS
// Bionic "Internal Climate Control" says it eases the effects of high and low ambient temps
const int variation = BODYTEMP_NORM*0.5;
if (has_bionic("bio_climate")
if (in_climate_control(g)
&& temp_conv[i] < BODYTEMP_SCORCHING + variation
&& temp_conv[i] > BODYTEMP_FREEZING - variation)
{
@@ -2322,6 +2324,29 @@ void player::toggle_trait(int flag)
my_mutations[flag] = !my_mutations[flag];
}

bool player::in_climate_control(game *g)
{
bool regulated_area=false;
if(has_active_bionic("bio_climate")) { return true; }
if(int(g->turn) >= next_climate_control_check) {
next_climate_control_check=int(g->turn)+20; // save cpu and similate acclimation.
int vpart = -1;
vehicle *veh = g->m.veh_at(posx, posy, vpart);
if(veh) {
regulated_area=(
veh->is_inside(vpart) && // Already checks for opened doors
veh->total_power(true) > 0 // Out of gas? No AC for you!
); // TODO: (?) Force player to scrounge together an AC unit
}
// TODO: AC check for when building power is implmented
last_climate_control_ret=regulated_area;
if(!regulated_area) { next_climate_control_check+=40; } // Takes longer to cool down / warm up with AC, than it does to step outside and feel cruddy.
} else {
return ( last_climate_control_ret ? true : false );
}
return regulated_area;
}

bool player::has_bionic(bionic_id b) const
{
for (int i = 0; i < my_bionics.size(); i++) {
@@ -72,6 +72,8 @@ class player {
bool has_mutation(int flag) const;
void toggle_trait(int flag);

bool in_climate_control(game *g);

bool has_bionic(bionic_id b) const;
bool has_active_bionic(bionic_id b) const;
void add_bionic(bionic_id b);
@@ -299,6 +301,8 @@ class player {
bool my_traits[PF_MAX2];
bool my_mutations[PF_MAX2];
int mutation_category_level[NUM_MUTATION_CATEGORIES];
int next_climate_control_check;
bool last_climate_control_ret;
std::vector<bionic> my_bionics;
// Current--i.e. modified by disease, pain, etc.
int str_cur, dex_cur, int_cur, per_cur;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.