Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -1551,9 +1551,19 @@ void npc::alt_attack(game *g, int target)
moves -= 125;
if (g->u_see(posx, posy))
g->add_msg(_("%s throws a %s."), name.c_str(), used->tname().c_str());
g->throw_item(*this, tarx, tary, *used, trajectory);
i_remn(invlet);

int stack_size = -1;
if( used->count_by_charges() ) {
stack_size = used->charges;
used->charges = 1;
}
g->throw_item(*this, tarx, tary, *used, trajectory);
// Throw a single charge of a stacking object.
if( stack_size == -1 || stack_size == 1 ) {
i_remn(invlet);
} else {
used->charges = stack_size - 1;
}
} else if (!wont_hit_friend(g, tarx, tary, invlet)) {// Danger of friendly fire

if (!used->active || used->charges > 2) // Safe to hold on to, for now
@@ -1603,7 +1613,21 @@ void npc::alt_attack(game *g, int target)
moves -= 125;
if (g->u_see(posx, posy))
g->add_msg(_("%s throws a %s."), name.c_str(), used->tname().c_str());

int stack_size = -1;
if( used->count_by_charges() ) {
stack_size = used->charges;
used->charges = 1;
}
g->throw_item(*this, tarx, tary, *used, trajectory);

// Throw a single charge of a stacking object.
if( stack_size == -1 || stack_size == 1 ) {
i_remn(invlet);
} else {
used->charges = stack_size - 1;
}

i_remn(invlet);
}

@@ -7805,72 +7805,55 @@ int player::encumb(body_part bp, int &layers, int &armorenc)
it_armor* armor;
for (int i = 0; i < worn.size(); i++)
{
if (!worn[i].is_armor())
if( !worn[i].is_armor() ) {
debugmsg("%s::encumb hit a non-armor item at worn[%d] (%s)", name.c_str(),
i, worn[i].tname().c_str());
i, worn[i].tname().c_str());
}
armor = dynamic_cast<it_armor*>(worn[i].type);

if (armor->covers & mfb(bp))
{
if (armor->is_power_armor() && (has_active_item("UPS_on") || has_active_item("adv_UPS_on") || has_active_bionic("bio_power_armor_interface") || has_active_bionic("bio_power_armor_interface_mkII")))
{
if( armor->covers & mfb(bp) ) {
layers++;
if( armor->is_power_armor() &&
(has_active_item("UPS_on") || has_active_item("adv_UPS_on") ||
has_active_bionic("bio_power_armor_interface") ||
has_active_bionic("bio_power_armor_interface_mkII")) ) {
armorenc += armor->encumber - 4;
}
else
{
} else {
armorenc += armor->encumber;
if (worn[i].has_flag("FIT"))
{
armorenc--;
// Fitted clothes will either reduce encumberance or negate layering.
if( worn[i].has_flag( "FIT" ) ) {
if( armor->encumber > 0 ) {
armorenc--;
} else {
layers--;
}
}
}
if (armor->encumber >= 0 || bp != bp_torso)
{
layers++;
}
}
}

ret += armorenc;

// Following items undo their layering. Once. Bodypart has to be taken into account, hence the switch.
switch (bp)
{
case bp_feet : if (is_wearing("socks") || is_wearing("socks_wool")) layers--; break;
case bp_legs : if (is_wearing("long_underpants")) layers--; break;
case bp_hands : if (is_wearing("gloves_liner")) layers--; break;
case bp_torso : if (is_wearing("under_armor")) layers--; break;
}
if (layers > 1)
{
if (layers > 1) {
ret += (layers - 1) * (bp == bp_torso ? .5 : 2);// Easier to layer on torso
}
if (volume_carried() > volume_capacity() - 2 && bp != bp_head)
{
if (volume_carried() > volume_capacity() - 2 && bp != bp_head) {
ret += 3;
}

// Fix for negative hand encumbrance
if ((bp == bp_hands) && (ret < 0))
ret =0;

// Bionics and mutation
if (has_bionic("bio_stiff") && bp != bp_head && bp != bp_mouth)
{
if( has_bionic("bio_stiff") && bp != bp_head && bp != bp_mouth ) {
ret += 1;
}
if (has_trait(PF_CHITIN3) && bp != bp_eyes && bp != bp_mouth)
{
if( has_trait(PF_CHITIN3) && bp != bp_eyes && bp != bp_mouth ) {
ret += 1;
}
if (has_trait(PF_SLIT_NOSTRILS) && bp == bp_mouth)
{
if( has_trait(PF_SLIT_NOSTRILS) && bp == bp_mouth ) {
ret += 1;
}
if (bp == bp_hands &&
(has_trait(PF_ARM_TENTACLES) || has_trait(PF_ARM_TENTACLES_4) ||
has_trait(PF_ARM_TENTACLES_8)))
{
(has_trait(PF_ARM_TENTACLES) || has_trait(PF_ARM_TENTACLES_4) ||
has_trait(PF_ARM_TENTACLES_8)) ) {
ret += 3;
}
return ret;
@@ -188,7 +188,7 @@ int veh_interact::cant_do (char mode)
case 'o': // remove mode
valid_target = cpart >= 0 && 0 == veh->tags.count("convertible");
has_tools = has_wrench && has_hacksaw;
part_free = parts_here.size() > 1 || veh->can_unmount(cpart);
part_free = parts_here.size() > 1 || (cpart >= 0 && veh->can_unmount(cpart));
has_skill = g->u.skillLevel("mechanics") >= 2;
break;
case 's': // siphon mode