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

Nanofab 2.0 #27106

Merged
merged 27 commits into from
Dec 24, 2018
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2477405
Nanofabricator-Preliminary
John-Candlebury Jul 29, 2018
31d1ad5
Small corrections to item group
John-Candlebury Jul 29, 2018
c165592
Json corrections
John-Candlebury Jul 29, 2018
c7a6dcb
Add price
John-Candlebury Jul 29, 2018
694291d
Item drops
John-Candlebury Jul 29, 2018
613de65
Lab Finale and Json corrections
John-Candlebury Jul 29, 2018
d6621c2
Merge remote-tracking branch 'upstream/master' into nano-fabricator
John-Candlebury Aug 1, 2018
b996711
Better descriptions, balance
John-Candlebury Aug 1, 2018
1a5f000
Finale layout corrections
John-Candlebury Aug 1, 2018
9de88bc
correct translation mistake
John-Candlebury Aug 1, 2018
c570ada
Prices and Trader_avoid
John-Candlebury Aug 2, 2018
6776bd5
Merge branch 'nano-fabricator' into nanofab-2.0
John-Candlebury Dec 14, 2018
7f6474f
Code-Style
John-Candlebury Dec 14, 2018
dd784da
Map-changes and fix
John-Candlebury Dec 14, 2018
9ef1fdc
Format terrain.json
John-Candlebury Dec 14, 2018
f540c73
Suggested change src/item.cpp
BevapDin Dec 16, 2018
1726211
Suggested change src/iexamine.cpp
BevapDin Dec 16, 2018
9c73405
Suggested change src/iexamine.cpp II
BevapDin Dec 16, 2018
56c7b7d
Fix item spawning
John-Candlebury Dec 16, 2018
bb77484
Properly add recipes to the template
John-Candlebury Dec 16, 2018
65db18e
Update src/iexamine.cpp
ZhilkinSerg Dec 16, 2018
966ee55
Update src/iexamine.cpp
ZhilkinSerg Dec 16, 2018
e7b6b7b
Update src/iexamine.cpp
ZhilkinSerg Dec 16, 2018
2bbe79e
Update src/iexamine.cpp
ZhilkinSerg Dec 16, 2018
befb689
Remove unecessary data
John-Candlebury Dec 16, 2018
0047963
Update src/iexamine.cpp
Night-Pryanik Dec 17, 2018
7edccc9
Merge lines in iexamine.cpp
John-Candlebury Dec 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/json/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@
"description": "Allows wielding with unarmed fighting styles and trains unarmed when used.",
"info": "This weapon <good>can be used with</good> <info>unarmed fighting styles</info>."
},
{
"id": "NANOFAB_TEMPLATE",
"type": "json_flag",
"context": [ "generic", "TOOL" ],
"info": "This item contains a nanofabricator recipe."
},
{
"id": "BIONIC_FAULTY",
"type": "json_flag",
Expand Down
5 changes: 5 additions & 0 deletions data/json/item_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -4336,6 +4336,8 @@
"items":[
["purifier", 12],
["plut_cell", 10],
["standard_template_construct", 5],
["nanomaterial", 5],
["ftk93", 1],
["canister_goo", 8],
["UPS_off", 5],
Expand Down Expand Up @@ -5625,6 +5627,7 @@
["eink_tablet_pc", 15],
["mobile_memory_card", 40],
["mobile_memory_card_science", 10],
["standard_template_construct", 5],
["camera", 15],
["camera_pro", 5],
["lighter", 50],
Expand Down Expand Up @@ -6824,6 +6827,7 @@
["eink_tablet_pc", 1],
["mobile_memory_card", 8],
["mobile_memory_card_science", 1],
["standard_template_construct", 8],
["id_military", 3],
["militarymap", 3],
["pistol_bayonet", 4],
Expand Down Expand Up @@ -7489,6 +7493,7 @@
["eink_tablet_pc", 20],
["mobile_memory_card", 50],
["mobile_memory_card_science", 5],
["standard_template_construct", 5],
["camera", 3],
["thermometer", 3],
["hygrometer", 3],
Expand Down
47 changes: 46 additions & 1 deletion data/json/itemgroups/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
["knife_rm42", 20],
["l-stick", 10],
["large_repairkit", 20],
["standard_template_construct", 15],
["laser_pack", 100],
["laser_rifle", 10],
["m240", 10],
Expand Down Expand Up @@ -73,7 +74,51 @@
["tool_rdx_charge", 10],
["v29", 10]
]
},{
},
{
"type" : "item_group",
"id" : "nanofab_recipes",
"//" : "Very rare high level loot. This list doesnt spawn anywere directly, it is used to create the recipes inside nanofabricator templates. ",
"magazine": 100,
"items":[
["12mm", 10],
["bot_laserturret", 10],
["alloy_plate", 10],
["ftk93", 10],
["solar_panel_v3", 10],
["q_solarpack", 10],
["can_sealer", 10],
["hk_g80", 10],
["hk_g80mag", 10],
["stillsuit", 10],
["hk_g80mag", 10],
["emp_gun", 10],
["knife_rm42", 10],
["laser_pack", 10],
["laser_rifle", 10],
["mininuke", 10],
["adv_UPS_off", 10],
["optical_cloak", 10],
["holo_cloak", 10],
["plasma_rifle", 10],
["portal", 10],
["atomic_coffeepot", 10],
["power_armor_basic", 10],
["power_armor_frame", 10],
["power_armor_heavy", 10],
["power_armor_helmet_basic", 10],
["power_armor_helmet_heavy", 10],
["power_armor_helmet_light", 10],
["high_density_capacitor", 10],
["beam_scatterer", 10 ],
["power_armor_light", 10],
["control_laptop", 10],
["rm11b_sniper_rifle", 10],
["rm13_armor", 10],
["v29", 10]
]
},
{
"type" : "item_group",
"id" : "player_crafted",
"//" : "items that should only be crafted by the player. Excluded from all other item groups. this is just an FYI list, it's not used to spawn items in game.",
Expand Down
18 changes: 18 additions & 0 deletions data/json/items/chemicals_and_resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,24 @@
"category" : "chems",
"fun": -20
},
{
"type" : "AMMO",
"id" : "nanomaterial",
"category" : "chems",
"price" : 250000,
"price_postapoc": 1500,
"name" : "nanomaterial canisters",
"name_plural" : "nanomaterial canisters",
"symbol" : "=",
"color" : "light_gray",
"flags" : [ "TRADER_AVOID" ],
"description" : "Steel canisters containing carbon, iron, titanium, copper and other elements in specifically engineered atomic scale configurations. A nanofabricator can assemble them into usable items.",
"material" : "steel",
"volume" : 60,
"weight" : 250,
"ammo_type" : "components",
"count" : 50
},
{
"type" : "AMMO",
"id" : "ash",
Expand Down
16 changes: 16 additions & 0 deletions data/json/items/generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,22 @@
"to_hit": -1,
"flags": [ "TRADER_AVOID" ]
},
{
"type": "GENERIC",
"id": "standard_template_construct",
"symbol": ",",
"color": "cyan",
"name": "nanofabricator template",
"category": "spare_parts",
"description": "A state-of-the-art optical storage system. This small slate of transparent glass holds, inscribed as a miniature pattern, the instructions required to create an item through a nanofabricator.",
"price": 150000,
"price_postapoc": 15000,
"material": [ "steel", "plastic" ],
"weight": 317,
"volume": 1,
"to_hit": -1,
"flags": [ "NANOFAB_TEMPLATE", "TRADER_AVOID" ]
},
{
"type": "GENERIC",
"id": "antenna",
Expand Down
65 changes: 65 additions & 0 deletions data/json/mapgen/lab/lab_floorplans_finale1level.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,71 @@
}
},
{
"//": "nano_fabricator room",
"type": "mapgen",
"method": "json",
"om_terrain": [ "lab_finale_1level" ],
"weight": 50,
"object": {
"rotation": [ 0, 3 ],
"fill_ter": "t_thconc_floor",
"rows": [
"CCC..................CCC",
"C..........YY..........C",
"........................",
"....cc............cc....",
"....cc..c......c..cc....",
"....cc..c..//..c..cc....",
"........c..//..c........",
"........c......c........",
"....cc.....YY.....cc....",
"....cc............cc....",
"....cc..--gGGg--..cc....",
"........-,,,,,,-........",
"..YY....g,/,,/,g....YY..",
"........g,?,,?,g........",
"ggGGg----,,,,,,----gGGgg",
".x...-CC-+gggg+-CC-...x.",
".x..x-,,,,,,,,,,,,-x..x.",
".x..C-,r,,,rr,,,r,-C..x.",
".x..C-Y,,,,,,,,,,Y-C..x.",
".x..x----GggggG----x..x.",
".R....G..........G....R.",
"......G....YY....G......",
".Yxx..g..........g..xxY.",
"......g..........g......"
],
"palettes": [
"lab_palette", "lab_loot_research"
],
"furniture": {
"R": "f_rack"
},
"terrain": {
"C": "t_machinery_electronic",
"x": "t_machinery_heavy",
"?": "t_nanofab",
"r": "t_metal_floor",
"/": "t_nanofab_body",
"Y": "t_thconc_floor_olight",
"p": "t_metal_floor"
},
"mapping": {
"r": {
"item": { "item": "standard_template_construct" }
},
"R": {
"item": { "item": "nanomaterial" }
}
},
"place_monster": [
{ "monster": "mon_tripod", "x": [ 1, 4 ], "y": [ 20, 22 ], "chance": 90 },
{ "monster": "mon_tripod", "x": [ 19, 20 ], "y": [ 20, 22 ], "chance": 90 },
{ "monster": "mon_zombie_scientist", "x": [2, 20], "y": [ 1, 9 ], "chance": 90, "repeat": [1,2] }
]
}
},
{
"//": "mutagen tank, ~75% chance normal mutagen, ~25% flavored mutagen",
"type": "mapgen",
"method": "json",
Expand Down
6 changes: 6 additions & 0 deletions data/json/requirements/materials.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
"//": "Materials required to apply diamond coating (per 250ml volume)",
"components": [ [ [ "plasma", 5 ] ], [ [ "charcoal", 25 ], [ "coal_lump", 25 ] ] ]
},
{
"id": "nanofabricator",
"type": "requirement",
"//": "Materials required by the nanofabricator to create an item (per 250ml volume)",
"components": [ [ [ "nanomaterial", 5 ] ] ]
},
{
"id": "fabric_standard",
"type": "requirement",
Expand Down
60 changes: 60 additions & 0 deletions data/json/terrain.json
Original file line number Diff line number Diff line change
Expand Up @@ -5841,6 +5841,66 @@
]
}
},
{
"type": "terrain",
"id": "t_nanofab_body",
"name": "nanofabricator",
"symbol": "%",
"description": "A great column of advanced machinery. Within this self-contained, miniaturized factory, several 3d printers work in tandem with a robotic assembler to manufacture nearly any inorganic object.",
"color": "dark_gray",
"move_cost": 0,
"flags": [ "PLACE_ITEM" ],
"bash": {
"str_min": 120,
"str_max": 150,
"sound": "crunch!",
"sound_fail": "whack!",
"ter_set": "t_floor",
"items": [
{ "item": "e_scrap", "count": [ 10, 14 ] },
{ "item": "processor", "count": [ 10, 20 ] },
{ "item": "RAM", "count": [ 14, 20 ] },
{ "item": "nanomaterial", "count": 1, "prob": 10 },
{ "item": "bearing", "charges": [ 20, 60 ] },
{ "item": "motor", "count": 4 },
{ "item": "power_supply", "count": [ 4, 16 ] },
{ "item": "amplifier", "count": [ 4, 16 ] },
{ "item": "cable", "charges": [ 250, 500 ] },
{ "item": "circuit", "count": [ 1, 6 ] },
{ "item": "scrap", "count": [ 12, 18 ] }
]
}
},
{
"type": "terrain",
"id": "t_nanofab",
"name": "nanofabricator control panel",
"symbol": "&",
"description": "A small computer panel attached to a nanofabricator. It has a single slot for reading templates.",
"color": "red",
"move_cost": 0,
"flags": [ "WALL", "NOITEM", "PERMEABLE" ],
"examine_action": "nanofab",
"bash": {
"str_min": 8,
"str_max": 150,
"sound": "crunch!",
"sound_fail": "whack!",
"ter_set": "t_console_broken",
"items": [
{ "item": "processor", "prob": 25 },
{ "item": "RAM", "count": [ 0, 2 ], "prob": 50 },
{ "item": "cable", "charges": [ 1, 2 ], "prob": 50 },
{ "item": "small_lcd_screen", "prob": 25 },
{ "item": "e_scrap", "count": [ 1, 4 ], "prob": 50 },
{ "item": "circuit", "count": [ 0, 2 ], "prob": 50 },
{ "item": "power_supply", "prob": 25 },
{ "item": "amplifier", "prob": 25 },
{ "item": "plastic_chunk", "count": [ 4, 10 ], "prob": 50 },
{ "item": "scrap", "count": [ 2, 6 ], "prob": 50 }
]
}
},
{
"type": "terrain",
"id": "t_column",
Expand Down
56 changes: 56 additions & 0 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,61 @@ void iexamine::cvdmachine( player &p, const tripoint & ) {
p.mod_moves( -1000 );
}

/**
* UI FOR LAB_FINALE NANO FABRICATOR.
*/
void iexamine::nanofab( player &p, const tripoint &examp )
{
bool table_exists = false;
tripoint spawn_point;
for( const auto &valid_location : g->m.points_in_radius( examp, 1, 0 ) ) {
if( g->m.ter( valid_location ) == t_nanofab_body ) {
spawn_point = valid_location;
table_exists = true;
break;
}
}
if (!table_exists){
John-Candlebury marked this conversation as resolved.
Show resolved Hide resolved
return;
}

auto nanofab_template= g->inv_map_splice( []( const item &e ) {
return e.has_var( "NANOFAB_ITEM_ID" );
}, _( "Introduce Nanofabricator template" ), PICKUP_RANGE, _( "You don't have any usable templates." ) );

if( !nanofab_template ) {
return;
}

item new_item( nanofab_template->get_var( "NANOFAB_ITEM_ID" ), calendar::turn );

auto qty = new_item.volume() / 250_ml;
qty = std::max( 1, qty );
John-Candlebury marked this conversation as resolved.
Show resolved Hide resolved
auto reqs = *requirement_id( "nanofabricator" ) * qty;

if( !reqs.can_make_with_inventory( p.crafting_inventory() ) ) {
popup( "%s", reqs.list_missing().c_str() );
return;
}

// Consume materials
for( const auto &e : reqs.get_components() ) {
p.consume_items( e );
}
for( const auto &e : reqs.get_tools() ) {
p.consume_tools( e );
}
p.invalidate_crafting_inventory();

if( new_item.is_armor() && new_item.has_flag( "VARSIZE" ) ) {
new_item.item_tags.insert( "FIT" );
John-Candlebury marked this conversation as resolved.
Show resolved Hide resolved
}

g->m.add_item_or_charges( spawn_point, new_item );


}

/**
* Use "gas pump." Will pump any liquids on tile.
*/
Expand Down Expand Up @@ -4183,6 +4238,7 @@ iexamine_function iexamine_function_from_string(std::string const &function_name
{ "none", &iexamine::none },
{ "deployed_furniture", &iexamine::deployed_furniture },
{ "cvdmachine", &iexamine::cvdmachine },
{ "nanofab", &iexamine::nanofab },
{ "gaspump", &iexamine::gaspump },
{ "atm", &iexamine::atm },
{ "vending", &iexamine::vending },
Expand Down
1 change: 1 addition & 0 deletions src/iexamine.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void atm( player &p, const tripoint &examp );
void vending( player &p, const tripoint &examp );
void toilet( player &p, const tripoint &examp );
void elevator( player &p, const tripoint &examp );
void nanofab( player &p, const tripoint &examp );
void controls_gate( player &p, const tripoint &examp );
void cardreader( player &p, const tripoint &examp );
void cvdmachine( player &p, const tripoint &examp );
Expand Down