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

Remove hardcoded Power Armor encumbrance reduction #54764

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 93 additions & 6 deletions data/json/items/armor/power_armor.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,14 @@
"flags": [ "USE_UPS", "WATERPROOF", "STURDY", "ELECTRIC_IMMUNE", "TRADER_AVOID", "CLIMATE_CONTROL", "COMBAT_TOGGLEABLE" ],
"power_draw": 4000000,
"revert_to": "power_armor_basic",
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s armor disengages.", "target": "power_armor_basic" }
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s armor disengages.", "target": "power_armor_basic" },
"armor": [
{
"encumbrance": 10,
"coverage": 100,
"covers": [ "torso", "arm_l", "arm_r", "hand_l", "hand_r", "leg_l", "leg_r", "foot_l", "foot_r" ]
}
]
},
{
"id": "power_armor_frame",
Expand Down Expand Up @@ -385,11 +392,18 @@
"flags": [ "USE_UPS", "WATERPROOF", "STURDY", "ELECTRIC_IMMUNE", "TRADER_AVOID", "CLIMATE_CONTROL", "COMBAT_TOGGLEABLE" ],
"power_draw": 4000000,
"revert_to": "power_armor_heavy",
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s armor disengages.", "target": "power_armor_heavy" }
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s armor disengages.", "target": "power_armor_heavy" },
"armor": [
{
"encumbrance": 20,
"coverage": 100,
"covers": [ "torso", "arm_l", "arm_r", "hand_l", "hand_r", "leg_l", "leg_r", "foot_l", "foot_r" ]
}
]
},
{
"id": "power_armor_helmet_basic",
"type": "ARMOR",
"type": "TOOL_ARMOR",
"category": "armor",
"name": { "str": "environmental combat helmet" },
"description": "A fully enclosed combat helmet for hazardous environments, this was designed to fit with a powered exoskeleton, using cameras to expand visual range. In practice, the cameras were unreliable and easily fouled. The environmental controls function best with direct-skin contact.",
Expand All @@ -405,15 +419,37 @@
"color": "light_gray",
"warmth": 90,
"power_armor": true,
"ammo": "battery",
"use_action": {
"type": "transform",
"menu_text": "Turn on",
"msg": "The %s engages.",
"target": "power_armor_helmet_basic_on",
"active": true
},
"material_thickness": 14,
"environmental_protection": 16,
"qualities": [ [ "GLARE", 1 ] ],
"flags": [ "WATCH", "WATERPROOF", "STURDY", "PARTIAL_DEAF", "THERMOMETER", "SUN_GLASSES", "COMBAT_TOGGLEABLE" ],
"armor": [ { "encumbrance": 50, "coverage": 100, "covers": [ "head", "eyes", "mouth" ] } ]
},
{
"id": "power_armor_helmet_basic_on",
"type": "TOOL_ARMOR",
"copy-from": "power_armor_helmet_basic",
"repairs_like": "power_armor_helmet_basic",
"looks_like": "power_armor_helmet_basic",
"name": { "str": "environmental combat helmet (on)", "str_pl": "environmental combat helmets (on)" },
"description": "A fully enclosed combat helmet for hazardous environments, this was designed to fit with a powered exoskeleton, using cameras to expand visual range. In practice, the cameras were unreliable and easily fouled. The environmental controls function best with direct-skin contact. The environmental controls function best with direct-skin contact. It is turned on and continually drawing power. Use it to turn it off.",
"power_draw": 435,
"revert_to": "power_armor_helmet_basic",
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s disengages.", "target": "power_armor_helmet_basic" },
"extend": { "flags": [ "USE_UPS" ] },
"armor": [ { "encumbrance": 10, "coverage": 100, "covers": [ "head", "eyes", "mouth" ] } ]
},
{
"id": "power_armor_helmet_heavy",
"type": "ARMOR",
"type": "TOOL_ARMOR",
"category": "armor",
"name": { "str": "heavy environmental combat helmet" },
"description": "An extremely heavy-duty fully enclosed combat helmet for hazardous environments, this was designed to fit with a powered exoskeleton. In the field, soldiers reported that the protection was not worth the awkward size and limited visuals. The environmental controls function best with direct-skin contact.",
Expand All @@ -432,12 +468,34 @@
"material_thickness": 16,
"environmental_protection": 16,
"qualities": [ [ "GLARE", 1 ] ],
"ammo": "battery",
"use_action": {
"type": "transform",
"menu_text": "Turn on",
"msg": "The %s engages.",
"target": "power_armor_helmet_heavy_on",
"active": true
},
"flags": [ "WATCH", "WATERPROOF", "STURDY", "PARTIAL_DEAF", "THERMOMETER", "SUN_GLASSES", "COMBAT_TOGGLEABLE" ],
"armor": [ { "encumbrance": 60, "coverage": 100, "covers": [ "head", "eyes", "mouth" ] } ]
},
{
"id": "power_armor_helmet_heavy_on",
"type": "TOOL_ARMOR",
"copy-from": "power_armor_helmet_heavy",
"repairs_like": "power_armor_helmet_heavy",
"looks_like": "power_armor_helmet_heavy",
"name": { "str": "heavy environmental combat helmet (on)", "str_pl": "heavy environmental combat helmets (on)" },
"description": "An extremely heavy-duty fully enclosed combat helmet for hazardous environments, this was designed to fit with a powered exoskeleton. In the field, soldiers reported that the protection was not worth the awkward size and limited visuals. The environmental controls function best with direct-skin contact. It is turned on and continually drawing power. Use it to turn it off.",
"power_draw": 435,
"revert_to": "power_armor_helmet_heavy",
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s disengages.", "target": "power_armor_helmet_heavy" },
"extend": { "flags": [ "USE_UPS" ] },
"armor": [ { "encumbrance": 20, "coverage": 100, "covers": [ "head", "eyes", "mouth" ] } ]
},
{
"id": "power_armor_helmet_light",
"type": "ARMOR",
"type": "TOOL_ARMOR",
"category": "armor",
"name": { "str": "light environmental combat helmet" },
"description": "This full-enclosure helmet was designed based on commercial diving equipment, in response to complaints that earlier designs were impossible to use in combat. While still a little more restrictive than regular combat headgear - and frustrating should your nose itch - this one received far better reviews from soldiers. Sadly, civilization ended before they could roll out in significant numbers. The environmental controls function best with direct-skin contact.",
Expand All @@ -453,11 +511,33 @@
"color": "dark_gray",
"warmth": 60,
"power_armor": true,
"ammo": "battery",
"use_action": {
"type": "transform",
"menu_text": "Turn on",
"msg": "The %s engages.",
"target": "power_armor_helmet_light_on",
"active": true
},
"material_thickness": 8,
"environmental_protection": 16,
"flags": [ "WATCH", "WATERPROOF", "STURDY", "THERMOMETER", "SUN_GLASSES", "SWIM_GOGGLES", "COMBAT_TOGGLEABLE" ],
"armor": [ { "encumbrance": 40, "coverage": 100, "covers": [ "head", "eyes", "mouth" ] } ]
},
{
"id": "power_armor_helmet_light_on",
"type": "TOOL_ARMOR",
"copy-from": "power_armor_helmet_light",
"repairs_like": "power_armor_helmet_light",
"looks_like": "power_armor_helmet_light",
"name": { "str": "light environmental combat helmet (on)", "str_pl": "light environmental combat helmets (on)" },
"description": "This full-enclosure helmet was designed based on commercial diving equipment, in response to complaints that earlier designs were impossible to use in combat. While still a little more restrictive than regular combat headgear - and frustrating should your nose itch - this one received far better reviews from soldiers. Sadly, civilization ended before they could roll out in significant numbers. The environmental controls function best with direct-skin contact. It is turned on and continually drawing power. Use it to turn it off.",
"power_draw": 435,
"revert_to": "power_armor_helmet_light",
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s disengages.", "target": "power_armor_helmet_light" },
"extend": { "flags": [ "USE_UPS" ] },
"armor": [ { "encumbrance": 0, "coverage": 100, "covers": [ "head", "eyes", "mouth" ] } ]
},
{
"id": "power_armor_light",
"type": "TOOL_ARMOR",
Expand Down Expand Up @@ -572,6 +652,13 @@
"flags": [ "USE_UPS", "WATERPROOF", "STURDY", "ELECTRIC_IMMUNE", "TRADER_AVOID", "CLIMATE_CONTROL", "COMBAT_TOGGLEABLE" ],
"power_draw": 4000000,
"revert_to": "power_armor_light",
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s armor disengages.", "target": "power_armor_light" }
"use_action": { "type": "transform", "menu_text": "Turn off", "msg": "The %s armor disengages.", "target": "power_armor_light" },
"armor": [
{
"encumbrance": 0,
"coverage": 100,
"covers": [ "torso", "arm_l", "arm_r", "hand_l", "hand_r", "leg_l", "leg_r", "foot_l", "foot_r" ]
}
]
}
]
7 changes: 7 additions & 0 deletions data/json/items/tool_armor.json
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,13 @@
"PSYSHIELD_PARTIAL",
"GNV_EFFECT",
"CLIMATE_CONTROL"
],
"armor": [
{
"encumbrance": 10,
"coverage": 100,
"covers": [ "head", "mouth", "eyes", "torso", "arm_l", "arm_r", "hand_l", "hand_r", "leg_l", "leg_r", "foot_l", "foot_r" ]
}
]
},
{
Expand Down
14 changes: 5 additions & 9 deletions src/character_attire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ bool Character::is_wearing_active_optcloak() const
}

static void layer_item( std::map<bodypart_id, encumbrance_data> &vals, const item &it,
std::map<bodypart_id, layer_level> &highest_layer_so_far, bool power_armor, const Character &c )
std::map<bodypart_id, layer_level> &highest_layer_so_far, const Character &c )
{
body_part_set covered_parts = it.get_covered_body_parts();
for( const bodypart_id &bp : c.get_all_body_parts() ) {
Expand All @@ -800,9 +800,6 @@ static void layer_item( std::map<bodypart_id, encumbrance_data> &vals, const ite
layering_encumbrance = 0;
}

const int armorenc = !power_armor || !it.is_power_armor() ?
encumber_val : std::max( 0, encumber_val - 40 );

for( layer_level item_layer : item_layers ) {
// do the sublayers of this armor conflict
bool conflicts = false;
Expand All @@ -822,7 +819,7 @@ static void layer_item( std::map<bodypart_id, encumbrance_data> &vals, const ite
penalty_layer <= highest_layer_so_far[bp]; ++penalty_layer ) {
vals[bp].layer( penalty_layer, layering_encumbrance, conflicts );
}
vals[bp].armor_encumbrance += armorenc;
vals[bp].armor_encumbrance += encumber_val;
}
}
}
Expand Down Expand Up @@ -864,16 +861,15 @@ void Character::item_encumb( std::map<bodypart_id, encumbrance_data> &vals,
// items
std::map<bodypart_id, layer_level> highest_layer_so_far;

const bool power_armored = is_wearing_active_power_armor();
for( auto w_it = worn.begin(); w_it != worn.end(); ++w_it ) {
if( w_it == new_item_position ) {
layer_item( vals, new_item, highest_layer_so_far, power_armored, *this );
layer_item( vals, new_item, highest_layer_so_far, *this );
}
layer_item( vals, *w_it, highest_layer_so_far, power_armored, *this );
layer_item( vals, *w_it, highest_layer_so_far, *this );
}

if( worn.end() == new_item_position && !new_item.is_null() ) {
layer_item( vals, new_item, highest_layer_so_far, power_armored, *this );
layer_item( vals, new_item, highest_layer_so_far, *this );
}

// make sure values are sane
Expand Down
3 changes: 1 addition & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3592,7 +3592,6 @@ void item::armor_info( std::vector<iteminfo> &info, const iteminfo_query *parts,
insert_separation_line( info );

if( covers_anything ) {
int power_armor_encumbrance_reduction = 40;

if( is_power_armor() || type->get_id() == itype_rm13_armor ) {
item tmp = *this;
Expand All @@ -3618,7 +3617,7 @@ void item::armor_info( std::vector<iteminfo> &info, const iteminfo_query *parts,
if( type->get_id() == itype_rm13_armor ) {
print_prot = !tmp.armor_encumbrance_info( info, parts );
} else {
print_prot = !tmp.armor_encumbrance_info( info, parts, true, power_armor_encumbrance_reduction );
print_prot = !tmp.armor_encumbrance_info( info, parts, true );
}
}
if( print_prot ) {
Expand Down