construction
Code: Select all
direct_driver=vehicle.get_inventory(defines.inventory.fuel)
if direct_driver[i] and direct_driver[i].valid
do not detect invalid/empty state inventory cell
1467.307 Script @__aai-programmable-vehicles__/control.lua:1824: inventory:: defines.inventory.fuel is present in [3] cells
1467.307 Script @__aai-programmable-vehicles__/control.lua:1825: inventory:: Index =1
1467.307 Script @__aai-programmable-vehicles__/control.lua:1828: inventory::containing:
1467.307 Script @__aai-programmable-vehicles__/control.lua:1830: y-infused-uca2=5
1467.307 Script @__aai-programmable-vehicles__/control.lua:1836: inventory::List:
1467.307 Script @__aai-programmable-vehicles__/control.lua:1840: cedll[1]=5 X y-infused-uca2
1467.764 Error MainLoop.cpp:1035: Exception at tick 4300: Error while running event aai-programmable-vehicles::on_tick (ID 0)
LuaItemStack API call when LuaItemStack was invalid.
stack traceback:
__aai-programmable-vehicles__/control.lua:1840: in function 'select_weapon'
__aai-programmable-vehicles__/control.lua:1898: in function 'unit_update_gun'
__aai-programmable-vehicles__/control.lua:2838: in function 'unit_update_state'
__aai-programmable-vehicles__/control.lua:4980: in function 'unit_tick'
__aai-programmable-vehicles__/control.lua:5017: in function <__aai-programmable-vehicles__/control.lua:4987
Code: Select all
local direct_driver=vehicle.get_inventory(def) -- get inventory from vehicle (iterate over all defines of inventory)
log("inventory::List: " )
for i=1, #direct_driver ,1 do
local s="false"
if direct_driver[i] and direct_driver[i].valid then -->> line :__aai-programmable-vehicles__/control.lua:18439:
log ("cell["..i.."]="..direct_driver[i].count.." X "..direct_driver[i].name) -->> 1467.764 Error MainLoop.cpp:1035: Exception at tick 4300: Error while running event aai-programmable-vehicles::on_tick (ID 0) LuaItemStack API call when LuaItemStack was invalid.
else
log ("cedll["..i.."]=".." empty ")
end
end
log("direct_driver:: "..serpent.block(direct_driver.selected_gun_index) )
[en]
the purpose of the modification: access to the management of weapons of transport from the program code (analog LuaPlayer.selected_gun_index)
guess: select the current weapon when you use different characters/players of the transport is preserved (in the transport)
goal: is not achieved
[ru]
цель модификации: доступ к управлению оружием транспорта из программного кода (аналог LuaPlayer.selected_gun_index)
предпосылки: выбор текущего оружия транспорта при использовании разными персонажами/игроками сохраняется (в самом транспорте)
цель: не достигнута
предпосылки: выбор текущего оружия транспорта при использовании разными персонажами/игроками сохраняется (в самом транспорте)
цель: не достигнута