Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit ac6550a

Browse files
committed
Allow HumanFunctions.DoAutomaticEquip to unequip BG item and equip it in FG hand (previously only possible by going prone) + re-enabling the function as default, for now
1 parent d6bffb3 commit ac6550a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Base.rte/AI/HumanAI.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Create(self)
66
self.AI = NativeHumanAI:Create(self);
77
--You can turn features on and off here
88
self.armSway = true;
9-
self.automaticEquip = false;
9+
self.automaticEquip = true;
1010
self.alternativeGib = true;
1111
self.visibleInventory = true;
1212
end

Base.rte/AI/HumanFunctions.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ end
5959

6060
function HumanFunctions.DoAutomaticEquip(actor)
6161
--Equip a weapon automatically if the one held by a player is destroyed
62-
if actor:IsPlayerControlled() and actor.EquippedItem == nil and actor.InventorySize > 0 and not actor.controller:IsState(Controller.WEAPON_FIRE) then
63-
actor:EquipFirearm(true);
62+
if actor.EquippedItem == nil and actor.FGArm and not actor.controller:IsState(Controller.WEAPON_FIRE) then
63+
if (actor:IsPlayerControlled() and actor.InventorySize > 0) or actor:UnequipBGArm() then
64+
actor:EquipFirearm(true);
65+
end
6466
end
6567
end
6668

0 commit comments

Comments
 (0)