-
Notifications
You must be signed in to change notification settings - Fork 283
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
Power Armor Overhaul #1505
Power Armor Overhaul #1505
Conversation
2dcd51b
to
b49bc65
Compare
b49bc65
to
2bca562
Compare
return true; | ||
if( elem.has_flag( flag_POWERARMOR_EXO ) ) { | ||
result = true; | ||
if( hasHelmet == nullptr ) { |
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.
Unrelated to the PR itself, but this bool *hasHelmet
is a terrible practice. Nowadays we'd return a struct or pair and not bother early exiting a loop over worn items because worn items vector is small.
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'm not sure how this should be fixed to be honest, C++ is still fairly arcane to me.
Was throwing up a few build errors for whatever reason.
Also adds code to check that a swap is valid. This only matters for power armour right now.
src/item.cpp
Outdated
@@ -9203,16 +9284,46 @@ bool item::process_tool( player *carrier, const tripoint &pos ) | |||
energy -= ammo_consume( energy, pos ); | |||
|
|||
// for items in player possession if insufficient charges within tool try UPS | |||
if( carrier && has_flag( flag_USE_UPS ) ) { | |||
if( carrier && ( has_flag( flag_USE_UPS ) || ( is_power_armor() ) ) ) { |
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.
Can we just make power armor use UPS and make it processed like any other UPS tool here? Switching off doesn't seem to be something specific for power armor.
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 don't understand your meaning, this is my method of having the power armour use ups charges without having the (UPS) suffix and an incorrect description that the device has been "modified to run off a universal power supply" since that is it's default state.
It is thus processed exactly like a UPS tool assuming the power armour interface is not installed/activated.
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'd rather have the incorrect description, since many items have it as well. It looks like we may need to change the description, but for power armors, it should be consistent with other UPS items, even if the description is currently not perfect.
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 just think it's really ugly, and I already folded the UPS description/function into the POWERARMOR_EXO/EXTERNAL/MOD flags alongside the Bionic Armour Interface. But if this is considered necessary I guess I can change that.
I'd also have to rewrite the use_charges
and has_enough_charges
function, which will be a bit of a pain due to how they are. It's hard to see a situation where we'd want power armour to run off the interface but not UPS.
It does make sense that only active tools are processed here.
f83576e
to
a2b2c9d
Compare
There's a check to make power armour with the USE_UPS flag not have (UPS) appended to it. This is mainly a taste issue. I just don't like it to appear as "power armor basic (active) (UPS)". If you would prefer such a thing, then I can remove the check. |
All the groundwork was already laid by previous contributors, just needed to remove the hardcode check.
Turns out I don't really need to make new functions to make set_transform(ed) work.
To silence (UPS) suffix
So that the description outright tells players it's more efficient than using UPS.
6b373a6
to
8e32ba6
Compare
This reverts commit 8e32ba6.
Pre-existing and very minor bug: if you destroy worn power armor, you can keep the helmet on. |
Summary
SUMMARY: Infrastructure? "Full overhaul of Power Armour system"
Purpose of change
Power Armour effects are all currently hardcoded, and the way it works right now is fairly undeveloped. This PR is essentially a full overhaul of how Power Armour is stored, transforms, and it's effects. There will also be content additions along with this.
As a side effect optical cloaks which also use the ups_based_armor activation have also been changed to function using transforms.
Describe the solution
The goal is a gradual deprecation of the power_armor bool in the json, and rewrite the system so that modular attachments can be applied to power armour. It will also attempt to convert most of the effects of the power_armor bool (like climate control, power armour interface, etc) into JSON flags, as many of these effects can already be replicated with little effort.
Some effects will be added to Power Armour as well, mainly a carry weight modification so that the average joe isn't overburdened by basic power armour.
List of current plans and completed ideas follow.
Describe alternatives you've considered
Removal of the Power Armour Interface and rigging it so that it just draws from UPS instead (at rebalanced rate).
Testing
Apparently I didn't consider that carrier could be null, fixed.
Additional context
Oh, I also reordered the power_armor.json because finding where everything was placed gave me a headache.
Currently completed implementations are:
Future things to do. [Note: Remember to link the PRs of future fixes to this so that this set of PRs is easy to follow.]