tester-fixes
This commit is contained in:
parent
7ac7f99287
commit
819abb1a27
1 changed files with 29 additions and 4 deletions
|
|
@ -636,10 +636,35 @@ namespace RacesOfValheim
|
||||||
// it is put back to full once rather than left as a stale figure in the save file.
|
// it is put back to full once rather than left as a stale figure in the save file.
|
||||||
if (claws.m_durability < claws.GetMaxDurability()) claws.m_durability = claws.GetMaxDurability();
|
if (claws.m_durability < claws.GetMaxDurability()) claws.m_durability = claws.GetMaxDurability();
|
||||||
|
|
||||||
// Empty-handed means clawed. Anything else in the right hand wins until it is put away,
|
// Empty-handed means clawed. Anything the player is actually holding wins until it is
|
||||||
// which is the whole compromise.
|
// put away, which is the whole compromise.
|
||||||
ItemDrop.ItemData held = Traverse.Create((Humanoid)player).Field<ItemDrop.ItemData>("m_rightItem").Value;
|
//
|
||||||
if (held == null && !player.InAttack())
|
// BOTH HANDS, and asking only about the right one is what broke the bow. A bow is held
|
||||||
|
// in m_leftItem, so a bow-wielding player read as empty-handed here and got the claws
|
||||||
|
// forced into his hands - and Humanoid.EquipItem's OneHandedWeapon branch (read off the
|
||||||
|
// IL) does this before it puts anything in the right hand:
|
||||||
|
//
|
||||||
|
// UnequipItem(m_rightItem);
|
||||||
|
// if (m_leftItem != null && m_leftItem.m_shared.m_itemType != Shield)
|
||||||
|
// UnequipItem(m_leftItem);
|
||||||
|
//
|
||||||
|
// Everything but a shield is torn out of the left hand. So the archer's bow was pulled
|
||||||
|
// out from under him, up to twice a second - and not only on the throttled tick, because
|
||||||
|
// RaceClaws_UnequipItem_Patch calls Maintain from inside UnequipItem and EquipItem calls
|
||||||
|
// UnequipItem first, so drawing a bow started the fight immediately.
|
||||||
|
//
|
||||||
|
// Free is therefore defined as "nothing the claws would displace", which is that rule
|
||||||
|
// mirrored rather than a second guess at it: a shield stays because equipping the claws
|
||||||
|
// over a shield costs the player nothing.
|
||||||
|
Humanoid humanoid = player;
|
||||||
|
ItemDrop.ItemData right = Traverse.Create(humanoid).Field<ItemDrop.ItemData>("m_rightItem").Value;
|
||||||
|
ItemDrop.ItemData left = Traverse.Create(humanoid).Field<ItemDrop.ItemData>("m_leftItem").Value;
|
||||||
|
|
||||||
|
bool leftIsShield = left != null && left.m_shared != null &&
|
||||||
|
left.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Shield;
|
||||||
|
bool handsFree = right == null && (left == null || leftIsShield);
|
||||||
|
|
||||||
|
if (handsFree && !player.InAttack())
|
||||||
{
|
{
|
||||||
player.EquipItem(claws, false);
|
player.EquipItem(claws, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue