Permalink
Browse files

added directional floodlight, keybindings and recipes

  • Loading branch information...
peperov committed Dec 31, 2018
1 parent 85b4a93 commit 9db4c1ce18c792d282f3bc9c95c4f55c2a464f77
@@ -405,6 +405,21 @@
"category" : "veh_parts",
"price" : 40000
},
{
"type":"GENERIC",
"id" : "wide_headlight_reinforced",
"name" : "reinforced wide-angle headlight",
"description" : "A wide-angle vehicle headlight with a cage built around it to protect it from damage without reducing its effectiveness.",
"weight" : 1400,
"to_hit" : -2,
"color" : "light_cyan",
"symbol" : ",",
"material" : ["steel", "plastic"],
"volume" : 5,
"bashing" : 4,
"category" : "veh_parts",
"price" : 40000
},
{
"type":"GENERIC",
"id" : "it_battery_mount",
@@ -889,6 +904,21 @@
"category" : "veh_parts",
"price": 90000
},
{
"type":"GENERIC",
"id": "directed_floodlight",
"name": "directed floodlight",
"description": "A large and heavy light designed to illuminate a wide area in a half-circular cone.",
"weight": 2500,
"to_hit": 1,
"color": "white",
"symbol": ";",
"material": ["plastic", "steel"],
"volume": 8,
"bashing": 5,
"category" : "veh_parts",
"price": 90000
},
{
"type":"GENERIC",
"id": "recharge_station",
@@ -1186,6 +1216,18 @@
"weight": 1000,
"volume": 4,
"price": 3000
},{
"id": "car_wide_headlight",
"type":"GENERIC",
"name": "wide-angle car headlight",
"description": "A wide-angle vehicle headlight to light up the way.",
"symbol": ";",
"color": "white",
"material": "plastic",
"category": "veh_parts",
"weight": 2000,
"volume": 5,
"price": 4000
},{
"id": "cargo_lock",
"type":"GENERIC",
@@ -355,6 +355,30 @@
],
[ [ "cable", 10 ] ]
]
},{
"type" : "recipe",
"result": "directed_floodlight",
"category": "CC_ELECTRONIC",
"subcategory": "CSC_ELECTRONIC_LIGHTING",
"skill_used": "mechanics",
"skills_required": [ "electronics", 1 ],
"difficulty": 2,
"time": 15000,
"reversible": true,
"decomp_learn": 1,
"book_learn": [[ "manual_electronics", 1 ] , [ "mag_electronics", 2 ]],
"components": [
[ [ "amplifier", 4 ] ],
[
[ "steel_chunk", 2 ],
[ "scrap", 6 ]
],
[
[ "lightstrip_dead", 4 ],
[ "light_bulb", 4 ]
],
[ [ "cable", 10 ] ]
]
},{
"type" : "recipe",
"result": "car_headlight",
@@ -379,6 +403,30 @@
],
[ [ "cable", 10 ] ]
]
},{
"type" : "recipe",
"result": "car_wide_headlight",
"category": "CC_ELECTRONIC",
"subcategory": "CSC_ELECTRONIC_LIGHTING",
"skill_used": "mechanics",
"skills_required": [ "electronics", 1 ],
"difficulty": 2,
"reversible": true,
"decomp_learn": 1,
"book_learn": [[ "manual_electronics", 1 ] , [ "mag_electronics", 2 ]],
"time": 14000,
"components": [
[ [ "amplifier", 3 ] ],
[
[ "plastic_chunk", 3 ],
[ "scrap", 4 ]
],
[
[ "lightstrip_dead", 3 ],
[ "light_bulb", 3 ]
],
[ [ "cable", 12 ] ]
]
},{
"type" : "recipe",
"result": "soldering_iron",
@@ -340,6 +340,19 @@
"qualities": [ { "id": "SAW_M", "level": 1 } ],
"components": [ [ [ "car_headlight", 1 ] ], [ [ "wire", 2 ] ], [ [ "superglue", 1 ] ] ]
},
{
"type": "recipe",
"result": "wide_headlight_reinforced",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_PARTS",
"skill_used": "fabrication",
"difficulty": 2,
"time": 24000,
"book_learn": [ [ "textbook_fabrication", 3 ], [ "textbook_mechanics", 3 ], [ "welding_book", 5 ] ],
"using": [ [ "welding_standard", 2 ] ],
"qualities": [ { "id": "SAW_M", "level": 1 } ],
"components": [ [ [ "car_wide_headlight", 1 ] ], [ [ "wire", 3 ] ], [ [ "superglue", 1 ] ] ]
},
{
"type": "recipe",
"result": "reinforced_solar_panel",
@@ -62,7 +62,7 @@
"color": "white",
"broken_color": "blue",
"durability": 20,
"description": "A very bright, wide-angle light that illuminates the area outside the vehicle when turned on.",
"description": "A very bright, circular light that illuminates the area outside the vehicle when turned on.",
"epower": -1500,
"bonus": 8000,
"damage_modifier": 10,
@@ -79,6 +79,16 @@
},
"flags": [ "CIRCLE_LIGHT", "FOLDABLE", "ENABLED_DRAINS_EPOWER" ]
},
{
"id": "directed_floodlight",
"type": "vehicle_part",
"name": "directed floodlight",
"item": "directed_floodlight",
"copy-from": "floodlight",
"description": "A very bright, directed light that illuminates a half-circular area outside the vehicle when turned on. During installation, you can choose what direction to point the light.",
"epower": -750,
"flags": [ "HALF_CIRCLE_LIGHT", "FOLDABLE", "ENABLED_DRAINS_EPOWER" ]
},
{
"id": "headlight",
"type": "vehicle_part",
@@ -106,23 +116,10 @@
"id": "wide_headlight",
"type": "vehicle_part",
"name": "wide angle headlight",
"item": "car_headlight",
"symbol": "*",
"broken_symbol": "*",
"color": "white",
"broken_color": "white",
"durability": 20,
"item": "car_wide_headlight",
"copy-from": "headlight",
"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 ] ] }
},
"epower": -375,
"flags": [ "WIDE_CONE_LIGHT", "FOLDABLE", "ENABLED_DRAINS_EPOWER" ]
},
{
@@ -134,6 +131,15 @@
"color": "light_blue",
"proportional": { "durability": 4 }
},
{
"id": "wide_headlight_reinforced",
"copy-from": "wide_headlight",
"type": "vehicle_part",
"name": "reinforced wide-angle headlight",
"item": "wide_headlight_reinforced",
"color": "light_blue",
"proportional": { "durability": 4 }
},
{
"abstract": "light_emergency",
"type": "vehicle_part",
@@ -122,7 +122,14 @@
"id": "TOGGLE_WIDE_HEADLIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle wide angle headlights",
"name": "Toggle wide-angle headlights",
"bindings":[ { "input_method": "keyboard", "key": "b" } ]
},
{
"id": "TOGGLE_HALF_OVERHEAD_LIGHT",
"type": "keybinding",
"category": "VEHICLE",
"name": "Toggle directional overhead lights",
"bindings":[ { "input_method": "keyboard", "key": "O" } ]
},
{
@@ -483,7 +483,6 @@ 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.
@@ -507,6 +506,7 @@ These branches are also the valid entries for the categories of `dreams` in `dre
- ```FRIDGE``` Can refrigerate items.
- ```FREEZER``` Can freeze items in below zero degrees Celsius temperature.
- ```FUNNEL```
- ```HALF_CIRCLE_LIGHT``` Projects a directed half-circular radius of light when turned on.
- ```HORN``` Generates noise when used.
- ```INITIAL_PART``` When starting a new vehicle via the construction menu, this vehicle part will be the initial part of the vehicle (if the used item matches the item required for this part). The items of parts with this flag are automatically added as component to the vehicle start construction.
- ```INTERNAL``` Must be mounted inside a cargo area.
@@ -558,6 +558,7 @@ These branches are also the valid entries for the categories of `dreams` in `dre
- ```VARIABLE_SIZE``` Has 'bigness' for power, wheel radius, etc.
- ```VISION```
- ```WELDRIG``` Acts as a welder for crafting.
- ```WIDE_CONE_LIGHT``` Projects a wide cone of light when turned on.
- ```WHEEL``` Counts as a wheel in wheel calculations.
- ```WASHING_MACHINE``` Can be used to wash filthy clothes en masse.
- ```WINDOW``` Can see through this part and can install curtains over it.
@@ -346,7 +346,7 @@ 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;
@@ -370,9 +370,13 @@ void map::generate_lightmap( const int zlev )
} 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 );
apply_light_arc( src, v->face.dir() + pt->direction, veh_luminance, 90 );
}

} else if( vp.has_flag( VPFLAG_HALF_CIRCLE_LIGHT ) ) {
add_light_source( src, SQRT_2 ); // Add a little surrounding light
apply_light_arc( src, v->face.dir() + pt->direction, vp.bonus, 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 ) ) ||
@@ -2661,13 +2661,16 @@ void veh_interact::complete_vehicle()
const point q = veh->coord_translate( point( dx, dy ) );

if ( vpinfo.has_flag( VPFLAG_CONE_LIGHT ) ||
vpinfo.has_flag( VPFLAG_WIDE_CONE_LIGHT ) ) {
vpinfo.has_flag( VPFLAG_WIDE_CONE_LIGHT ) ||
vpinfo.has_flag( VPFLAG_HALF_CIRCLE_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;
g->u.view_offset.x = veh->global_pos3().x + q.x - g->u.posx();
g->u.view_offset.y = veh->global_pos3().y + q.y - g->u.posy();
popup(_("Choose a facing direction for the new headlight. Press space to continue."));

bool is_overheadlight = vpinfo.has_flag( VPFLAG_HALF_CIRCLE_LIGHT );
popup(_("Choose a facing direction for the new %s. Press space to continue."), is_overheadlight ? "overhead light" : "headlight");
const cata::optional<tripoint> headlight_target = g->look_around();
// Restore previous view offsets.
g->u.view_offset.x = px;
@@ -53,6 +53,7 @@ static const std::unordered_map<std::string, vpart_bitflags> vpart_bitflag_map =
{ "ODDTURN", VPFLAG_ODDTURN },
{ "CONE_LIGHT", VPFLAG_CONE_LIGHT },
{ "WIDE_CONE_LIGHT", VPFLAG_WIDE_CONE_LIGHT },
{ "HALF_CIRCLE_LIGHT", VPFLAG_HALF_CIRCLE_LIGHT },
{ "CIRCLE_LIGHT", VPFLAG_CIRCLE_LIGHT },
{ "BOARDABLE", VPFLAG_BOARDABLE },
{ "AISLE", VPFLAG_AISLE },
@@ -46,6 +46,7 @@ enum vpart_bitflags : int {
VPFLAG_ODDTURN,
VPFLAG_CONE_LIGHT,
VPFLAG_WIDE_CONE_LIGHT,
VPFLAG_HALF_CIRCLE_LIGHT,
VPFLAG_CIRCLE_LIGHT,
VPFLAG_BOARDABLE,
VPFLAG_AISLE,
@@ -310,17 +310,23 @@ void vehicle::init_state( int init_veh_fuel, int init_veh_status )
}

auto light_head = one_in( 20 );
auto light_whead = one_in( 20 ); // wide-angle headlight
auto light_dome = one_in( 16 );
auto light_aisle = one_in( 8 );
auto light_hoverh = one_in( 4 ); // half circle overhead light
auto light_overh = one_in( 4 );
auto light_atom = one_in( 2 );
for( auto &pt : parts ) {
if( pt.has_flag( VPFLAG_CONE_LIGHT ) ) {
pt.enabled = light_head;
} else if( pt.has_flag( VPFLAG_WIDE_CONE_LIGHT ) ) {
pt.enabled = light_whead;
} else if( pt.has_flag( VPFLAG_DOME_LIGHT ) ) {
pt.enabled = light_dome;
} else if( pt.has_flag( VPFLAG_AISLE_LIGHT ) ) {
pt.enabled = light_aisle;
} else if( pt.has_flag( VPFLAG_HALF_CIRCLE_LIGHT ) ) {
pt.enabled = light_hoverh;
} else if( pt.has_flag( VPFLAG_CIRCLE_LIGHT ) ) {
pt.enabled = light_overh;
} else if( pt.has_flag( VPFLAG_ATOMIC_LIGHT ) ) {
@@ -428,6 +428,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_HALF_CIRCLE_LIGHT ) ||
vp.has_flag( VPFLAG_CIRCLE_LIGHT ) ||
vp.has_flag( VPFLAG_AISLE_LIGHT ) ||
vp.has_flag( VPFLAG_DOME_LIGHT ) ||
@@ -201,6 +201,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( _( "directed overhead lights" ), keybind( "TOGGLE_HALF_OVERHEAD_LIGHT" ), "HALF_CIRCLE_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 9db4c1c

Please sign in to comment.