Permalink
Browse files

added wide angle headlight

  • Loading branch information...
peperov committed Dec 30, 2018
1 parent 2102191 commit 85b4a9356ba024e25b4244292ee139fab9bfc2f5
@@ -102,6 +102,29 @@
},
"flags": [ "CONE_LIGHT", "FOLDABLE", "ENABLED_DRAINS_EPOWER" ]
},
{
"id": "wide_headlight",
"type": "vehicle_part",
"name": "wide angle headlight",
"item": "car_headlight",
"symbol": "*",
"broken_symbol": "*",
"color": "white",
"broken_color": "white",
"durability": 20,
"description": "A bright light that illuminates a wide cone outside the vehicle when turned on. During installation, you can choose what direction to point the light, so multiple headlights can illuminate the sides or rear, as well as the front.",
"epower": -750,
"bonus": 8000,
"damage_modifier": 10,
"folded_volume": 1,
"breaks_into": [ { "item": "cable", "charges": [ 1, 4 ] }, { "item": "scrap", "count": [ 0, 2 ] } ],
"requirements": {
"install": { "skills": [ [ "mechanics", 1 ] ], "time": 20000, "qualities": [ { "id": "SCREW", "level": 1 } ] },
"removal": { "skills": [ [ "mechanics", 1 ] ], "qualities": [ { "id": "SCREW", "level": 1 } ] },
"repair": { "skills": [ [ "mechanics", 1 ] ], "time": 2000, "using": [ [ "adhesive", 1 ] ] }
},
"flags": [ "WIDE_CONE_LIGHT", "FOLDABLE", "ENABLED_DRAINS_EPOWER" ]
},
{
"id": "headlight_reinforced",
"copy-from": "headlight",
@@ -118,6 +118,13 @@
"name": "Toggle headlights",
"bindings":[ { "input_method": "keyboard", "key": "h" } ]
},
{
"id": "TOGGLE_WIDE_HEADLIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle wide angle headlights",
"bindings":[ { "input_method": "keyboard", "key": "O" } ]
},
{
"id": "TOGGLE_OVERHEAD_LIGHT",
"type": "keybinding",
@@ -483,6 +483,7 @@ These branches are also the valid entries for the categories of `dreams` in `dre
- ```CHIMES``` Generates continuous noise when used.
- ```CIRCLE_LIGHT``` Projects a circular radius of light when turned on.
- ```CONE_LIGHT``` Projects a cone of light when turned on.
- ```WIDE_CONE_LIGHT``` Projects a wide cone of light when turned on.
- ```CONTROLS``` Can be used to control the vehicle.
- ```COVERED``` Prevents items in cargo parts from emitting any light.
- ```CRAFTRIG``` Acts as a dehydrator, vacuum sealer and reloading press for crafting purposes. Potentially to include additional tools in the future.
@@ -1357,7 +1357,8 @@ static int veh_lumi( vehicle &veh )

for( const auto pt : lights ) {
const auto &vp = pt->info();
if( vp.has_flag( VPFLAG_CONE_LIGHT ) ) {
if( vp.has_flag( VPFLAG_CONE_LIGHT ) ||
vp.has_flag( VPFLAG_WIDE_CONE_LIGHT ) ) {
veh_luminance += vp.bonus / iteration;
iteration = iteration * 1.1;
}
@@ -346,7 +346,8 @@ void map::generate_lightmap( const int zlev )

for( const auto pt : lights ) {
const auto &vp = pt->info();
if( vp.has_flag( VPFLAG_CONE_LIGHT ) ) {
if( vp.has_flag( VPFLAG_CONE_LIGHT ) ||
vp.has_flag( VPFLAG_WIDE_CONE_LIGHT ) ) {
veh_luminance += vp.bonus / iteration;
iteration = iteration * 1.1;
}
@@ -366,6 +367,12 @@ void map::generate_lightmap( const int zlev )
apply_light_arc( src, v->face.dir() + pt->direction, veh_luminance, 45 );
}

} else if( vp.has_flag( VPFLAG_WIDE_CONE_LIGHT ) ) {
if( veh_luminance > LL_LIT ) {
add_light_source( src, SQRT_2 ); // Add a little surrounding light
apply_light_arc( src, v->face.dir() + pt->direction, veh_luminance, 180 );
}

} else if( vp.has_flag( VPFLAG_CIRCLE_LIGHT ) ) {
const bool odd_turn = calendar::once_every( 2_turns );
if( ( odd_turn && vp.has_flag( VPFLAG_ODDTURN ) ) ||
@@ -756,6 +756,7 @@ bool veh_interact::do_install( std::string &msg )
tab_filters[2] = [&](const vpart_info *p) { auto &part = *p;
return part.has_flag(VPFLAG_LIGHT) || // Light
part.has_flag(VPFLAG_CONE_LIGHT) ||
part.has_flag(VPFLAG_WIDE_CONE_LIGHT) ||
part.has_flag(VPFLAG_CIRCLE_LIGHT) ||
part.has_flag(VPFLAG_DOME_LIGHT) ||
part.has_flag(VPFLAG_AISLE_LIGHT) ||
@@ -2322,7 +2323,8 @@ void veh_interact::display_details( const vpart_info *part )
label = small_mode ? _( "NoisRed" ) : _( "Noise Reduction" );
} else if( part->has_flag( VPFLAG_EXTENDS_VISION ) ) {
label = _( "Range" );
} else if( part->has_flag( VPFLAG_LIGHT ) || part->has_flag( VPFLAG_CONE_LIGHT ) ||
} else if( part->has_flag( VPFLAG_LIGHT ) || part->has_flag( VPFLAG_CONE_LIGHT ) ||
part->has_flag( VPFLAG_WIDE_CONE_LIGHT ) ||
part->has_flag( VPFLAG_CIRCLE_LIGHT ) || part->has_flag( VPFLAG_DOME_LIGHT ) ||
part->has_flag( VPFLAG_AISLE_LIGHT ) || part->has_flag( VPFLAG_EVENTURN ) ||
part->has_flag( VPFLAG_ODDTURN ) || part->has_flag( VPFLAG_ATOMIC_LIGHT ) ) {
@@ -2658,7 +2660,8 @@ void veh_interact::complete_vehicle()
// Need to call coord_translate() directly since it's a new part.
const point q = veh->coord_translate( point( dx, dy ) );

if ( vpinfo.has_flag("CONE_LIGHT") ) {
if ( vpinfo.has_flag( VPFLAG_CONE_LIGHT ) ||
vpinfo.has_flag( VPFLAG_WIDE_CONE_LIGHT ) ) {
// Stash offset and set it to the location of the part so look_around will start there.
int px = g->u.view_offset.x;
int py = g->u.view_offset.y;
@@ -52,6 +52,7 @@ static const std::unordered_map<std::string, vpart_bitflags> vpart_bitflag_map =
{ "EVENTURN", VPFLAG_EVENTURN },
{ "ODDTURN", VPFLAG_ODDTURN },
{ "CONE_LIGHT", VPFLAG_CONE_LIGHT },
{ "WIDE_CONE_LIGHT", VPFLAG_WIDE_CONE_LIGHT },
{ "CIRCLE_LIGHT", VPFLAG_CIRCLE_LIGHT },
{ "BOARDABLE", VPFLAG_BOARDABLE },
{ "AISLE", VPFLAG_AISLE },
@@ -45,6 +45,7 @@ enum vpart_bitflags : int {
VPFLAG_EVENTURN,
VPFLAG_ODDTURN,
VPFLAG_CONE_LIGHT,
VPFLAG_WIDE_CONE_LIGHT,
VPFLAG_CIRCLE_LIGHT,
VPFLAG_BOARDABLE,
VPFLAG_AISLE,
@@ -427,6 +427,7 @@ bool vehicle_part::is_light() const
{
const auto &vp = info();
return vp.has_flag( VPFLAG_CONE_LIGHT ) ||
vp.has_flag( VPFLAG_WIDE_CONE_LIGHT ) ||
vp.has_flag( VPFLAG_CIRCLE_LIGHT ) ||
vp.has_flag( VPFLAG_AISLE_LIGHT ) ||
vp.has_flag( VPFLAG_DOME_LIGHT ) ||
@@ -200,6 +200,7 @@ void vehicle::set_electronics_menu_options( std::vector<uilist_entry> &options,
};
add_toggle( _( "reactor" ), keybind( "TOGGLE_REACTOR" ), "REACTOR" );
add_toggle( _( "headlights" ), keybind( "TOGGLE_HEADLIGHT" ), "CONE_LIGHT" );
add_toggle( _( "wide angle headlights" ), keybind( "TOGGLE_WIDE_HEADLIGHT" ), "WIDE_CONE_LIGHT" );
add_toggle( _( "overhead lights" ), keybind( "TOGGLE_OVERHEAD_LIGHT" ), "CIRCLE_LIGHT" );
add_toggle( _( "aisle lights" ), keybind( "TOGGLE_AISLE_LIGHT" ), "AISLE_LIGHT" );
add_toggle( _( "dome lights" ), keybind( "TOGGLE_DOME_LIGHT" ), "DOME_LIGHT" );

0 comments on commit 85b4a93

Please sign in to comment.