--[[ * Bullet penetration on all weapons by the maintainer of this account
*
* Changelog:
* v1: Initial release
*
* Not for use in Pirate Perfagtion Trainer]]
local old_init = WeaponTweakData.init
function WeaponTweakData:init()
old_init(self)
for k, v in pairs(self) do
if type(v) == "table" and v.category then
self[k].can_shoot_through_shield = true
self[k].can_shoot_through_enemy = true
self[k].can_shoot_through_wall = true
end
end
end
--[[ * SimpleMenu implementation of Spawn Primary Weapons by gir489 v1
*
* Credits; Harfatus for SimpleMenu.
*
* Changelog:
* v1: Initial release
*
* Not for use in Pirate Perfagtion Trainer]]
if not SimpleMenu then
SimpleMenu = class()
function SimpleMenu:init(title, message, options)
self.dialog_data = { title = title, text = message, button_list = {},
id = tostring(math.random(0,0xFFFFFFFF)) }
self.visible = false
for _,opt in ipairs(options) do
local elem = {}
elem.text = opt.text
opt.data = opt.data or nil
opt.callback = opt.callback or nil
elem.callback_func = callback(self, self, "_do_callback",
{ data = opt.data,
callback = opt.callback})
elem.cancel_button = opt.is_cancel_button or false
if opt.is_focused_button then
self.dialog_data.focus_button = #self.dialog_data.button_list+1
end
table.insert(self.dialog_data.button_list, elem)
end
return self
end
function SimpleMenu:_do_callback(info)
if info.callback then
if info.data then
info.callback(info.data)
else
info.callback()
end
end
self.visible = false
end
function SimpleMenu:show()
if self.visible then
return
end
self.visible = true
managers.system_menu:show(self.dialog_data)
end
function SimpleMenu:hide()
if self.visible then
managers.system_menu:close(self.dialog_data.id)
self.visible = false
return
end
end
end
patched_update_input = patched_update_input or function (self, t, dt )
if self._data.no_buttons then
return
end
local dir, move_time
local move = self._controller:get_input_axis( "menu_move" )
if( self._controller:get_input_bool( "menu_down" )) then
dir = 1
elseif( self._controller:get_input_bool( "menu_up" )) then
dir = -1
end
if dir == nil then
if move.y > self.MOVE_AXIS_LIMIT then
dir = 1
elseif move.y < -self.MOVE_AXIS_LIMIT then
dir = -1
end
end
if dir ~= nil then
if( ( self._move_button_dir == dir ) and self._move_button_time and ( t < self._move_button_time + self.MOVE_AXIS_DELAY ) ) then
move_time = self._move_button_time or t
else
self._panel_script:change_focus_button( dir )
move_time = t
end
end
self._move_button_dir = dir
self._move_button_time = move_time
local scroll = self._controller:get_input_axis( "menu_scroll" )
-- local sdir
if( scroll.y > self.MOVE_AXIS_LIMIT ) then
self._panel_script:scroll_up()
-- sdir = 1
elseif( scroll.y < -self.MOVE_AXIS_LIMIT ) then
self._panel_script:scroll_down()
-- sdir = -1
end
end
managers.system_menu.DIALOG_CLASS.update_input = patched_update_input
managers.system_menu.GENERIC_DIALOG_CLASS.update_input = patched_update_input
spawnprimarycallback = spawnprimarycallback or function(info)
if ( managers.player:player_unit() ) then
local weapon = Global.blackmarket_manager.crafted_items.primaries[info]
if weapon then
managers.player:player_unit():inventory():add_unit_by_factory_name( weapon.factory_id, false, false, weapon.blueprint ) --The first false means to not equip it, the second false means it's not instant.
end
end
end
opts = {}
for i,weapon in pairs(Global.blackmarket_manager.crafted_items.primaries) do
if ( weapon ) then
table.insert( opts, { text = managers.blackmarket:get_weapon_name_by_category_slot("primaries",i):gsub("\"", ""), callback = spawnprimarycallback, data = i } )
end
end
table.insert( opts, { text = "Close", is_cancel_button = true } )
mymenu = SimpleMenu:new("Spawn Primary Weapons", "Select the weapon you want to spawn.", opts)
mymenu:show()
--[[ * SimpleMenu implementation of Spawn Secondary Weapons by gir489 v1
*
* Credits; Harfatus for SimpleMenu.
*
* Changelog:
* v1: Initial release
*
* Not for use in Pirate Perfagtion Trainer]]
if not SimpleMenu then
SimpleMenu = class()
function SimpleMenu:init(title, message, options)
self.dialog_data = { title = title, text = message, button_list = {},
id = tostring(math.random(0,0xFFFFFFFF)) }
self.visible = false
for _,opt in ipairs(options) do
local elem = {}
elem.text = opt.text
opt.data = opt.data or nil
opt.callback = opt.callback or nil
elem.callback_func = callback(self, self, "_do_callback",
{ data = opt.data,
callback = opt.callback})
elem.cancel_button = opt.is_cancel_button or false
if opt.is_focused_button then
self.dialog_data.focus_button = #self.dialog_data.button_list+1
end
table.insert(self.dialog_data.button_list, elem)
end
return self
end
function SimpleMenu:_do_callback(info)
if info.callback then
if info.data then
info.callback(info.data)
else
info.callback()
end
end
self.visible = false
end
function SimpleMenu:show()
if self.visible then
return
end
self.visible = true
managers.system_menu:show(self.dialog_data)
end
function SimpleMenu:hide()
if self.visible then
managers.system_menu:close(self.dialog_data.id)
self.visible = false
return
end
end
end
patched_update_input = patched_update_input or function (self, t, dt )
if self._data.no_buttons then
return
end
local dir, move_time
local move = self._controller:get_input_axis( "menu_move" )
if( self._controller:get_input_bool( "menu_down" )) then
dir = 1
elseif( self._controller:get_input_bool( "menu_up" )) then
dir = -1
end
if dir == nil then
if move.y > self.MOVE_AXIS_LIMIT then
dir = 1
elseif move.y < -self.MOVE_AXIS_LIMIT then
dir = -1
end
end
if dir ~= nil then
if( ( self._move_button_dir == dir ) and self._move_button_time and ( t < self._move_button_time + self.MOVE_AXIS_DELAY ) ) then
move_time = self._move_button_time or t
else
self._panel_script:change_focus_button( dir )
move_time = t
end
end
self._move_button_dir = dir
self._move_button_time = move_time
local scroll = self._controller:get_input_axis( "menu_scroll" )
-- local sdir
if( scroll.y > self.MOVE_AXIS_LIMIT ) then
self._panel_script:scroll_up()
-- sdir = 1
elseif( scroll.y < -self.MOVE_AXIS_LIMIT ) then
self._panel_script:scroll_down()
-- sdir = -1
end
end
managers.system_menu.DIALOG_CLASS.update_input = patched_update_input
managers.system_menu.GENERIC_DIALOG_CLASS.update_input = patched_update_input
spawnsecondarycallback = spawnsecondarycallback or function(info)
if ( managers.player:player_unit() ) then
local weapon = Global.blackmarket_manager.crafted_items.secondaries[info]
if weapon then
managers.player:player_unit():inventory():add_unit_by_factory_name( weapon.factory_id, false, false, weapon.blueprint )
end
end
end
opts = {}
for i,weapon in pairs(Global.blackmarket_manager.crafted_items.secondaries) do
if ( weapon ) then
table.insert( opts, { text = managers.blackmarket:get_weapon_name_by_category_slot("secondaries",i):gsub("\"", ""), callback = spawnsecondarycallback, data = i } )
end
end
table.insert( opts, { text = "Close", is_cancel_button = true } )
mymenu = SimpleMenu:new("Spawn Secondary Weapons", "Select the weapon you want to spawn.", opts)
mymenu:show()