Skip to content

Commit

Permalink
Revamp foldable solar panels (CleverRaven#68705)
Browse files Browse the repository at this point in the history
* Add deploy_appliance iuse actor

Enabled activating an item to place an appliance.

* vpart: allow removal into different item

Allow vehicle parts to have a different base item than the item they are
removed to. This allows having fake items for appliances that are not
the same item they remove to.

* Make folding solar panel a camping solar panel

Folding solar panels seem to be normal solar panels, modified in some
way to fold (add hinges?). Outside of spacecraft, I'm not sure such
things exist in real life, and this camping solar panel is probably a
lot more familiar to most people.

Remove the recipe for the folding solar panel, and add some spawns in
the camping ground (and add it to some large bugout bags).

Make it deployable as an appliance, so it can be used on the go to
charge devices. It's done in a bit of a hacky way due to the requirement
for a battery, but I think it's fine.

It probably shouldn't really be installable on vehicles, as it's got too
large of a surface area (and so is better than a normal vehicle solar
panel), but I didn't want to cause problems with existing vehicles.

Since it doesn't have components any more, I've made it break into an XX
damaged folding solar panel.

* Make folding_solar_panel_v2 a solar suitcase

Instead of not-spawning, have turn the solar_panel_v2 into a solar
suitcase. Add some spawns to vehicles, and allow it to be deployed as an
appliance for charging items.

Still a bit hacky, like the smaller folding solar panel.
Recipe was also removed, though it is potentially reasonable to craft a
solar suitcase. I just don't know enough about it to say the recipe is
still accurate.

* Remove vehicle folding solar panels

These are voluminous enough that it doesn't make sense to have a whole
lot on a folding vehicle, and they don't deliver that much juice either.
It just makes more sense to carry around the folding panels and deploy
them.
Also, these are too big (surface area) to fit on a vehicle tile.
  • Loading branch information
ehughsbaird authored and Maleclypse committed Nov 16, 2023
1 parent c2fcb44 commit 9f1d9cc
Show file tree
Hide file tree
Showing 19 changed files with 224 additions and 97 deletions.
29 changes: 29 additions & 0 deletions data/json/furniture_and_terrain/appliances.json
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,35 @@
"flags": [ "APPLIANCE", "OBSTACLE", "WALL_MOUNTED", "WIRING" ],
"variants": [ { "symbols": "_", "symbols_broken": "/" } ]
},
{
"type": "vehicle_part",
"id": "ap_folding_solar_panel",
"name": { "str": "deployed folding solar panel" },
"flags": [ "SOLAR_PANEL", "OBSTACLE", "APPLIANCE" ],
"description": "This folding solar panel has been unfolded, and it is ready to charge connected devices, if the sun is out.",
"copy-from": "solar_panel",
"color": "light_blue",
"broken_color": "light_gray",
"proportional": { "durability": 0.5 },
"epower": "120 W",
"requirements": { "removal": { "time": "5 s" } },
"breaks_into": [ { "item": "folding_solar_panel", "damage": [ 5, 5 ] } ],
"remove_as": "folding_solar_panel",
"item": "folding_solar_panel_deployed"
},
{
"type": "vehicle_part",
"id": "ap_folding_solar_panel_v2",
"flags": [ "SOLAR_PANEL", "OBSTACLE", "APPLIANCE" ],
"name": { "str": "deployed solar suitcase" },
"description": "This solar suitcase has been unpacked and is ready to supply power.",
"copy-from": "ap_folding_solar_panel",
"epower": "200 W",
"breaks_into": [ { "item": "folding_solar_panel_v2", "damage": [ 5, 5 ] } ],
"requirements": { "removal": { "time": "1 m" } },
"remove_as": "folding_solar_panel_v2",
"item": "folding_solar_panel_v2_deployed"
},
{
"type": "vehicle_part",
"id": "ap_solar_panel",
Expand Down
5 changes: 5 additions & 0 deletions data/json/item_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"id": "deploy_furn",
"name": { "str": "Deploy item" }
},
{
"type": "item_action",
"id": "deploy_appliance",
"name": { "str": "Deploy item" }
},
{
"type": "item_action",
"id": "CROWBAR_WEAK",
Expand Down
1 change: 1 addition & 0 deletions data/json/itemgroups/activities_hobbies.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
[ "waffleiron", 25 ],
[ "binoculars", 20 ],
[ "firecracker_pack", 5 ],
[ "folding_solar_panel", 3 ],
{ "item": "hotplate", "prob": 10, "charges": [ 0, 500 ] },
{ "item": "popcan_stove", "prob": 10, "charges": [ 0, 500 ] },
{ "item": "coffeemaker", "prob": 5, "charges": [ 0, 500 ] },
Expand Down
10 changes: 9 additions & 1 deletion data/json/itemgroups/stashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@
{ "group": "bugout_food", "prob": 50, "count": [ 1, 3 ] },
{ "group": "bugout_water", "prob": 50, "count": [ 1, 3 ] },
{ "group": "bugout_extras", "prob": 100, "count": [ 2, 6 ] },
{ "group": "civilian_armor", "count": 2, "prob": 35 }
{ "group": "civilian_armor", "count": 2, "prob": 35 },
{ "group": "bugout_large_extras", "prob": 40 }
]
},
{
Expand Down Expand Up @@ -261,6 +262,13 @@
{ "group": "bugout_bad_pack", "prob": 100 }
]
},
{
"type": "item_group",
"id": "bugout_large_extras",
"subtype": "distribution",
"//": "Large items of questionable use in a bugout bag.",
"entries": [ { "item": "folding_solar_panel" } ]
},
{
"type": "item_group",
"id": "bugout_bad_pack",
Expand Down
2 changes: 2 additions & 0 deletions data/json/itemgroups/vehicles_fuel_related.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
[ "hose", 50 ],
[ "jumper_cable", 30 ],
[ "hand_pump", 30 ],
[ "folding_solar_panel_v2", 2 ],
{ "group": "bugout_bag", "prob": 3 }
]
},
Expand Down Expand Up @@ -160,6 +161,7 @@
[ "sunglasses", 20 ],
[ "knife_swissarmy", 10 ],
[ "eclipse_glasses", 1 ],
[ "folding_solar_panel_v2", 2 ],
[ "thermos", 20 ]
]
},
Expand Down
64 changes: 56 additions & 8 deletions data/json/items/vehicle/solar.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,67 @@
"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.",
"price": 120000,
"price_postapoc": 1500
"name": { "str": "folding solar panel" },
"description": "This \"little\" solar panel folds up to carry around, in case you need to charge anything on the go. Its small size means in might take quite some time to charge, however.",
"//": [
"Based on https://www.bluettipower.com/products/bluetti-pv120-120w-solar-panel",
"53cmx47cmx~3cm = 7.5L (assuming it's folded). Weighs in at 5.7kg",
"'up to' 23.4% efficiency, max power = 120W (~20V ~6A)",
"surface area is 53cmx165cm = 0.8754m^2. 'solar_panel' above is 0.25m^2",
"From relative surface area, we get 175W. So 120W seems an alright figure"
],
"weight": "5700 g",
"volume": "7473 ml",
"longest_side": "53 cm",
"use_action": { "type": "deploy_appliance", "base": "folding_solar_panel_deployed" },
"price": 28000,
"price_postapoc": 500
},
{
"type": "MAGAZINE",
"copy-from": "folding_solar_panel",
"id": "folding_solar_panel_deployed",
"name": { "str": "deployed folding solar panel" },
"//": [
"Deployed version of the above. Shouldn't spawn in game.",
"Has a little hacky battery pocket so it can charge phones and the like"
],
"ammo_type": [ "battery" ],
"capacity": 1,
"flags": [ "NO_SALVAGE", "NO_UNLOAD", "NO_RELOAD", "RECHARGE" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "battery": 1 } } ]
},
{
"type": "GENERIC",
"copy-from": "folding_solar_panel",
"id": "folding_solar_panel_v2",
"name": { "str": "advanced collapsible solar array" },
"description": "An electronic device that can convert solar radiation into electric power, mounted on a folding frame. This one is a high-performance type made with monocrystalline silicon cells.",
"price": 220000,
"price_postapoc": 3500
"name": { "str": "solar suitcase" },
"description": "A large, ready-to-deploy set of solar panels, designed for portable off-the-grid use.",
"//": [
"Based on https://www.renogy.com/200-watt-12-volt-monocrystalline-foldable-solar-suitcase",
"26.4x32.5x2.8 inches is 39.4L, 38.6lbs = 17.5kg",
"Surface area 0.554m^2, listed 200W. Half of solar_panel_v2 for half surface area"
],
"weight": "17500 g",
"volume": "39400 ml",
"longest_side": "83 cm",
"use_action": { "type": "deploy_appliance", "base": "folding_solar_panel_v2_deployed" },
"price": 32000,
"price_postapoc": 2000
},
{
"type": "MAGAZINE",
"copy-from": "folding_solar_panel_v2",
"id": "folding_solar_panel_v2_deployed",
"name": { "str": "deployed solar suitcase" },
"//": [
"Deployed version of the above. Shouldn't spawn in game.",
"Has a little hacky battery pocket so it can charge phones and the like"
],
"ammo_type": [ "battery" ],
"capacity": 1,
"flags": [ "NO_SALVAGE", "NO_UNLOAD", "NO_RELOAD", "RECHARGE" ],
"pocket_data": [ { "pocket_type": "MAGAZINE", "rigid": true, "ammo_restriction": { "battery": 1 } } ]
},
{
"type": "GENERIC",
Expand Down
10 changes: 10 additions & 0 deletions data/json/obsoletion/migration_vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@
"to": "seat",
"variant": "windshield_front"
},
{
"type": "vehicle_part_migration",
"from": "foldable_solar_panel",
"to": "solar_panel"
},
{
"type": "vehicle_part_migration",
"from": "advanced_foldable_solar_panel",
"to": "solar_panel_v2"
},
{
"type": "vehicle_part_migration",
"from": "seat_swivel_chair",
Expand Down
42 changes: 0 additions & 42 deletions data/json/recipes/other/power_supplies.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,6 @@
"qualities": [ { "id": "SAW_M", "level": 1 } ],
"components": [ [ [ "solar_panel", 1 ] ], [ [ "reinforced_glass_pane", 1 ] ], [ [ "scrap", 1 ] ] ]
},
{
"type": "recipe",
"activity_level": "MODERATE_EXERCISE",
"result": "folding_solar_panel",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_PARTS",
"skill_used": "fabrication",
"difficulty": 4,
"time": "2 h",
"reversible": true,
"autolearn": true,
"//": "30cm weld",
"using": [ [ "welding_standard", 30 ] ],
"proficiencies": [
{ "proficiency": "prof_metalworking" },
{ "proficiency": "prof_welding_basic", "skill_penalty": 0.5 },
{ "proficiency": "prof_welding" }
],
"qualities": [ { "id": "SAW_M", "level": 1 } ],
"components": [ [ [ "solar_panel", 1 ] ], [ [ "scrap", 2 ] ], [ [ "wire", 2 ] ], [ [ "nuts_bolts", 8 ] ] ]
},
{
"type": "recipe",
"activity_level": "MODERATE_EXERCISE",
"result": "folding_solar_panel_v2",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_PARTS",
"skill_used": "fabrication",
"difficulty": 4,
"time": "2 h",
"reversible": true,
"autolearn": true,
"//": "30cm weld",
"using": [ [ "welding_standard", 30 ] ],
"proficiencies": [
{ "proficiency": "prof_metalworking" },
{ "proficiency": "prof_welding_basic", "skill_penalty": 0.5 },
{ "proficiency": "prof_welding" }
],
"qualities": [ { "id": "SAW_M", "level": 1 } ],
"components": [ [ [ "solar_panel_v2", 1 ] ], [ [ "scrap", 2 ] ], [ [ "wire", 2 ] ], [ [ "nuts_bolts", 8 ] ] ]
},
{
"type": "recipe",
"activity_level": "MODERATE_EXERCISE",
Expand Down
21 changes: 0 additions & 21 deletions data/json/vehicleparts/vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -1758,27 +1758,6 @@
"damage_reduction": { "all": 9 },
"variants": [ { "symbols": "Y", "symbols_broken": "X" } ]
},
{
"type": "vehicle_part",
"id": "foldable_solar_panel",
"copy-from": "solar_panel",
"name": { "str": "collapsible solar array" },
"color": "light_blue",
"broken_color": "light_gray",
"proportional": { "epower": 0.68, "durability": 0.5 },
"folded_volume": "2 L",
"description": "A small array of solar panels designed to be able to fold into one another.",
"item": "folding_solar_panel"
},
{
"type": "vehicle_part",
"id": "advanced_foldable_solar_panel",
"copy-from": "foldable_solar_panel",
"name": { "str": "advanced collapsible solar array" },
"proportional": { "epower": 2 },
"description": "A small array of high-performance solar panels designed to be able to fold into one another.",
"item": "folding_solar_panel_v2"
},
{
"type": "vehicle_part",
"id": "reinforced_solar_panel",
Expand Down
9 changes: 9 additions & 0 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,7 @@ Vehicle components when installed on a vehicle.
// When sun is at 90 degrees the panel produces the full epower.
"item": "wheel", // The item used to install this part, and the item obtained when
// removing this part.
"remove_as": "solar_panel", // Overrides "item", item returned when removing this part.
"difficulty": 4, // Your mechanics skill must be at least this level to install this part
"breaks_into" : [ // When the vehicle part is destroyed, items from this item group
// (see ITEM_SPAWN.md) will be spawned around the part on the ground.
Expand Down Expand Up @@ -4291,6 +4292,14 @@ The contents of use_action fields can either be a string indicating a built-in f
"ELECTRICAL_DEVICES" // "ELECTRICAL_DEVICES" is a special keyword that lets this cable extend all electrical devices that have link_up actions.
]
},
"use_action" : {
"type" : "deploy_furn",
"furn_type" : "f_foo", // What furniture this item will be transmuted into
},
"use_action" : {
"type" : "deploy_appliance",
"base" : "item_id", // Base item of the appliance this item will turn into
},
"use_action" : {
"type" : "delayed_transform", // Like transform, but it will only transform when the item has a certain age
"transform_age" : 600, // The minimal age of the item. Items that are younger wont transform. In turns (60 turns = 1 minute)
Expand Down
2 changes: 1 addition & 1 deletion src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9885,7 +9885,7 @@ bool item::is_emissive() const

bool item::is_deployable() const
{
return type->can_use( "deploy_furn" );
return type->can_use( "deploy_furn" ) || type->can_use( "deploy_appliance" );
}

bool item::is_tool() const
Expand Down
1 change: 1 addition & 0 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,7 @@ void Item_factory::init()
add_actor( std::make_unique<manualnoise_actor>() );
add_actor( std::make_unique<musical_instrument_actor>() );
add_actor( std::make_unique<deploy_furn_actor>() );
add_actor( std::make_unique<deploy_appliance_actor>() );
add_actor( std::make_unique<place_monster_iuse>() );
add_actor( std::make_unique<change_scent_iuse>() );
add_actor( std::make_unique<place_npc_iuse>() );
Expand Down
Loading

0 comments on commit 9f1d9cc

Please sign in to comment.