-
Notifications
You must be signed in to change notification settings - Fork 264
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 Essential field to Body Parts. Rework Repair Nanobots and NPC first aid action. #2482
Add Essential field to Body Parts. Rework Repair Nanobots and NPC first aid action. #2482
Conversation
Head and Torso labelled essential parts. Adjusted is_dead_state() to use essential bool. Priority parts are considered 10 points more injured for purposes of healing from nanobots and NPCs. If healing is done and there is still power/kcal, increment any mending effect by 1%
Didn't properly update my code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall it's an welcome addition. could you refactor the code a bit before merging?
src/bionics.cpp
Outdated
std::vector<bodypart_id> bleeding_bp_parts; | ||
std::vector<bodypart_id> damaged_hp_parts; | ||
std::vector<bodypart_id> mending_bp_parts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think optaining bleeding_bp_parts
, damaged_hp_parts
, and mending_bp_parts
vector should be done in separate function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it sort of is? bleeding_bp_parts is updated every 30 turns while damaged_hp_parts and mending_hp_parts are updated every 1 minute. Unless you mean some character specific vector that is updated every turn, which would likely be a bit costly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean, the vectors could be initialiazed from separate static function, for example
static std::vector<bodypart_id> get_bleeding_bp_parts( const character &c )
Co-authored-by: scarf <greenscarf005@gmail.com>
Co-authored-by: scarf <greenscarf005@gmail.com>
To fetch effect vector
0fcbd7f
to
01493ee
Compare
Co-authored-by: scarf <greenscarf005@gmail.com>
effect_map instantiates a new effect list instead of receiving the pointers, so the pointers provided by the function don't point at the bleeding effects on the character but to the effects on the effect map, which has likely ceased to exist.
0756ed8
to
053987b
Compare
Reinstate effect map as a reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set both torso and arm's health to 10
confirmed essential part (torso) gets healed first
broke an arm, confirmed it does not heal without splints
wore splints with CBM turned off, confirmed it does not heal within minutes
wore splints with CBM turned on, confirmed it heals in minute basis. however, i think it should be more explicitly described how it interacts with splints and broken arms.
Summary
SUMMARY: Balance "Add Essential field to Body Parts. Add kcal_trigger_cost to Bionics. Rework Repair Nanobots and NPC first aid action."
Purpose of change
When I first did a pass over the Repair Nanobots in #1442 and #1508, I had no idea what I was doing with C++. Now that I sort of do I can fix up some things and make the Repair Nanobots work closer to my vision.
Also, Repair Nanobots not working on broken limbs was a bit weird, so I'm going to make it repair your broken limbs (as long as they've been splinted, or you have Lizard Regeneration)
Added
kcal_trigger_cost
as a parameter for bionics, only used for Repair Nanobots currently, but jsonizes kcal costs.Describe the solution
Add
essential"
field to body parts. Currently only for Head and Torso. If these body parts reach 0 HP, you die.Add
kcal_trigger_cost
to bionics. Only used in Repair Nanobots right now.Swap
react_cost
on Repair Nanobots fortrigger_cost
to more accurately reflect what it does. Undo the hacks I did to makereact_cost
work for my purposes last time.Bleeding has been un-RNG'd, and will now prioritize essential body parts first.
Change trigger for HP/mending to once every minute. Both will now increment all wounded/mending parts by 1HP or 1% each, provided you have enough calories and enough bionic energy. If you do not, the system will prioritize injuries first (injured essential parts considered 10 HP more injured than other parts), then broken limbs.
Describe alternatives you've considered
Placing mending changes in
character::mend()
Testing
Spawned character, installed nanobots, gave enough power for a single limb, checked that when torso and arm were both similarly injured, torso was healed first, even when both were under 10 HP. Checked that when given enough power for all limbs all limbs were only healed 1 HP.
Broke one of their arms, checked that without a splint it would not heal from the Nanobots. Checked that when I put on the splint it incremented by 1% every minute.
Additional context