Divergent/mods/Anomaly Magazines Redux/gamedata/scripts/magazines_keybinds.script

24 lines
783 B
Plaintext
Raw Normal View History

2024-03-17 20:18:03 -04:00
-- hotkeys and stuff
print_dbg = magazines.print_dbg
-- shift click to unload
InventoryClick = ui_inventory.UIInventory.On_CC_Mouse1
function ui_inventory.UIInventory:On_CC_Mouse1(bag, idx)
InventoryClick(self, bag, idx)
local obj = self.CC[bag]:GetObj(idx)
if (not obj) then
self:Print(nil, "Callback On_CC_Mouse1 | no object recieved!", bag, idx)
return
end
if ((key_state(DIK_keys.DIK_LCONTROL) or 0) ~= 0 or (key_state(DIK_keys.DIK_RCONTROL) or 0) ~= 0) and (bag == "actor_bag" or bag == "npc_bag")then
2024-03-17 20:18:03 -04:00
if magazine_binder.is_magazine(obj) then
magazines.func_unload_ammo(obj)
print_dbg("shift unload")
elseif magazine_binder.is_supported_weapon(obj) then
magazines.eject_magazine(obj)
end
end
end