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

Add hand-powered battery charger #30378

Merged
merged 5 commits into from May 11, 2019

Conversation

Projects
None yet
6 participants
@esotericist
Copy link
Contributor

commented May 10, 2019

Summary

SUMMARY: Content "Add hand-powered battery charger"

Purpose of change

With the new-found proliferation of rechargeable batteries, players are somewhat stymied by the lack of options for putting more charge into the batteries. Currently the only available option in-game is the vehicle-mounted Recharging Station.

Partially addresses #30256 (I still think we need additional options, so that issue should probably not be closed yet)

Describe the solution

Added a hand-crank charger item, an iuse activity, and all the attendant c++ and json plumbing to make it so.

My research suggested that hand-crank charger outputs range from 2 watt (very common and easily verified) to 10 watt (claims I could only find from specific manufacturers, with little outside corroboration). I ultimately opted to aim for just under 7 watts of throughput to get 25 kJ / hour.

At this rate one battery charge is produced every 2.4 minutes (24 turns under the current 6-second turn model), and with the fatigue rate available to me, it looks like a 100% fully rested (zero fatigue) player hits 'dead tired' after about 10.5 hours of constant cranking, yielding ~259 charge. This means a player can come reasonably close to filling a medium battery cell in a single day's labor. The right comestibles could extend this.

Is this worthwhile? Probably not outside of emergencies. But it's an option that was missing that we reasonably should have had.

I'm not 100% sure on the recipe requirements. I was aiming for "substantially easier than the vehicle charger, but not trivial". Feedback welcome.

For worldgen, I added this to supplies_electronics, tools_common, tools_electronics, and tools_survival. I'm not very confident on the weights I used there, either.

Basically, if there's any changes someone wants to see on anything except the charge rate (which I'm fairly certain of), I'd be happy to accommodate.

Describe alternatives you've considered

I had originally planning on making a charger that would funnel power from battery magazine A into battery magazine B, but I decided this would be easier to do. I'd still like to get that done at some point.

I considered adding a morale penalty or kcal consumption to this activity, but I decided I just don't have the confidence to work out what those should be.

Additional context

image

image

image


// TODO: This should be 144 seconds, rather than 24 (6-second) turns
// but we don't have a seconds time macro?
if( calendar::once_every( 24_turns ) ) {

This comment has been minimized.

Copy link
@Night-Pryanik

Night-Pryanik May 10, 2019

Member

You can change this to

Suggested change
if( calendar::once_every( 24_turns ) ) {
if( calendar::once_every( 144_seconds ) ) {

This comment has been minimized.

Copy link
@esotericist

esotericist May 10, 2019

Author Contributor

I swear I tried that and got an error. Let me try again.

This comment has been minimized.

Copy link
@esotericist

esotericist May 10, 2019

Author Contributor
src/activity_handlers.cpp:2038:34: error: no matching literal operator for call to 'operator""_seconds' with argument of type 'unsigned long long' or 'const char *', and no matching literal operator template
    if( calendar::once_every( 144_seconds ) ) {
                                 ^

Both VS Code and clang say this is not legal.

This comment has been minimized.

Copy link
@esotericist

esotericist May 10, 2019

Author Contributor

That problem is the origin of the comment immediately above the line, btw.

This comment has been minimized.

Copy link
@Night-Pryanik

Night-Pryanik May 11, 2019

Member

Well, we could circumvent that by using something like 2_minutes.

Show resolved Hide resolved src/iuse.cpp Outdated

esotericist and others added some commits May 10, 2019

Update data/json/item_actions.json
Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>
Update data/json/items/tools.json
Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>
Update src/iuse.cpp
Co-Authored-By: Anton Burmistrov <Night_Pryanik@mail.ru>

@kevingranade kevingranade merged commit 5a355ee into CleverRaven:master May 11, 2019

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
gorgon-ghprb Build finished.
Details
@adamkad1

This comment was marked as off-topic.

Copy link

commented May 11, 2019

I like

@JeanLucVanDamme

This comment has been minimized.

Copy link

commented May 11, 2019

Seems like the right balance of useful and annoying-to-use. I'm for it.

@kevingranade

This comment has been minimized.

Copy link
Member

commented May 17, 2019

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/how-to-recharge-the-new-battery-cells/20081/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.