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

Npc can handle multipe power gen cbm #35601

Merged
merged 4 commits into from
Nov 20, 2019
Merged

Conversation

Fris0uman
Copy link
Contributor

@Fris0uman Fris0uman commented Nov 19, 2019

Summary

SUMMARY: Bugfixes "Npc can handle multipe power gen cbm"

Purpose of change

Npc can handle multipe power gen cbm
Fixes #35559
Internal Furnace CBM is NPC useable

Describe the solution

Fix wants_to_recharge_cbm() and recharge_cbm() logic to handle having multiple power gen CBMs
Add "BIONIC_NPC_USABLE" flag to Internal Furnace since it already has code to handle useage by NPCs

Describe alternatives you've considered

Testing

Get NPC
Give power bank Mk2, Laser finger, ethanol burner
NPC ask for ethanol,
Give ethanol
NPC refuel CBM
wait
Ethanol Burner turns off
wait
No message, no crash
Spawn Z
NPC shoots Z
Turns ethanol burner on
Power is recharged
Turns ethanol burner off

Install Battery system
No infinite loop
Spawn Z/NPC shoots
NPC ask for battery and turns on ethanol burner
wait
Power goes up
wait, no complain, no infinite loop

Spawn new NPC
Give power bank and internal furnace
NPC ask for junk
Give plank
NPC recharge 70 kJ with plank
Give another
Same

Additional context

NPC will use the first CBM with fuel

src/npcmove.cpp Outdated Show resolved Hide resolved
Co-Authored-By: anothersimulacrum <[email protected]>
src/npcmove.cpp Outdated
}
return no_fueled_cbm;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return no_fueled_cbm;
return get_fueled_bionics().empty();

And get rid of the variable. It's only used here.

And why do NPC want to recharge their bionic power if they don't have any fuelled CBMs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bio_furnace and bio_reactor don't use the fuel system but NPC can use them.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Bionics CBM (Compact Bionic Modules) labels Nov 19, 2019
@ZhilkinSerg ZhilkinSerg merged commit 14e05ae into CleverRaven:master Nov 20, 2019
@Fris0uman Fris0uman deleted the mutlipow branch April 28, 2020 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bionics CBM (Compact Bionic Modules) [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPC dies when completing CBM installation
4 participants