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

Adjust headlamp to match flashlight #77461

Merged
merged 13 commits into from
Nov 7, 2024

Conversation

ampersand55
Copy link
Contributor

Summary

Balance "Adjust headlamp to match flashlight"

Purpose of change

As we can make a headlamp using a flashlight and patches/strings/tape and you can disassemble a headlamp to get a flashlight, we should expect the headlamp to function exactly as a flashlight strapped to your head.

Furthermore, the headlamp is borderline unusable and severely under-powered compared to a real life equivalent and only functions for 23 minutes with a light battery (or 1 second with a ultra-light battery). Fixes #77394.

I believe the current discrepancy between the current flashlight and headlamp is because the listed specs for the reference flashlight is either a) straight up lying or b) use some different and incompatible metric for its brightness and/or burn time.

Reference in-game flashlight: https://www.amazon.com/dp/B0CFLGMKQM?th=1
Reference headlamp: https://www.rei.com/product/202772/black-diamond-astro-300-headlamp

They both take 3xAAA batteries (corresponding to a medium battery), but the advertised performance is 1000 lm for 10 hours for the flashlight and 300 lm for 4-6 hours the headlamp.

1996, white LEDs' luminous efficacy has increased from 5 lm/W to today's commercial white LED of 150 lm/W, the highest luminous efficacy of all white light sources. The theoretical limit for white LEDs is about 260-300 lm/W.

https://phys.org/news/2010-08-white-super-high-luminous-efficacy.html

At the maximum theoretical efficiency of 300 lm/W, to shine at a brightness of 1000 lumen for 10 hours would take 120 kJ of energy, and the medium battery is only 56 kJ.

The in-game power draw is 1560 mW and a 150 lm/W luminous efficacy it would produce 234 lumen for the duration of 56 kJ / 1560 mW = 10 hours, which seems very close to the 300 lumen for 6 hours from the reference headlamp's spec.

Running a 56 kJ battery 6 hours at an efficiency of 150 lumen / W would produce 389 lumen.

I think they are close enough that we can consider a flashlight strapped to your head and a headlamp functionally the same item.

Describe the solution

Json edits to headlamp to match flashlight.

Describe alternatives you've considered

Make the recipes into a makeshift headlamp and create new a new item for a commercial headlamp. But as they would be so similar I don't think adding another item would achieve that much.

Testing

Additional context

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Items: Armor / Clothing Armor and clothing <Bugfix> This is a fix for a bug (or closes open issue) Game: Balance Balancing of (existing) in-game features. astyled astyled PR, label is assigned by github actions labels Oct 30, 2024
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Oct 30, 2024
@github-actions github-actions bot added Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` labels Oct 30, 2024
@ampersand55
Copy link
Contributor Author

As I changed the headlight to use a medium battery like the flashlight instead of light battery, tests fail when a helper function tries to load headlamp with a light battery.

void player_add_headlamp()
{
item headlamp( "wearable_light_on" );
item battery( "light_battery_cell" );
battery.ammo_set( battery.ammo_default(), -1 );
headlamp.put_in( battery, pocket_type::MAGAZINE_WELL );
Character &you = get_player_character();
you.worn.wear_item( you, headlamp, false, true );
}

@ampersand55
Copy link
Contributor Author

This should now be ready for merging.

I limited the scope of this to just adjusting the headlamp, I made it accept a light battery specifically to pass the tests.

Headlamp should really have the same battery slot as flashlight. A version with battery and the tests fixed should be previous commit at HEAD b0324d1

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 3, 2024
@Termineitor244
Copy link
Contributor

Did you not adjust the heavy-duty headlamp too? It uses light batteries too.

@ampersand55
Copy link
Contributor Author

My idea for the heavy headlamp includes some changes to the heavy flashlight too (which is part of the recipe of the heavy headlamp). I have that branch mostly ready and I'll make a separate PR if this one gets merged/accepted.

The heavy-duty headlamp is made from a heavy flashlight, which has an internal 48 kJ battery that can't be changed. It's based on this item:

https://www.amazon.com/dp/B00Y8AHZYC

Which is kind of silly to strap to your head as it weighs 720 g and has a volume of 4267 ml.

@kevingranade
Copy link
Member

Remove battery light from the headlamp, fix the test.

@ampersand55
Copy link
Contributor Author

I can't figure out why the tests fail. I need help with fixing the tests.

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 3, 2024
@Night-Pryanik
Copy link
Contributor

There's Urban Explorer profession which has wearable_light with corresponding light_battery_cell which the game tries to put inside.

@github-actions github-actions bot added the Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies label Nov 7, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 7, 2024
@ampersand55
Copy link
Contributor Author

The failed test is unrelated to this PR.

@Night-Pryanik Night-Pryanik merged commit c9808dd into CleverRaven:master Nov 7, 2024
21 of 27 checks passed
@ampersand55 ampersand55 deleted the adjust_headlamp branch November 7, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Game: Balance Balancing of (existing) in-game features. Items: Armor / Clothing Armor and clothing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The headlamp is severely under-powered compared to a real-life equivalent.
4 participants