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

Add CBM Artificial Night #1724

Merged
merged 4 commits into from
Jun 27, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ void player::activate_bionic(int b, game *g)
pkill = pain;
} else if (bio.id == "bio_nanobots"){
healall(4);
} else if (bio.id == "bio_night"){
if (g->turn % 5)
g->add_msg("Artificial night generator active!");
} else if (bio.id == "bio_resonator"){
g->sound(posx, posy, 30, "VRRRRMP!");
for (int i = posx - 1; i <= posx + 1; i++) {
Expand Down Expand Up @@ -1045,6 +1048,9 @@ Interfaces your power system with the internal charging port on suits of power a
The Mk. II was designed by DoubleTech Inc., to meet the popularity of the Mk. II\n\
power armor series.");

bionics["bio_night"] = new bionic_data("Artificial Night Generator", false, true, 1, 2, "\
Destructive interference eliminates all light within a 15 tile radius.");

bionics["bio_flashbang"] = new bionic_data("Flashbang Generator", false, true, 5, 0, "\
Light emitting diodes integrated into your skin can release a flash comparable\n\
to a flashbang grenade, blinding nearby enemies. Speakers integrated into your\n\
Expand Down
6 changes: 4 additions & 2 deletions game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3837,7 +3837,7 @@ bool game::sees_u(int x, int y, int &t)
if( range <= 0)
range = 1;

return (!u.has_active_bionic("bio_cloak") &&
return ((!u.has_active_bionic("bio_cloak") || !u.has_active_bionic("bio_night")) &&
!u.has_artifact_with(AEP_INVISIBLE) &&
m.sees(x, y, u.posx, u.posy, range, t));
}
Expand All @@ -3852,7 +3852,9 @@ bool game::u_see(int x, int y)
else if (wanted_range <= u.sight_range(light_level()) ||
(wanted_range <= u.sight_range(DAYLIGHT_LEVEL) &&
m.light_at(x, y) >= LL_LOW))
can_see = m.pl_sees(u.posx, u.posy, x, y, wanted_range);
can_see = m.pl_sees(u.posx, u.posy, x, y, wanted_range);
if (u.has_active_bionic("bio_night") && wanted_range < 15 && wanted_range > u.sight_range(1))
return false;

return can_see;
}
Expand Down
3 changes: 2 additions & 1 deletion itypedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ BIO_SINGLE("bio_armor_legs", 3, 3500, c_cyan, 3);
BIO_SINGLE("bio_face_mask", 1, 8500, c_magenta, 5);
BIO_SINGLE("bio_scent_mask", 1, 8500, c_magenta, 5);
BIO_SINGLE("bio_cloak", 1, 8500, c_magenta, 5);
BIO_SINGLE("bio_fingerhack", 1, 3500, c_magenta, 2);
BIO_SINGLE("bio_fingerhack", 1, 3500, c_magenta, 2);
BIO_SINGLE("bio_night", 1, 8500, c_magenta, 5);
// defensive
BIO_SINGLE("bio_ads", 1, 9500, c_ltblue, 7);
BIO_SINGLE("bio_ods", 1, 9500, c_ltblue, 7);
Expand Down
10 changes: 10 additions & 0 deletions lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@ void map::generate_lightmap(game* g)
}
}
}
for(int sx = 0; sx < LIGHTMAP_CACHE_X; ++sx)
{
for(int sy = 0; sy < LIGHTMAP_CACHE_Y; ++sy)
{
if (g->u.has_active_bionic("bio_night") && rl_dist(sx, sy, g->u.posx, g->u.posy) < 15)
{
lm[sx][sy] = 0;
}
}
}
}

lit_level map::light_at(int dx, int dy)
Expand Down
3 changes: 2 additions & 1 deletion map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3082,7 +3082,8 @@ void map::draw(game *g, WINDOW* w, const point center)
}
}

if (dist > real_max_sight_range ||
if ((g->u.has_active_bionic("bio_night") && dist < 15 && dist > natural_sight_range) || // if bio_night active, blackout 15 tile radius around player
dist > real_max_sight_range ||
(dist > light_sight_range &&
(lit == LL_DARK ||
(u_sight_impaired && lit != LL_BRIGHT) ||
Expand Down
4 changes: 2 additions & 2 deletions mapitemsdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void game::init_mapitems()
"bio_membrane", "bio_gills",
"bio_purifier", "bio_climate", "bio_heatsink", "bio_blood_filter",
"bio_recycler", "bio_digestion", "bio_evap", "bio_water_extractor",
"bio_face_mask", "bio_scent_mask", "bio_cloak", "bio_fingerhack",
"bio_face_mask", "bio_scent_mask", "bio_cloak", "bio_fingerhack", "bio_night",
"bio_carbon", "bio_armor_head", "bio_armor_torso",
"bio_armor_arms", "bio_armor_legs",
"bio_shock", "bio_heat_absorb", "bio_claws", "bio_shockwave",
Expand Down Expand Up @@ -717,7 +717,7 @@ void game::init_mapitems()
"bio_carbon", "bio_armor_head", "bio_armor_torso",
"bio_armor_arms", "bio_armor_legs",
"bio_targeting", "bio_ground_sonar",
"bio_face_mask", "bio_scent_mask", "bio_cloak", "bio_fingerhack",
"bio_face_mask", "bio_scent_mask", "bio_cloak", "bio_fingerhack", "bio_night",
"bio_nanobots", "bio_blood_anal",
"bio_ads", "bio_ods",
"bio_blaster", "bio_laser", "bio_emp", "bio_railgun", "bio_flashbang",
Expand Down