39 lines
903 B
Plaintext
39 lines
903 B
Plaintext
|
local holding_shift = false
|
||
|
|
||
|
local tasks = {0}
|
||
|
function inventory_upgrades.effect_upgrade_item(item)
|
||
|
if (item:clsid() == "WP_BINOC") or (ui_options.get("gameplay/general/mechanic_feature") ~= true) then
|
||
|
return
|
||
|
end
|
||
|
|
||
|
local npc = get_speaker()
|
||
|
if (npc) then
|
||
|
if (holding_shift) then
|
||
|
tasks = {tasks[1] + 1, item, npc}
|
||
|
else
|
||
|
inventory_upgrades.lend_item_for_repair(item,npc:section(),1800)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local function on_key_hold(key)
|
||
|
if (key == DIK_keys["DIK_LSHIFT"]) then
|
||
|
holding_shift = true
|
||
|
end
|
||
|
end
|
||
|
|
||
|
local function on_key_release(key)
|
||
|
if (key == DIK_keys["DIK_LSHIFT"]) then
|
||
|
holding_shift = false
|
||
|
|
||
|
if (tasks[1] > 0) then
|
||
|
inventory_upgrades.lend_item_for_repair(tasks[2],tasks[3]:section(),1800*tasks[1])
|
||
|
tasks = {0}
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function on_game_start()
|
||
|
RegisterScriptCallback("on_key_release",on_key_release)
|
||
|
RegisterScriptCallback("on_key_hold",on_key_hold)
|
||
|
end
|