Skip to content

Commit

Permalink
Make ground mounted solar panels more efficient
Browse files Browse the repository at this point in the history
Because vehicles are smaller than ground tiles are, ground solar panels
are very inefficient per their area. Fix this by making special ground
solar panels that have an appropriate area.

Vehicle tile width comes from tile_to_width in src/vehicle.cpp, is ~0.5m
for most vehicles.
  • Loading branch information
ehughsbaird committed Oct 11, 2023
1 parent 11a2c1e commit 728a108
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 21 deletions.
26 changes: 26 additions & 0 deletions data/json/construction.json
Original file line number Diff line number Diff line change
Expand Up @@ -5329,6 +5329,19 @@
"post_special": "done_appliance",
"activity_level": "LIGHT_EXERCISE"
},
{
"type": "construction",
"id": "app_ground_solar",
"group": "place_ground_solar_panel",
"category": "APPLIANCE",
"required_skills": [ [ "fabrication", 1 ] ],
"time": "6 m",
"qualities": [ [ { "id": "WRENCH", "level": 1 } ] ],
"components": [ [ [ "ground_solar_panel", 1 ] ] ],
"pre_special": "check_empty",
"post_special": "done_appliance",
"activity_level": "LIGHT_EXERCISE"
},
{
"type": "construction",
"id": "app_reinforced_solar",
Expand All @@ -5355,6 +5368,19 @@
"post_special": "done_appliance",
"activity_level": "LIGHT_EXERCISE"
},
{
"type": "construction",
"id": "app_ground_solar_v2",
"group": "place_ground_solar_panel_v2",
"category": "APPLIANCE",
"required_skills": [ [ "fabrication", 1 ] ],
"time": "6 m",
"qualities": [ [ { "id": "WRENCH", "level": 1 } ] ],
"components": [ [ [ "ground_solar_panel_v2", 1 ] ] ],
"pre_special": "check_empty",
"post_special": "done_appliance",
"activity_level": "LIGHT_EXERCISE"
},
{
"type": "construction",
"id": "app_reinfoced_solar_v2",
Expand Down
10 changes: 10 additions & 0 deletions data/json/construction_group.json
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,11 @@
{
"type": "construction_group",
"id": "place_solar_panel",
"name": "Place Small Solar Panel"
},
{
"type": "construction_group",
"id": "place_ground_solar_panel",
"name": "Place Solar Panel"
},
{
Expand All @@ -1337,6 +1342,11 @@
{
"type": "construction_group",
"id": "place_solar_panel_v2",
"name": "Place Small Advanced Solar Panel"
},
{
"type": "construction_group",
"id": "place_ground_solar_panel_v2",
"name": "Place Advanced Solar Panel"
},
{
Expand Down
54 changes: 52 additions & 2 deletions data/json/furniture_and_terrain/appliances.json
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,39 @@
{
"type": "vehicle_part",
"id": "ap_solar_panel",
"name": { "str": "small solar panel" },
"flags": [ "SOLAR_PANEL", "OBSTACLE", "APPLIANCE" ],
"description": "A solar panel, mounted on a frame and ready to power other appliances.",
"description": "A small solar panel, mounted on a frame and ready to power other appliances.",
"copy-from": "solar_panel",
"proportional": { "epower": 1.2 },
"requirements": { "removal": { "time": "3 m", "using": [ [ "vehicle_wrench_2", 1 ] ] } },
"variants": [ { "symbols": "#", "symbols_broken": "x" } ]
},
{
"type": "vehicle_part",
"id": "ap_ground_solar_panel",
"flags": [ "SOLAR_PANEL", "OBSTACLE", "APPLIANCE" ],
"description": "A solar panel, mounted on a frame and ready to power other appliances.",
"item": "ground_solar_panel",
"copy-from": "solar_panel",
"//": "4 times the panels, 1.2x matching the above appliance",
"proportional": { "epower": 4.8 },
"requirements": {
"removal": { "time": "3 m", "using": [ [ "vehicle_wrench_2", 1 ] ] },
"repair": {
"skills": [ [ "electronics", 6 ] ],
"time": "120 m",
"using": [ [ "vehicle_screw", 1 ], [ "solar_panel", 4 ], [ "soldering_standard", 8 ] ]
}
},
"breaks_into": [
{ "item": "steel_lump", "count": [ 8, 32 ] },
{ "item": "steel_chunk", "count": [ 8, 32 ] },
{ "item": "scrap", "count": [ 8, 32 ] },
{ "item": "solar_cell", "count": [ 4, 16 ] }
],
"variants": [ { "symbols": "#", "symbols_broken": "x" } ]
},
{
"type": "vehicle_part",
"id": "ap_reinforced_solar_panel",
Expand All @@ -695,13 +721,37 @@
{
"type": "vehicle_part",
"id": "ap_solar_panel_v2",
"name": { "str": "small advanced solar panel" },
"flags": [ "SOLAR_PANEL", "OBSTACLE", "APPLIANCE" ],
"description": "A high-performance solar panel, mounted on a frame and ready to power other appliances.",
"description": "A small, high-performance solar panel, mounted on a frame and ready to power other appliances.",
"copy-from": "solar_panel_v2",
"proportional": { "epower": 1.2 },
"requirements": { "removal": { "time": "3 m", "using": [ [ "vehicle_wrench_2", 1 ] ] } },
"variants": [ { "symbols": "#", "symbols_broken": "x" } ]
},
{
"type": "vehicle_part",
"id": "ap_ground_solar_panel_v2",
"copy-from": "solar_panel_v2",
"flags": [ "SOLAR_PANEL", "OBSTACLE", "APPLIANCE" ],
"item": "ground_solar_panel_v2",
"//": "4 times from 4 more panels, 1.2 times as is done above",
"proportional": { "epower": 4.8 },
"requirements": {
"removal": { "time": "3 m", "using": [ [ "vehicle_wrench_2", 1 ] ] },
"repair": {
"skills": [ [ "electronics", 8 ] ],
"time": "150 m",
"using": [ [ "vehicle_screw", 1 ], [ "solar_panel_v2", 4 ], [ "soldering_standard", 64 ] ]
}
},
"breaks_into": [
{ "item": "steel_lump", "count": [ 8, 16 ] },
{ "item": "steel_chunk", "count": [ 8, 16 ] },
{ "item": "scrap", "count": [ 8, 16 ] },
{ "item": "solar_cell_v2", "count": [ 4, 24 ] }
]
},
{
"type": "vehicle_part",
"id": "ap_reinforced_solar_panel_v2",
Expand Down
20 changes: 10 additions & 10 deletions data/json/furniture_and_terrain/furniture-appliances.json
Original file line number Diff line number Diff line change
Expand Up @@ -694,23 +694,23 @@
"color": "yellow",
"move_cost_mod": 2,
"required_str": -1,
"examine_action": { "type": "appliance_convert", "furn_set": "f_null", "item": "solar_panel" },
"examine_action": { "type": "appliance_convert", "furn_set": "f_null", "item": "ground_solar_panel" },
"flags": [ "TRANSPARENT" ],
"deconstruct": { "items": [ { "item": "solar_panel", "count": 1 } ] },
"deconstruct": { "items": [ { "item": "ground_solar_panel", "count": 1 } ] },
"bash": {
"str_min": 10,
"str_max": 20,
"sound": "whack!",
"sound_fail": "clang!",
"items": [
{ "item": "solar_cell", "count": [ 1, 5 ] },
{ "item": "scrap", "count": [ 3, 6 ] },
{ "item": "amplifier", "prob": 50 },
{ "item": "cable", "charges": [ 10, 15 ] },
{ "item": "power_supply", "prob": 50 },
{ "item": "scrap", "count": [ 4, 6 ] },
{ "item": "plastic_chunk", "count": [ 1, 2 ] },
{ "item": "steel_chunk", "count": 3 }
{ "item": "solar_cell", "count": [ 4, 20 ] },
{ "item": "scrap", "count": [ 12, 24 ] },
{ "item": "amplifier", "count": [ 0, 2 ] },
{ "item": "cable", "charges": [ 40, 60 ] },
{ "item": "power_supply", "count": [ 0, 2 ] },
{ "item": "scrap", "count": [ 16, 24 ] },
{ "item": "plastic_chunk", "count": [ 4, 8 ] },
{ "item": "steel_chunk", "count": 12 }
]
}
},
Expand Down
30 changes: 27 additions & 3 deletions data/json/items/vehicle/solar.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
[
{
"//": "Assumed to be ~0.5x0.5m to fit in a vehicle tile",
"type": "GENERIC",
"id": "solar_panel",
"name": { "str": "solar panel" },
"description": "An electronic device that can convert solar radiation into electric power. Useful for a vehicle or a static power grid.",
"weight": "14000 g",
"//1": [
"66x40x2in = 68L solar panels weigh 40lbs, for density of ~210g/L",
"If this is 0.5mx0.5mx5cm, it has a volume of 12.5L, and a weight of 2.63kg",
"Numbers from https://modernize.com/homeowner-resources/solar/average-solar-panel-dimensions-and-sizes"
],
"weight": "2630 g",
"to_hit": -4,
"color": "yellow",
"symbol": "]",
"material": [ "glass" ],
"volume": "3 L",
"volume": "12500 ml",
"flags": [ "NO_REPAIR", "WATER_BREAK" ],
"category": "veh_parts",
"price": 90000,
"price_postapoc": 1000,
"melee_damage": { "bash": 1 }
},
{
"//": "Four solar panels stuck together to fit in 1x1m",
"type": "GENERIC",
"id": "ground_solar_panel",
"name": { "str": "solar panel array" },
"description": "A collection of four solar panels, ready to get to work converting solar radiation into electric power. Install them to use them in a static power grid.",
"copy-from": "solar_panel",
"proportional": { "weight": 4, "volume": 4, "price": 4, "price_postapoc": 4 }
},
{
"type": "GENERIC",
"copy-from": "solar_panel",
"id": "folding_solar_panel",
"name": { "str": "collapsible solar array" },
"description": "An electronic device that can convert solar radiation into electric power, mounted on a folding frame. This one is a common, inexpensive type made with polycrystalline silicon cells.",
"weight": "14500 g",
"price": 120000,
"price_postapoc": 1500
},
Expand All @@ -49,6 +63,7 @@
"copy-from": "solar_panel"
},
{
"//": "Assumed to be ~0.5mx0.5m to fit in a vehicle tile",
"type": "GENERIC",
"id": "solar_panel_v2",
"name": { "str": "advanced solar panel" },
Expand All @@ -57,6 +72,15 @@
"price_postapoc": 3000,
"copy-from": "solar_panel"
},
{
"//": "Four advanced solar panels stuck together for 1mx1m area",
"type": "GENERIC",
"id": "ground_solar_panel_v2",
"name": { "str": "advanced solar panel array" },
"description": "A collection of four smaller solar panels, read to convert solar radiation into electric power. These panels are high-performance, made with monocrystalline silicon cells.",
"copy-from": "solar_panel_v2",
"proportional": { "price": 4, "price_postapoc": 4, "weight": 4, "volume": 4 }
},
{
"type": "GENERIC",
"id": "reinforced_solar_panel_v2",
Expand Down
26 changes: 26 additions & 0 deletions data/json/recipes/other/power_supplies.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,32 @@
],
"components": [ [ [ "power_supply", 2 ] ], [ [ "amplifier", 2 ] ], [ [ "solar_cell", 12 ] ], [ [ "cable", 20 ] ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
"result": "ground_solar_panel",
"category": "CC_ELECTRONIC",
"subcategory": "CSC_ELECTRONIC_PARTS",
"skill_used": "electronics",
"difficulty": 2,
"time": "50 m",
"reversible": true,
"autolearn": true,
"components": [ [ [ "solar_panel", 4 ] ], [ [ "cable", 20 ] ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
"result": "ground_solar_panel_v2",
"category": "CC_ELECTRONIC",
"subcategory": "CSC_ELECTRONIC_PARTS",
"skill_used": "electronics",
"difficulty": 2,
"time": "50 m",
"reversible": true,
"autolearn": true,
"components": [ [ [ "solar_panel_v2", 4 ] ], [ [ "cable", 20 ] ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
Expand Down
4 changes: 0 additions & 4 deletions data/mods/TEST_DATA/known_bad_density.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"art_sphere",
"cooked_marrow",
"fruit_pancakes",
"folding_solar_panel_v2",
"broken_mech_combat",
"beer",
"sandwich_sauce_wheat_free",
Expand Down Expand Up @@ -181,7 +180,6 @@
"survivor_scope",
"triffid_fungicide",
"pine_resin",
"folding_solar_panel",
"rehydration_drink",
"bee_sting",
"test_cracklins",
Expand Down Expand Up @@ -570,7 +568,6 @@
"test_liquid_1ml",
"compositecrossbow",
"toothbrush_plain",
"solar_panel",
"homemade_burrito",
"bot_lab_security_drone_BM",
"bot_manhack",
Expand All @@ -594,7 +591,6 @@
"thermal_suit",
"flavored_bonemeal_tablet",
"chaw",
"solar_panel_v2",
"moisturizer",
"8mm_hvp",
"load_bearing_vest",
Expand Down
2 changes: 1 addition & 1 deletion data/mods/TEST_DATA/vehicle_drag_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"kayak_racing": [ 0.609525, 2.604776, 0.983417, 714, 1309 ],
"DUKW": [ 0.918158, 3.636234, 78.648471, 9801, 11742 ],
"raft": [ 0.997815, 9.743243, 5.51775, 216, 461 ],
"rara_x": [ 0.930735, 1.251436, 699.958333, 8357, 8665 ],
"rara_x": [ 0.930735, 0.946989, 529.673611, 8401, 8709 ],
"aapc-mg": [ 1.9866, 8.699023, 4398.563988, 7576, 8873 ],
"quad_bike": [ 0.690795, 1.093925, 698.691964, 6893, 8235 ],
"golf_cart": [ 1.069088, 1.127783, 709.645833, 6813, 7065 ],
Expand Down
2 changes: 1 addition & 1 deletion data/mods/TEST_DATA/vehicle_efficiency_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"car_sports": { "forward": [ 1006190, 665500, 483000, 44490, 31712 ], "reverse": [ 1006190, 667700, 484600, 42877, 28849 ] },
"ambulance": { "forward": [ 1718761, 581126, 494600, 92170, 74550 ], "reverse": [ 1718761, 54450, 54030, 41110, 39970 ] },
"superbike": { "forward": [ 232935, 126400, 73470, 45480, 26130 ], "reverse": [ 232935, 19660, 11160, 13860, 8875 ] },
"electric_car": { "forward": [ 722429, 203700, 173713, 16636, 13807 ], "reverse": [ 722429, 204000, 173991, 16669, 13835 ] },
"electric_car": { "forward": [ 676949, 209900, 192700, 17800, 15810 ], "reverse": [ 676949, 210200, 193000, 17830, 15850 ] },
"test_beetle": { "forward": [ 711045, 499600, 434400, 116300, 95800 ], "reverse": [ 711045, 60380, 60270, 47140, 45680 ] },
"scooter": { "forward": [ 37541, 309800, 309800, 237100, 237100 ], "reverse": [ 37541, 92444, 92444, 68680, 68680 ] },
"truck_swat": { "forward": [ 6053351, 629000, 112300, 34510, 7719 ], "reverse": [ 6053351, 126300, 127100, 32650, 7898 ] },
Expand Down

0 comments on commit 728a108

Please sign in to comment.