├── .gitignore ├── GoonMod ├── dialogs │ ├── RedeemCodeDialog.lua │ ├── RedeemCodeItemsDialog.lua │ └── ScalableTextBoxGUI.lua ├── goonbase.lua ├── loc │ ├── en.txt │ ├── fr.txt │ └── ru.txt ├── lua │ ├── AchievementManager.lua │ ├── ActionSpooc.lua │ ├── AssetsTweakData.lua │ ├── BlackMarketGUI.lua │ ├── BlackMarketManager.lua │ ├── BlackMarketTweakData.lua │ ├── CharacterTweakData.lua │ ├── ChatManager.lua │ ├── ContourExt.lua │ ├── CopActionHurt.lua │ ├── CopDamage.lua │ ├── CopInventory.lua │ ├── CoreMenuInput.lua │ ├── CoreMenuItem.lua │ ├── CoreMenuItemSlider.lua │ ├── CoreMenuLogic.lua │ ├── CoreMissionManager.lua │ ├── CriminalsManager.lua │ ├── ECMJammerBase.lua │ ├── ElementLaserTrigger.lua │ ├── ElementSpawnGrenade.lua │ ├── ExperienceManager.lua │ ├── FPCameraPlayerBase.lua │ ├── FragGrenade.lua │ ├── GageAssignmentManager.lua │ ├── GameSetup.lua │ ├── GameStateMachine.lua │ ├── GroupAIManager.lua │ ├── GroupAIStateBase.lua │ ├── HUDManager.lua │ ├── HUDManagerPD2.lua │ ├── InfamyTweakData.lua │ ├── InteractionExt.lua │ ├── JobManager.lua │ ├── LevelsTweakData.lua │ ├── MaskExt.lua │ ├── MenuComponentManager.lua │ ├── MenuManager.lua │ ├── MenuSceneManager.lua │ ├── MenuSetup.lua │ ├── MissionBriefingGUI.lua │ ├── NPCRaycastWeaponBase.lua │ ├── NarrativeTweakData.lua │ ├── NetworkGame.lua │ ├── NetworkManager.lua │ ├── NetworkMatchMakingSteam.lua │ ├── NewRaycastWeaponBase.lua │ ├── PlayerDamage.lua │ ├── PlayerInventory.lua │ ├── PlayerInventoryGUI.lua │ ├── PlayerManager.lua │ ├── PlayerProfileGUIObject.lua │ ├── PlayerStandard.lua │ ├── PreplanningTweakData.lua │ ├── QuickSmokeGrenade.lua │ ├── SaveFileManager.lua │ ├── SentryGunWeapon.lua │ ├── Setup.lua │ ├── SkillTreeGUINew.lua │ ├── SkillTreeManager.lua │ ├── SkillTreeTweakData.lua │ ├── SpoocLogicAttack.lua │ ├── SystemMenuManager.lua │ ├── TweakData.lua │ ├── UpgradesTweakData.lua │ ├── WalletGUIObject.lua │ ├── WeaponFlashlight.lua │ ├── WeaponLaser.lua │ ├── WeaponSkinsTweakData.lua │ └── WeaponTweakData.lua ├── menus │ ├── corpse_mod_menu.txt │ ├── custom_enemy_laser_menu.txt │ ├── custom_flashlight_menu.txt │ ├── custom_waypoints_menu.txt │ ├── custom_weapon_laser_menu.txt │ ├── custom_world_laser_menu.txt │ ├── example_menu.txt │ ├── infamy_outliner_menu.txt │ ├── push_to_interact_menu.txt │ └── weapon_visual_customization.txt ├── mod.txt ├── mods │ ├── color_grading_menu.lua │ ├── custom_colours │ │ ├── flashlight_player_weapon.lua │ │ ├── laser_enemy_weapon.lua │ │ ├── laser_player_weapon.lua │ │ └── laser_world.lua │ ├── custom_waypoints.lua │ ├── disable_inventory_new_item.lua │ ├── extended_inventory.lua │ ├── infamy_outliner.lua │ ├── mask_mod_search.lua │ ├── mod_shop.lua │ ├── push_to_interact.lua │ ├── weapon_customization.lua │ ├── weapon_customization_menus.lua │ └── weapon_customization_part_data.lua └── req │ ├── autils.lua │ ├── color_hsvrgb.lua │ ├── localization.lua │ ├── mods.lua │ ├── options.lua │ └── updates.lua ├── LICENSE.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | GoonMod/mods/akimbo_autoaim.lua 2 | GoonMod/mods/riot_shields.lua 3 | GoonMod/mods/perkdeck_jacket.lua 4 | GoonMod/mods/choose_any_character.lua 5 | GoonMod/loc/pd_jacket_en.txt 6 | GoonModWeaponCustomizer/units/payday2/weapons/wpn_frag_grenade/wpn_frag_grenade.material_config 7 | GoonModWeaponCustomizer/units/payday2/weapons/wpn_frag_grenade/wpn_frag_grenade_enemy.material_config 8 | GoonModWeaponCustomizer/units/payday2/weapons/wpn_frag_grenade/wpn_frag_grenade_husk.material_config 9 | GoonModWeaponCustomizer/units/payday2/weapons/wpn_frag_grenade/wpn_frag_grenade_sprint.material_config 10 | GoonModWeaponCustomizer/units/pd2_dlc_bbq/weapons/wpn_launcher_incendiary_grenade/wpn_launcher_incendiary_grenade.material_config 11 | GoonModWeaponCustomizer/units/pd2_dlc_cro/weapons/wpn_molotov_grenade/wpn_molotov_grenade.material_config 12 | GoonModWeaponCustomizer/units/pd2_dlc_cro/weapons/wpn_molotov_grenade/wpn_molotov_grenade_enemy.material_config 13 | GoonModWeaponCustomizer/units/pd2_dlc_cro/weapons/wpn_molotov_grenade/wpn_molotov_grenade_husk.material_config 14 | GoonModWeaponCustomizer/units/pd2_dlc_cro/weapons/wpn_molotov_grenade/wpn_molotov_grenade_sprint.material_config 15 | GoonModWeaponCustomizer/units/pd2_dlc_gage_assault/weapons/wpn_launcher_frag_grenade/wpn_launcher_frag_grenade.material_config 16 | GoonModWeaponCustomizer/units/pd2_dlc_west/weapons/wpn_gre_dynamite/wpn_gre_dynamite.material_config 17 | GoonModWeaponCustomizer/units/pd2_dlc_west/weapons/wpn_gre_dynamite/wpn_gre_dynamite_husk.material_config 18 | -------------------------------------------------------------------------------- /GoonMod/dialogs/RedeemCodeDialog.lua: -------------------------------------------------------------------------------- 1 | 2 | core:module("SystemMenuManager") 3 | require("lib/managers/dialogs/GenericDialog") 4 | 5 | RedeemCodeDialog = RedeemCodeDialog or class(GenericDialog) 6 | local tweak_data = _G.tweak_data 7 | local code_color_normal = Color.white 8 | local code_color_no_code = Color.white:with_alpha(0.3) 9 | local max_code_length = 15 10 | 11 | local function make_fine_text(text) 12 | local x, y, w, h = text:text_rect() 13 | text:set_size(w, h) 14 | text:set_position(math.round(text:x()), math.round(text:y())) 15 | return text:x(), text:y(), w, h 16 | end 17 | 18 | function RedeemCodeDialog:init(manager, data) 19 | 20 | Dialog.init(self, manager, data) 21 | if not self._data.focus_button then 22 | if #self._button_text_list > 0 then 23 | self._data.focus_button = #self._button_text_list 24 | else 25 | self._data.focus_button = 1 26 | end 27 | end 28 | self._ws = self._data.ws or manager:_get_ws() 29 | self._panel_script = _G.ScalableTextBoxGui:new(self._ws, self._data.title or "", (self._data.text or ""), self._data, { 30 | no_close_legend = true, 31 | use_indicator = data.indicator or data.no_buttons, 32 | is_title_outside = is_title_outside, 33 | }) 34 | self._panel_script:add_background() 35 | self._panel_script:set_layer(tweak_data.gui.DIALOG_LAYER) 36 | self._panel_script:set_fade(0) 37 | self._panel_script:set_size( 540, 360 ) 38 | self._panel_script:set_centered() 39 | self._controller = self._data.controller or manager:_get_controller() 40 | self._confirm_func = callback(self, self, "button_pressed_callback") 41 | self._cancel_func = callback(self, self, "dialog_cancel_callback") 42 | self._resolution_changed_callback = callback(self, self, "resolution_changed_callback") 43 | managers.viewport:add_resolution_changed_func(self._resolution_changed_callback) 44 | if data.counter then 45 | self._counter = data.counter 46 | self._counter_time = self._counter[1] 47 | end 48 | 49 | self._panel = self._panel_script._panel 50 | 51 | local layer = tweak_data.gui.MOUSE_LAYER - 50 52 | local w, h = self._panel_script:w() * 0.85, self._panel_script:h() * 0.3 53 | local x, y = self._panel_script:w() * 0.5, self._panel_script:h() * 0.525 54 | 55 | self._code_rect = self._panel:rect({ 56 | w = w, 57 | h = h, 58 | }) 59 | self._code_rect:set_color( Color.black:with_alpha(0.5) ) 60 | self._code_rect:set_center( x, y ) 61 | 62 | self._code_text = self._panel:text({ 63 | name = "code_text", 64 | text = managers.localization:text("gm_ex_inv_redeem_code_default"), 65 | font = tweak_data.menu.pd2_large_font, 66 | font_size = tweak_data.menu.pd2_large_font_size, 67 | blend_mode = "add", 68 | layer = layer 69 | }) 70 | self._code_text:set_text( managers.localization:text("gm_ex_inv_redeem_code_default") ) 71 | self._code_text:set_color( code_color_no_code ) 72 | make_fine_text( self._code_text ) 73 | self._code_text:set_center( x, y ) 74 | 75 | if not self._connected_keyboard then 76 | self._ws:connect_keyboard(Input:keyboard()) 77 | self._panel:enter_text(callback(self, self, "enter_text")) 78 | self._panel:key_press(callback(self, self, "key_press")) 79 | self._connected_keyboard = true 80 | end 81 | 82 | self._is_entering_code = true 83 | self._entered_code = "" 84 | 85 | end 86 | 87 | function RedeemCodeDialog:UpdateCodeText() 88 | 89 | if not alive( self._code_text ) then 90 | return 91 | end 92 | 93 | self._code_text:set_text( tostring(self._entered_code):upper() ) 94 | if self._entered_code:is_nil_or_empty() then 95 | self._code_text:set_color( code_color_no_code ) 96 | self._code_text:set_text( managers.localization:text("gm_ex_inv_redeem_code_default") ) 97 | else 98 | self._code_text:set_color( code_color_normal ) 99 | end 100 | 101 | local x, y = self._panel_script:w() * 0.5, self._panel_script:h() * 0.525 102 | make_fine_text( self._code_text ) 103 | self._code_text:set_center( x, y ) 104 | 105 | end 106 | 107 | function RedeemCodeDialog:enter_text( o, s ) 108 | 109 | if not self._is_entering_code then 110 | return 111 | end 112 | 113 | local n = utf8.len(self._entered_code) 114 | if n < max_code_length then 115 | self._entered_code = self._entered_code .. tostring(s) 116 | self._entered_code = self._entered_code:lower() 117 | end 118 | 119 | self:UpdateCodeText() 120 | 121 | end 122 | 123 | function RedeemCodeDialog:key_press( o, k ) 124 | 125 | if not self._is_entering_code then 126 | return 127 | end 128 | 129 | if k == Idstring("backspace") then 130 | local n = utf8.len(self._entered_code) 131 | self._entered_code = utf8.sub(self._entered_code, 0, math.max(n - 1, 0)) 132 | end 133 | 134 | self:UpdateCodeText() 135 | 136 | end 137 | 138 | function RedeemCodeDialog:close() 139 | 140 | if self._connected_keyboard then 141 | self._ws:disconnect_keyboard() 142 | self._panel:enter_text(nil) 143 | self._panel:key_press(nil) 144 | self._connected_keyboard = false 145 | end 146 | 147 | local code = self._entered_code 148 | RedeemCodeDialog.super.close(self) 149 | _G.GoonBase.ExtendedInventory:EnteredRedeemCode( code ) 150 | 151 | end 152 | -------------------------------------------------------------------------------- /GoonMod/dialogs/RedeemCodeItemsDialog.lua: -------------------------------------------------------------------------------- 1 | 2 | core:module("SystemMenuManager") 3 | require("lib/managers/dialogs/GenericDialog") 4 | 5 | RedeemCodeItemsDialog = RedeemCodeItemsDialog or class(GenericDialog) 6 | local tweak_data = _G.tweak_data 7 | local item_size = 80 8 | local redeem_max_items_w = 5 9 | local item_padding = 8 10 | 11 | local function make_fine_text(text) 12 | local x, y, w, h = text:text_rect() 13 | text:set_size(w, h) 14 | text:set_position(math.round(text:x()), math.round(text:y())) 15 | return text:x(), text:y(), w, h 16 | end 17 | 18 | local function make_fine_text(text) 19 | local x, y, w, h = text:text_rect() 20 | text:set_size(w, h) 21 | text:set_position(math.round(text:x()), math.round(text:y())) 22 | return text:x(), text:y(), w, h 23 | end 24 | 25 | function RedeemCodeItemsDialog:init(manager, data) 26 | 27 | Dialog.init(self, manager, data) 28 | if not self._data.focus_button then 29 | if #self._button_text_list > 0 then 30 | self._data.focus_button = #self._button_text_list 31 | else 32 | self._data.focus_button = 1 33 | end 34 | end 35 | self._ws = self._data.ws or manager:_get_ws() 36 | self._panel_script = _G.ScalableTextBoxGui:new(self._ws, self._data.title or "", (self._data.text or ""), self._data, { 37 | no_close_legend = true, 38 | use_indicator = data.indicator or data.no_buttons, 39 | is_title_outside = is_title_outside, 40 | }) 41 | self._panel_script:add_background() 42 | self._panel_script:set_layer(tweak_data.gui.DIALOG_LAYER) 43 | self._panel_script:set_fade(0) 44 | self._panel_script:set_size( 500, 340 ) 45 | self._panel_script:set_centered() 46 | self._controller = self._data.controller or manager:_get_controller() 47 | self._confirm_func = callback(self, self, "button_pressed_callback") 48 | self._cancel_func = callback(self, self, "dialog_cancel_callback") 49 | self._resolution_changed_callback = callback(self, self, "resolution_changed_callback") 50 | managers.viewport:add_resolution_changed_func(self._resolution_changed_callback) 51 | if data.counter then 52 | self._counter = data.counter 53 | self._counter_time = self._counter[1] 54 | end 55 | 56 | self._panel = self._panel_script._panel 57 | self._item_panel = self._panel:panel() 58 | 59 | local w, h = item_size * redeem_max_items_w + item_padding * redeem_max_items_w, item_size + item_padding * 2 60 | local x, y = self._panel_script:w() * 0.5, self._panel_script:h() * 0.465 61 | self._item_panel:set_size( w, h ) 62 | self._item_panel:set_center( x, y ) 63 | 64 | self._panel_box = _G.BoxGuiObject:new(self._item_panel, { 65 | sides = { 66 | 1, 67 | 1, 68 | 1, 69 | 1 70 | } 71 | }) 72 | 73 | if data.items then 74 | 75 | self._code_items = {} 76 | for k, v in pairs( data.items ) do 77 | local item = ExtendedInventoryCodeItem:new( self._item_panel, k, v ) 78 | table.insert( self._code_items, item ) 79 | end 80 | 81 | end 82 | 83 | end 84 | 85 | function RedeemCodeItemsDialog:mouse_moved(o, x, y) 86 | 87 | RedeemCodeItemsDialog.super.mouse_moved(self, o, x, y) 88 | 89 | if self._code_items then 90 | for k, v in pairs( self._code_items ) do 91 | v:check_mouse( x, y ) 92 | end 93 | end 94 | 95 | end 96 | 97 | ExtendedInventoryCodeItem = ExtendedInventoryCodeItem or class() 98 | function ExtendedInventoryCodeItem:init( panel, index, data ) 99 | 100 | local padding = item_padding 101 | local w, h = item_size, item_size 102 | local x, y = padding * index + w * (index - 1), padding 103 | local ExtendedInv = _G.GoonBase.ExtendedInventory 104 | 105 | local item_name, item_icon, item_render = ExtendedInv:GetDisplayDataForItem( data ) 106 | local item_is_color = ExtendedInv:IsItemColour( data ) 107 | if item_name and data.quantity then 108 | item_name = item_name .. ( data.quantity > 1 and " x" .. tostring(data.quantity) or "" ) 109 | end 110 | 111 | self._panel = panel 112 | self._item = panel:bitmap({ 113 | name = "item_" .. index, 114 | texture = item_icon or "guis/textures/pd2/blackmarket/icons/cash", 115 | x = x, 116 | y = y, 117 | w = w, 118 | h = h, 119 | layer = 2, 120 | color = Color.white, 121 | render_template = item_render, 122 | }) 123 | 124 | if item_is_color then 125 | 126 | local col1, col2 = ExtendedInv:GetColourSwatchColours( data ) 127 | 128 | self._item_col1 = panel:bitmap({ 129 | texture = "guis/textures/pd2/blackmarket/icons/colors/color_01", 130 | x = x, 131 | y = y, 132 | w = w, 133 | h = h, 134 | color = col1, 135 | layer = 1, 136 | }) 137 | 138 | self._item_col2 = panel:bitmap({ 139 | texture = "guis/textures/pd2/blackmarket/icons/colors/color_02", 140 | x = x, 141 | y = y, 142 | w = w, 143 | h = h, 144 | color = col2, 145 | layer = 1, 146 | }) 147 | 148 | end 149 | 150 | self._item_name = panel:text({ 151 | text = item_name or "Item", 152 | font = tweak_data.menu.pd2_small_font, 153 | font_size = tweak_data.menu.pd2_small_font_size, 154 | blend_mode = "add", 155 | color = Color.white, 156 | layer = 5, 157 | }) 158 | make_fine_text( self._item_name ) 159 | self._item_name:set_center( x + w * 0.5, y + h ) 160 | self._item_name:set_alpha(0) 161 | 162 | return self 163 | 164 | end 165 | 166 | function ExtendedInventoryCodeItem:destroy() 167 | self._panel:remove( self._item ) 168 | self._panel:remove( self._item_name ) 169 | if alive( self._item_col1 ) then 170 | self._panel:remove( self._item_col1 ) 171 | end 172 | if alive( self._item_col2 ) then 173 | self._panel:remove( self._item_col2 ) 174 | end 175 | self._item = nil 176 | self._item_name = nil 177 | end 178 | 179 | function ExtendedInventoryCodeItem:check_mouse(x, y) 180 | 181 | if self._item:inside(x, y) then 182 | if self._item_name:alpha() < 1 then 183 | managers.menu:post_event("highlight") 184 | end 185 | self._item_name:set_alpha( 1 ) 186 | else 187 | self._item_name:set_alpha( 0 ) 188 | end 189 | 190 | end 191 | -------------------------------------------------------------------------------- /GoonMod/dialogs/ScalableTextBoxGUI.lua: -------------------------------------------------------------------------------- 1 | 2 | ScalableTextBoxGui = ScalableTextBoxGui or class( TextBoxGui ) 3 | 4 | local function make_fine_text(text) 5 | local x, y, w, h = text:text_rect() 6 | text:set_size(w, h) 7 | text:set_position(math.round(text:x()), math.round(text:y())) 8 | return text:x(), text:y(), w, h 9 | end 10 | 11 | function ScalableTextBoxGui:set_size(x, y) 12 | 13 | ScalableTextBoxGui.super.set_size(self, x, y) 14 | 15 | local padding = 10 16 | local info_area = self._panel:child("info_area") 17 | local buttons_panel = info_area:child("buttons_panel") 18 | local scroll_panel = info_area:child("scroll_panel") 19 | scroll_panel:set_w( info_area:w() - scroll_panel:x() * 2 ) 20 | scroll_panel:set_h( info_area:h() - buttons_panel:h() - padding * 3 ) 21 | 22 | make_fine_text( scroll_panel:child("text") ) 23 | 24 | buttons_panel:set_right( info_area:right() - padding ) 25 | buttons_panel:set_bottom( info_area:bottom() - padding ) 26 | 27 | end 28 | -------------------------------------------------------------------------------- /GoonMod/goonbase.lua: -------------------------------------------------------------------------------- 1 | 2 | if not _G.GoonBase then 3 | 4 | _G.GoonBase = {} 5 | 6 | GoonBase.Version = 32 7 | GoonBase.GameVersion = "1.57.0" 8 | GoonBase.SupportedVersion = true 9 | 10 | GoonBase.Path = "" 11 | GoonBase.LuaPath = "lua/" 12 | GoonBase.RequiresFolder = "req/" 13 | GoonBase.ModsFolders = { 14 | "mods/", 15 | "mods/custom_colours/" 16 | } 17 | GoonBase.MenusPath = "menus/" 18 | GoonBase.LocalizationFolder = "loc/" 19 | 20 | GoonBase.LogFile = "GoonMod.txt" 21 | GoonBase.SavePath = SavePath .. "goonmod_options.txt" 22 | 23 | GoonBase.LogTag = "[GoonMod]" 24 | GoonBase.LoggingEnabled = false 25 | 26 | end 27 | 28 | GoonBase.RequireHookFiles = { 29 | "lib/managers/menumanager", 30 | "lib/setups/menusetup" 31 | } 32 | 33 | GoonBase.HookFiles = { 34 | 35 | ["lib/managers/menumanager"] = "MenuManager.lua", 36 | ["lib/units/weapons/grenades/quicksmokegrenade"] = "QuickSmokeGrenade.lua", 37 | ["lib/managers/hudmanager"] = "HUDManager.lua", 38 | ["lib/managers/jobmanager"] = "JobManager.lua", 39 | ["lib/managers/group_ai_states/groupaistatebase"] = "GroupAIStateBase.lua", 40 | ["lib/units/beings/player/states/playerstandard"] = "PlayerStandard.lua", 41 | ["lib/units/beings/player/playerdamage"] = "PlayerDamage.lua", 42 | ["lib/managers/playermanager"] = "PlayerManager.lua", 43 | ["lib/managers/gageassignmentmanager"] = "GageAssignmentManager.lua", 44 | ["lib/managers/achievmentmanager"] = "AchievementManager.lua", 45 | ["lib/tweak_data/infamytweakdata"] = "InfamyTweakData.lua", 46 | ["lib/setups/gamesetup"] = "GameSetup.lua", 47 | ["lib/setups/menusetup"] = "MenuSetup.lua", 48 | ["lib/managers/menu/blackmarketgui"] = "BlackMarketGUI.lua", 49 | ["lib/managers/blackmarketmanager"] = "BlackMarketManager.lua", 50 | ["lib/tweak_data/charactertweakdata"] = "CharacterTweakData.lua", 51 | ["lib/units/enemies/cop/copinventory"] = "CopInventory.lua", 52 | ["lib/units/enemies/cop/copdamage"] = "CopDamage.lua", 53 | ["lib/managers/mission/elementlasertrigger"] = "ElementLaserTrigger.lua", 54 | ["lib/units/weapons/weaponflashlight"] = "WeaponFlashlight.lua", 55 | ["lib/units/weapons/weaponlaser"] = "WeaponLaser.lua", 56 | ["lib/tweak_data/levelstweakdata"] = "LevelsTweakData.lua", 57 | ["lib/tweak_data/assetstweakdata"] = "AssetsTweakData.lua", 58 | ["lib/tweak_data/narrativetweakdata"] = "NarrativeTweakData.lua", 59 | ["lib/managers/criminalsmanager"] = "CriminalsManager.lua", 60 | ["lib/units/weapons/newraycastweaponbase"] = "NewRaycastWeaponBase.lua", 61 | ["lib/units/weapons/npcraycastweaponbase"] = "NPCRaycastWeaponBase.lua", 62 | ["lib/units/cameras/fpcameraplayerbase"] = "FPCameraPlayerBase.lua", 63 | ["core/lib/managers/menu/items/coremenuitemslider"] = "CoreMenuItemSlider.lua", 64 | ["lib/utils/game_state_machine/gamestatemachine"] = "GameStateMachine.lua", 65 | ["lib/units/contourext"] = "ContourExt.lua", 66 | ["lib/units/interactions/interactionext"] = "InteractionExt.lua", 67 | ["lib/units/enemies/spooc/actions/lower_body/actionspooc"] = "ActionSpooc.lua", 68 | ["lib/managers/menu/menucomponentmanager"] = "MenuComponentManager.lua", 69 | ["lib/managers/menu/missionbriefinggui"] = "MissionBriefingGUI.lua", 70 | ["lib/network/matchmaking/networkmatchmakingsteam"] = "NetworkMatchMakingSteam.lua", 71 | ["lib/managers/menu/menuscenemanager"] = "MenuSceneManager.lua", 72 | ["lib/units/enemies/cop/actions/full_body/copactionhurt"] = "CopActionHurt.lua", 73 | ["lib/units/equipment/ecm_jammer/ecmjammerbase"] = "ECMJammerBase.lua", 74 | ["lib/tweak_data/weapontweakdata"] = "WeaponTweakData.lua", 75 | ["lib/units/beings/player/playerinventory"] = "PlayerInventory.lua", 76 | ["lib/tweak_data/skilltreetweakdata"] = "SkillTreeTweakData.lua", 77 | ["lib/managers/systemmenumanager"] = "SystemMenuManager.lua", 78 | ["lib/managers/menu/playerprofileguiobject"] = "PlayerProfileGUIObject.lua", 79 | ["lib/managers/menu/walletguiobject"] = "WalletGUIObject.lua", 80 | ["lib/managers/experiencemanager"] = "ExperienceManager.lua", 81 | ["lib/managers/skilltreemanager"] = "SkillTreeManager.lua", 82 | ["lib/managers/menu/skilltreeguinew"] = "SkillTreeGUINew.lua", 83 | ["lib/network/networkgame"] = "NetworkGame.lua", 84 | ["lib/tweak_data/upgradestweakdata"] = "UpgradesTweakData.lua", 85 | ["lib/network/base/networkmanager"] = "NetworkManager.lua", 86 | ["lib/units/weapons/sentrygunweapon"] = "SentryGunWeapon.lua", 87 | ["lib/managers/savefilemanager"] = "SaveFileManager.lua", 88 | ["lib/managers/menu/playerinventorygui"] = "PlayerInventoryGUI.lua", 89 | ["lib/tweak_data/blackmarket/weaponskinstweakdata"] = "WeaponSkinsTweakData.lua", 90 | 91 | } 92 | 93 | -- Required Global Functions 94 | function _G.Print( ... ) 95 | 96 | local str = GoonBase.LogTag 97 | for k, v in ipairs( arg ) do 98 | str = str .. tostring(v) 99 | end 100 | 101 | -- Write to console 102 | log( str ) 103 | 104 | -- Write to log file 105 | if GoonBase.LoggingEnabled then 106 | 107 | str = str .. "\n" 108 | local file = io.open( GoonBase.LogFile, "a+" ) 109 | if file ~= nil then 110 | 111 | io.output( file ) 112 | 113 | if GoonBase._print_cache ~= nil then 114 | for k, v in ipairs(GoonBase._print_cache) do 115 | io.write( v ) 116 | end 117 | GoonBase._print_cache = {} 118 | end 119 | io.write( str ) 120 | 121 | io.close( file ) 122 | 123 | else 124 | 125 | log( "[Error] Could not write to file, caching print string: '" .. str .. "'" ) 126 | if GoonBase._print_cache == nil then 127 | GoonBase._print_cache = {} 128 | end 129 | table.insert( GoonBase._print_cache, str ) 130 | 131 | end 132 | 133 | end 134 | 135 | end 136 | 137 | function _G.SafeDoFile( fileName ) 138 | 139 | local success, errorMsg = pcall(function() 140 | if io.file_is_readable( fileName ) then 141 | dofile( fileName ) 142 | else 143 | Print("[Error] Could not open file '" .. fileName .. "'! Does it exist, is it readable?") 144 | end 145 | end) 146 | 147 | if not success then 148 | Print("[Error]\nFile: " .. fileName .. "\n" .. errorMsg) 149 | end 150 | 151 | end 152 | 153 | local unsupported = true 154 | 155 | -- Load Require and Mod Scripts 156 | if not GoonBase.HasLoadedScripts then 157 | 158 | GoonBase.Path = ModPath 159 | GoonBase.LogFile = LogsPath .. GoonBase.LogFile 160 | 161 | GoonBase.LuaPath = ModPath .. GoonBase.LuaPath 162 | GoonBase.RequiresFolder = ModPath .. GoonBase.RequiresFolder 163 | GoonBase.MenusPath = ModPath .. GoonBase.MenusPath 164 | GoonBase.LocalizationFolder = ModPath .. GoonBase.LocalizationFolder 165 | 166 | -- Check required classes exist now 167 | if class and Application and string.split then 168 | 169 | GoonBase.HasLoadedScripts = true 170 | 171 | -- Load required files 172 | local required_files = file.GetFiles( GoonBase.RequiresFolder ) 173 | for k, v in ipairs( required_files ) do 174 | SafeDoFile( GoonBase.RequiresFolder .. v ) 175 | end 176 | 177 | GoonBase.SupportedVersion = GoonBase.Updates:GameUpdateVersionCheck() 178 | 179 | -- Run hooks 180 | if GoonBase.SupportedVersion and Hooks ~= nil then 181 | 182 | Hooks:RegisterHook("GoonBaseLoadMods") 183 | Hooks:Call("GoonBaseLoadMods") 184 | 185 | Hooks:RegisterHook("GoonBasePostLoadedMods") 186 | Hooks:Call("GoonBasePostLoadedMods") 187 | 188 | end 189 | 190 | end 191 | 192 | end 193 | 194 | -- Load Hook Scripts 195 | if RequiredScript then 196 | 197 | local requiredScript = RequiredScript:lower() 198 | if GoonBase.HookFiles[requiredScript] then 199 | 200 | if GoonBase.SupportedVersion or table.contains(GoonBase.RequireHookFiles, requiredScript) then 201 | 202 | if type( GoonBase.HookFiles[requiredScript] ) == "table" then 203 | for k, v in pairs( GoonBase.HookFiles[requiredScript] ) do 204 | SafeDoFile( GoonBase.LuaPath .. v ) 205 | end 206 | else 207 | SafeDoFile( GoonBase.LuaPath .. GoonBase.HookFiles[requiredScript] ) 208 | end 209 | 210 | end 211 | 212 | end 213 | 214 | end 215 | -------------------------------------------------------------------------------- /GoonMod/lua/AchievementManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( AchievmentManager ) 3 | 4 | AchievmentManager._disabled_stack = {} 5 | 6 | Hooks:RegisterHook("AchievementManagerPreAward") 7 | function AchievmentManager.award(self, id) 8 | 9 | Hooks:Call("AchievementManagerPreAward", self, id) 10 | 11 | AchievmentManager:CheckAchievementsDisabled() 12 | if self:AchievementsDisabled() then 13 | return 14 | end 15 | 16 | self.orig.award(self, id) 17 | 18 | end 19 | 20 | Hooks:RegisterHook("AchievementManagerPreAwardProgress") 21 | function AchievmentManager.award_progress(self, stat, value) 22 | 23 | Hooks:Call("AchievementManagerPreAwardProgress", self, stat, value) 24 | 25 | AchievmentManager:CheckAchievementsDisabled() 26 | if self:AchievementsDisabled() then 27 | return 28 | end 29 | 30 | self.orig.award_progress(self, stat, value) 31 | 32 | end 33 | 34 | function AchievmentManager:AchievementsDisabled() 35 | local disabled = false 36 | for k, v in pairs( self._disabled_stack ) do 37 | if v ~= nil and v == true then 38 | disabled = true 39 | end 40 | end 41 | return disabled 42 | end 43 | 44 | function AchievmentManager:DisableAchievements(id) 45 | self._disabled_stack[id] = true 46 | end 47 | 48 | function AchievmentManager:EnableAchievements(id) 49 | self._disabled_stack[id] = nil 50 | end 51 | 52 | Hooks:RegisterHook("AchievementManagerCheckDisable") 53 | function AchievmentManager:CheckAchievementsDisabled() 54 | AchievmentManager._disabled_stack = {} 55 | Hooks:Call("AchievementManagerCheckDisable", self) 56 | end 57 | -------------------------------------------------------------------------------- /GoonMod/lua/ActionSpooc.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( ActionSpooc ) 3 | 4 | Hooks:RegisterHook("ActionSpoocInitialize") 5 | function ActionSpooc.init(self, action_desc, common_data) 6 | Hooks:Call("ActionSpoocInitialize", self, action_desc, common_data) 7 | return self.orig.init(self, action_desc, common_data) 8 | end 9 | 10 | Hooks:RegisterHook("ActionSpoocAnimActCallback") 11 | function ActionSpooc.anim_act_clbk(self, anim_act) 12 | Hooks:Call("ActionSpoocAnimActCallback", self, anim_act) 13 | return self.orig.anim_act_clbk(self, anim_act) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/AssetsTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( AssetsTweakData ) 3 | 4 | function AssetsTweakData._init_assets(self, tweak_data) 5 | 6 | self.orig._init_assets(self, tweak_data) 7 | 8 | table.insert(self.bodybags_bag.stages, "arm_for_prof") 9 | table.insert(self.grenade_crate.stages, "arm_for_prof") 10 | 11 | table.insert(self.arm_for_info.stages, "arm_for_prof") 12 | table.insert(self.arm_for_ammo.stages, "arm_for_prof") 13 | table.insert(self.arm_for_health.stages, "arm_for_prof") 14 | 15 | end 16 | -------------------------------------------------------------------------------- /GoonMod/lua/BlackMarketManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( BlackMarketManager ) 3 | 4 | local INV_TO_CRAFT = Idstring("inventory_to_crafted") 5 | local CRAFT_TO_INV = Idstring("crafted_to_inventroy") 6 | local INV_ADD = Idstring("add_to_inventory") 7 | local INV_REMOVE = Idstring("remove_from_inventory") 8 | local CRAFT_ADD = Idstring("add_to_crafted") 9 | local CRAFT_REMOVE = Idstring("remove_from_crafted") 10 | 11 | Hooks:RegisterHook("BlackMarketManagerPostSetup") 12 | function BlackMarketManager._setup(self) 13 | self.orig._setup(self) 14 | Hooks:Call("BlackMarketManagerPostSetup", self) 15 | end 16 | 17 | Hooks:RegisterHook("BlackMarketManagerModifyGetInventoryCategory") 18 | function BlackMarketManager.get_inventory_category(self, category) 19 | 20 | local t = {} 21 | 22 | for global_value, categories in pairs(self._global.inventory) do 23 | if categories[category] then 24 | 25 | for id, amount in pairs(categories[category]) do 26 | table.insert(t, { 27 | id = id, 28 | global_value = global_value, 29 | amount = amount 30 | }) 31 | end 32 | 33 | end 34 | end 35 | 36 | Hooks:Call("BlackMarketManagerModifyGetInventoryCategory", self, category, t) 37 | 38 | return t 39 | 40 | end 41 | 42 | Hooks:Call("BlackMarketManagerGotAnyNewDrop") 43 | function BlackMarketManager.got_any_new_drop(self) 44 | local r = Hooks:ReturnCall("BlackMarketManagerGotAnyNewDrop", self) 45 | if r ~= nil then 46 | return r 47 | end 48 | return self.orig.got_any_new_drop(self) 49 | end 50 | 51 | Hooks:Call("BlackMarketManagerGotNewDrop") 52 | function BlackMarketManager.got_new_drop(self, global_value, category, id) 53 | local r = Hooks:ReturnCall("BlackMarketManagerGotNewDrop", self, global_value, category, id) 54 | if r ~= nil then 55 | return r 56 | end 57 | return self.orig.got_new_drop(self, global_value, category, id) 58 | end 59 | 60 | -- Custom functions 61 | function BlackMarketManager:is_mod_shop_running() 62 | if GoonBase and GoonBase.ModShop then 63 | return true 64 | end 65 | return false 66 | end 67 | 68 | function BlackMarketManager:get_item_tweak_entry( item, category ) 69 | 70 | if category == "primaries" or category == "secondaries" then 71 | return tweak_data.weapon[ item ] 72 | end 73 | 74 | if category == "parts" then 75 | return tweak_data:get_raw_value("weapon", "factory", category, item) 76 | end 77 | 78 | return tweak_data:get_raw_value("blackmarket", category, item) 79 | 80 | end 81 | 82 | function BlackMarketManager:add_item_to_inventory( item, category ) 83 | 84 | local entry = tweak_data:get_raw_value("blackmarket", category, item) 85 | if entry then 86 | local global_value = entry.infamous and "infamous" or entry.global_value or entry.dlc or entry.dlcs and entry.dlcs[math.random(#entry.dlcs)] or "normal" 87 | managers.blackmarket:add_to_inventory(global_value, category, item) 88 | end 89 | 90 | end 91 | 92 | function BlackMarketManager:get_mods_on_weapon(category, slot) 93 | 94 | if Global and Global.blackmarket_manager and Global.blackmarket_manager.crafted_items then 95 | local items = Global.blackmarket_manager.crafted_items 96 | if items[category] and items[category][slot] then 97 | return items[category][slot].blueprint 98 | end 99 | end 100 | 101 | return nil 102 | 103 | end 104 | 105 | function BlackMarketManager:on_traded_weapon(category, slot, remove_mods, skip_verification) 106 | 107 | local _global = Global.blackmarket_manager 108 | if not _global.crafted_items[category] or not _global.crafted_items[category][slot] then 109 | return 110 | end 111 | 112 | local global_values = _global.crafted_items[category][slot].global_values or {} 113 | local blueprint = _global.crafted_items[category][slot].blueprint 114 | local default_blueprint = managers.weapon_factory:get_default_blueprint_by_factory_id( _global.crafted_items[category][slot].factory_id ) 115 | 116 | for i, default_part in ipairs(default_blueprint) do 117 | table.delete(blueprint, default_part) 118 | end 119 | 120 | -- Remove mods if we traded them 121 | if remove_mods then 122 | 123 | for k, part_id in pairs(blueprint) do 124 | local global_value = global_values[part_id] or "normal" 125 | self:add_to_inventory(global_value, "weapon_mods", part_id, true) 126 | self:alter_global_value_item(global_value, category, slot, part_id, CRAFT_REMOVE) 127 | end 128 | 129 | end 130 | 131 | _global.crafted_items[category][slot] = nil 132 | if not skip_verification then 133 | self:_verfify_equipped_category(category) 134 | if category == "primaries" then 135 | self:_update_menu_scene_primary() 136 | elseif category == "secondaries" then 137 | self:_update_menu_scene_secondary() 138 | end 139 | 140 | end 141 | 142 | end 143 | 144 | function BlackMarketManager:on_traded_mod(part_id) 145 | 146 | -- Find mod using part id 147 | for k, v in pairs( tweak_data.blackmarket["weapon_mods"] ) do 148 | if k == part_id then 149 | 150 | -- Get global value and amount of mod 151 | local global_value = v.global_value or v.dlc or "normal" 152 | local mod_amt = self:get_item_amount(global_value, "weapon_mods", part_id, true) 153 | 154 | -- Check if we have the mod before trying to remove it 155 | if mod_amt > 0 then 156 | self:remove_item(global_value, "weapon_mods", part_id) 157 | end 158 | 159 | end 160 | end 161 | 162 | end 163 | 164 | function BlackMarketManager:on_received_traded_mod(part_id) 165 | 166 | local success, err = pcall(function() 167 | 168 | -- Find mod using part id 169 | for k, v in pairs( tweak_data.blackmarket["weapon_mods"] ) do 170 | if k == part_id then 171 | 172 | -- Get global value and add mod 173 | local global_value = v.global_value or v.dlc or "normal" 174 | Print("global_value: " .. global_value) 175 | managers.blackmarket:add_to_inventory(global_value, "weapon_mods", part_id, true) 176 | 177 | end 178 | end 179 | 180 | end) 181 | if not success then Print("[Error] " .. err) end 182 | 183 | end 184 | 185 | function BlackMarketManager:get_mask_slot_data(mask) 186 | 187 | local category = "masks" 188 | if not Global.blackmarket_manager.crafted_items[category] then 189 | return nil 190 | end 191 | 192 | local slot 193 | if type(mask) == "table" then 194 | slot = mask.slot 195 | end 196 | if type(mask) == "number" then 197 | slot = mask 198 | end 199 | 200 | return Global.blackmarket_manager.crafted_items[category][slot] 201 | 202 | end 203 | 204 | function BlackMarketManager:get_mask_data(mask_id) 205 | return tweak_data.blackmarket.masks[mask_id] 206 | end 207 | 208 | function BlackMarketManager:get_mask_name(mask) 209 | return managers.localization:text(tweak_data.blackmarket.masks[mask].name_id) 210 | end 211 | 212 | function BlackMarketManager:get_mask_mod_data(mod_id, category) 213 | return tweak_data.blackmarket[category][mod_id] 214 | end 215 | 216 | function BlackMarketManager:get_mask_mod_name(mod, category) 217 | return managers.localization:text(tweak_data.blackmarket[category][mod].name_id) 218 | end 219 | 220 | function BlackMarketManager:get_free_mask_slot() 221 | 222 | local unlocked_mask_slots = Global.blackmarket_manager.unlocked_mask_slots 223 | local mask_slots = Global.blackmarket_manager.crafted_items.masks 224 | 225 | for i = 1, #unlocked_mask_slots, 1 do 226 | if mask_slots[i] == nil then 227 | return i 228 | end 229 | end 230 | 231 | return nil 232 | 233 | end 234 | 235 | function BlackMarketManager:has_all_dlc_for_mask(mask_id) 236 | 237 | -- Get mask data 238 | local mask_data = tweak_data.blackmarket.masks[mask_id] 239 | if mask_data == nil then 240 | return 241 | end 242 | 243 | -- Check if user has DLC for mask 244 | local dlc = mask_data.dlc 245 | if dlc ~= nil then 246 | if not managers.dlc:has_dlc(dlc) then 247 | return dlc 248 | end 249 | end 250 | 251 | return true 252 | 253 | end 254 | 255 | function BlackMarketManager:has_all_dlc_for_mask_mod(mod_id, category) 256 | 257 | -- Get part data 258 | local part_data = tweak_data.blackmarket[category][mod_id] 259 | if part_data == nil then 260 | return 261 | end 262 | local part_global_value = part_data.global_value or part_data.dlc or "normal" 263 | 264 | -- Check user has DLC 265 | local dlc = part_data.dlc 266 | if dlc ~= nil then 267 | if not managers.dlc:has_dlc(dlc) then 268 | return dlc 269 | end 270 | end 271 | 272 | return true 273 | 274 | end 275 | 276 | function BlackMarketManager:has_all_dlc_for_mask_and_parts(mask_id, material, pattern, color) 277 | 278 | -- Get mask part data 279 | local mask_data = tweak_data.blackmarket.masks[mask_id] 280 | local material_data = tweak_data.blackmarket.materials[material] 281 | local pattern_data = tweak_data.blackmarket.textures[pattern] 282 | local color_data = tweak_data.blackmarket.colors[color] 283 | 284 | if mask_data == nil then 285 | return 286 | end 287 | if material_data == nil then 288 | return 289 | end 290 | if pattern_data == nil then 291 | return 292 | end 293 | if color_data == nil then 294 | return 295 | end 296 | 297 | -- Get DLCs 298 | local dlcs_to_test = {} 299 | if mask_data.dlc ~= nil then 300 | table.insert( dlcs_to_test, mask_data.dlc ) 301 | end 302 | if material_data.dlc ~= nil then 303 | table.insert( dlcs_to_test, material_data.dlc ) 304 | end 305 | if pattern_data.dlc ~= nil then 306 | table.insert( dlcs_to_test, pattern_data.dlc ) 307 | end 308 | if color_data.dlc ~= nil then 309 | table.insert( dlcs_to_test, color_data.dlc ) 310 | end 311 | 312 | -- Test DLCs 313 | local dlcs_failed = nil 314 | for k, v in pairs(dlcs_to_test) do 315 | if not managers.dlc:has_dlc(v) then 316 | 317 | if dlcs_failed == nil then 318 | dlcs_failed = {} 319 | end 320 | 321 | dlcs_failed[v] = true 322 | 323 | end 324 | end 325 | 326 | -- Return result 327 | if dlcs_failed ~= nil then 328 | return dlcs_failed 329 | end 330 | return true 331 | 332 | end 333 | 334 | function BlackMarketManager:add_traded_mask_to_inventory( mask_id ) 335 | self:add_item_to_inventory( mask_id, "masks" ) 336 | end 337 | 338 | function BlackMarketManager:add_traded_mask_to_free_slot(mask_id) 339 | 340 | -- Get free mask slot 341 | local slot = self:get_free_mask_slot() 342 | if slot == nil then 343 | return 344 | end 345 | 346 | -- Get mask data 347 | local mask_data = tweak_data.blackmarket.masks[mask_id] 348 | if mask_data == nil then 349 | return 350 | end 351 | local mask_global_value = mask_data.global_value or mask_data.dlc or "normal" 352 | 353 | -- Add mask to inventory 354 | self:on_buy_mask_to_inventory(mask_id, mask_global_value, slot) 355 | 356 | end 357 | 358 | function BlackMarketManager:add_traded_modded_mask_to_free_slot(mask_id, material, pattern, color) 359 | 360 | local success, err = pcall(function() 361 | 362 | -- Get free mask slot 363 | local slot = self:get_free_mask_slot() 364 | if slot == nil then 365 | return 366 | end 367 | 368 | -- Get mask part data 369 | local mask_data = tweak_data.blackmarket.masks[mask_id] 370 | local material_data = tweak_data.blackmarket.materials[material] 371 | local pattern_data = tweak_data.blackmarket.textures[pattern] 372 | local color_data = tweak_data.blackmarket.colors[color] 373 | 374 | if mask_data == nil then 375 | return 376 | end 377 | if material_data == nil then 378 | return 379 | end 380 | if pattern_data == nil then 381 | return 382 | end 383 | if color_data == nil then 384 | return 385 | end 386 | 387 | -- Global values 388 | local mask_global_value = mask_data.global_value or mask_data.dlc or "normal" 389 | local material_global_value = material_data.global_value or material_data.dlc or "normal" 390 | local pattern_global_value = pattern_data.global_value or pattern_data.dlc or "normal" 391 | local color_global_value = color_data.global_value or color_data.dlc or "normal" 392 | 393 | -- Add mask to inventory 394 | self:on_buy_mask_to_inventory(mask_id, mask_global_value, slot) 395 | 396 | -- Start customizing mask 397 | self:start_customize_mask(slot) 398 | 399 | -- Setup customized mask data 400 | self._customize_mask.slot = slot 401 | self._customize_mask.materials = {id = material, global_value = material_global_value} 402 | self._customize_mask.textures = {id = pattern, global_value = pattern_global_value} 403 | self._customize_mask.colors = {id = color, global_value = color_global_value} 404 | 405 | -- Add cash to automatically craft mask 406 | local amount = managers.money:get_mask_crafting_price_modified(self._customize_mask.mask_id, self._customize_mask.global_value, self:get_customized_mask_blueprint(), {}) 407 | managers.money:_add_to_total(amount, {no_offshore = true}) 408 | 409 | -- Finish customizing mask and add to inventory 410 | self:finish_customize_mask() 411 | 412 | end) 413 | if not success then Print("[Error] " .. err) end 414 | 415 | end 416 | 417 | function BlackMarketManager:remove_mask_from_inventory(mask_slot) 418 | 419 | local category = mask_slot.category 420 | local slot = mask_slot.slot 421 | 422 | managers.blackmarket:alter_global_value_item(mask_slot.global_value, category, slot, mask_slot.mask_id, INV_REMOVE) 423 | Global.blackmarket_manager.crafted_items[category][slot] = nil 424 | 425 | end 426 | 427 | function BlackMarketManager:remove_mask_mod_from_inventory(mod_id, category) 428 | local data = managers.blackmarket:get_mask_mod_data(mod_id, category) 429 | local global_value = data.global_value or data.dlc or "normal" 430 | managers.blackmarket:remove_item(global_value, category, mod_id) 431 | end 432 | 433 | Hooks:RegisterHook("BlackMarketManagerModifyGetCosmeticsInstancesByWeaponId") 434 | function BlackMarketManager:get_cosmetics_instances_by_weapon_id(weapon_id) 435 | local items = self.orig.get_cosmetics_instances_by_weapon_id(self, weapon_id) 436 | Hooks:Call("BlackMarketManagerModifyGetCosmeticsInstancesByWeaponId", self, weapon_id, items) 437 | return items 438 | end 439 | 440 | Hooks:RegisterHook("BlackMarketManagerPreGetInventoryTradable") 441 | function BlackMarketManager.get_inventory_tradable(self) 442 | Hooks:Call("BlackMarketManagerPreGetInventoryTradable", self) 443 | return self._global.inventory_tradable 444 | end 445 | 446 | function BlackMarketManager:get_crafted_category(category) 447 | if not self._global.crafted_items then 448 | return {} 449 | end 450 | return self._global.crafted_items[category] or {} 451 | end 452 | -------------------------------------------------------------------------------- /GoonMod/lua/BlackMarketTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( BlackMarketTweakData ) 3 | 4 | Hooks:RegisterHook("BlackMarketTweakDataPostInitGrenades") 5 | function BlackMarketTweakData._init_grenades(self) 6 | self.orig._init_grenades(self) 7 | Hooks:Call("BlackMarketTweakDataPostInitGrenades", self) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/CharacterTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( CharacterTweakData ) 3 | 4 | Hooks:RegisterHook("CharacterTweakDataPostMultiplyAllSpeeds") 5 | function CharacterTweakData._multiply_all_speeds(this, walk_mul, run_mul) 6 | this.orig._multiply_all_speeds(this, walk_mul, run_mul) 7 | Hooks:Call("CharacterTweakDataPostMultiplyAllSpeeds", this, walk_mul, run_mul) 8 | end 9 | 10 | Hooks:RegisterHook("CharacterTweakDataPostInitSecurity") 11 | function CharacterTweakData._init_security(this, presets) 12 | this.orig._init_security(this, presets) 13 | Hooks:Call("CharacterTweakDataPostInitSecurity", this, presets) 14 | end 15 | 16 | Hooks:RegisterHook("CharacterTweakDataPostInitGenSec") 17 | function CharacterTweakData._init_gensec(this, presets) 18 | this.orig._init_gensec(this, presets) 19 | Hooks:Call("CharacterTweakDataPostInitGenSec", this, presets) 20 | end 21 | 22 | Hooks:RegisterHook("CharacterTweakDataPostInitCop") 23 | function CharacterTweakData._init_cop(this, presets) 24 | this.orig._init_cop(this, presets) 25 | Hooks:Call("CharacterTweakDataPostInitCop", this, presets) 26 | end 27 | 28 | Hooks:RegisterHook("CharacterTweakDataPostInitFBI") 29 | function CharacterTweakData._init_fbi(this, presets) 30 | this.orig._init_fbi(this, presets) 31 | Hooks:Call("CharacterTweakDataPostInitFBI", this, presets) 32 | end 33 | 34 | Hooks:RegisterHook("CharacterTweakDataPostInitSWAT") 35 | function CharacterTweakData._init_swat(this, presets) 36 | this.orig._init_swat(this, presets) 37 | Hooks:Call("CharacterTweakDataPostInitSWAT", this, presets) 38 | end 39 | 40 | Hooks:RegisterHook("CharacterTweakDataPostInitHeavySWAT") 41 | function CharacterTweakData._init_heavy_swat(this, presets) 42 | this.orig._init_heavy_swat(this, presets) 43 | Hooks:Call("CharacterTweakDataPostInitHeavySWAT", this, presets) 44 | end 45 | 46 | Hooks:RegisterHook("CharacterTweakDataPostInitFBISWAT") 47 | function CharacterTweakData._init_fbi_swat(this, presets) 48 | this.orig._init_fbi_swat(this, presets) 49 | Hooks:Call("CharacterTweakDataPostInitFBISWAT", this, presets) 50 | end 51 | 52 | Hooks:RegisterHook("CharacterTweakDataPostInitFBIHeavySWAT") 53 | function CharacterTweakData._init_fbi_heavy_swat(this, presets) 54 | this.orig._init_fbi_heavy_swat(this, presets) 55 | Hooks:Call("CharacterTweakDataPostInitFBIHeavySWAT", this, presets) 56 | end 57 | 58 | Hooks:RegisterHook("CharacterTweakDataPostInitCitySWAT") 59 | function CharacterTweakData._init_city_swat(this, presets) 60 | this.orig._init_city_swat(this, presets) 61 | Hooks:Call("CharacterTweakDataPostInitCitySWAT", this, presets) 62 | end 63 | 64 | Hooks:RegisterHook("CharacterTweakDataPostInitSniper") 65 | function CharacterTweakData._init_sniper(this, presets) 66 | this.orig._init_sniper(this, presets) 67 | Hooks:Call("CharacterTweakDataPostInitSniper", this, presets) 68 | end 69 | 70 | Hooks:RegisterHook("CharacterTweakDataPostInitTank") 71 | function CharacterTweakData._init_tank(this, presets) 72 | this.orig._init_tank(this, presets) 73 | Hooks:Call("CharacterTweakDataPostInitTank", this, presets) 74 | end 75 | 76 | Hooks:RegisterHook("CharacterTweakDataPostInitCloaker") 77 | function CharacterTweakData._init_spooc(this, presets) 78 | this.orig._init_spooc(this, presets) 79 | Hooks:Call("CharacterTweakDataPostInitCloaker", this, presets) 80 | end 81 | 82 | Hooks:RegisterHook("CharacterTweakDataPostInitShield") 83 | function CharacterTweakData._init_shield(this, presets) 84 | this.orig._init_shield(this, presets) 85 | Hooks:Call("CharacterTweakDataPostInitShield", this, presets) 86 | end 87 | 88 | Hooks:RegisterHook("CharacterTweakDataPostInitTaser") 89 | function CharacterTweakData._init_taser(this, presets) 90 | this.orig._init_taser(this, presets) 91 | Hooks:Call("CharacterTweakDataPostInitTaser", this, presets) 92 | end 93 | -------------------------------------------------------------------------------- /GoonMod/lua/ChatManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( ChatManager ) 3 | 4 | Hooks:RegisterHook( "ChatManagerOnSendMessage" ) 5 | function ChatManager.send_message(this, channel_id, sender, message) 6 | Hooks:Call( "ChatManagerOnSendMessage", channel_id, sender, message ) 7 | this.orig.send_message(this, channel_id, sender, message) 8 | end 9 | 10 | Hooks:RegisterHook( "ChatManagerOnReceiveMessage" ) 11 | function ChatManager._receive_message(this, channel_id, name, message, color, icon) 12 | Hooks:Call( "ChatManagerOnReceiveMessage", channel_id, name, message, color, icon ) 13 | this.orig._receive_message(this, channel_id, name, message, color, icon) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/ContourExt.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( ContourExt ) 3 | 4 | Hooks:RegisterHook("ContourExtPreInitialize") 5 | Hooks:RegisterHook("ContourExtPostInitialize") 6 | function ContourExt.init(self, unit) 7 | Hooks:Call("ContourExtPreInitialize", self, unit) 8 | self.orig.init(self, unit) 9 | Hooks:Call("ContourExtPostInitialize", self, unit) 10 | end 11 | 12 | Hooks:RegisterHook("ContourExtPreAdd") 13 | function ContourExt.add(self, type, sync, multiplier) 14 | local r = Hooks:ReturnCall("ContourExtPreAdd", self, type, sync, multiplier) 15 | if r ~= nil then 16 | return 17 | end 18 | return self.orig.add(self, type, sync, multiplier) 19 | end 20 | -------------------------------------------------------------------------------- /GoonMod/lua/CopActionHurt.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( CopActionHurt ) 3 | 4 | Hooks:RegisterHook("CopActionHurtPostUpdateRagdolled") 5 | function CopActionHurt._upd_ragdolled(self, t) 6 | self.orig._upd_ragdolled(self, t) 7 | Hooks:Call("CopActionHurtPostUpdateRagdolled", self, t) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/CopDamage.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( CopDamage ) 3 | 4 | Hooks:RegisterHook("CopDamagePostInitialize") 5 | function CopDamage.init(self, unit) 6 | self.orig.init(self, unit) 7 | Hooks:Call("CopDamagePostInitialize", self, unit) 8 | end 9 | 10 | Hooks:RegisterHook("CopDamageSetMoverCollisionState") 11 | function CopDamage.set_mover_collision_state(self, state) 12 | local r = Hooks:ReturnCall("CopDamageSetMoverCollisionState", self, state) 13 | if r ~= nil then 14 | state = r 15 | end 16 | self.orig.set_mover_collision_state(self, state) 17 | end 18 | 19 | Hooks:RegisterHook("CopDamagePreDamageExplosion") 20 | function CopDamage.damage_explosion(self, attack_data) 21 | local r = Hooks:ReturnCall("CopDamagePreDamageExplosion", self, attack_data) 22 | if r ~= nil then 23 | return 24 | end 25 | self.orig.damage_explosion(self, attack_data) 26 | end 27 | 28 | Hooks:RegisterHook("CopDamagePostDeath") 29 | function CopDamage.die(self, variant) 30 | self.orig.die(self, variant) 31 | Hooks:Call("CopDamagePostDeath", self, variant) 32 | end 33 | 34 | Hooks:RegisterHook("CopDamagePostDamageBullet") 35 | function CopDamage.damage_bullet(self, attack_data) 36 | local res = self.orig.damage_bullet(self, attack_data) 37 | Hooks:Call("CopDamagePostDamageBullet", self, attack_data, res) 38 | return res 39 | end 40 | -------------------------------------------------------------------------------- /GoonMod/lua/CopInventory.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( CopInventory ) 3 | 4 | Hooks:RegisterHook("CopInventoryDropShield") 5 | function CopInventory.drop_shield(self) 6 | 7 | if alive(self._shield_unit) then 8 | self._shield_unit:unlink() 9 | if self._shield_unit:damage() then 10 | self._shield_unit:damage():run_sequence_simple("enable_body") 11 | end 12 | end 13 | 14 | Hooks:Call("CopInventoryDropShield", self) 15 | 16 | end 17 | 18 | Hooks:RegisterHook("CopInventoryDestroyAllItems") 19 | function CopInventory.destroy_all_items(self) 20 | 21 | CopInventory.super.destroy_all_items(self) 22 | if alive(self._shield_unit) then 23 | self._shield_unit:set_slot(0) 24 | self._shield_unit = nil 25 | end 26 | 27 | Hooks:Call("CopInventoryDestroyAllItems", self) 28 | 29 | end 30 | 31 | Hooks:RegisterHook("CopInventoryCheckSpawnShield") 32 | function CopInventory._chk_spawn_shield(self, weapon_unit) 33 | 34 | -- self.orig._chk_spawn_shield(self, weapon_unit) 35 | Hooks:Call("CopInventoryCheckSpawnShield", self, weapon_unit) 36 | 37 | if self._shield_unit_name and not alive(self._shield_unit) then 38 | local align_name = self._shield_attach_point or Idstring("a_weapon_left_front") 39 | local align_obj = self._unit:get_object(align_name) 40 | self._shield_unit = World:spawn_unit(Idstring(self._shield_unit_name), align_obj:position(), align_obj:rotation()) 41 | self._unit:link(align_name, self._shield_unit, self._shield_unit:orientation_object():name()) 42 | self._shield_unit:set_enabled(false) 43 | end 44 | 45 | end 46 | 47 | Hooks:RegisterHook("CopInventoryUpdate") 48 | function CopInventory.update(self, unit, t, dt) 49 | Hooks:Call("CopInventoryUpdate", self, unit, t, dt) 50 | end 51 | -------------------------------------------------------------------------------- /GoonMod/lua/CoreMenuInput.lua: -------------------------------------------------------------------------------- 1 | 2 | core:import("CoreMenuInput") 3 | 4 | CloneClass( CoreMenuInput.MenuInput ) 5 | local MenuInput = CoreMenuInput.MenuInput 6 | 7 | function MenuInput.input_slider(self, item, controller) 8 | 9 | local slider_delay_down = 0.1 10 | local slider_delay_pressed = 0.2 11 | 12 | if self:menu_right_input_bool() then 13 | 14 | item:increase() 15 | self._logic:trigger_item(true, item) 16 | self:set_axis_x_timer(slider_delay_down) 17 | if self:menu_right_pressed() then 18 | local percentage = item:percentage() 19 | if percentage > 0 and percentage < 100 then 20 | self:post_event("slider_increase") 21 | end 22 | self:set_axis_x_timer(slider_delay_pressed) 23 | end 24 | 25 | elseif self:menu_left_input_bool() then 26 | 27 | item:decrease() 28 | self._logic:trigger_item(true, item) 29 | self:set_axis_x_timer(slider_delay_down) 30 | if self:menu_left_pressed() then 31 | self:set_axis_x_timer(slider_delay_pressed) 32 | local percentage = item:percentage() 33 | if percentage > 0 and percentage < 100 then 34 | self:post_event("slider_decrease") 35 | end 36 | end 37 | 38 | end 39 | 40 | end 41 | -------------------------------------------------------------------------------- /GoonMod/lua/CoreMenuItem.lua: -------------------------------------------------------------------------------- 1 | 2 | core:import("CoreMenuItem") 3 | 4 | CloneClass( CoreMenuItem.Item ) 5 | local Item = CoreMenuItem.Item 6 | 7 | function Item.trigger(self) 8 | self.orig.trigger(self) 9 | end 10 | 11 | function Item.dirty(self) 12 | 13 | if self._parameters.type ~= "CoreMenuItemSlider.ItemSlider" or self._type ~= "slider" then 14 | if self.dirty_callback then 15 | self.dirty_callback(self) 16 | end 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /GoonMod/lua/CoreMenuItemSlider.lua: -------------------------------------------------------------------------------- 1 | 2 | core:module("CoreMenuItemSlider") 3 | local CloneClass = _G.CloneClass 4 | local tweak_data = _G.tweak_data 5 | 6 | CloneClass( ItemSlider ) 7 | 8 | function ItemSlider.setup_gui(self, node, row_item) 9 | local r = self.orig.setup_gui(self, node, row_item) 10 | row_item.gui_slider_text:set_font_size( tweak_data.menu.stats_font_size ) 11 | return r 12 | end 13 | 14 | function ItemSlider.set_value(self, value) 15 | self._value = math.min(math.max(self._min, value), self._max) 16 | self:dirty() 17 | end 18 | 19 | function ItemSlider.reload(self, row_item, node) 20 | local r = self.orig.reload(self, row_item, node) 21 | local value = self:show_value() and string.format("%.2f", math.round_with_precision(self:value(), 2)) or string.format("%.0f", self:percentage()) .. "%" 22 | row_item.gui_slider_text:set_text(value) 23 | return r 24 | end 25 | -------------------------------------------------------------------------------- /GoonMod/lua/CoreMenuLogic.lua: -------------------------------------------------------------------------------- 1 | 2 | core:import("CoreMenuLogic") 3 | 4 | CloneClass( CoreMenuLogic.Logic ) 5 | local Logic = CoreMenuLogic.Logic 6 | 7 | function Logic.select_node(self, node_name, queue, ...) 8 | -- Print("Logic.select_node") 9 | self.orig.select_node(self, node_name, queue, ...) 10 | end 11 | 12 | function Logic.select_item(self, item_name, queue) 13 | -- Print("Logic.select_item") 14 | self.orig.select_item(self, item_name, queue) 15 | end 16 | 17 | function Logic.trigger_item(self, queue, item) 18 | -- Print("Logic.trigger_item") 19 | self.orig.trigger_item(self, queue, item) 20 | end 21 | 22 | function Logic._trigger_item(self, item) 23 | -- Print("Logic._trigger_item") 24 | self.orig._trigger_item(self, item) 25 | end 26 | -------------------------------------------------------------------------------- /GoonMod/lua/CoreMissionManager.lua: -------------------------------------------------------------------------------- 1 | core:module("CoreMissionManager") 2 | 3 | local function PrintTable (tbl, cmp) 4 | cmp = cmp or {} 5 | if type(tbl) == "table" then 6 | for k, v in pairs (tbl) do 7 | if type(v) == "table" and not cmp[v] then 8 | cmp[v] = true 9 | Print( string.format("[\"%s\"] -> table", tostring(k)) ); 10 | PrintTable (v, cmp) 11 | else 12 | Print( string.format("\"%s\" -> %s", tostring(k), tostring(v)) ) 13 | end 14 | end 15 | else Print(tbl) end 16 | end 17 | 18 | local function DoSaveTable(tbl, cmp, fileName, fileIsOpen, preText) 19 | 20 | local file = nil 21 | if fileIsOpen == nil then 22 | file = io.open(fileName, "w") 23 | else 24 | file = fileIsOpen 25 | end 26 | 27 | cmp = cmp or {} 28 | if type(tbl) == "table" then 29 | for k, v in pairs(tbl) do 30 | if type(v) == "table" and not cmp[v] then 31 | cmp[v] = true 32 | file:write( preText .. string.format("[\"%s\"] -> table", tostring (k)) .. "\n" ) 33 | DoSaveTable(v, cmp, fileName, file, preText .. "\t") 34 | else 35 | file:write( preText .. string.format( "\"%s\" -> %s", tostring(k), tostring(v) ) .. "\n" ) 36 | end 37 | end 38 | else 39 | file:write( preText .. tbl .. "\n") 40 | end 41 | 42 | if fileIsOpen == nil then 43 | file:close() 44 | end 45 | end 46 | 47 | local function SaveTable(tbl, file) 48 | DoSaveTable(tbl, {}, file, nil, "") 49 | end 50 | 51 | function MissionManager:parse(params, stage_name, offset, file_type) 52 | 53 | Print("MissionManager:parse") 54 | 55 | local file_path, activate_mission 56 | if CoreClass.type_name(params) == "table" then 57 | file_path = params.file_path 58 | file_type = params.file_type or "mission" 59 | activate_mission = params.activate_mission 60 | offset = params.offset 61 | else 62 | file_path = params 63 | file_type = file_type or "mission" 64 | end 65 | 66 | Print("-----") 67 | Print("file_path: ", file_path) 68 | Print("file_type: ", file_type) 69 | Print("activate_mission: ", activate_mission) 70 | Print("offset: ", offset) 71 | Print("-----") 72 | 73 | CoreDebug.cat_debug("gaspode", "MissionManager", file_path, file_type, activate_mission) 74 | if not DB:has(file_type, file_path) then 75 | Application:error("Couldn't find", file_path, "(", file_type, ")") 76 | return false 77 | end 78 | 79 | local reverse = string.reverse(file_path) 80 | local i = string.find(reverse, "/") 81 | local file_dir = string.reverse(string.sub(reverse, i)) 82 | local continent_files = self:_serialize_to_script(file_type, file_path) 83 | continent_files._meta = nil 84 | 85 | for name, data in pairs(continent_files) do 86 | if not managers.worlddefinition:continent_excluded(name) then 87 | self:_load_mission_file(file_dir, data) 88 | end 89 | end 90 | 91 | self:_activate_mission(activate_mission) 92 | 93 | return true 94 | 95 | end 96 | 97 | function MissionManager:_load_mission_file(file_dir, data) 98 | 99 | local file_path = file_dir .. data.file 100 | local scripts = self:_serialize_to_script("mission", file_path) 101 | scripts._meta = nil 102 | 103 | for name, data in pairs(scripts) do 104 | data.name = name 105 | self:_add_script(data) 106 | end 107 | 108 | end 109 | -------------------------------------------------------------------------------- /GoonMod/lua/CriminalsManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( CriminalsManager ) 3 | 4 | Hooks:Call("CriminalsManagerNumberOfTakenCriminals") 5 | function CriminalsManager.nr_taken_criminals(self) 6 | local r = Hooks:ReturnCall("CriminalsManagerNumberOfTakenCriminals", self) 7 | if r ~= nil then 8 | return r 9 | end 10 | return self.orig.nr_taken_criminals(self) 11 | end 12 | -------------------------------------------------------------------------------- /GoonMod/lua/ECMJammerBase.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( ECMJammerBase ) 3 | -------------------------------------------------------------------------------- /GoonMod/lua/ElementLaserTrigger.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( ElementLaserTrigger ) 3 | 4 | Hooks:RegisterHook("ElementLaserTriggerPostInit") 5 | function ElementLaserTrigger.init(self, ...) 6 | if self and self.orig then 7 | self.orig.init(self, ...) 8 | Hooks:Call("ElementLaserTriggerPostInit", self) 9 | end 10 | end 11 | 12 | Hooks:RegisterHook("ElementLaserTriggerUpdateDraw") 13 | function ElementLaserTrigger.update_laser_draw(self, t, dt) 14 | if self and self.orig then 15 | self.orig.update_laser_draw(self, t, dt) 16 | Hooks:Call("ElementLaserTriggerUpdateDraw", self, t, dt) 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /GoonMod/lua/ElementSpawnGrenade.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( ElementSpawnGrenade ) 3 | 4 | function ElementSpawnGrenade.on_executed(self, instigator) 5 | self.orig.on_executed(self, instigator) 6 | end 7 | -------------------------------------------------------------------------------- /GoonMod/lua/ExperienceManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( ExperienceManager ) 3 | 4 | Hooks:RegisterHook("ExperienceManagerGetRankString") 5 | function ExperienceManager.rank_string(self, rank) 6 | local r = Hooks:ReturnCall("ExperienceManagerGetRankString", self, rank) 7 | if r ~= nil then 8 | return r 9 | end 10 | return self.orig.rank_string(self, rank) 11 | end 12 | -------------------------------------------------------------------------------- /GoonMod/lua/FPCameraPlayerBase.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( FPCameraPlayerBase ) 3 | 4 | Hooks:RegisterHook("FPCameraPlayerBaseOnSpawnMeleeItem") 5 | function FPCameraPlayerBase.spawn_melee_item( self ) 6 | self.orig.spawn_melee_item( self ) 7 | Hooks:Call( "FPCameraPlayerBaseOnSpawnMeleeItem", self, self._melee_item_units ) 8 | end 9 | 10 | Hooks:RegisterHook("FPCameraPlayerBaseStanceEnteredCallback") 11 | function FPCameraPlayerBase.clbk_stance_entered(self, new_shoulder_stance, new_head_stance, new_vel_overshot, new_fov, new_shakers, stance_mod, duration_multiplier, duration) 12 | Hooks:Call( "FPCameraPlayerBaseStanceEnteredCallback", self, new_shoulder_stance, new_head_stance, new_vel_overshot, new_fov, new_shakers, stance_mod, duration_multiplier, duration ) 13 | self.orig.clbk_stance_entered(self, new_shoulder_stance, new_head_stance, new_vel_overshot, new_fov, new_shakers, stance_mod, duration_multiplier, duration) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/FragGrenade.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( FragGrenade ) 3 | 4 | Hooks:RegisterHook("FragGrenadePostInit") 5 | function FragGrenade.init(self, unit) 6 | self.orig.init(self, unit) 7 | Hooks:Call("FragGrenadePostInit", self, unit) 8 | end 9 | 10 | Hooks:RegisterHook("FragGrenadeDetonate") 11 | function FragGrenade._detonate(self) 12 | self._detonate(self) 13 | Hooks:Call("FragGrenadeDetonate") 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/GageAssignmentManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( GageAssignmentManager ) 3 | 4 | Hooks:RegisterHook("GageAssignmentManagerOnMissionCompleted") 5 | function GageAssignmentManager.on_mission_completed(self) 6 | Hooks:Call("GageAssignmentManagerOnMissionCompleted", self) 7 | return self.orig.on_mission_completed(self) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/GameSetup.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( GameSetup ) 3 | 4 | Hooks:RegisterHook("GameSetupUpdate") 5 | function GameSetup.update(self, t, dt) 6 | Hooks:Call("GameSetupUpdate", t, dt) 7 | return self.orig.update(self, t, dt) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/GameStateMachine.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( GameStateMachine ) 3 | 4 | Hooks:RegisterHook("GameStateMachineChangeStateByName") 5 | function GameStateMachine.change_state_by_name(self, state_name, params) 6 | Hooks:Call("GameStateMachineChangeStateByName", self, state_name, params) 7 | self.orig.change_state_by_name(self, state_name, params) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/GroupAIManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( GroupAIManager ) 3 | 4 | function GroupAIManager.set_state(self, name) 5 | -- Print("Setting Group AI State to: " .. name) 6 | self.orig.set_state(self, name) 7 | end 8 | -------------------------------------------------------------------------------- /GoonMod/lua/GroupAIStateBase.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( GroupAIStateBase ) 3 | 4 | function GroupAIStateBase.convert_hostage_to_criminal(self, unit, peer_unit) 5 | unit:movement()._preconvert_team = unit:movement():team() 6 | self.orig.convert_hostage_to_criminal(self, unit, peer_unit) 7 | end 8 | 9 | function GroupAIStateBase.clbk_minion_dies(self, player_key, minion_unit, damage_info) 10 | local _preconvert_team = minion_unit:movement()._preconvert_team 11 | if _preconvert_team ~= nil then 12 | minion_unit:movement():set_team( _preconvert_team ) 13 | end 14 | self.orig.clbk_minion_dies(self, player_key, minion_unit, damage_info) 15 | end 16 | -------------------------------------------------------------------------------- /GoonMod/lua/HUDManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( HUDManager ) 3 | 4 | Hooks:RegisterHook("HUDManagerPreAddWaypoint") 5 | function HUDManager.add_waypoint(self, id, data) 6 | local r = Hooks:ReturnCall("HUDManagerPreAddWaypoint", self, id, data) 7 | if r then 8 | return 9 | end 10 | return self.orig.add_waypoint(self, id, data) 11 | end 12 | 13 | Hooks:RegisterHook("HUDManagerPreAddNameLabel") 14 | function HUDManager._add_name_label(self, data) 15 | Hooks:Call("HUDManagerPreAddNameLabel", self, data) 16 | return self.orig._add_name_label(self, data) 17 | end 18 | -------------------------------------------------------------------------------- /GoonMod/lua/HUDManagerPD2.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( HUDManager ) 3 | 4 | function HUDManager._create_teammates_panel(self, hud) 5 | Print("HUDManager._create_teammates_panel(self, hud)") 6 | self.orig._create_teammates_panel(self, hud) 7 | end 8 | 9 | function HUDManager.remove_teammate_panel_by_name_id(self, name_id) 10 | Print("HUDManager:remove_teammate_panel_by_name_id(" .. name_id .. ")") 11 | self.orig.remove_teammate_panel_by_name_id(self, name_id) 12 | end 13 | 14 | function HUDManager.remove_teammate_panel(self, id) 15 | Print("HUDManager:remove_teammate_panel(" .. tostring(id) .. ")") 16 | self.orig.remove_teammate_panel(self, id) 17 | end 18 | 19 | function HUDManager:add_mugshot_by_unit(unit) 20 | if unit:base().is_local_player then 21 | return 22 | end 23 | local character_name = unit:base():nick_name() 24 | local name_label_id = managers.hud:_add_name_label({name = character_name, unit = unit}) 25 | unit:unit_data().name_label_id = name_label_id 26 | local is_husk_player = unit:base().is_husk_player 27 | local character_name_id = managers.criminals:character_name_by_unit(unit) 28 | for i, data in ipairs(self._hud.mugshots) do 29 | if data.character_name_id == character_name_id then 30 | if is_husk_player and not data.peer_id then 31 | -- self:_remove_mugshot(data.id) 32 | break 33 | else 34 | unit:unit_data().mugshot_id = data.id 35 | managers.hud:set_mugshot_normal(unit:unit_data().mugshot_id) 36 | managers.hud:set_mugshot_armor(unit:unit_data().mugshot_id, 1) 37 | managers.hud:set_mugshot_health(unit:unit_data().mugshot_id, 1) 38 | return 39 | end 40 | end 41 | end 42 | local peer, peer_id 43 | if is_husk_player then 44 | peer = unit:network():peer() 45 | peer_id = peer:id() 46 | end 47 | local use_lifebar = is_husk_player and true or false 48 | local mugshot_id = managers.hud:add_mugshot({ 49 | name = utf8.to_upper(character_name), 50 | use_lifebar = use_lifebar, 51 | peer_id = peer_id, 52 | character_name_id = character_name_id 53 | }) 54 | unit:unit_data().mugshot_id = mugshot_id 55 | if peer and peer:is_cheater() then 56 | self:mark_cheater(peer_id) 57 | end 58 | return mugshot_id 59 | end 60 | 61 | function HUDManager.add_teammate_panel(self, character_name, player_name, ai, peer_id) 62 | 63 | Print("HUDManager.add_teammate_panel (" .. tostring(character_name) .. " / " .. tostring(player_name) .. ")") 64 | 65 | for i, data in ipairs(self._hud.teammate_panels_data) do 66 | Print(tostring(i) .. " / taken: " .. tostring(data.taken)) 67 | if not data.taken then 68 | 69 | Print(tostring(i) .. " is not taken yet") 70 | 71 | self._teammate_panels[i]:add_panel() 72 | self._teammate_panels[i]:set_peer_id(peer_id) 73 | self._teammate_panels[i]:set_ai(ai) 74 | self:set_teammate_callsign(i, ai and 5 or peer_id) 75 | self:set_teammate_name(i, player_name) 76 | self:set_teammate_state(i, ai and "ai" or "player") 77 | 78 | if peer_id then 79 | 80 | local peer_equipment = managers.player:get_synced_equipment_possession(peer_id) or {} 81 | for equipment, amount in pairs(peer_equipment) do 82 | self:add_teammate_special_equipment(i, { 83 | id = equipment, 84 | icon = tweak_data.equipments.specials[equipment].icon, 85 | amount = amount 86 | }) 87 | end 88 | 89 | local peer_deployable_equipment = managers.player:get_synced_deployable_equipment(peer_id) 90 | 91 | if peer_deployable_equipment then 92 | local icon = tweak_data.equipments[peer_deployable_equipment.deployable].icon 93 | self:set_deployable_equipment(i, { 94 | icon = icon, 95 | amount = peer_deployable_equipment.amount 96 | }) 97 | end 98 | 99 | local peer_cable_ties = managers.player:get_synced_cable_ties(peer_id) 100 | if peer_cable_ties then 101 | local icon = tweak_data.equipments.specials.cable_tie.icon 102 | self:set_cable_tie(i, { 103 | icon = icon, 104 | amount = peer_cable_ties.amount 105 | }) 106 | end 107 | 108 | local peer_grenades = managers.player:get_synced_grenades(peer_id) 109 | if peer_grenades then 110 | local icon = tweak_data.blackmarket.grenades[peer_grenades.grenade].icon 111 | self:set_teammate_grenades(i, { 112 | icon = icon, 113 | amount = Application:digest_value(peer_grenades.amount, false) 114 | }) 115 | end 116 | 117 | end 118 | 119 | local unit = managers.player:player_unit(peer_id) 120 | --local unit = managers.criminals:character_unit_by_name(character_name) 121 | if alive(unit) then 122 | local weapon = unit:inventory():equipped_unit() 123 | if alive(weapon) then 124 | local icon = weapon:base():weapon_tweak_data().hud_icon 125 | local equipped_selection = unit:inventory():equipped_selection() 126 | self:_set_teammate_weapon_selected(i, equipped_selection, icon) 127 | end 128 | end 129 | 130 | local peer_ammo_info = managers.player:get_synced_ammo_info(peer_id) 131 | if peer_ammo_info then 132 | for selection_index, ammo_info in pairs(peer_ammo_info) do 133 | self:set_teammate_ammo_amount(i, selection_index, unpack(ammo_info)) 134 | end 135 | end 136 | 137 | local peer_carry_data = managers.player:get_synced_carry(peer_id) 138 | 139 | if peer_carry_data then 140 | self:set_teammate_carry_info(i, peer_carry_data.carry_id, managers.loot:get_real_value(peer_carry_data.carry_id, peer_carry_data.multiplier)) 141 | end 142 | 143 | data.taken = true 144 | 145 | Print("id: " .. tostring(i)) 146 | return i 147 | 148 | end 149 | end 150 | 151 | end 152 | -------------------------------------------------------------------------------- /GoonMod/lua/InfamyTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( InfamyTweakData ) 3 | 4 | function InfamyTweakData.init(self) 5 | self.orig.init(self) 6 | end 7 | -------------------------------------------------------------------------------- /GoonMod/lua/InteractionExt.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( BaseInteractionExt ) 3 | 4 | local ids_contour_color = Idstring("contour_color") 5 | local ids_contour_opacity = Idstring("contour_opacity") 6 | Hooks:RegisterHook("BaseInteractionExtPreSetContour") 7 | function BaseInteractionExt.set_contour(self, color, opacity) 8 | local r = Hooks:ReturnCall("BaseInteractionExtPreSetContour", self, color, opacity) 9 | if r ~= nil then 10 | color = r.color 11 | opacity = r.opacity 12 | end 13 | self.orig.set_contour(self, color, opacity) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/JobManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( JobManager ) 3 | 4 | Hooks:RegisterHook("JobManagerOnSetNextInteruptStage") 5 | function JobManager.set_next_interupt_stage(self, interupt) 6 | self.orig.set_next_interupt_stage(self, interupt) 7 | Hooks:Call("JobManagerOnSetNextInteruptStage", self, interupt) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/LevelsTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( LevelsTweakData ) 3 | 4 | Hooks:RegisterHook("LevelsTweakDataInit") 5 | function LevelsTweakData.init(self) 6 | self.orig.init(self) 7 | Hooks:Call("LevelsTweakDataInit", self) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/MaskExt.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( MaskExt ) 3 | 4 | function MaskExt.clbk_texture_loaded(self, async_clbk, tex_name) 5 | if not alive(self._unit) then 6 | return 7 | end 8 | for tex_id, texture_data in pairs(self._textures) do 9 | if not texture_data.ready and tex_name == texture_data.name then 10 | texture_data.ready = true 11 | local new_texture = TextureCache:retrieve(tex_name, "normal") 12 | for _, material in ipairs(self._materials) do 13 | material:set_texture(tex_id == "pattern" and "material_texture" or "reflection_texture", new_texture) 14 | end 15 | TextureCache:unretrieve(tex_name) 16 | TextureCache:unretrieve(tex_name) 17 | end 18 | end 19 | self:_chk_load_complete(async_clbk) 20 | end 21 | -------------------------------------------------------------------------------- /GoonMod/lua/MenuComponentManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( MenuComponentManager ) 3 | 4 | Hooks:RegisterHook("PostCreateCrimenetContractGUI") 5 | function MenuComponentManager._create_crimenet_contract_gui(self, node) 6 | self.orig._create_crimenet_contract_gui(self, node) 7 | Hooks:Call("PostCreateCrimenetContractGUI", self, node, self._crimenet_contract_gui) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/MenuManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( MenuManager ) 3 | CloneClass( MenuCallbackHandler ) 4 | 5 | Hooks:RegisterHook( "MenuManagerSetMouseSensitivity" ) 6 | function MenuManager.set_mouse_sensitivity(self, zoomed) 7 | self.orig.set_mouse_sensitivity(self, zoomed) 8 | Hooks:Call( "MenuManagerSetMouseSensitivity", self, zoomed ) 9 | end 10 | 11 | -- Start game delaying 12 | Hooks:RegisterHook("MenuCallbackHandlerPreStartTheGame") 13 | function MenuCallbackHandler.start_the_game(self) 14 | 15 | if not self._start_the_game then 16 | self._start_the_game = function(self) 17 | self.orig.start_the_game(self) 18 | end 19 | end 20 | 21 | local r = Hooks:ReturnCall("MenuCallbackHandlerPreStartTheGame", self) 22 | if r then 23 | self._delayed_start_game = true 24 | return nil 25 | end 26 | 27 | return self.orig.start_the_game(self) 28 | 29 | end 30 | 31 | Hooks:RegisterHook("MenuCallbackHandlerPreIncreaseInfamous") 32 | function MenuCallbackHandler._increase_infamous( self ) 33 | Hooks:Call("MenuCallbackHandlerPreIncreaseInfamous", self) 34 | return self.orig._increase_infamous( self ) 35 | end 36 | 37 | function MenuCallbackHandler:_process_start_game_delay( t, dt ) 38 | 39 | if self._delayed_start_game and #self._start_delays == 0 then 40 | self._delayed_start_game = false 41 | if self._start_the_game then 42 | self:_start_the_game() 43 | end 44 | end 45 | 46 | end 47 | 48 | function MenuCallbackHandler:delay_game_start( id ) 49 | 50 | self._delayed_start_game = true 51 | 52 | if not self._start_delays then 53 | self._start_delays = {} 54 | end 55 | table.insert( self._start_delays, id ) 56 | 57 | end 58 | 59 | function MenuCallbackHandler:release_game_start_delay( id ) 60 | 61 | for i = #self._start_delays, 0, -1 do 62 | if self._start_delays[i] == id then 63 | table.remove( self._start_delays, i ) 64 | end 65 | end 66 | 67 | end 68 | 69 | Hooks:Add("MenuUpdate", "MenuUpdate_MenuManager", function(t, dt) 70 | MenuCallbackHandler._process_start_game_delay(MenuCallbackHandler, t, dt) 71 | end) 72 | 73 | -- Lobby permissions 74 | Hooks:RegisterHook("MenuCallbackHandlerPreChoseLobbyPermission") 75 | function MenuCallbackHandler.choice_lobby_permission(self, item) 76 | local r = Hooks:ReturnCall("MenuCallbackHandlerPreChoseLobbyPermission", self, item) 77 | if r then 78 | return 79 | end 80 | self.orig.choice_lobby_permission(self, item) 81 | end 82 | 83 | Hooks:RegisterHook("MenuCallbackHandlerPreCrimeNetChoseLobbyPermission") 84 | function MenuCallbackHandler.choice_crimenet_lobby_permission(self, item) 85 | local r = Hooks:ReturnCall("MenuCallbackHandlerPreCrimeNetChoseLobbyPermission", self, item) 86 | if r then 87 | return 88 | end 89 | self.orig.choice_crimenet_lobby_permission(self, item) 90 | end 91 | 92 | -- Nodes 93 | Hooks:RegisterHook( "MenuManagerOnOpenNode" ) 94 | Hooks:RegisterHook( "MenuManagerOnBack" ) 95 | function MenuManager.open_node( self, node_name, parameter_list ) 96 | 97 | -- Hook menu:back() 98 | if not self.__back_func then 99 | self.__back_func = self.back 100 | managers.menu.back = function(queue, skip_nodes) 101 | self.__back_func(queue, skip_nodes) 102 | Hooks:Call( "MenuManagerOnBack", self, queue, skip_nodes ) 103 | end 104 | end 105 | 106 | -- Hook menu:open_node() 107 | self.orig.open_node( self, node_name, parameter_list ) 108 | Hooks:Call( "MenuManagerOnOpenNode", self, node_name, parameter_list ) 109 | 110 | end 111 | -------------------------------------------------------------------------------- /GoonMod/lua/MenuSceneManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( MenuSceneManager ) 3 | 4 | Hooks:RegisterHook("MenuSceneManagerSpawnedItemWeapon") 5 | function MenuSceneManager.spawn_item_weapon(self, factory_id, blueprint, cosmetics, texture_switches, custom_data) 6 | local unit = self.orig.spawn_item_weapon(self, factory_id, blueprint, cosmetics, texture_switches, custom_data) 7 | Hooks:Call("MenuSceneManagerSpawnedItemWeapon", self, factory_id, blueprint, cosmetics, texture_switches, custom_data, unit) 8 | return unit 9 | end 10 | 11 | Hooks:RegisterHook("MenuSceneManagerSpawnedMeleeWeapon") 12 | function MenuSceneManager.spawn_melee_weapon_clbk(self, melee_weapon_id) 13 | local unit = self.orig.spawn_melee_weapon_clbk(self, melee_weapon_id) 14 | Hooks:Call("MenuSceneManagerSpawnedMeleeWeapon", self, melee_weapon_id, unit) 15 | return unit 16 | end 17 | 18 | Hooks:RegisterHook("MenuSceneManagerOverrideSceneTemplate") 19 | function MenuSceneManager.set_scene_template(self, template, data, custom_name, skip_transition) 20 | local r = Hooks:ReturnCall("MenuSceneManagerOverrideSceneTemplate", self, template, data, custom_name, skip_transition) 21 | if r then 22 | template = r 23 | end 24 | self.orig.set_scene_template(self, template, data, custom_name, skip_transition) 25 | end 26 | 27 | Hooks:RegisterHook("MenuSceneManagerOnSetCharacterEquippedWeapon") 28 | function MenuSceneManager.set_character_equipped_weapon(self, unit, factory_id, blueprint, type, cosmetics) 29 | self.orig.set_character_equipped_weapon(self, unit, factory_id, blueprint, type, cosmetics) 30 | Hooks:Call("MenuSceneManagerOnSetCharacterEquippedWeapon", self, unit, factory_id, blueprint, type, cosmetics) 31 | end 32 | 33 | Hooks:RegisterHook("MenuSceneManagerOnCallbackWeaponBaseUnitLoaded") 34 | function MenuSceneManager.clbk_weapon_base_unit_loaded(self, params, status, asset_type, asset_name) 35 | self.orig.clbk_weapon_base_unit_loaded(self, params, status, asset_type, asset_name) 36 | Hooks:Call("MenuSceneManagerOnCallbackWeaponBaseUnitLoaded", self, params, status, asset_type, asset_name) 37 | end 38 | 39 | Hooks:RegisterHook("MenuSceneManagerOnSetCharacterOutfitVisibility") 40 | function MenuSceneManager._set_character_and_outfit_visibility(self, char_unit, state) 41 | self.orig._set_character_and_outfit_visibility(self, char_unit, state) 42 | Hooks:Call("MenuSceneManagerOnSetCharacterOutfitVisibility", self, char_unit, state) 43 | end 44 | -------------------------------------------------------------------------------- /GoonMod/lua/MenuSetup.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( MenuSetup ) 3 | 4 | Hooks:RegisterHook("MenuUpdate") 5 | function MenuSetup.update(self, t, dt) 6 | self.orig.update(self, t, dt) 7 | Hooks:Call("MenuUpdate", t, dt) 8 | end 9 | 10 | Hooks:RegisterHook("SetupOnQuit") 11 | function MenuSetup.quit(self) 12 | Hooks:Call("SetupOnQuit", self) 13 | return self.orig.quit(self) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/MissionBriefingGUI.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( MissionBriefingGui ) 3 | 4 | Hooks:RegisterHook("MissionBriefingGUIPreInit") 5 | Hooks:RegisterHook("MissionBriefingGUIPostInit") 6 | function MissionBriefingGui.init(self, saferect_ws, fullrect_ws, node) 7 | Hooks:Call( "MissionBriefingGUIPreInit", self, saferect_ws, fullrect_ws, node ) 8 | self.orig.init(self, saferect_ws, fullrect_ws, node) 9 | Hooks:Call( "MissionBriefingGUIPostInit", self, saferect_ws, fullrect_ws, node ) 10 | end 11 | -------------------------------------------------------------------------------- /GoonMod/lua/NPCRaycastWeaponBase.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( NPCRaycastWeaponBase ) 3 | 4 | Hooks:RegisterHook("NPCRaycastWeaponBaseInit") 5 | function NPCRaycastWeaponBase.init(self, unit) 6 | self.orig.init(self, unit) 7 | Hooks:Call("NPCRaycastWeaponBaseInit", self, unit) 8 | end 9 | --[[ dunno if these exist for enemy weapons but whatever 10 | Hooks:RegisterHook("NPCRaycastWeaponBaseUpdate") 11 | function NPCRaycastWeaponBase.update(self, unit, t, dt) 12 | Hooks:Call("NPCRaycastWeaponBaseUpdate", self, unit, t, dt) 13 | end 14 | 15 | Hooks:RegisterHook("NPCRaycastWeaponBaseSetFactoryData") 16 | function NPCRaycastWeaponBase.set_factory_data(self, factory_id) 17 | self.orig.set_factory_data(self, factory_id) 18 | Hooks:Call("NPCRaycastWeaponBaseSetFactoryData", self, factory_id) 19 | end 20 | ]]-- 21 | -------------------------------------------------------------------------------- /GoonMod/lua/NarrativeTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( NarrativeTweakData ) 3 | 4 | Hooks:RegisterHook("NarrativeTweakDataInit") 5 | function NarrativeTweakData.init(self, ...) 6 | self.orig.init(self, ...) 7 | Hooks:Call("NarrativeTweakDataInit", self, ...) 8 | end -------------------------------------------------------------------------------- /GoonMod/lua/NetworkGame.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( NetworkGame ) 3 | 4 | Hooks:RegisterHook("NetworkGamePostLoad") 5 | function NetworkGame.load(self, game_data) 6 | self.orig.load(self, game_data) 7 | Hooks:Call("NetworkGamePostLoad", self, game_data) 8 | end 9 | 10 | Hooks:RegisterHook("NetworkGameCheckPeerPreferredCharacter") 11 | function NetworkGame.check_peer_preferred_character(self, preferred_character) 12 | local r = Hooks:ReturnCall("NetworkGameCheckPeerPreferredCharacter", self, preferred_character) 13 | if r ~= nil then 14 | return r 15 | end 16 | return self.orig.check_peer_preferred_character(self, preferred_character) 17 | end 18 | -------------------------------------------------------------------------------- /GoonMod/lua/NetworkManager.lua: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /GoonMod/lua/NetworkMatchMakingSteam.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( NetworkMatchMakingSTEAM ) 3 | 4 | Hooks:RegisterHook("NetworkMatchmakingSetAttributes") 5 | function NetworkMatchMakingSTEAM.set_attributes(self, settings) 6 | self.orig.set_attributes(self, settings) 7 | Hooks:Call("NetworkMatchmakingSetAttributes", self, settings) 8 | if self.lobby_handler then 9 | self.lobby_handler:set_lobby_data( self._lobby_attributes ) 10 | end 11 | end 12 | 13 | Hooks:RegisterHook("NetworkMatchmakingJoinOKServer") 14 | function NetworkMatchMakingSTEAM.join_server(self, room_id, skip_showing_dialog) 15 | Hooks:Call("NetworkMatchmakingJoinOKServer", self, room_id, skip_showing_dialog) 16 | self.orig.join_server(self, room_id, skip_showing_dialog) 17 | end 18 | -------------------------------------------------------------------------------- /GoonMod/lua/NewRaycastWeaponBase.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( NewRaycastWeaponBase ) 3 | 4 | Hooks:RegisterHook("NewRaycastWeaponBaseInit") 5 | function NewRaycastWeaponBase.init(self, unit) 6 | self.orig.init(self, unit) 7 | Hooks:Call("NewRaycastWeaponBaseInit", self, unit) 8 | end 9 | 10 | Hooks:RegisterHook("NewRaycastWeaponBaseUpdate") 11 | function NewRaycastWeaponBase.update(self, unit, t, dt) 12 | Hooks:Call("NewRaycastWeaponBaseUpdate", self, unit, t, dt) 13 | end 14 | 15 | Hooks:RegisterHook("NewRaycastWeaponBaseSetFactoryData") 16 | function NewRaycastWeaponBase.set_factory_data(self, factory_id) 17 | self.orig.set_factory_data(self, factory_id) 18 | Hooks:Call("NewRaycastWeaponBaseSetFactoryData", self, factory_id) 19 | end 20 | 21 | Hooks:RegisterHook("NewRaycastWeaponBasePostAssemblyComplete") 22 | function NewRaycastWeaponBase.clbk_assembly_complete(self, clbk, parts, blueprint) 23 | self.orig.clbk_assembly_complete(self, clbk, parts, blueprint) 24 | Hooks:Call("NewRaycastWeaponBasePostAssemblyComplete", self, clbk, parts, blueprint) 25 | end 26 | -------------------------------------------------------------------------------- /GoonMod/lua/PlayerDamage.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( PlayerDamage ) 3 | 4 | Hooks:RegisterHook( "PlayerDamageOnPostInit" ) 5 | function PlayerDamage.init(this, unit) 6 | this.orig.init(this, unit) 7 | Hooks:Call("PlayerDamageOnPostInit", this, unit) 8 | end 9 | 10 | Hooks:RegisterHook( "PlayerDamageOnRegenerated" ) 11 | function PlayerDamage._regenerated(this, no_messiah) 12 | this.orig._regenerated(this, no_messiah) 13 | Hooks:Call("PlayerDamageOnRegenerated", this, no_messiah) 14 | end 15 | 16 | Hooks:RegisterHook( "PlayerDamageOnDowned" ) 17 | function PlayerDamage.on_downed(self) 18 | self.orig.on_downed(self) 19 | Hooks:Call("PlayerDamageOnDowned", self) 20 | end 21 | 22 | Hooks:RegisterHook( "PlayerDamagePreDamageBullet" ) 23 | function PlayerDamage.damage_bullet(self, attack_data) 24 | local r = Hooks:ReturnCall("PlayerDamagePreDamageBullet", self, attack_data) 25 | if r then 26 | return 27 | end 28 | self.orig.damage_bullet(self, attack_data) 29 | end 30 | -------------------------------------------------------------------------------- /GoonMod/lua/PlayerInventory.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( PlayerInventory ) 3 | 4 | function PlayerInventory.add_unit_by_factory_name(self, factory_name, equip, instant, blueprint, cosmetics, texture_switches) 5 | self.orig.add_unit_by_factory_name(self, factory_name, equip, instant, blueprint, cosmetics, texture_switches) 6 | end 7 | 8 | Hooks:RegisterHook("PlayerInventoryOnPlaceSelection") 9 | function PlayerInventory._place_selection(self, selection_index, is_equip) 10 | self.orig._place_selection(self, selection_index, is_equip) 11 | Hooks:Call("PlayerInventoryOnPlaceSelection", self, selection_index, is_equip) 12 | end 13 | 14 | Hooks:RegisterHook("PlayerInventoryOnUpdate") 15 | function PlayerInventory.update(self, unit, t, dt) 16 | Hooks:Call("PlayerInventoryOnUpdate", self, unit, t, dt) 17 | end 18 | -------------------------------------------------------------------------------- /GoonMod/lua/PlayerInventoryGUI.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( PlayerInventoryGui ) 3 | 4 | --[[ 5 | Temporary until PlayerInventoryGui decides to decrypt fully instead of stopping half way through the initialization function 6 | ]] 7 | 8 | Hooks:RegisterHook("PlayerInventoryGUIOnPreviewPrimary") 9 | function PlayerInventoryGui.preview_primary(self, ...) 10 | local args = ... 11 | local r = Hooks:ReturnCall("PlayerInventoryGUIOnPreviewPrimary", self, args) 12 | if r ~= nil then 13 | return r 14 | end 15 | self.orig.preview_primary(self, ...) 16 | end 17 | 18 | Hooks:RegisterHook("PlayerInventoryGUIOnPreviewSecondary") 19 | function PlayerInventoryGui.preview_secondary(self, ...) 20 | local args = ... 21 | local r = Hooks:ReturnCall("PlayerInventoryGUIOnPreviewSecondary", self, args) 22 | if r ~= nil then 23 | return r 24 | end 25 | self.orig.preview_secondary(self, ...) 26 | end 27 | 28 | Hooks:RegisterHook("PlayerInventoryGUIOnPreviewMelee") 29 | function PlayerInventoryGui.preview_melee(self, ...) 30 | local args = ... 31 | local r = Hooks:ReturnCall("PlayerInventoryGUIOnPreviewMelee", self, args) 32 | if r ~= nil then 33 | return r 34 | end 35 | self.orig.preview_melee(self, ...) 36 | end 37 | 38 | Hooks:RegisterHook("PlayerInventoryGUIOnOpenWeaponModMenu") 39 | function PlayerInventoryGui.open_weapon_mod_menu(self, box) 40 | BlackMarketGui._choose_weapon_mods_callback(self, box.params.mod_data) 41 | end 42 | -------------------------------------------------------------------------------- /GoonMod/lua/PlayerManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( PlayerManager ) 3 | 4 | function PlayerManager.verify_carry(self, peer_id, carry_id) 5 | if self._force_verify_carry and self._force_verify_carry > 0 then 6 | self._force_verify_carry = self._force_verify_carry - 1 7 | return true 8 | end 9 | return self.orig.verify_carry(self, peer_id, carry_id) 10 | end 11 | 12 | function PlayerManager:force_verify_carry() 13 | if not self._force_verify_carry then 14 | self._force_verify_carry = 0 15 | end 16 | self._force_verify_carry = self._force_verify_carry + 1 17 | end 18 | 19 | function PlayerManager.get_my_carry_data(self) 20 | if managers.network:session() then 21 | local peer_id = managers.network:session():local_peer():id() 22 | return self._global.synced_carry[peer_id] 23 | end 24 | return nil 25 | end 26 | -------------------------------------------------------------------------------- /GoonMod/lua/PlayerProfileGUIObject.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( PlayerProfileGuiObject ) 3 | 4 | Hooks:RegisterHook("PlayerProfileGuiObjectPostInit") 5 | function PlayerProfileGuiObject.init(self, ws) 6 | self.orig.init(self, ws) 7 | Hooks:Call( "PlayerProfileGuiObjectPostInit", self, ws ) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/PlayerStandard.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( PlayerStandard ) 3 | 4 | Hooks:RegisterHook("PlayerStandardCheckActionInteract") 5 | function PlayerStandard._check_action_interact(self, t, input) 6 | local r = Hooks:ReturnCall("PlayerStandardCheckActionInteract", self, t, input) 7 | if r ~= nil then 8 | return r 9 | end 10 | return self.orig._check_action_interact(self, t, input) 11 | end 12 | 13 | Hooks:RegisterHook("PlayerStandardStartMaskUp") 14 | function PlayerStandard._enter(self, enter_data) 15 | self.orig._enter(self, enter_data) 16 | Hooks:Call("PlayerStandardStartMaskUp", self, enter_data) 17 | end 18 | 19 | Hooks:RegisterHook("PlayerStandardStartActionEquipWeapon") 20 | function PlayerStandard._start_action_equip_weapon(self, t) 21 | self.orig._start_action_equip_weapon(self, t) 22 | Hooks:Call("PlayerStandardStartActionEquipWeapon", self, t) 23 | end 24 | 25 | Hooks:RegisterHook("PlayerStandardChangingWeapon") 26 | function PlayerStandard._changing_weapon(self) 27 | Hooks:Call("PlayerStandardChangingWeapon", self) 28 | return self.orig._changing_weapon(self) 29 | end 30 | 31 | Hooks:RegisterHook("PlayerStandardCheckActionThrowGrenade") 32 | function PlayerStandard._check_action_throw_grenade(self, t, input) 33 | local r = Hooks:ReturnCall("PlayerStandardCheckActionThrowGrenade", self, t, input) 34 | if r ~= nil then 35 | return r 36 | end 37 | return self.orig._check_action_throw_grenade(self, t, input) 38 | end 39 | 40 | Hooks:RegisterHook("PlayerStandardOnUpdate") 41 | function PlayerStandard.update(self, t, dt) 42 | self.orig.update(self, t, dt) 43 | Hooks:Call("PlayerStandardOnUpdate", self, t, dt) 44 | end 45 | -------------------------------------------------------------------------------- /GoonMod/lua/PreplanningTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( PrePlanningTweakData ) 3 | 4 | function PrePlanningTweakData._create_locations(this, tweak_data) 5 | 6 | this.orig._create_locations(this, tweak_data) 7 | 8 | this.locations.branchbank = { 9 | default_plans = { 10 | escape_plan = "escape_helicopter_loud", 11 | vault_plan = "vault_big_drill" 12 | }, 13 | total_budget = 10, 14 | start_location = { 15 | group = "a", 16 | x = 1500, 17 | y = 1025, 18 | zoom = 1.5 19 | }, 20 | { 21 | name_id = "menu_pp_big_loc_a", 22 | texture = "guis/textures/pd2/mission_briefing/assets/bank/assets_bank_blueprint", 23 | map_x = -1.1, 24 | map_y = 0.5, 25 | map_size = 1, 26 | x1 = -250, 27 | y1 = -3000, 28 | x2 = 5750, 29 | y2 = 3000, 30 | rotation = 0, 31 | custom_points = {} 32 | } 33 | } 34 | 35 | end 36 | -------------------------------------------------------------------------------- /GoonMod/lua/QuickSmokeGrenade.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( QuickSmokeGrenade ) 3 | 4 | Hooks:RegisterHook( "QuickSmokeGrenadeActivate" ) 5 | function QuickSmokeGrenade.activate(this, pos, duration) 6 | this.orig.activate(this, pos, duration) 7 | Hooks:Call("QuickSmokeGrenadeActivate", this, pos, duration) 8 | end 9 | 10 | Hooks:RegisterHook( "QuickSmokeGrenadeDetonate" ) 11 | function QuickSmokeGrenade.detonate(this) 12 | this.orig.detonate(this) 13 | Hooks:Call("QuickSmokeGrenadeDetonate", this) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/SaveFileManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( SavefileManager ) 3 | 4 | Hooks:RegisterHook("SaveFileManagerOnSave") 5 | function SavefileManager._save(self, slot, cache_only, save_system) 6 | Hooks:Call("SaveFileManagerOnSave", self, slot, cache_only, save_system) 7 | return self.orig._save(self, slot, cache_only, save_system) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/SentryGunWeapon.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( SentryGunWeapon ) 3 | 4 | Hooks:RegisterHook("SentryGunWeaponOnPostSetup") 5 | function SentryGunWeapon.setup( self, setup_data, damage_multiplier ) 6 | self.orig.setup( self, setup_data, damage_multiplier ) 7 | Hooks:Call( "SentryGunWeaponOnPostSetup", self, setup_data, damage_multiplier ) 8 | end 9 | 10 | Hooks:RegisterHook("SentryGunWeaponOnApplyDamageMultiplier") 11 | function SentryGunWeapon._apply_dmg_mul( self, damage, col_ray, from_pos ) 12 | local val = Hooks:ReturnCall("SentryGunWeaponOnApplyDamageMultiplier", self, damage, col_ray, from_pos) 13 | return val or self.orig._apply_dmg_mul( self, damage, col_ray, from_pos ) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/Setup.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( Setup ) 3 | 4 | Hooks:RegisterHook("SetupOnQuit") 5 | function Setup.quit(self) 6 | Hooks:Call("SetupOnQuit", self) 7 | return self.orig.quit(self) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/SkillTreeGUINew.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( NewSkillTreeSkillItem ) 3 | 4 | Hooks:RegisterHook("NewSkillTreeSkillItemPostInit") 5 | function NewSkillTreeSkillItem.init(self, skill_id, skill_data, skill_panel, tree_panel, tree, tier, fullscreen_panel, gui) 6 | self.orig.init(self, skill_id, skill_data, skill_panel, tree_panel, tree, tier, fullscreen_panel, gui) 7 | Hooks:Call("NewSkillTreeSkillItemPostInit", self, skill_id, skill_data, skill_panel, tree_panel, tree, tier, fullscreen_panel, gui) 8 | end 9 | 10 | Hooks:RegisterHook("NewSkillTreeSkillItemPostRefresh") 11 | function NewSkillTreeSkillItem.refresh(self) 12 | self.orig.refresh(self) 13 | Hooks:Call("NewSkillTreeSkillItemPostRefresh", self) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/SkillTreeManager.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( SkillTreeManager ) 3 | 4 | Hooks:RegisterHook("SkillTreeManagerPreInfamyReset") 5 | function SkillTreeManager.infamy_reset(self) 6 | Hooks:Call("SkillTreeManagerPreInfamyReset", self) 7 | self.orig.infamy_reset(self) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/SkillTreeTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( SkillTreeTweakData ) 3 | 4 | Hooks:RegisterHook("SkillTreeTweakDataPostInit") 5 | function SkillTreeTweakData.init( self ) 6 | self.orig.init( self ) 7 | Hooks:Call("SkillTreeTweakDataPostInit", self) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/SpoocLogicAttack.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | function SpoocLogicAttack.action_complete_clbk(data, action) 4 | local action_type = action:type() 5 | local my_data = data.internal_data 6 | if action_type == "walk" then 7 | my_data.advancing = nil 8 | if my_data.surprised then 9 | my_data.surprised = false 10 | elseif my_data.moving_to_cover then 11 | if action:expired() then 12 | my_data.in_cover = my_data.moving_to_cover 13 | CopLogicAttack._set_nearest_cover(my_data, my_data.in_cover) 14 | my_data.cover_enter_t = data.t 15 | my_data.cover_sideways_chk = nil 16 | end 17 | my_data.moving_to_cover = nil 18 | elseif my_data.walking_to_cover_shoot_pos then 19 | my_data.walking_to_cover_shoot_pos = nil 20 | end 21 | elseif action_type == "shoot" then 22 | my_data.shooting = nil 23 | elseif action_type == "turn" then 24 | my_data.turning = nil 25 | elseif action_type == "spooc" then 26 | Print("SPOOKED BY A SPOOKY SPOOK") 27 | data.spooc_attack_timeout_t = TimerManager:game():time() + math.lerp(data.char_tweak.spooc_attack_timeout[1], data.char_tweak.spooc_attack_timeout[2], math.random()) 28 | if action:complete() and data.char_tweak.spooc_attack_use_smoke_chance > 0 and math.random() <= data.char_tweak.spooc_attack_use_smoke_chance and not managers.groupai:state():is_smoke_grenade_active() then 29 | managers.groupai:state():detonate_smoke_grenade(data.m_pos + math.UP * 10, data.unit:movement():m_head_pos(), math.lerp(15, 30, math.random()), false) 30 | end 31 | my_data.spooc_attack = nil 32 | elseif action_type == "dodge" then 33 | local timeout = action:timeout() 34 | if timeout then 35 | data.dodge_timeout_t = TimerManager:game():time() + math.lerp(timeout[1], timeout[2], math.random()) 36 | end 37 | CopLogicAttack._cancel_cover_pathing(data, my_data) 38 | if action:expired() then 39 | SpoocLogicAttack._upd_aim(data, my_data) 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /GoonMod/lua/SystemMenuManager.lua: -------------------------------------------------------------------------------- 1 | 2 | local Hooks = Hooks 3 | local CloneClass = CloneClass 4 | core:module("SystemMenuManager") 5 | 6 | CloneClass( GenericSystemMenuManager ) 7 | 8 | Hooks:RegisterHook("GenericSystemMenuManagerPostInit") 9 | function GenericSystemMenuManager.init( self ) 10 | Hooks:Call("GenericSystemMenuManagerPostInit", self) 11 | self.orig.init( self ) 12 | end 13 | 14 | Hooks:RegisterHook("GenericSystemMenuManagerPreShowNewUnlock") 15 | function GenericSystemMenuManager.show_new_unlock( self, data ) 16 | local r = Hooks:ReturnCall("GenericSystemMenuManagerPreShowNewUnlock", self, data) 17 | if r ~= nil then 18 | return 19 | end 20 | self.orig.show_new_unlock( self, data ) 21 | end 22 | -------------------------------------------------------------------------------- /GoonMod/lua/TweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | TweakData.orig = {} 3 | TweakData.orig.init = TweakData.init 4 | 5 | Hooks:RegisterHook("TweakDataPostInit") 6 | function TweakData.init(this) 7 | this.orig.init(this) 8 | Hooks:Call("TweakDataPostInit") 9 | end 10 | -------------------------------------------------------------------------------- /GoonMod/lua/UpgradesTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( UpgradesTweakData ) 3 | 4 | Hooks:RegisterHook("UpgradesTweakDataOnSetupPaydayValues") 5 | function UpgradesTweakData._init_pd2_values( self, ... ) 6 | self.orig._init_pd2_values( self, ... ) 7 | Hooks:Call("UpgradesTweakDataOnSetupPaydayValues", self, ...) 8 | end 9 | 10 | Hooks:RegisterHook("UpgradesTweakDataOnSetupPlayerDefinitions") 11 | function UpgradesTweakData._player_definitions( self, ... ) 12 | self.orig._player_definitions( self, ... ) 13 | Hooks:Call("UpgradesTweakDataOnSetupPlayerDefinitions", self, ...) 14 | end 15 | -------------------------------------------------------------------------------- /GoonMod/lua/WalletGUIObject.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( WalletGuiObject ) 3 | 4 | Hooks:RegisterHook("WalletGuiObjectOnSetWallet") 5 | function WalletGuiObject.set_wallet(panel, layer) 6 | WalletGuiObject.orig.set_wallet(panel, layer) 7 | Hooks:Call( "WalletGuiObjectOnSetWallet", panel, layer ) 8 | end 9 | 10 | Hooks:RegisterHook("WalletGuiObjectOnRefresh") 11 | function WalletGuiObject.refresh() 12 | WalletGuiObject.orig.refresh() 13 | Hooks:Call( "WalletGuiObjectOnRefresh" ) 14 | end 15 | 16 | Hooks:RegisterHook("WalletGuiObjectSetObjectVisible") 17 | function WalletGuiObject.set_object_visible(object, visible) 18 | WalletGuiObject.orig.set_object_visible(object, visible) 19 | Hooks:Call( "WalletGuiObjectSetObjectVisible", object, visible ) 20 | end 21 | -------------------------------------------------------------------------------- /GoonMod/lua/WeaponFlashlight.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( WeaponFlashLight ) 3 | 4 | Hooks:RegisterHook("WeaponFlashLightInit") 5 | function WeaponFlashLight.init(self, unit) 6 | self.orig.init(self, unit) 7 | Hooks:Call( "WeaponFlashLightInit", self, unit ) 8 | end 9 | 10 | Hooks:RegisterHook("WeaponFlashLightCheckState") 11 | function WeaponFlashLight._check_state(self) 12 | self.orig._check_state(self) 13 | Hooks:Call( "WeaponFlashLightCheckState", self ) 14 | end 15 | 16 | -- TODO: This is a messy hack-fix. Fix this up proper sometime. 17 | function WeaponFlashLight:overkill_update(unit, t, dt) 18 | 19 | t = Application:time() 20 | self._light_speed = self._light_speed or 1 21 | self._light_speed = math.step(self._light_speed, 1, dt * (math.random(4) + 2)) 22 | -- self._light:set_rotation(self._light:rotation() * Rotation(dt * -50 * self._light_speed, 0)) 23 | self:update_flicker(t, dt) 24 | self:update_laughter(t, dt) 25 | if not self._kittens_timer then 26 | self._kittens_timer = t + 25 27 | end 28 | if t > self._kittens_timer then 29 | if math.rand(1) < 0.75 then 30 | self:run_net_event(self.HALLOWEEN_FLICKER) 31 | self._kittens_timer = t + math.random(10) + 5 32 | elseif math.rand(1) < 0.35 then 33 | self:run_net_event(self.HALLOWEEN_WARP) 34 | self._kittens_timer = t + math.random(12) + 3 35 | elseif math.rand(1) < 0.25 then 36 | self:run_net_event(self.HALLOWEEN_LAUGHTER) 37 | self._kittens_timer = t + math.random(5) + 8 38 | elseif math.rand(1) < 0.15 then 39 | self:run_net_event(self.HALLOWEEN_SPOOC) 40 | self._kittens_timer = t + math.random(2) + 3 41 | else 42 | self._kittens_timer = t + math.random(5) + 3 43 | end 44 | end 45 | 46 | end 47 | -------------------------------------------------------------------------------- /GoonMod/lua/WeaponLaser.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( WeaponLaser ) 3 | 4 | Hooks:RegisterHook("WeaponLaserInit") 5 | function WeaponLaser.init(self, unit) 6 | self.orig.init(self, unit) 7 | Hooks:Call("WeaponLaserInit", self, unit) 8 | end 9 | 10 | Hooks:RegisterHook("WeaponLaserUpdate") 11 | function WeaponLaser.update(self, unit, t, dt) 12 | self.orig.update(self, unit, t, dt) 13 | Hooks:Call("WeaponLaserUpdate", self, unit, t, dt) 14 | end 15 | 16 | Hooks:RegisterHook("WeaponLaserSetNPC") 17 | function WeaponLaser.set_npc(self) 18 | self.orig.set_npc(self) 19 | Hooks:Call("WeaponLaserSetNPC", self) 20 | end 21 | 22 | Hooks:RegisterHook("WeaponLaserPostSetColorByTheme") 23 | function WeaponLaser.set_color_by_theme(self, theme) 24 | self.orig.set_color_by_theme(self, theme) 25 | Hooks:Call("WeaponLaserPostSetColorByTheme", self, theme) 26 | end 27 | 28 | Hooks:RegisterHook("WeaponLaserSetOn") 29 | Hooks:RegisterHook("WeaponLaserSetOff") 30 | function WeaponLaser._check_state(self) 31 | self.orig._check_state(self) 32 | if self._on then 33 | Hooks:Call("WeaponLaserSetOn", self) 34 | else 35 | Hooks:Call("WeaponLaserSetOff", self) 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /GoonMod/lua/WeaponSkinsTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( BlackMarketTweakData ) 3 | 4 | Hooks:RegisterHook("BlackMarketTweakDataPostInitWeaponSkins") 5 | function BlackMarketTweakData._init_weapon_skins(self) 6 | self.orig._init_weapon_skins(self) 7 | Hooks:Call("BlackMarketTweakDataPostInitWeaponSkins", self) 8 | end 9 | -------------------------------------------------------------------------------- /GoonMod/lua/WeaponTweakData.lua: -------------------------------------------------------------------------------- 1 | 2 | CloneClass( WeaponTweakData ) 3 | 4 | Hooks:RegisterHook("WeaponTweakDataPostInit") 5 | function WeaponTweakData.init(self, tweak_data) 6 | self.orig.init(self, tweak_data) 7 | Hooks:Call("WeaponTweakDataPostInit", self, tweak_data) 8 | end 9 | 10 | Hooks:RegisterHook("WeaponTweakDataPostInitPlayerWeaponData") 11 | function WeaponTweakData._init_data_player_weapons(self, tweak_data) 12 | self.orig._init_data_player_weapons(self, tweak_data) 13 | Hooks:Call("WeaponTweakDataPostInitPlayerWeaponData", self, tweak_data) 14 | end 15 | 16 | Hooks:RegisterHook("WeaponTweakDataPostInitNewWeapons") 17 | function WeaponTweakData._init_new_weapons(self, autohit_rifle_default, autohit_pistol_default, autohit_shotgun_default, autohit_lmg_default, autohit_snp_default, autohit_smg_default, autohit_minigun_default, damage_melee_default, damage_melee_effect_multiplier_default, aim_assist_rifle_default, aim_assist_pistol_default, aim_assist_shotgun_default, aim_assist_lmg_default, aim_assist_snp_default, aim_assist_smg_default, aim_assist_minigun_default) 18 | self.orig._init_new_weapons(self, autohit_rifle_default, autohit_pistol_default, autohit_shotgun_default, autohit_lmg_default, autohit_snp_default, autohit_smg_default, autohit_minigun_default, damage_melee_default, damage_melee_effect_multiplier_default, aim_assist_rifle_default, aim_assist_pistol_default, aim_assist_shotgun_default, aim_assist_lmg_default, aim_assist_snp_default, aim_assist_smg_default, aim_assist_minigun_default) 19 | Hooks:Call("WeaponTweakDataPostInitNewWeapons", self, autohit_rifle_default, autohit_pistol_default, autohit_shotgun_default, autohit_lmg_default, autohit_snp_default, autohit_smg_default, autohit_minigun_default, damage_melee_default, damage_melee_effect_multiplier_default, aim_assist_rifle_default, aim_assist_pistol_default, aim_assist_shotgun_default, aim_assist_lmg_default, aim_assist_snp_default, aim_assist_smg_default, aim_assist_minigun_default) 20 | end 21 | -------------------------------------------------------------------------------- /GoonMod/menus/corpse_mod_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_corpse_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_corpse_menu_title", 5 | "description" : "gm_options_corpse_menu_desc", 6 | "back_callback" : "ClosedGoonModOptions", 7 | "items" : [ 8 | 9 | { 10 | "type" : "toggle", 11 | "id" : "gm_cm_toggle_corpse_limit", 12 | "title" : "gm_options_corpse_custom_title", 13 | "description" : "gm_options_corpse_custom_desc", 14 | "callback" : "ToggleCorpseLimit", 15 | "value" : "UseCustomCorpseLimit", 16 | "default_value" : true 17 | }, 18 | { 19 | "type" : "slider", 20 | "id" : "gm_cm_slider_corpse_limit", 21 | "title" : "gm_options_corpse_amount_title", 22 | "description" : "gm_options_corpse_amount_desc", 23 | "callback" : "SetMaximumCorpseAmount", 24 | "value" : "MaxCorpses", 25 | "default_value" : 256, 26 | "min" : 8, 27 | "max" : 1024, 28 | "step" : 8 29 | }, 30 | { 31 | "type" : "divider", 32 | "size" : 16 33 | }, 34 | 35 | { 36 | "type" : "toggle", 37 | "id" : "gm_cm_toggle_shield_despawn", 38 | "title" : "gm_options_corpse_shields_title", 39 | "description" : "gm_options_corpse_shields_desc", 40 | "callback" : "ToggleDespawnShields", 41 | "value" : "RemoveShields", 42 | "default_value" : false 43 | }, 44 | { 45 | "type" : "slider", 46 | "id" : "gm_cm_slider_shield_despawn_time", 47 | "title" : "gm_options_corpse_shields_timer_title", 48 | "description" : "gm_options_corpse_shields_timer_desc", 49 | "callback" : "SetShieldDespawnTime", 50 | "value" : "RemoveShieldsTime", 51 | "default_value" : 180, 52 | "min" : 10, 53 | "max" : 600, 54 | "step" : 10 55 | }, 56 | { 57 | "type" : "divider", 58 | "size" : 16 59 | }, 60 | 61 | { 62 | "type" : "keybind", 63 | "id" : "gm_cm_keybind_remove_all", 64 | "title" : "gm_options_corpse_keybind_remove_all_title", 65 | "description" : "gm_options_corpse_keybind_remove_all_desc", 66 | "keybind_id" : "BodyCountModRemoveAll", 67 | "func" : "DoRemoveAllCorpses" 68 | }, 69 | { 70 | "type" : "keybind", 71 | "id" : "gm_cm_keybind_remove_shields", 72 | "title" : "gm_options_corpse_keybind_remove_shields_title", 73 | "description" : "gm_options_corpse_keybind_remove_shields_desc", 74 | "keybind_id" : "BodyCountModRemoveShields", 75 | "func" : "DoRemoveAllShields" 76 | } 77 | 78 | ] 79 | } 80 | -------------------------------------------------------------------------------- /GoonMod/menus/custom_enemy_laser_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_elc_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_elc_menu_title", 5 | "description" : "gm_options_elc_menu_desc", 6 | "focus_changed_callback" : "CustomEnemyLaserMenuChangeFocus", 7 | "back_callback" : "ClosedGoonModOptions", 8 | "area_bg" : "half", 9 | "items" : [ 10 | 11 | { 12 | "type" : "toggle", 13 | "id" : "gm_elc_toggle_custom_flashlight", 14 | "title" : "gm_options_elc_enabled_title", 15 | "description" : "gm_options_elc_enabled_desc", 16 | "callback" : "ToggleEnableCustomEnemyLaser", 17 | "value" : "Enabled", 18 | "default_value" : true 19 | }, 20 | { 21 | "type" : "divider", 22 | "size" : 8 23 | }, 24 | 25 | { 26 | "type" : "toggle", 27 | "id" : "gm_elc_toggle_custom_flashlight_use_hue", 28 | "title" : "gm_options_custom_use_hue_title", 29 | "description" : "gm_options_custom_use_hue_desc", 30 | "callback" : "CustomEnemyLaserToggleUseHue", 31 | "value" : "UseHSV", 32 | "default_value" : false 33 | }, 34 | { 35 | "type" : "slider", 36 | "id" : "gm_elc_colour_slider_rh", 37 | "title" : "gm_options_custom_rh_title", 38 | "description" : "gm_options_custom_rh_desc", 39 | "callback" : "CustomEnemyLaserSetRedHue", 40 | "value" : "RH", 41 | "default_value" : 0.8, 42 | "min" : 0, 43 | "max" : 1, 44 | "step" : 0.01 45 | }, 46 | { 47 | "type" : "slider", 48 | "id" : "gm_elc_colour_slider_gs", 49 | "title" : "gm_options_custom_gs_title", 50 | "description" : "gm_options_custom_gs_desc", 51 | "callback" : "CustomEnemyLaserSetGreenSaturation", 52 | "value" : "GS", 53 | "default_value" : 0, 54 | "min" : 0, 55 | "max" : 1, 56 | "step" : 0.01 57 | }, 58 | { 59 | "type" : "slider", 60 | "id" : "gm_elc_colour_slider_bv", 61 | "title" : "gm_options_custom_bv_title", 62 | "description" : "gm_options_custom_bv_desc", 63 | "callback" : "CustomEnemyLaserSetBlueValue", 64 | "value" : "BV", 65 | "default_value" : 0, 66 | "min" : 0, 67 | "max" : 1, 68 | "step" : 0.01 69 | }, 70 | { 71 | "type" : "divider", 72 | "size" : 64 73 | }, 74 | 75 | { 76 | "type" : "toggle", 77 | "id" : "gm_elc_toggle_rainbow", 78 | "title" : "gm_options_custom_rainbow_title", 79 | "description" : "gm_options_custom_rainbow_desc", 80 | "callback" : "CustomEnemyLaserSetUseRainbow", 81 | "value" : "UseRainbow", 82 | "default_value" : false 83 | }, 84 | { 85 | "type" : "slider", 86 | "id" : "gm_elc_slider_rainbow_speed", 87 | "title" : "gm_options_custom_rainbow_speed_title", 88 | "description" : "gm_options_custom_rainbow_speed_desc", 89 | "callback" : "CustomEnemyLaserSetRainbowSpeed", 90 | "value" : "RainbowSpeed", 91 | "default_value" : 1, 92 | "min" : 1, 93 | "max" : 100, 94 | "step" : 1 95 | } 96 | 97 | ] 98 | 99 | } 100 | -------------------------------------------------------------------------------- /GoonMod/menus/custom_flashlight_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_cfc_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_cfc_menu_title", 5 | "description" : "gm_options_cfc_menu_desc", 6 | "focus_changed_callback" : "CustomFlashlightMenuChangeFocus", 7 | "back_callback" : "ClosedGoonModOptions", 8 | "area_bg" : "half", 9 | "items" : [ 10 | 11 | { 12 | "type" : "toggle", 13 | "id" : "gm_cfc_toggle_custom_flashlight", 14 | "title" : "gm_options_cfc_enabled_title", 15 | "description" : "gm_options_cfc_enabled_desc", 16 | "callback" : "ToggleEnableCustomFlashlight", 17 | "value" : "Enabled", 18 | "default_value" : true 19 | }, 20 | { 21 | "type" : "divider", 22 | "size" : 8 23 | }, 24 | 25 | { 26 | "type" : "toggle", 27 | "id" : "gm_cfc_toggle_custom_flashlight_use_hue", 28 | "title" : "gm_options_custom_use_hue_title", 29 | "description" : "gm_options_custom_use_hue_desc", 30 | "callback" : "CustomFlashlightToggleUseHue", 31 | "value" : "UseHSV", 32 | "default_value" : false 33 | }, 34 | { 35 | "type" : "slider", 36 | "id" : "gm_cfc_colour_slider_rh", 37 | "title" : "gm_options_custom_rh_title", 38 | "description" : "gm_options_custom_rh_desc", 39 | "callback" : "CustomFlashlightSetRedHue", 40 | "value" : "RH", 41 | "default_value" : 1, 42 | "min" : 0, 43 | "max" : 1, 44 | "step" : 0.01 45 | }, 46 | { 47 | "type" : "slider", 48 | "id" : "gm_cfc_colour_slider_gs", 49 | "title" : "gm_options_custom_gs_title", 50 | "description" : "gm_options_custom_gs_desc", 51 | "callback" : "CustomFlashlightSetGreenSaturation", 52 | "value" : "GS", 53 | "default_value" : 1, 54 | "min" : 0, 55 | "max" : 1, 56 | "step" : 0.01 57 | }, 58 | { 59 | "type" : "slider", 60 | "id" : "gm_cfc_colour_slider_bv", 61 | "title" : "gm_options_custom_bv_title", 62 | "description" : "gm_options_custom_bv_desc", 63 | "callback" : "CustomFlashlightSetBlueValue", 64 | "value" : "BV", 65 | "default_value" : 1, 66 | "min" : 0, 67 | "max" : 1, 68 | "step" : 0.01 69 | }, 70 | { 71 | "type" : "divider", 72 | "size" : 64 73 | }, 74 | 75 | { 76 | "type" : "toggle", 77 | "id" : "gm_cfc_toggle_rainbow", 78 | "title" : "gm_options_custom_rainbow_title", 79 | "description" : "gm_options_custom_rainbow_desc", 80 | "callback" : "CustomFlashlightSetUseRainbow", 81 | "value" : "UseRainbow", 82 | "default_value" : false 83 | }, 84 | { 85 | "type" : "slider", 86 | "id" : "gm_cfc_slider_rainbow_speed", 87 | "title" : "gm_options_custom_rainbow_speed_title", 88 | "description" : "gm_options_custom_rainbow_speed_desc", 89 | "callback" : "CustomFlashlightSetRainbowSpeed", 90 | "value" : "RainbowSpeed", 91 | "default_value" : 1, 92 | "min" : 1, 93 | "max" : 100, 94 | "step" : 1 95 | } 96 | 97 | ] 98 | 99 | } 100 | -------------------------------------------------------------------------------- /GoonMod/menus/custom_waypoints_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_custom_waypoints_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_custom_waypoints_menu_title", 5 | "description" : "gm_options_custom_waypoints_menu_desc", 6 | "back_callback" : "ClosedGoonModOptions", 7 | "items" : [ 8 | 9 | { 10 | "type" : "keybind", 11 | "id" : "gm_cw_keybind_place_waypoint", 12 | "title" : "gm_options_custom_waypoints_place", 13 | "description" : "gm_options_custom_waypoints_place", 14 | "keybind_id" : "CustomWaypointsPlaceWaypoint", 15 | "func" : "DoPlaceWaypoint" 16 | }, 17 | { 18 | "type" : "keybind", 19 | "id" : "gm_cw_keybind_remove_waypoint", 20 | "title" : "gm_options_custom_waypoints_remove", 21 | "description" : "gm_options_custom_waypoints_remove", 22 | "keybind_id" : "CustomWaypointsRemoveWaypoint", 23 | "func" : "DoRemoveWaypoint" 24 | }, 25 | { 26 | "type" : "divider", 27 | "size" : 16 28 | }, 29 | 30 | { 31 | "type" : "toggle", 32 | "id" : "gm_cm_toggle_shield_despawn", 33 | "title" : "gm_options_custom_waypoints_distance_title", 34 | "description" : "gm_options_custom_waypoints_distance_desc", 35 | "callback" : "ToggleWaypointShowDistance", 36 | "value" : "ShowDistance", 37 | "default_value" : false 38 | } 39 | 40 | ] 41 | 42 | } 43 | -------------------------------------------------------------------------------- /GoonMod/menus/custom_weapon_laser_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_cpwl_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_cpwl_menu_title", 5 | "description" : "gm_options_cpwl_menu_desc", 6 | "focus_changed_callback" : "CustomWeaponLaserMenuChangeFocus", 7 | "back_callback" : "ClosedGoonModOptions", 8 | "area_bg" : "half", 9 | "items" : [ 10 | 11 | { 12 | "type" : "toggle", 13 | "id" : "gm_cpwl_toggle_custom_laser", 14 | "title" : "gm_options_cpwl_enabled_title", 15 | "description" : "gm_options_cpwl_enabled_desc", 16 | "callback" : "ToggleEnableCustomWeaponLaser", 17 | "value" : "Enabled", 18 | "default_value" : true 19 | }, 20 | { 21 | "type" : "divider", 22 | "size" : 8 23 | }, 24 | 25 | { 26 | "type" : "toggle", 27 | "id" : "gm_cpwl_toggle_custom_use_hue", 28 | "title" : "gm_options_custom_use_hue_title", 29 | "description" : "gm_options_custom_use_hue_desc", 30 | "callback" : "CustomWeaponLaserToggleUseHue", 31 | "value" : "UseHSV", 32 | "default_value" : false 33 | }, 34 | { 35 | "type" : "slider", 36 | "id" : "gm_cpwl_colour_slider_rh", 37 | "title" : "gm_options_custom_rh_title", 38 | "description" : "gm_options_custom_rh_desc", 39 | "callback" : "CustomWeaponLaserSetRedHue", 40 | "value" : "RH", 41 | "default_value" : 1, 42 | "min" : 0, 43 | "max" : 1, 44 | "step" : 0.01 45 | }, 46 | { 47 | "type" : "slider", 48 | "id" : "gm_cpwl_colour_slider_gs", 49 | "title" : "gm_options_custom_gs_title", 50 | "description" : "gm_options_custom_gs_desc", 51 | "callback" : "CustomWeaponLaserSetGreenSaturation", 52 | "value" : "GS", 53 | "default_value" : 1, 54 | "min" : 0, 55 | "max" : 1, 56 | "step" : 0.01 57 | }, 58 | { 59 | "type" : "slider", 60 | "id" : "gm_cpwl_colour_slider_bv", 61 | "title" : "gm_options_custom_bv_title", 62 | "description" : "gm_options_custom_bv_desc", 63 | "callback" : "CustomWeaponLaserSetBlueValue", 64 | "value" : "BV", 65 | "default_value" : 1, 66 | "min" : 0, 67 | "max" : 1, 68 | "step" : 0.01 69 | }, 70 | { 71 | "type" : "divider", 72 | "size" : 64 73 | }, 74 | 75 | { 76 | "type" : "toggle", 77 | "id" : "gm_cpwl_toggle_rainbow", 78 | "title" : "gm_options_custom_rainbow_title", 79 | "description" : "gm_options_custom_rainbow_desc", 80 | "callback" : "CustomWeaponLaserSetUseRainbow", 81 | "value" : "UseRainbow", 82 | "default_value" : false 83 | }, 84 | { 85 | "type" : "slider", 86 | "id" : "gm_cpwl_slider_rainbow_speed", 87 | "title" : "gm_options_custom_rainbow_speed_title", 88 | "description" : "gm_options_custom_rainbow_speed_desc", 89 | "callback" : "CustomWeaponLaserSetRainbowSpeed", 90 | "value" : "RainbowSpeed", 91 | "default_value" : 1, 92 | "min" : 1, 93 | "max" : 100, 94 | "step" : 1 95 | }, 96 | { 97 | "type" : "divider", 98 | "size" : 8 99 | }, 100 | 101 | { 102 | "type" : "multiple_choice", 103 | "id" : "json_menu_mutli", 104 | "title" : "gm_options_cpwl_teammate_lasers_title", 105 | "description" : "gm_options_cpwl_teammate_lasers_desc", 106 | "callback" : "CustomWeaponLaserSetTeammateLaser", 107 | "items" : [ 108 | "gm_options_cpwl_teammate_lasers_off", 109 | "gm_options_cpwl_teammate_lasers_same", 110 | "gm_options_cpwl_teammate_lasers_network", 111 | "gm_options_cpwl_teammate_lasers_unique" 112 | ], 113 | "value" : "TeamLasers", 114 | "default_value" : 3 115 | } 116 | 117 | ] 118 | 119 | } 120 | -------------------------------------------------------------------------------- /GoonMod/menus/custom_world_laser_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_cwl_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_cwl_menu_title", 5 | "description" : "gm_options_cwl_menu_desc", 6 | "focus_changed_callback" : "CustomWorldLaserMenuChangeFocus", 7 | "back_callback" : "ClosedGoonModOptions", 8 | "area_bg" : "half", 9 | "items" : [ 10 | 11 | { 12 | "type" : "toggle", 13 | "id" : "gm_cwl_toggle_custom_laser", 14 | "title" : "gm_options_cwl_enabled_title", 15 | "description" : "gm_options_cwl_enabled_desc", 16 | "callback" : "ToggleEnableCustomWorldLaser", 17 | "value" : "Enabled", 18 | "default_value" : true 19 | }, 20 | { 21 | "type" : "divider", 22 | "size" : 8 23 | }, 24 | 25 | { 26 | "type" : "toggle", 27 | "id" : "gm_cwl_toggle_custom_use_hue", 28 | "title" : "gm_options_custom_use_hue_title", 29 | "description" : "gm_options_custom_use_hue_desc", 30 | "callback" : "CustomWorldLaserToggleUseHue", 31 | "value" : "UseHSV", 32 | "default_value" : false 33 | }, 34 | { 35 | "type" : "slider", 36 | "id" : "gm_cwl_colour_slider_rh", 37 | "title" : "gm_options_custom_rh_title", 38 | "description" : "gm_options_custom_rh_desc", 39 | "callback" : "CustomWorldLaserSetRedHue", 40 | "value" : "RH", 41 | "default_value" : 1, 42 | "min" : 0, 43 | "max" : 1, 44 | "step" : 0.01 45 | }, 46 | { 47 | "type" : "slider", 48 | "id" : "gm_cwl_colour_slider_gs", 49 | "title" : "gm_options_custom_gs_title", 50 | "description" : "gm_options_custom_gs_desc", 51 | "callback" : "CustomWorldLaserSetGreenSaturation", 52 | "value" : "GS", 53 | "default_value" : 1, 54 | "min" : 0, 55 | "max" : 1, 56 | "step" : 0.01 57 | }, 58 | { 59 | "type" : "slider", 60 | "id" : "gm_cwl_colour_slider_bv", 61 | "title" : "gm_options_custom_bv_title", 62 | "description" : "gm_options_custom_bv_desc", 63 | "callback" : "CustomWorldLaserSetBlueValue", 64 | "value" : "BV", 65 | "default_value" : 1, 66 | "min" : 0, 67 | "max" : 1, 68 | "step" : 0.01 69 | }, 70 | { 71 | "type" : "divider", 72 | "size" : 64 73 | }, 74 | 75 | { 76 | "type" : "toggle", 77 | "id" : "gm_cwl_toggle_rainbow", 78 | "title" : "gm_options_custom_rainbow_title", 79 | "description" : "gm_options_custom_rainbow_desc", 80 | "callback" : "CustomWorldLaserSetUseRainbow", 81 | "value" : "UseRainbow", 82 | "default_value" : false 83 | }, 84 | { 85 | "type" : "slider", 86 | "id" : "gm_cwl_slider_rainbow_speed", 87 | "title" : "gm_options_custom_rainbow_speed_title", 88 | "description" : "gm_options_custom_rainbow_speed_desc", 89 | "callback" : "CustomWorldLaserSetRainbowSpeed", 90 | "value" : "RainbowSpeed", 91 | "default_value" : 1, 92 | "min" : 1, 93 | "max" : 100, 94 | "step" : 1 95 | } 96 | 97 | ] 98 | 99 | } 100 | -------------------------------------------------------------------------------- /GoonMod/menus/example_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "json_example_menu", 3 | "parent_menu_id" : "lua_mod_options_menu", 4 | "title" : "my_custom_menu", 5 | "description" : "my_custom_menu_desc", 6 | "items" : [ 7 | 8 | { 9 | "type" : "toggle", 10 | "id" : "json_menu_toggle", 11 | "title" : "json_item_toggle", 12 | "description" : "json_item_toggle_desc", 13 | "callback" : "callback_test_toggle", 14 | "value" : "toggle_value", 15 | "default_value" : false, 16 | }, 17 | { 18 | "type" : "slider", 19 | "id" : "json_menu_slider", 20 | "title" : "json_item_slider", 21 | "description" : "json_item_slider_desc", 22 | "callback" : "callback_test_slider", 23 | "value" : "slider_value", 24 | "default_value" : 50, 25 | "max" : 100, 26 | "min" : 0, 27 | "step" : 1, 28 | }, 29 | { 30 | "type" : "divider", 31 | "size" : 128, 32 | }, 33 | { 34 | "type" : "button", 35 | "id" : "json_menu_button", 36 | "title" : "json_item_button", 37 | "description" : "json_item_button_desc", 38 | "callback" : "callback_test_button", 39 | "back_callback" : "callback_test_button_back", 40 | }, 41 | { 42 | "type" : "keybind", 43 | "id" : "json_menu_keybind", 44 | "title" : "json_item_keybind", 45 | "description" : "json_item_keybind_desc", 46 | "keybind_id" : "json_menu_example_keybind", 47 | "func" : "func_test_keybind", 48 | }, 49 | { 50 | "type" : "multiple_choice", 51 | "id" : "json_menu_mutli", 52 | "title" : "json_item_multi", 53 | "description" : "json_item_multi_desc", 54 | "callback" : "callback_test_multi", 55 | "items" : [ 56 | "json_multi_item_a", 57 | "json_multi_item_b", 58 | "json_multi_item_c", 59 | "json_multi_item_d", 60 | "json_multi_item_e" 61 | ], 62 | "value" : "multi_value", 63 | "default_value" : 3, 64 | } 65 | 66 | ] 67 | 68 | } -------------------------------------------------------------------------------- /GoonMod/menus/infamy_outliner_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_io_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_infamy_outliner_menu_title", 5 | "description" : "gm_options_infamy_outliner_menu_desc", 6 | "focus_changed_callback" : "InfamyOutlinerChangedFocus", 7 | "back_callback" : "ClosedGoonModOptions", 8 | "items" : [ 9 | 10 | { 11 | "type" : "toggle", 12 | "id" : "gm_io_toggle_infamy_outliner", 13 | "title" : "gm_options_infamy_outliner_enabled_title", 14 | "description" : "gm_options_infamy_outliner_enabled_desc", 15 | "callback" : "InfamyOutlinerToggleEnabled", 16 | "value" : "Enabled", 17 | "default_value" : true 18 | }, 19 | { 20 | "type" : "divider", 21 | "size" : 8 22 | }, 23 | 24 | { 25 | "type" : "toggle", 26 | "id" : "gm_io_toggle_custom_use_hue", 27 | "title" : "gm_options_custom_use_hue_title", 28 | "description" : "gm_options_custom_use_hue_desc", 29 | "callback" : "InfamyOutlinerSetUseHSV", 30 | "value" : "UseHSV", 31 | "default_value" : true 32 | }, 33 | { 34 | "type" : "slider", 35 | "id" : "gm_cwl_colour_slider_rh", 36 | "title" : "gm_options_custom_rh_title", 37 | "description" : "gm_options_custom_rh_desc", 38 | "callback" : "InfamyOutlinerSetRedHue", 39 | "value" : "RH", 40 | "default_value" : 0.6, 41 | "min" : 0, 42 | "max" : 1, 43 | "step" : 0.01 44 | }, 45 | { 46 | "type" : "slider", 47 | "id" : "gm_io_colour_slider_gs", 48 | "title" : "gm_options_custom_gs_title", 49 | "description" : "gm_options_custom_gs_desc", 50 | "callback" : "InfamyOutlinerSetGreenSaturation", 51 | "value" : "GS", 52 | "default_value" : 1, 53 | "min" : 0, 54 | "max" : 1, 55 | "step" : 0.01 56 | }, 57 | { 58 | "type" : "slider", 59 | "id" : "gm_io_colour_slider_bv", 60 | "title" : "gm_options_custom_bv_title", 61 | "description" : "gm_options_custom_bv_desc", 62 | "callback" : "InfamyOutlinerSetBlueValue", 63 | "value" : "BV", 64 | "default_value" : 0.2, 65 | "min" : 0, 66 | "max" : 1, 67 | "step" : 0.01 68 | }, 69 | { 70 | "type" : "divider", 71 | "size" : 64 72 | }, 73 | 74 | { 75 | "type" : "button", 76 | "id" : "gm_io_toggle_rainbow", 77 | "title" : "gm_options_infamy_outliner_clear_data_title", 78 | "description" : "gm_options_infamy_outliner_clear_data_desc", 79 | "callback" : "InfamyOutlinerClearInfamyData" 80 | } 81 | 82 | ] 83 | 84 | } 85 | -------------------------------------------------------------------------------- /GoonMod/menus/push_to_interact_menu.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_push_to_interact_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_push_interact_menu_title", 5 | "description" : "gm_options_push_interact_menu_desc", 6 | "back_callback" : "ClosedGoonModOptions", 7 | "items" : [ 8 | 9 | { 10 | "type" : "toggle", 11 | "id" : "gm_pti_toggle_push_interact", 12 | "title" : "gm_options_push_interact_enabled_title", 13 | "description" : "gm_options_push_interact_enabled_desc", 14 | "callback" : "TogglePushToInteract", 15 | "value" : "Enabled", 16 | "default_value" : true 17 | }, 18 | { 19 | "type" : "slider", 20 | "id" : "gm_pti_slider_interaction_min_time", 21 | "title" : "gm_options_push_interact_min_time_title", 22 | "description" : "gm_options_push_interact_min_time_desc", 23 | "callback" : "SetPushToInteractMinimumTime", 24 | "value" : "InteractionMinTime", 25 | "default_value" : 2, 26 | "min" : 0, 27 | "max" : 10, 28 | "step" : 0.5 29 | }, 30 | { 31 | "type" : "toggle", 32 | "id" : "gm_pti_toggle_hold_all", 33 | "title" : "gm_options_push_interact_hold_all_title", 34 | "description" : "gm_options_push_interact_hold_all_desc", 35 | "callback" : "ToggleHoldAllInteractions", 36 | "value" : "HoldAllEnabled", 37 | "default_value" : false 38 | }, 39 | 40 | { 41 | "type" : "divider", 42 | "size" : 16 43 | }, 44 | 45 | { 46 | "type" : "toggle", 47 | "id" : "gm_pti_toggle_use_stop_key", 48 | "title" : "gm_options_push_interact_use_stop_key_title", 49 | "description" : "gm_options_push_interact_use_stop_key_desc", 50 | "callback" : "TogglePushInteractUseStopKey", 51 | "value" : "UseStopKey", 52 | "default_value" : false 53 | }, 54 | { 55 | "type" : "keybind", 56 | "id" : "gm_pti_keybind_cancel_interact", 57 | "title" : "gm_options_push_interact_stop_key_title", 58 | "description" : "gm_options_push_interact_stop_key_desc", 59 | "keybind_id" : "PushToInteractCancelCurrentInteraction", 60 | "func" : "CancelCurrentInteraction" 61 | } 62 | 63 | ] 64 | 65 | } 66 | -------------------------------------------------------------------------------- /GoonMod/menus/weapon_visual_customization.txt: -------------------------------------------------------------------------------- 1 | { 2 | "menu_id" : "gm_options_weapon_customization_menu", 3 | "parent_menu_id" : "goonbase_options_menu", 4 | "title" : "gm_options_wc_title", 5 | "description" : "gm_options_wc_desc", 6 | "back_callback" : "ClosedGoonModOptions", 7 | "items" : [ 8 | 9 | { 10 | "type" : "button", 11 | "id" : "gm_wc_clear_customization", 12 | "title" : "gm_options_wc_clear_all_data_title", 13 | "description" : "gm_options_wc_clear_all_data_desc", 14 | "callback" : "WeaponCustomizationClearDataAll" 15 | }, 16 | { 17 | "type" : "divider", 18 | "size" : 16 19 | }, 20 | 21 | { 22 | "type" : "button", 23 | "id" : "gm_wc_clear_customization_primary", 24 | "title" : "gm_options_wc_clear_primary_data_title", 25 | "description" : "gm_options_wc_clear_primary_data_desc", 26 | "callback" : "WeaponCustomizationClearDataPrimaries" 27 | }, 28 | { 29 | "type" : "button", 30 | "id" : "gm_wc_clear_customization_secondary", 31 | "title" : "gm_options_wc_clear_secondary_data_title", 32 | "description" : "gm_options_wc_clear_secondary_data_desc", 33 | "callback" : "WeaponCustomizationClearDataSecondaries" 34 | }, 35 | { 36 | "type" : "button", 37 | "id" : "gm_wc_clear_customization_melee", 38 | "title" : "gm_options_wc_clear_melee_data_title", 39 | "description" : "gm_options_wc_clear_melee_data_desc", 40 | "callback" : "WeaponCustomizationClearDataMelee" 41 | } 42 | 43 | ] 44 | 45 | } 46 | -------------------------------------------------------------------------------- /GoonMod/mod.txt: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "GoonMod", 3 | "author" : "James Wilkinson", 4 | "contact" : "jw@jameswilko.com", 5 | "priority" : 200, 6 | "updates" : [ 7 | { 8 | "revision" : 32, 9 | "identifier" : "goonmod" 10 | }, 11 | { 12 | "revision" : "revision.txt", 13 | "identifier" : "goonmodwepcust", 14 | "install_dir" : "assets/mod_overrides/", 15 | "install_folder" : "GoonModWeaponCustomizer", 16 | "display_name" : "GoonMod Weapon Customizer" 17 | } 18 | ], 19 | "hooks" : [ 20 | { "hook_id" : "lib/managers/localizationmanager", "script_path" : "goonbase.lua" }, 21 | { "hook_id" : "lib/managers/menumanager", "script_path" : "goonbase.lua" }, 22 | { "hook_id" : "lib/units/weapons/grenades/quicksmokegrenade", "script_path" : "goonbase.lua" }, 23 | { "hook_id" : "lib/managers/hudmanager", "script_path" : "goonbase.lua" }, 24 | { "hook_id" : "lib/managers/jobmanager", "script_path" : "goonbase.lua" }, 25 | { "hook_id" : "lib/managers/group_ai_states/groupaistatebase", "script_path" : "goonbase.lua" }, 26 | { "hook_id" : "lib/units/beings/player/states/playerstandard", "script_path" : "goonbase.lua" }, 27 | { "hook_id" : "lib/units/beings/player/playerdamage", "script_path" : "goonbase.lua" }, 28 | { "hook_id" : "lib/managers/playermanager", "script_path" : "goonbase.lua" }, 29 | { "hook_id" : "lib/managers/gageassignmentmanager", "script_path" : "goonbase.lua" }, 30 | { "hook_id" : "lib/managers/achievmentmanager", "script_path" : "goonbase.lua" }, 31 | { "hook_id" : "lib/tweak_data/infamytweakdata", "script_path" : "goonbase.lua" }, 32 | { "hook_id" : "lib/setups/gamesetup", "script_path" : "goonbase.lua" }, 33 | { "hook_id" : "lib/setups/menusetup", "script_path" : "goonbase.lua" }, 34 | { "hook_id" : "lib/managers/menu/blackmarketgui", "script_path" : "goonbase.lua" }, 35 | { "hook_id" : "lib/managers/blackmarketmanager", "script_path" : "goonbase.lua" }, 36 | { "hook_id" : "lib/tweak_data/charactertweakdata", "script_path" : "goonbase.lua" }, 37 | { "hook_id" : "lib/units/enemies/cop/copinventory", "script_path" : "goonbase.lua" }, 38 | { "hook_id" : "lib/units/enemies/cop/copdamage", "script_path" : "goonbase.lua" }, 39 | { "hook_id" : "lib/managers/mission/elementlasertrigger", "script_path" : "goonbase.lua" }, 40 | { "hook_id" : "lib/units/weapons/weaponflashlight", "script_path" : "goonbase.lua" }, 41 | { "hook_id" : "lib/units/weapons/weaponlaser", "script_path" : "goonbase.lua" }, 42 | { "hook_id" : "lib/tweak_data/levelstweakdata", "script_path" : "goonbase.lua" }, 43 | { "hook_id" : "lib/tweak_data/assetstweakdata", "script_path" : "goonbase.lua" }, 44 | { "hook_id" : "lib/tweak_data/narrativetweakdata", "script_path" : "goonbase.lua" }, 45 | { "hook_id" : "lib/managers/menu/menunodegui", "script_path" : "goonbase.lua" }, 46 | { "hook_id" : "lib/managers/menu/items/menuitemcustomizecontroller", "script_path" : "goonbase.lua" }, 47 | { "hook_id" : "lib/managers/criminalsmanager", "script_path" : "goonbase.lua" }, 48 | { "hook_id" : "lib/units/weapons/newraycastweaponbase", "script_path" : "goonbase.lua" }, 49 | { "hook_id" : "lib/units/weapons/npcraycastweaponbase", "script_path" : "goonbase.lua" }, 50 | { "hook_id" : "lib/units/cameras/fpcameraplayerbase", "script_path" : "goonbase.lua" }, 51 | { "hook_id" : "core/lib/managers/menu/items/coremenuitemslider", "script_path" : "goonbase.lua" }, 52 | { "hook_id" : "lib/utils/game_state_machine/gamestatemachine", "script_path" : "goonbase.lua" }, 53 | { "hook_id" : "lib/units/contourext", "script_path" : "goonbase.lua" }, 54 | { "hook_id" : "lib/units/interactions/interactionext", "script_path" : "goonbase.lua" }, 55 | { "hook_id" : "lib/units/enemies/spooc/actions/lower_body/actionspooc", "script_path" : "goonbase.lua" }, 56 | { "hook_id" : "lib/managers/menu/menucomponentmanager", "script_path" : "goonbase.lua" }, 57 | { "hook_id" : "lib/managers/menu/missionbriefinggui", "script_path" : "goonbase.lua" }, 58 | { "hook_id" : "lib/network/matchmaking/networkmatchmakingsteam", "script_path" : "goonbase.lua" }, 59 | { "hook_id" : "lib/managers/menu/menuscenemanager", "script_path" : "goonbase.lua" }, 60 | { "hook_id" : "lib/units/enemies/cop/actions/full_body/copactionhurt", "script_path" : "goonbase.lua" }, 61 | { "hook_id" : "lib/units/equipment/ecm_jammer/ecmjammerbase", "script_path" : "goonbase.lua" }, 62 | { "hook_id" : "lib/tweak_data/weapontweakdata", "script_path" : "goonbase.lua" }, 63 | { "hook_id" : "lib/units/beings/player/playerinventory", "script_path" : "goonbase.lua" }, 64 | { "hook_id" : "lib/tweak_data/skilltreetweakdata", "script_path" : "goonbase.lua" }, 65 | { "hook_id" : "lib/managers/systemmenumanager", "script_path" : "goonbase.lua" }, 66 | { "hook_id" : "lib/managers/menu/playerprofileguiobject", "script_path" : "goonbase.lua" }, 67 | { "hook_id" : "lib/managers/menu/walletguiobject", "script_path" : "goonbase.lua" }, 68 | { "hook_id" : "lib/managers/experiencemanager", "script_path" : "goonbase.lua" }, 69 | { "hook_id" : "lib/managers/skilltreemanager", "script_path" : "goonbase.lua" }, 70 | { "hook_id" : "lib/managers/menu/skilltreeguinew", "script_path" : "goonbase.lua" }, 71 | { "hook_id" : "lib/network/networkgame", "script_path" : "goonbase.lua" }, 72 | { "hook_id" : "lib/tweak_data/upgradestweakdata", "script_path" : "goonbase.lua" }, 73 | { "hook_id" : "lib/network/base/networkmanager", "script_path" : "goonbase.lua" }, 74 | { "hook_id" : "lib/units/weapons/sentrygunweapon", "script_path" : "goonbase.lua" }, 75 | { "hook_id" : "lib/managers/savefilemanager", "script_path" : "goonbase.lua" }, 76 | { "hook_id" : "lib/managers/menu/playerinventorygui", "script_path" : "goonbase.lua" }, 77 | { "hook_id" : "lib/tweak_data/blackmarket/weaponskinstweakdata", "script_path" : "goonbase.lua" } 78 | ] 79 | } 80 | -------------------------------------------------------------------------------- /GoonMod/mods/color_grading_menu.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Mod Definition 3 | local Mod = class( BaseMod ) 4 | Mod.id = "MenuColourGrading" 5 | Mod.Name = "Menu Colour Grading" 6 | Mod.Desc = "Allows you to change the colour grading scheme used on the main menu" 7 | Mod.Requirements = {} 8 | Mod.Incompatibilities = {} 9 | 10 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod.id, function() 11 | GoonBase.Mods:RegisterMod( Mod ) 12 | end) 13 | 14 | if not Mod:IsEnabled() then 15 | return 16 | end 17 | 18 | -- Colour Grading 19 | GoonBase.ColourGrading = GoonBase.ColourGrading or {} 20 | local ColourGrading = GoonBase.ColourGrading 21 | ColourGrading.GradingOptions = { 22 | "color_matrix", -- color_off for default, menu default is matrices 23 | "color_payday", 24 | "color_heat", 25 | "color_nice", 26 | "color_sin", 27 | "color_bhd", 28 | "color_xgen", 29 | "color_xxxgen", 30 | "color_matrix" 31 | } 32 | 33 | -- Options 34 | GoonBase.Options.ColourGrading = GoonBase.Options.ColourGrading or {} 35 | GoonBase.Options.ColourGrading.GradingOption = GoonBase.Options.ColourGrading.GradingOption or 9 36 | 37 | -- Functions 38 | function ColourGrading:ColourGradingEnabled() 39 | if not GoonBase.Options.ColourGrading then 40 | return false 41 | end 42 | if not GoonBase.Options.ColourGrading.GradingOption then 43 | return false 44 | end 45 | return GoonBase.Options.ColourGrading.GradingOption > 1 46 | end 47 | 48 | function ColourGrading:GetGradingIndex() 49 | if not GoonBase.Options.ColourGrading then 50 | return 1 51 | end 52 | if not GoonBase.Options.ColourGrading.GradingOption then 53 | return 1 54 | end 55 | return GoonBase.Options.ColourGrading.GradingOption 56 | end 57 | 58 | function ColourGrading:GetGradingOption() 59 | if not Utils:IsInGameState() then 60 | return ColourGrading.GradingOptions[ ColourGrading:GetGradingIndex() ] 61 | else 62 | return ColourGrading:GetDefaultGradingOption() 63 | end 64 | end 65 | 66 | function ColourGrading:GetDefaultGradingOption() 67 | return "color_matrix" 68 | end 69 | 70 | function ColourGrading:UpdateColourGrading() 71 | if not Utils:IsInGameState() and managers and managers.environment_controller then 72 | local grading = ColourGrading:GetGradingOption() 73 | if grading then 74 | if managers.menu_scene then 75 | managers.menu_scene._environments.standard.color_grading = grading 76 | end 77 | managers.environment_controller:set_default_color_grading( grading ) 78 | managers.environment_controller:refresh_render_settings() 79 | end 80 | end 81 | end 82 | 83 | -- Menu 84 | Hooks:Add("MenuManagerSetupGoonBaseMenu", "MenuManagerSetupGoonBaseMenu_" .. Mod:ID(), function( menu_manager ) 85 | 86 | MenuCallbackHandler.goonmod_set_menu_colour_grading = function(this, item) 87 | GoonBase.Options.ColourGrading.GradingOption = tonumber(item:value()) 88 | GoonBase.Options:Save() 89 | ColourGrading:UpdateColourGrading() 90 | end 91 | 92 | MenuHelper:AddMultipleChoice({ 93 | id = "gm_colour_grading_override_multichoice", 94 | title = "gm_options_color_grading_menu", 95 | desc = "gm_options_color_grading_menu_desc", 96 | callback = "goonmod_set_menu_colour_grading", 97 | menu_id = "goonbase_options_menu", 98 | items = { 99 | [1] = "gm_col_grading_off", 100 | [2] = "gm_col_grading_payday_plus", 101 | [3] = "gm_col_grading_heat", 102 | [4] = "gm_col_grading_nice", 103 | [5] = "gm_col_grading_sin", 104 | [6] = "gm_col_grading_bhd", 105 | [7] = "gm_col_grading_xgen", 106 | [8] = "gm_col_grading_xxxgen", 107 | [9] = "gm_col_grading_matrix", 108 | }, 109 | value = GoonBase.Options.ColourGrading.GradingOption, 110 | priority = 1, 111 | }) 112 | 113 | end) 114 | 115 | Hooks:Add("MenuManagerOnOpenMenu", "MenuManagerOnOpenMenu_" .. Mod:ID(), function( menu_manager, menu, position ) 116 | ColourGrading:UpdateColourGrading() 117 | end) 118 | -------------------------------------------------------------------------------- /GoonMod/mods/custom_colours/flashlight_player_weapon.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Mod Definition 3 | local Mod = class( BaseMod ) 4 | Mod.id = "CustomWeaponFlashlight" 5 | Mod.Name = "Custom Flashlight Colour - Players" 6 | Mod.Desc = "Modify the color of flashlights attached to your weapons" 7 | Mod.Requirements = {} 8 | Mod.Incompatibilities = {} 9 | 10 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod.id, function() 11 | GoonBase.Mods:RegisterMod( Mod ) 12 | end) 13 | 14 | if not Mod:IsEnabled() then 15 | return 16 | end 17 | 18 | -- Weapon Light 19 | GoonBase.WeaponLight = GoonBase.WeaponLight or {} 20 | local Light = GoonBase.WeaponLight 21 | Light.MenuFile = "custom_flashlight_menu.txt" 22 | 23 | -- Options 24 | GoonBase.Options.WeaponLight = GoonBase.Options.WeaponLight or {} 25 | GoonBase.Options.WeaponLight.Enabled = GoonBase.Options.WeaponLight.Enabled or true 26 | GoonBase.Options.WeaponLight.RH = GoonBase.Options.WeaponLight.RH or 1 27 | GoonBase.Options.WeaponLight.GS = GoonBase.Options.WeaponLight.GS or 1 28 | GoonBase.Options.WeaponLight.BV = GoonBase.Options.WeaponLight.BV or 1 29 | GoonBase.Options.WeaponLight.UseHSV = GoonBase.Options.WeaponLight.UseHSV or false 30 | GoonBase.Options.WeaponLight.UseRainbow = GoonBase.Options.WeaponLight.UseRainbow or false 31 | GoonBase.Options.WeaponLight.RainbowSpeed = GoonBase.Options.WeaponLight.RainbowSpeed or 1 32 | if GoonBase.Options.WeaponLight.Enabled == nil then 33 | GoonBase.Options.WeaponLight.Enabled = true 34 | end 35 | if GoonBase.Options.WeaponLight.UseHSV == nil then 36 | GoonBase.Options.WeaponLight.UseHSV = false 37 | end 38 | if GoonBase.Options.WeaponLight.UseRainbow == nil then 39 | GoonBase.Options.WeaponLight.UseRainbow = false 40 | end 41 | 42 | -- Light Colour 43 | Light.Color = ColorHSVRGB:new( GoonBase.Options.WeaponLight, Color.white ) 44 | 45 | -- Functions 46 | function Light:IsEnabled() 47 | return GoonBase.Options.WeaponLight.Enabled 48 | end 49 | 50 | function Light:IsRainbow() 51 | return GoonBase.Options.WeaponLight.UseRainbow 52 | end 53 | 54 | function Light:RainbowSpeed() 55 | return GoonBase.Options.WeaponLight.RainbowSpeed 56 | end 57 | 58 | function Light:GetColor(alpha) 59 | return Light.Color:GetColor( alpha ) 60 | end 61 | 62 | function Light:ShowPreviewMenuItem() 63 | 64 | if not managers.menu_component then 65 | return 66 | end 67 | 68 | local ws = managers.menu_component._ws 69 | self._panel = ws:panel():panel() 70 | 71 | local w, h = self._panel:w() * 0.35, 48 72 | self._color_rect = self._panel:rect({ 73 | w = w, 74 | h = h, 75 | color = Color.red, 76 | blend_mode = "add", 77 | layer = tweak_data.gui.MOUSE_LAYER - 50, 78 | }) 79 | self._color_rect:set_right( self._panel:right() ) 80 | self._color_rect:set_top( self._panel:h() * 0.265 ) 81 | 82 | self:UpdatePreview() 83 | 84 | end 85 | 86 | function Light:DestroyPreviewMenuItem() 87 | 88 | if alive(self._panel) then 89 | 90 | self._panel:remove( self._color_rect ) 91 | self._panel:remove( self._panel ) 92 | 93 | self._color_rect = nil 94 | self._panel = nil 95 | 96 | end 97 | 98 | end 99 | 100 | function Light:UpdatePreview( t ) 101 | 102 | if not alive(self._panel) or not alive(self._color_rect) or not Light.Color then 103 | return 104 | end 105 | 106 | if self:IsRainbow() and t then 107 | self._color_rect:set_color( Light.Color:GetRainbowColor(t, self:RainbowSpeed()) ) 108 | else 109 | self._color_rect:set_color( Light.Color:GetColor() ) 110 | end 111 | 112 | end 113 | 114 | -- Menu 115 | Hooks:Add("MenuManagerInitialize", "MenuManagerInitialize_" .. Mod:ID(), function( menu_manager ) 116 | 117 | -- Callbacks 118 | MenuCallbackHandler.CustomFlashlightMenuChangeFocus = function( node, focus ) 119 | if focus then 120 | Light:ShowPreviewMenuItem() 121 | else 122 | Light:DestroyPreviewMenuItem() 123 | end 124 | end 125 | 126 | MenuCallbackHandler.ToggleEnableCustomFlashlight = function( this, item ) 127 | GoonBase.Options.WeaponLight.Enabled = item:value() == "on" and true or false 128 | Light:UpdatePreview() 129 | end 130 | 131 | MenuCallbackHandler.CustomFlashlightToggleUseHue = function( this, item ) 132 | GoonBase.Options.WeaponLight.UseHSV = item:value() == "on" and true or false 133 | Light:UpdatePreview() 134 | end 135 | 136 | MenuCallbackHandler.CustomFlashlightSetRedHue = function( this, item ) 137 | GoonBase.Options.WeaponLight.RH = tonumber( item:value() ) 138 | Light:UpdatePreview() 139 | end 140 | 141 | MenuCallbackHandler.CustomFlashlightSetGreenSaturation = function( this, item ) 142 | GoonBase.Options.WeaponLight.GS = tonumber( item:value() ) 143 | Light:UpdatePreview() 144 | end 145 | 146 | MenuCallbackHandler.CustomFlashlightSetBlueValue = function( this, item ) 147 | GoonBase.Options.WeaponLight.BV = tonumber( item:value() ) 148 | Light:UpdatePreview() 149 | end 150 | 151 | MenuCallbackHandler.CustomFlashlightSetUseRainbow = function( this, item ) 152 | GoonBase.Options.WeaponLight.UseRainbow = item:value() == "on" and true or false 153 | Light:UpdatePreview() 154 | end 155 | 156 | MenuCallbackHandler.CustomFlashlightSetRainbowSpeed = function( this, item ) 157 | GoonBase.Options.WeaponLight.RainbowSpeed = tonumber( item:value() ) 158 | end 159 | 160 | MenuHelper:LoadFromJsonFile( GoonBase.MenusPath .. Light.MenuFile, GoonBase.WeaponLight, GoonBase.Options.WeaponLight ) 161 | 162 | end) 163 | 164 | -- Hooks 165 | Hooks:Add("MenuUpdate", "MenuUpdate_" .. Mod:ID(), function(t, dt) 166 | if Light:IsRainbow() then 167 | Light:UpdatePreview( t ) 168 | end 169 | end) 170 | 171 | Hooks:Add("GameSetupUpdate", "GameSetupUpdate_" .. Mod:ID(), function(t, dt) 172 | if Light:IsRainbow() then 173 | Light:UpdatePreview( t ) 174 | end 175 | end) 176 | 177 | Hooks:Add("WeaponFlashLightInit", "WeaponFlashLightInit_" .. Mod:ID(), function(flashlight, unit) 178 | 179 | if not Light:IsEnabled() then 180 | Hooks:Remove("WeaponFlashLightInit_CustomLight") 181 | return 182 | end 183 | 184 | flashlight._light:set_color( Light:GetColor() ) 185 | 186 | end) 187 | 188 | Hooks:Add("WeaponFlashLightCheckState", "WeaponFlashLightCheckState_" .. Mod:ID(), function(flashlight) 189 | 190 | if flashlight._on then 191 | 192 | flashlight._unit:set_extension_update_enabled( Idstring("base"), flashlight._on ) 193 | 194 | Hooks:RegisterHook("WeaponFlashLightUpdate") 195 | flashlight._old_update = flashlight.update 196 | flashlight.update = function(self, unit, t, dt) 197 | Hooks:Call( "WeaponFlashLightUpdate", self, unit, t, dt ) 198 | if flashlight.overkill_update ~= nil then 199 | flashlight.overkill_update(self, unit, t, dt) 200 | end 201 | end 202 | 203 | end 204 | 205 | end) 206 | 207 | Hooks:Add("WeaponFlashLightUpdate", "WeaponFlashLightUpdate_" .. Mod:ID(), function(flashlight, unit, t, dt) 208 | 209 | if not Light:IsEnabled() then 210 | return 211 | end 212 | 213 | if not Light:IsRainbow() then 214 | flashlight._light:set_color( Light:GetColor() ) 215 | end 216 | 217 | if Light:IsRainbow() then 218 | flashlight._light:set_color( Light.Color:GetRainbowColor( t, Light:RainbowSpeed() ) ) 219 | end 220 | 221 | end) 222 | -------------------------------------------------------------------------------- /GoonMod/mods/custom_colours/laser_enemy_weapon.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Mod Definition 3 | local Mod = class( BaseMod ) 4 | Mod.id = "CustomEnemyWeaponLaser" 5 | Mod.Name = "Custom Laser Colour - Enemy" 6 | Mod.Desc = "Set a custom colour for lasers attached to enemy weapons" 7 | Mod.Requirements = {} 8 | Mod.Incompatibilities = {} 9 | 10 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod.id, function() 11 | GoonBase.Mods:RegisterMod( Mod ) 12 | end) 13 | 14 | if not Mod:IsEnabled() then 15 | return 16 | end 17 | 18 | -- Lasers 19 | GoonBase.EnemyLasers = GoonBase.EnemyLasers or {} 20 | local Lasers = GoonBase.EnemyLasers 21 | Lasers.MenuFile = "custom_enemy_laser_menu.txt" 22 | Lasers._WorldOpacity = 0.4 23 | 24 | -- Options 25 | GoonBase.Options.EnemyLasers = GoonBase.Options.EnemyLasers or {} 26 | GoonBase.Options.EnemyLasers.Enabled = GoonBase.Options.EnemyLasers.Enabled or true 27 | GoonBase.Options.EnemyLasers.RH = GoonBase.Options.EnemyLasers.RH or 0.8 28 | GoonBase.Options.EnemyLasers.GS = GoonBase.Options.EnemyLasers.GS or 0.0 29 | GoonBase.Options.EnemyLasers.BV = GoonBase.Options.EnemyLasers.BV or 0.0 30 | GoonBase.Options.EnemyLasers.UseHSV = GoonBase.Options.EnemyLasers.UseHSV or false 31 | GoonBase.Options.EnemyLasers.UseRainbow = GoonBase.Options.EnemyLasers.UseRainbow or false 32 | GoonBase.Options.EnemyLasers.RainbowSpeed = GoonBase.Options.EnemyLasers.RainbowSpeed or 1 33 | if GoonBase.Options.EnemyLasers.Enabled == nil then 34 | GoonBase.Options.EnemyLasers.Enabled = true 35 | end 36 | if GoonBase.Options.EnemyLasers.UseHSV == nil then 37 | GoonBase.Options.EnemyLasers.UseHSV = false 38 | end 39 | if GoonBase.Options.EnemyLasers.UseRainbow == nil then 40 | GoonBase.Options.EnemyLasers.UseRainbow = false 41 | end 42 | 43 | -- Laser Colour 44 | Lasers.Color = ColorHSVRGB:new( GoonBase.Options.EnemyLasers, Color.red:with_alpha(0.6) ) 45 | 46 | -- Functions 47 | function Lasers:IsEnabled() 48 | return GoonBase.Options.EnemyLasers.Enabled 49 | end 50 | 51 | function Lasers:IsRainbow() 52 | return GoonBase.Options.EnemyLasers.UseRainbow 53 | end 54 | 55 | function Lasers:RainbowSpeed() 56 | return GoonBase.Options.EnemyLasers.RainbowSpeed 57 | end 58 | 59 | function Lasers:GetColor(alpha) 60 | return Lasers.Color:GetColor( alpha ) 61 | end 62 | 63 | function Lasers:IsNPCPlayerUnitLaser( laser ) 64 | 65 | if not self._laser_units_lookup then 66 | self._laser_units_lookup = {} 67 | end 68 | 69 | local laser_key = nil 70 | if laser._unit then 71 | laser_key = laser._unit:key() 72 | end 73 | if laser_key and self._laser_units_lookup[laser_key] ~= nil then 74 | return self._laser_units_lookup[laser_key] 75 | end 76 | 77 | local criminals_manager = managers.criminals 78 | if not criminals_manager then 79 | return 80 | end 81 | 82 | for id, data in pairs(criminals_manager._characters) do 83 | if alive(data.unit) and data.name ~= criminals_manager:local_character_name() and data.unit:inventory() and data.unit:inventory():equipped_unit() then 84 | 85 | local wep_base = data.unit:inventory():equipped_unit():base() 86 | local weapon_base = data.unit:inventory():equipped_unit():base() 87 | if Lasers:CheckWeaponForLasers( weapon_base, laser_key ) then 88 | self._laser_units_lookup[laser_key] = true 89 | return 90 | end 91 | 92 | if weapon_base._second_gun then 93 | if Lasers:CheckWeaponForLasers( weapon_base._second_gun:base(), laser_key ) then 94 | self._laser_units_lookup[laser_key] = true 95 | return 96 | end 97 | end 98 | 99 | end 100 | end 101 | 102 | if laser_key then 103 | self._laser_units_lookup[laser_key] = false 104 | end 105 | return false 106 | 107 | end 108 | 109 | function Lasers:CheckWeaponForLasers( weapon_base, key ) 110 | 111 | if weapon_base and weapon_base._factory_id and weapon_base._blueprint then 112 | 113 | local gadgets = managers.weapon_factory:get_parts_from_weapon_by_type_or_perk("gadget", weapon_base._factory_id, weapon_base._blueprint) 114 | if gadgets then 115 | for _, i in ipairs(gadgets) do 116 | 117 | local gadget_key = weapon_base._parts[i].unit:key() 118 | if gadget_key == key then 119 | return true 120 | end 121 | 122 | end 123 | end 124 | 125 | end 126 | return false 127 | 128 | end 129 | 130 | function Lasers:ShowPreviewMenuItem() 131 | 132 | if not managers.menu_component then 133 | return 134 | end 135 | 136 | local ws = managers.menu_component._ws 137 | self._panel = ws:panel():panel() 138 | 139 | local w, h = self._panel:w() * 0.35, 48 140 | self._color_rect = self._panel:rect({ 141 | w = w, 142 | h = h, 143 | color = Color.red, 144 | blend_mode = "add", 145 | layer = tweak_data.gui.MOUSE_LAYER - 50, 146 | }) 147 | self._color_rect:set_right( self._panel:right() ) 148 | self._color_rect:set_top( self._panel:h() * 0.265 ) 149 | 150 | self:UpdatePreview() 151 | 152 | end 153 | 154 | function Lasers:DestroyPreviewMenuItem() 155 | 156 | if alive(self._panel) then 157 | 158 | self._panel:remove( self._color_rect ) 159 | self._panel:remove( self._panel ) 160 | 161 | self._color_rect = nil 162 | self._panel = nil 163 | 164 | end 165 | 166 | end 167 | 168 | function Lasers:UpdatePreview( t ) 169 | 170 | if not alive(self._panel) or not alive(self._color_rect) or not Lasers.Color then 171 | return 172 | end 173 | 174 | if self:IsRainbow() and t then 175 | self._color_rect:set_color( Lasers.Color:GetRainbowColor(t, self:RainbowSpeed()) ) 176 | else 177 | self._color_rect:set_color( Lasers.Color:GetColor() ) 178 | end 179 | 180 | end 181 | 182 | -- Menu 183 | Hooks:Add("MenuManagerInitialize", "MenuManagerInitialize_" .. Mod:ID(), function( menu_manager ) 184 | 185 | -- Callbacks 186 | MenuCallbackHandler.CustomEnemyLaserMenuChangeFocus = function( node, focus ) 187 | if focus then 188 | Lasers:ShowPreviewMenuItem() 189 | else 190 | Lasers:DestroyPreviewMenuItem() 191 | end 192 | end 193 | 194 | MenuCallbackHandler.ToggleEnableCustomEnemyLaser = function( this, item ) 195 | GoonBase.Options.EnemyLasers.Enabled = item:value() == "on" and true or false 196 | Lasers:UpdatePreview() 197 | end 198 | 199 | MenuCallbackHandler.CustomEnemyLaserToggleUseHue = function( this, item ) 200 | GoonBase.Options.EnemyLasers.UseHSV = item:value() == "on" and true or false 201 | Lasers:UpdatePreview() 202 | end 203 | 204 | MenuCallbackHandler.CustomEnemyLaserSetRedHue = function( this, item ) 205 | GoonBase.Options.EnemyLasers.RH = tonumber( item:value() ) 206 | Lasers:UpdatePreview() 207 | end 208 | 209 | MenuCallbackHandler.CustomEnemyLaserSetGreenSaturation = function( this, item ) 210 | GoonBase.Options.EnemyLasers.GS = tonumber( item:value() ) 211 | Lasers:UpdatePreview() 212 | end 213 | 214 | MenuCallbackHandler.CustomEnemyLaserSetBlueValue = function( this, item ) 215 | GoonBase.Options.EnemyLasers.BV = tonumber( item:value() ) 216 | Lasers:UpdatePreview() 217 | end 218 | 219 | MenuCallbackHandler.CustomEnemyLaserSetUseRainbow = function( this, item ) 220 | GoonBase.Options.EnemyLasers.UseRainbow = item:value() == "on" and true or false 221 | Lasers:UpdatePreview() 222 | end 223 | 224 | MenuCallbackHandler.CustomEnemyLaserSetRainbowSpeed = function( this, item ) 225 | GoonBase.Options.EnemyLasers.RainbowSpeed = tonumber( item:value() ) 226 | end 227 | 228 | MenuHelper:LoadFromJsonFile( GoonBase.MenusPath .. Lasers.MenuFile, GoonBase.EnemyLasers, GoonBase.Options.EnemyLasers ) 229 | 230 | end) 231 | 232 | -- Hooks 233 | Hooks:Add("MenuUpdate", "MenuUpdate_" .. Mod:ID(), function(t, dt) 234 | if Lasers:IsRainbow() then 235 | Lasers:UpdatePreview( t ) 236 | end 237 | end) 238 | 239 | Hooks:Add("GameSetupUpdate", "GameSetupUpdate_" .. Mod:ID(), function(t, dt) 240 | if Lasers:IsRainbow() then 241 | Lasers:UpdatePreview( t ) 242 | end 243 | end) 244 | 245 | Hooks:Add("WeaponLaserPostSetColorByTheme", "WeaponLaserPostSetColorByTheme_CustomEnemyLaser", function(laser, unit) 246 | 247 | if not Lasers:IsEnabled() then 248 | return 249 | end 250 | 251 | if laser._is_npc and not Lasers:IsNPCPlayerUnitLaser( laser ) then 252 | laser:set_color( Lasers:GetColor(Lasers._WorldOpacity) ) 253 | end 254 | 255 | end) 256 | 257 | Hooks:Add("WeaponLaserUpdate", "WeaponLaserUpdate_EnemyRainbow", function(laser, unit, t, dt) 258 | 259 | if not Lasers:IsEnabled() then 260 | return 261 | end 262 | 263 | if laser._is_npc and not Lasers:IsNPCPlayerUnitLaser( laser ) then 264 | 265 | if not Lasers:IsRainbow() then 266 | laser:set_color( Lasers:GetColor() ) 267 | else 268 | laser:set_color( Lasers.Color:GetRainbowColor( t, Lasers:RainbowSpeed() ):with_alpha(Lasers._WorldOpacity) ) 269 | end 270 | 271 | end 272 | 273 | end) 274 | -------------------------------------------------------------------------------- /GoonMod/mods/custom_colours/laser_player_weapon.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Mod Definition 3 | local Mod = class( BaseMod ) 4 | Mod.id = "CustomWeaponLaserColour" 5 | Mod.Name = "Custom Laser Colour - Players" 6 | Mod.Desc = "Modify the color of your own, and your teammates weapon lasers" 7 | Mod.Requirements = {} 8 | Mod.Incompatibilities = {} 9 | 10 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod.id, function() 11 | GoonBase.Mods:RegisterMod( Mod ) 12 | end) 13 | 14 | if not Mod:IsEnabled() then 15 | return 16 | end 17 | 18 | -- Lasers 19 | GoonBase.WeaponLasers = GoonBase.WeaponLasers or {} 20 | local Lasers = GoonBase.WeaponLasers 21 | Lasers.MenuFile = "custom_weapon_laser_menu.txt" 22 | Lasers.NetworkID = "gmcpwlc" 23 | Lasers._WorldOpacity = 0.4 24 | 25 | -- Options 26 | GoonBase.Options.WeaponLasers = GoonBase.Options.WeaponLasers or {} 27 | GoonBase.Options.WeaponLasers.Enabled = GoonBase.Options.WeaponLasers.Enabled 28 | GoonBase.Options.WeaponLasers.RH = GoonBase.Options.WeaponLasers.RH or 0.0 29 | GoonBase.Options.WeaponLasers.GS = GoonBase.Options.WeaponLasers.GS or 0.75 30 | GoonBase.Options.WeaponLasers.BV = GoonBase.Options.WeaponLasers.BV or 0.0 31 | GoonBase.Options.WeaponLasers.UseHSV = GoonBase.Options.WeaponLasers.UseHSV 32 | GoonBase.Options.WeaponLasers.UseRainbow = GoonBase.Options.WeaponLasers.UseRainbow 33 | GoonBase.Options.WeaponLasers.RainbowSpeed = GoonBase.Options.WeaponLasers.RainbowSpeed or 1 34 | GoonBase.Options.WeaponLasers.TeamLasers = GoonBase.Options.WeaponLasers.TeamLasers or 3 35 | if GoonBase.Options.WeaponLasers.Enabled == nil then 36 | GoonBase.Options.WeaponLasers.Enabled = true 37 | end 38 | if GoonBase.Options.WeaponLasers.UseHSV == nil then 39 | GoonBase.Options.WeaponLasers.UseHSV = false 40 | end 41 | if GoonBase.Options.WeaponLasers.UseRainbow == nil then 42 | GoonBase.Options.WeaponLasers.UseRainbow = false 43 | end 44 | 45 | -- Laser Colours 46 | Lasers.Color = ColorHSVRGB:new( GoonBase.Options.WeaponLasers, Color.red:with_alpha(0.6) ) 47 | Lasers.TeammateColours = Lasers.TeammateColours or {} 48 | Lasers.UniquePlayerColours = Lasers.UniquePlayerColours or { 49 | [1] = Color("29ce31"), 50 | [2] = Color("00eae8"), 51 | [3] = Color("f99d1c"), 52 | [4] = Color("ebe818"), 53 | [5] = Color("ebe818"), 54 | } 55 | 56 | -- Functions 57 | function Lasers:IsEnabled() 58 | return GoonBase.Options.WeaponLasers.Enabled 59 | end 60 | 61 | function Lasers:IsRainbow() 62 | return GoonBase.Options.WeaponLasers.UseRainbow 63 | end 64 | 65 | function Lasers:RainbowSpeed() 66 | return GoonBase.Options.WeaponLasers.RainbowSpeed 67 | end 68 | 69 | function Lasers:GetColor(alpha) 70 | return Lasers.Color:GetColor( alpha ) 71 | end 72 | 73 | function Lasers:AreTeamLasersOff() 74 | return GoonBase.Options.WeaponLasers.TeamLasers == 1 75 | end 76 | 77 | function Lasers:AreTeamLasersSameColour() 78 | return GoonBase.Options.WeaponLasers.TeamLasers == 2 79 | end 80 | 81 | function Lasers:AreTeamLasersNetworked() 82 | return GoonBase.Options.WeaponLasers.TeamLasers == 3 83 | end 84 | 85 | function Lasers:AreTeamLasersUnique() 86 | return GoonBase.Options.WeaponLasers.TeamLasers == 4 87 | end 88 | 89 | function Lasers:GetCriminalNameFromLaserUnit( laser ) 90 | 91 | if not self._laser_units_lookup then 92 | self._laser_units_lookup = {} 93 | end 94 | 95 | local laser_key = nil 96 | if laser._unit then 97 | laser_key = laser._unit:key() 98 | end 99 | if laser_key and self._laser_units_lookup[laser_key] ~= nil then 100 | return self._laser_units_lookup[laser_key] 101 | end 102 | 103 | local criminals_manager = managers.criminals 104 | if not criminals_manager then 105 | return 106 | end 107 | 108 | for id, character in pairs(criminals_manager._characters) do 109 | if alive(character.unit) and character.unit:inventory() and character.unit:inventory():equipped_unit() then 110 | 111 | local weapon_base = character.unit:inventory():equipped_unit():base() 112 | if Lasers:CheckWeaponForLasers( weapon_base, laser_key ) then 113 | self._laser_units_lookup[laser_key] = character.name 114 | return 115 | end 116 | 117 | if weapon_base._second_gun then 118 | if Lasers:CheckWeaponForLasers( weapon_base._second_gun:base(), laser_key ) then 119 | self._laser_units_lookup[laser_key] = character.name 120 | return 121 | end 122 | end 123 | 124 | end 125 | end 126 | 127 | if laser_key then 128 | self._laser_units_lookup[laser_key] = false 129 | end 130 | return nil 131 | 132 | end 133 | 134 | function Lasers:CheckWeaponForLasers( weapon_base, key ) 135 | 136 | if weapon_base and weapon_base._factory_id and weapon_base._blueprint then 137 | 138 | local gadgets = managers.weapon_factory:get_parts_from_weapon_by_type_or_perk("gadget", weapon_base._factory_id, weapon_base._blueprint) 139 | if gadgets then 140 | for _, i in ipairs(gadgets) do 141 | 142 | local gadget_key = weapon_base._parts[i].unit:key() 143 | if gadget_key == key then 144 | return true 145 | end 146 | 147 | end 148 | end 149 | 150 | end 151 | return false 152 | 153 | end 154 | 155 | function Lasers:UpdateLaser( laser, unit, t, dt ) 156 | 157 | if not Lasers:IsEnabled() then 158 | return 159 | end 160 | 161 | if laser._is_npc then 162 | 163 | local criminal_name = Lasers:GetCriminalNameFromLaserUnit( laser ) 164 | if not criminal_name then 165 | return 166 | end 167 | 168 | if Lasers:AreTeamLasersOff() then 169 | Lasers:SetColourOfLaser( laser, unit, t, dt, Color.green:with_alpha(0.1) ) 170 | return 171 | end 172 | 173 | if Lasers:AreTeamLasersSameColour() then 174 | Lasers:SetColourOfLaser( laser, unit, t, dt ) 175 | return 176 | end 177 | 178 | if Lasers:AreTeamLasersNetworked() then 179 | local color = Lasers.TeammateColours[criminal_name] 180 | if color then 181 | Lasers:SetColourOfLaser( laser, unit, t, dt, color ) 182 | end 183 | return 184 | end 185 | 186 | if Lasers:AreTeamLasersUnique() then 187 | local id = managers.criminals:character_color_id_by_name( criminal_name ) 188 | if id == 1 then id = id + 1 end 189 | local color = Lasers.UniquePlayerColours[ id or 5 ]:with_alpha(Lasers._WorldOpacity) 190 | if color then 191 | Lasers:SetColourOfLaser( laser, unit, t, dt, color ) 192 | end 193 | return 194 | end 195 | 196 | end 197 | 198 | Lasers:SetColourOfLaser( laser, unit, t, dt ) 199 | 200 | end 201 | 202 | function Lasers:SetColourOfLaser( laser, unit, t, dt, override_color ) 203 | 204 | if override_color then 205 | if override_color ~= "rainbow" then 206 | laser:set_color( override_color ) 207 | else 208 | if type(override_color) == "string" then 209 | laser:set_color_by_theme( override_color ) 210 | else 211 | laser:set_color( Lasers.Color:GetRainbowColor( t, Lasers:RainbowSpeed() ):with_alpha(Lasers._WorldOpacity) ) 212 | end 213 | end 214 | return 215 | end 216 | 217 | if not Lasers:IsRainbow() then 218 | laser:set_color( Lasers:GetColor( Lasers._WorldOpacity ) ) 219 | return 220 | end 221 | 222 | if Lasers:IsRainbow() then 223 | laser:set_color( Lasers.Color:GetRainbowColor( t, Lasers:RainbowSpeed() ):with_alpha(Lasers._WorldOpacity) ) 224 | return 225 | end 226 | 227 | end 228 | 229 | 230 | function Lasers:ShowPreviewMenuItem() 231 | 232 | if not managers.menu_component then 233 | return 234 | end 235 | 236 | local ws = managers.menu_component._ws 237 | self._panel = ws:panel():panel() 238 | 239 | local w, h = self._panel:w() * 0.35, 48 240 | self._color_rect = self._panel:rect({ 241 | w = w, 242 | h = h, 243 | color = Color.red, 244 | blend_mode = "add", 245 | layer = tweak_data.gui.MOUSE_LAYER - 50, 246 | }) 247 | self._color_rect:set_right( self._panel:right() ) 248 | self._color_rect:set_top( self._panel:h() * 0.265 ) 249 | 250 | self:UpdatePreview() 251 | 252 | end 253 | 254 | function Lasers:DestroyPreviewMenuItem() 255 | 256 | if alive(self._panel) then 257 | 258 | self._panel:remove( self._color_rect ) 259 | self._panel:remove( self._panel ) 260 | 261 | self._color_rect = nil 262 | self._panel = nil 263 | 264 | end 265 | 266 | end 267 | 268 | function Lasers:UpdatePreview( t ) 269 | 270 | if not alive(self._panel) or not alive(self._color_rect) or not Lasers.Color then 271 | return 272 | end 273 | 274 | if self:IsRainbow() and t then 275 | self._color_rect:set_color( Lasers.Color:GetRainbowColor(t, self:RainbowSpeed()) ) 276 | else 277 | self._color_rect:set_color( Lasers.Color:GetColor() ) 278 | end 279 | 280 | end 281 | 282 | -- Menu 283 | Hooks:Add("MenuManagerInitialize", "MenuManagerInitialize_" .. Mod:ID(), function( menu_manager ) 284 | 285 | -- Callbacks 286 | MenuCallbackHandler.CustomWeaponLaserMenuChangeFocus = function( node, focus ) 287 | if focus then 288 | Lasers:ShowPreviewMenuItem() 289 | else 290 | Lasers:DestroyPreviewMenuItem() 291 | end 292 | end 293 | 294 | MenuCallbackHandler.ToggleEnableCustomWeaponLaser = function( this, item ) 295 | GoonBase.Options.WeaponLasers.Enabled = item:value() == "on" and true or false 296 | Lasers:UpdatePreview() 297 | end 298 | 299 | MenuCallbackHandler.CustomWeaponLaserToggleUseHue = function( this, item ) 300 | GoonBase.Options.WeaponLasers.UseHSV = item:value() == "on" and true or false 301 | Lasers:UpdatePreview() 302 | end 303 | 304 | MenuCallbackHandler.CustomWeaponLaserSetRedHue = function( this, item ) 305 | GoonBase.Options.WeaponLasers.RH = tonumber( item:value() ) 306 | Lasers:UpdatePreview() 307 | end 308 | 309 | MenuCallbackHandler.CustomWeaponLaserSetGreenSaturation = function( this, item ) 310 | GoonBase.Options.WeaponLasers.GS = tonumber( item:value() ) 311 | Lasers:UpdatePreview() 312 | end 313 | 314 | MenuCallbackHandler.CustomWeaponLaserSetBlueValue = function( this, item ) 315 | GoonBase.Options.WeaponLasers.BV = tonumber( item:value() ) 316 | Lasers:UpdatePreview() 317 | end 318 | 319 | MenuCallbackHandler.CustomWeaponLaserSetUseRainbow = function( this, item ) 320 | GoonBase.Options.WeaponLasers.UseRainbow = item:value() == "on" and true or false 321 | Lasers:UpdatePreview() 322 | end 323 | 324 | MenuCallbackHandler.CustomWeaponLaserSetRainbowSpeed = function( this, item ) 325 | GoonBase.Options.WeaponLasers.RainbowSpeed = tonumber( item:value() ) 326 | end 327 | 328 | MenuCallbackHandler.CustomWeaponLaserSetTeammateLaser = function( this, item ) 329 | GoonBase.Options.WeaponLasers.TeamLasers = tonumber( item:value() ) 330 | end 331 | 332 | MenuHelper:LoadFromJsonFile( GoonBase.MenusPath .. Lasers.MenuFile, GoonBase.WeaponLasers, GoonBase.Options.WeaponLasers ) 333 | 334 | end) 335 | 336 | -- Hooks 337 | Hooks:Add("MenuUpdate", "MenuUpdate_" .. Mod:ID(), function(t, dt) 338 | if Lasers:IsRainbow() then 339 | Lasers:UpdatePreview( t ) 340 | end 341 | end) 342 | 343 | Hooks:Add("GameSetupUpdate", "GameSetupUpdate_" .. Mod:ID(), function(t, dt) 344 | if Lasers:IsRainbow() then 345 | Lasers:UpdatePreview( t ) 346 | end 347 | end) 348 | 349 | Hooks:Add("WeaponLaserInit", "WeaponLaserInit_" .. Mod:ID(), function(laser, unit) 350 | Lasers:UpdateLaser(laser, unit, 0, 0) 351 | end) 352 | 353 | Hooks:Add("WeaponLaserUpdate", "WeaponLaserUpdate_Rainbow_" .. Mod:ID(), function(laser, unit, t, dt) 354 | Lasers:UpdateLaser(laser, unit, t, dt) 355 | end) 356 | 357 | Hooks:Add("WeaponLaserSetOn", "WeaponLaserSetOn_" .. Mod:ID(), function(laser) 358 | 359 | if laser._is_npc then 360 | return 361 | end 362 | 363 | local criminals_manager = managers.criminals 364 | if not criminals_manager then 365 | return 366 | end 367 | 368 | local local_name = criminals_manager:local_character_name() 369 | local laser_name = Lasers:GetCriminalNameFromLaserUnit( laser ) 370 | if laser_name == nil or local_name == laser_name then 371 | local col_str = LuaNetworking:ColourToString( Lasers:GetColor() ) 372 | if Lasers:IsRainbow() then 373 | col_str = "rainbow" 374 | end 375 | LuaNetworking:SendToPeers( Lasers.NetworkID, col_str ) 376 | end 377 | 378 | end) 379 | 380 | Hooks:Add("NetworkReceivedData", "NetworkReceivedData_" .. Mod:ID(), function(sender, message, data) 381 | 382 | if message == Lasers.NetworkID then 383 | 384 | local criminals_manager = managers.criminals 385 | if not criminals_manager then 386 | return 387 | end 388 | 389 | local char = criminals_manager:character_name_by_peer_id(sender) 390 | local col = data 391 | if data ~= "rainbow" then 392 | col = LuaNetworking:StringToColour(data) 393 | end 394 | 395 | if char then 396 | Lasers.TeammateColours[char] = col 397 | end 398 | 399 | end 400 | 401 | end) 402 | -------------------------------------------------------------------------------- /GoonMod/mods/custom_colours/laser_world.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Mod Definition 3 | local Mod = class( BaseMod ) 4 | Mod.id = "CustomWorldLaserColour" 5 | Mod.Name = "Custom Laser Colour - World" 6 | Mod.Desc = "Modify the colour of lasers that appear in the game world" 7 | Mod.Requirements = {} 8 | Mod.Incompatibilities = {} 9 | 10 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod.id, function() 11 | GoonBase.Mods:RegisterMod( Mod ) 12 | end) 13 | 14 | if not Mod:IsEnabled() then 15 | return 16 | end 17 | 18 | -- Lasers 19 | GoonBase.WorldLasers = GoonBase.WorldLasers or {} 20 | local Lasers = GoonBase.WorldLasers 21 | Lasers.MenuFile = "custom_world_laser_menu.txt" 22 | Lasers._WorldOpacity = 0.4 23 | 24 | -- Options 25 | GoonBase.Options.WorldLasers = GoonBase.Options.WorldLasers or {} 26 | GoonBase.Options.WorldLasers.Enabled = GoonBase.Options.WorldLasers.Enabled or true 27 | GoonBase.Options.WorldLasers.RH = GoonBase.Options.WorldLasers.RH or 0.6 28 | GoonBase.Options.WorldLasers.GS = GoonBase.Options.WorldLasers.GS or 0.0 29 | GoonBase.Options.WorldLasers.BV = GoonBase.Options.WorldLasers.BV or 0.0 30 | GoonBase.Options.WorldLasers.UseHSV = GoonBase.Options.WorldLasers.UseHSV or false 31 | GoonBase.Options.WorldLasers.UseRainbow = GoonBase.Options.WorldLasers.UseRainbow or false 32 | GoonBase.Options.WorldLasers.RainbowSpeed = GoonBase.Options.WorldLasers.RainbowSpeed or 1 33 | if GoonBase.Options.WorldLasers.Enabled == nil then 34 | GoonBase.Options.WorldLasers.Enabled = true 35 | end 36 | if GoonBase.Options.WorldLasers.UseHSV == nil then 37 | GoonBase.Options.WorldLasers.UseHSV = false 38 | end 39 | if GoonBase.Options.WorldLasers.UseRainbow == nil then 40 | GoonBase.Options.WorldLasers.UseRainbow = false 41 | end 42 | 43 | -- Laser Colour 44 | Lasers.Color = ColorHSVRGB:new( GoonBase.Options.WorldLasers, Color.red:with_alpha(0.6) ) 45 | 46 | -- Functions 47 | function Lasers:IsEnabled() 48 | return GoonBase.Options.WorldLasers.Enabled 49 | end 50 | 51 | function Lasers:IsRainbow() 52 | return GoonBase.Options.WorldLasers.UseRainbow 53 | end 54 | 55 | function Lasers:RainbowSpeed() 56 | return GoonBase.Options.WorldLasers.RainbowSpeed 57 | end 58 | 59 | function Lasers:GetColor(alpha) 60 | return Lasers.Color:GetColor( alpha ) 61 | end 62 | 63 | function Lasers:ShowPreviewMenuItem() 64 | 65 | if not managers.menu_component then 66 | return 67 | end 68 | 69 | local ws = managers.menu_component._ws 70 | self._panel = ws:panel():panel() 71 | 72 | local w, h = self._panel:w() * 0.35, 48 73 | self._color_rect = self._panel:rect({ 74 | w = w, 75 | h = h, 76 | color = Color.red, 77 | blend_mode = "add", 78 | layer = tweak_data.gui.MOUSE_LAYER - 50, 79 | }) 80 | self._color_rect:set_right( self._panel:right() ) 81 | self._color_rect:set_top( self._panel:h() * 0.265 ) 82 | 83 | self:UpdatePreview() 84 | 85 | end 86 | 87 | function Lasers:DestroyPreviewMenuItem() 88 | 89 | if alive(self._panel) then 90 | 91 | self._panel:remove( self._color_rect ) 92 | self._panel:remove( self._panel ) 93 | 94 | self._color_rect = nil 95 | self._panel = nil 96 | 97 | end 98 | 99 | end 100 | 101 | function Lasers:UpdatePreview( t ) 102 | 103 | if not alive(self._panel) or not alive(self._color_rect) or not Lasers.Color then 104 | return 105 | end 106 | 107 | if self:IsRainbow() and t then 108 | self._color_rect:set_color( Lasers.Color:GetRainbowColor(t, self:RainbowSpeed()) ) 109 | else 110 | self._color_rect:set_color( Lasers.Color:GetColor() ) 111 | end 112 | 113 | end 114 | 115 | -- Menu 116 | Hooks:Add("MenuManagerInitialize", "MenuManagerInitialize_" .. Mod:ID(), function( menu_manager ) 117 | 118 | -- Callbacks 119 | MenuCallbackHandler.CustomWorldLaserMenuChangeFocus = function( node, focus ) 120 | if focus then 121 | Lasers:ShowPreviewMenuItem() 122 | else 123 | Lasers:DestroyPreviewMenuItem() 124 | end 125 | end 126 | 127 | MenuCallbackHandler.ToggleEnableCustomWorldLaser = function( this, item ) 128 | GoonBase.Options.WorldLasers.Enabled = item:value() == "on" and true or false 129 | Lasers:UpdatePreview() 130 | end 131 | 132 | MenuCallbackHandler.CustomWorldLaserToggleUseHue = function( this, item ) 133 | GoonBase.Options.WorldLasers.UseHSV = item:value() == "on" and true or false 134 | Lasers:UpdatePreview() 135 | end 136 | 137 | MenuCallbackHandler.CustomWorldLaserSetRedHue = function( this, item ) 138 | GoonBase.Options.WorldLasers.RH = tonumber( item:value() ) 139 | Lasers:UpdatePreview() 140 | end 141 | 142 | MenuCallbackHandler.CustomWorldLaserSetGreenSaturation = function( this, item ) 143 | GoonBase.Options.WorldLasers.GS = tonumber( item:value() ) 144 | Lasers:UpdatePreview() 145 | end 146 | 147 | MenuCallbackHandler.CustomWorldLaserSetBlueValue = function( this, item ) 148 | GoonBase.Options.WorldLasers.BV = tonumber( item:value() ) 149 | Lasers:UpdatePreview() 150 | end 151 | 152 | MenuCallbackHandler.CustomWorldLaserSetUseRainbow = function( this, item ) 153 | GoonBase.Options.WorldLasers.UseRainbow = item:value() == "on" and true or false 154 | Lasers:UpdatePreview() 155 | end 156 | 157 | MenuCallbackHandler.CustomWorldLaserSetRainbowSpeed = function( this, item ) 158 | GoonBase.Options.WorldLasers.RainbowSpeed = tonumber( item:value() ) 159 | end 160 | 161 | MenuHelper:LoadFromJsonFile( GoonBase.MenusPath .. Lasers.MenuFile, GoonBase.WorldLasers, GoonBase.Options.WorldLasers ) 162 | 163 | end) 164 | 165 | -- Hooks 166 | Hooks:Add("MenuUpdate", "MenuUpdate_" .. Mod:ID(), function(t, dt) 167 | if Lasers:IsRainbow() then 168 | Lasers:UpdatePreview( t ) 169 | end 170 | end) 171 | 172 | Hooks:Add("GameSetupUpdate", "GameSetupUpdate_" .. Mod:ID(), function(t, dt) 173 | if Lasers:IsRainbow() then 174 | Lasers:UpdatePreview( t ) 175 | end 176 | end) 177 | 178 | Hooks:Add("ElementLaserTriggerPostInit", "ElementLaserTriggerPostInit_" .. Mod:ID(), function(laser) 179 | 180 | if not Lasers:IsEnabled() then 181 | return 182 | end 183 | 184 | laser._brush:set_color( Lasers:GetColor(Lasers._WorldOpacity) ) 185 | 186 | end) 187 | 188 | Hooks:Add("ElementLaserTriggerUpdateDraw", "ElementLaserTriggerUpdateDraw_" .. Mod:ID(), function(laser, t, dt) 189 | 190 | if not Lasers:IsEnabled() then 191 | return 192 | end 193 | 194 | if not Lasers:IsRainbow() then 195 | laser._brush:set_color( Lasers:GetColor(Lasers._WorldOpacity) ) 196 | end 197 | 198 | if Lasers:IsRainbow() then 199 | laser._brush:set_color( Lasers.Color:GetRainbowColor( t, Lasers:RainbowSpeed() ):with_alpha(Lasers._WorldOpacity) ) 200 | end 201 | 202 | end) 203 | -------------------------------------------------------------------------------- /GoonMod/mods/custom_waypoints.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Mod Definition 3 | local Mod = class( BaseMod ) 4 | Mod.id = "CustomWaypoints" 5 | Mod.Name = "Custom Waypoints" 6 | Mod.Desc = "Allows players to set waypoints for themselves and friends" 7 | Mod.Requirements = {} 8 | Mod.Incompatibilities = {} 9 | 10 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod:ID(), function() 11 | GoonBase.Mods:RegisterMod( Mod ) 12 | end) 13 | 14 | if not Mod:IsEnabled() then 15 | return 16 | end 17 | 18 | -- Custom Waypoints 19 | _G.GoonBase.CustomWaypoints = _G.GoonBase.CustomWaypoints or {} 20 | local CustomWaypoints = _G.GoonBase.CustomWaypoints 21 | CustomWaypoints.MenuFile = "custom_waypoints_menu.txt" 22 | 23 | -- Network 24 | CustomWaypoints.Network = {} 25 | CustomWaypoints.Network.PlaceWaypoint = "CustomWaypointPlace" 26 | CustomWaypoints.Network.RemoveWaypoint = "CustomWaypointRemove" 27 | 28 | -- Options 29 | GoonBase.Options.CustomWaypoints = GoonBase.Options.CustomWaypoints or {} 30 | GoonBase.Options.CustomWaypoints.ShowDistance = GoonBase.Options.CustomWaypoints.ShowDistance 31 | if GoonBase.Options.CustomWaypoints.ShowDistance == nil then 32 | GoonBase.Options.CustomWaypoints.ShowDistance = true 33 | end 34 | 35 | -- Menu 36 | Hooks:Add( "MenuManagerInitialize", "MenuManagerInitialize_" .. Mod:ID(), function( menu_manager ) 37 | 38 | MenuCallbackHandler.ToggleWaypointShowDistance = function(this, item) 39 | GoonBase.Options.CustomWaypoints.ShowDistance = item:value() == "on" and true or false 40 | end 41 | 42 | CustomWaypoints.DoPlaceWaypoint = function(self) 43 | if Utils:IsInGameState() then 44 | CustomWaypoints:SetWaypoint() 45 | end 46 | end 47 | 48 | CustomWaypoints.DoRemoveWaypoint = function(self) 49 | if Utils:IsInGameState() then 50 | CustomWaypoints:RemoveWaypoint() 51 | end 52 | end 53 | 54 | MenuHelper:LoadFromJsonFile( GoonBase.MenusPath .. CustomWaypoints.MenuFile, CustomWaypoints, GoonBase.Options.CustomWaypoints ) 55 | 56 | end) 57 | 58 | 59 | -- Waypoints 60 | function CustomWaypoints:_AddWaypoint( waypoint_name, pos, color_id ) 61 | managers.hud:add_waypoint( 62 | "CustomWaypoint_" .. waypoint_name, 63 | { 64 | icon = "infamy_icon", 65 | distance = GoonBase.Options.CustomWaypoints.ShowDistance, 66 | position = pos, 67 | no_sync = false, 68 | present_timer = 0, 69 | state = "present", 70 | radius = 50, 71 | color = tweak_data.preplanning_peer_colors[color_id or 1], 72 | blend_mode = "add" 73 | } 74 | ) 75 | end 76 | 77 | function CustomWaypoints:_RemoveWaypoint( waypoint_name ) 78 | managers.hud:remove_waypoint("CustomWaypoint_" .. waypoint_name) 79 | end 80 | 81 | function CustomWaypoints:SetWaypoint() 82 | 83 | if managers.player:player_unit() == nil then 84 | return 85 | end 86 | 87 | local pos = Utils:GetPlayerAimPos( managers.player:player_unit() ) 88 | if not pos then 89 | return 90 | end 91 | 92 | CustomWaypoints:_AddWaypoint( "localplayer", pos, LuaNetworking:LocalPeerID() ) 93 | 94 | pos = Vector3.ToString( pos ) 95 | LuaNetworking:SendToPeers( CustomWaypoints.Network.PlaceWaypoint, pos ) 96 | 97 | end 98 | 99 | function CustomWaypoints:RemoveWaypoint() 100 | LuaNetworking:SendToPeers( CustomWaypoints.Network.RemoveWaypoint, "" ) 101 | CustomWaypoints:_RemoveWaypoint( "localplayer" ) 102 | end 103 | 104 | function CustomWaypoints:NetworkPlace( player, position ) 105 | 106 | if player then 107 | 108 | local ply_name = LuaNetworking:GetNameFromPeerID(player) 109 | local pos = string.ToVector3(position) 110 | if pos ~= nil then 111 | CustomWaypoints:_AddWaypoint( ply_name, pos, player ) 112 | end 113 | 114 | end 115 | 116 | end 117 | 118 | function CustomWaypoints:NetworkRemove(player) 119 | local ply_name = LuaNetworking:GetNameFromPeerID(player) 120 | CustomWaypoints:_RemoveWaypoint( ply_name ) 121 | end 122 | 123 | -- Networked Data 124 | Hooks:Add("NetworkReceivedData", "NetworkReceivedData_" .. Mod:ID(), function(sender, messageType, data) 125 | 126 | if messageType == CustomWaypoints.Network.PlaceWaypoint then 127 | CustomWaypoints:NetworkPlace(sender, data) 128 | end 129 | 130 | if messageType == CustomWaypoints.Network.RemoveWaypoint then 131 | CustomWaypoints:NetworkRemove(sender) 132 | end 133 | 134 | end) 135 | -------------------------------------------------------------------------------- /GoonMod/mods/disable_inventory_new_item.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Mod Definition 3 | local Mod = class( BaseMod ) 4 | Mod.id = "DisableInventoryNewItem" 5 | Mod.Name = "Disable New Item Notifications" 6 | Mod.Desc = "Disables the exclamation point icons, and new item unlocked notifications." 7 | Mod.Requirements = {} 8 | Mod.Incompatibilities = {} 9 | 10 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod:ID(), function() 11 | GoonBase.Mods:RegisterMod( Mod ) 12 | end) 13 | 14 | if not Mod:IsEnabled() then 15 | return 16 | end 17 | 18 | -- Hooks 19 | Hooks:Add("BlackMarketGUISlotItemOnRefresh", "BlackMarketGUISlotItemOnRefresh_" .. Mod:ID(), function(self) 20 | 21 | if self._data.new_drop_data then 22 | local newdrop = self._data.new_drop_data 23 | if newdrop[1] and newdrop[2] and newdrop[3] then 24 | managers.blackmarket:remove_new_drop(newdrop[1], newdrop[2], newdrop[3]) 25 | if newdrop.icon then 26 | newdrop.icon:parent():remove(newdrop.icon) 27 | end 28 | self._data.new_drop_data = nil 29 | end 30 | end 31 | 32 | end) 33 | 34 | Hooks:Add("BlackMarketManagerGotAnyNewDrop", "BlackMarketManagerGotAnyNewDrop_" .. Mod:ID(), function(self) 35 | return false 36 | end) 37 | 38 | Hooks:Add("BlackMarketManagerGotNewDrop", "BlackMarketManagerGotNewDrop_" .. Mod:ID(), function(self, global_value, category, id) 39 | return false 40 | end) 41 | 42 | -- Hooks:Add("GenericSystemMenuManagerPreShowNewUnlock", "GenericSystemMenuManagerPreShowNewUnlock_" .. Mod:ID(), function(self, data) 43 | -- return false 44 | -- end) 45 | -------------------------------------------------------------------------------- /GoonMod/mods/infamy_outliner.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Mod Definition 3 | local Mod = class( BaseMod ) 4 | Mod.id = "InfamyOutliner" 5 | Mod.Name = "Infamy Outliner" 6 | Mod.Desc = "Provides an outline of your skill trees prior to going infamous for you to rebuild on." 7 | Mod.Requirements = {} 8 | Mod.Incompatibilities = {} 9 | Mod.EnabledByDefault = true 10 | 11 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod:ID(), function() 12 | GoonBase.Mods:RegisterMod( Mod ) 13 | end) 14 | 15 | if not Mod:IsEnabled() then 16 | return 17 | end 18 | 19 | -- Infamy Outliner 20 | _G.GoonBase.InfamyOutliner = _G.GoonBase.InfamyOutliner or {} 21 | local InfamyOutliner = _G.GoonBase.InfamyOutliner 22 | InfamyOutliner.SaveFile = "goonmod_infamy_outline.txt" 23 | InfamyOutliner.MenuFile = "infamy_outliner_menu.txt" 24 | InfamyOutliner.Outline = {} 25 | 26 | -- Options 27 | GoonBase.Options.InfamyOutliner = GoonBase.Options.InfamyOutliner or {} 28 | GoonBase.Options.InfamyOutliner.Enabled = GoonBase.Options.InfamyOutliner.Enabled 29 | GoonBase.Options.InfamyOutliner.RH = GoonBase.Options.InfamyOutliner.RH or 0.8 30 | GoonBase.Options.InfamyOutliner.GS = GoonBase.Options.InfamyOutliner.GS or 1.0 31 | GoonBase.Options.InfamyOutliner.BV = GoonBase.Options.InfamyOutliner.BV or 0.4 32 | GoonBase.Options.InfamyOutliner.UseHSV = GoonBase.Options.InfamyOutliner.UseHSV 33 | if GoonBase.Options.InfamyOutliner.Enabled == nil then 34 | GoonBase.Options.InfamyOutliner.Enabled = true 35 | end 36 | if GoonBase.Options.InfamyOutliner.UseHSV == nil then 37 | GoonBase.Options.InfamyOutliner.UseHSV = true 38 | end 39 | 40 | -- Color 41 | InfamyOutliner.Color = ColorHSVRGB:new( GoonBase.Options.InfamyOutliner, Color.purple:with_alpha(0) ) 42 | 43 | function InfamyOutliner:IsEnabled() 44 | return GoonBase.Options.InfamyOutliner.Enabled or false 45 | end 46 | 47 | function InfamyOutliner:LoadInfamySkillData() 48 | 49 | local path = SavePath .. InfamyOutliner.SaveFile 50 | local file = io.open( path, "r" ) 51 | if file then 52 | local data = file:read("*all") 53 | file:close() 54 | if not string.is_nil_or_empty( data ) then 55 | InfamyOutliner.Outline = json.decode( data ) 56 | end 57 | end 58 | 59 | end 60 | 61 | function InfamyOutliner:SaveInfamySkillData() 62 | 63 | local tree_data = managers.skilltree._global.skill_switches 64 | InfamyOutliner.Outline = tree_data 65 | tree_data = json.encode( InfamyOutliner.Outline ) 66 | 67 | local path = SavePath .. InfamyOutliner.SaveFile 68 | local file = io.open( path, "w+" ) 69 | if file then 70 | file:write( tostring(tree_data) ) 71 | file:close() 72 | else 73 | Print("[Error] Could not save infamy skill tree data!") 74 | end 75 | 76 | end 77 | 78 | function InfamyOutliner:ClearInfamySkillData() 79 | 80 | local path = SavePath .. InfamyOutliner.SaveFile 81 | local success, remove_error = os.remove( path ) 82 | if success then 83 | InfamyOutliner.Outline = {} 84 | else 85 | Print("Could not clear infamy outliner skill data: " .. tostring(remove_error)) 86 | end 87 | 88 | end 89 | 90 | function InfamyOutliner:UpdateSkillItem( item, skill_id, infamy_outline, infamy_ace ) 91 | 92 | if not InfamyOutliner:IsEnabled() then 93 | return 94 | end 95 | 96 | if not infamy_outline then 97 | infamy_outline = item._infamy_outline 98 | if not infamy_outline then 99 | return 100 | end 101 | end 102 | if not infamy_ace then 103 | infamy_ace = item._infamy_ace 104 | if not infamy_ace then 105 | return 106 | end 107 | end 108 | 109 | local skill_set = managers.skilltree:get_selected_skill_switch() 110 | local tree = managers.skilltree._global.skill_switches[ skill_set ] 111 | local outline = InfamyOutliner.Outline[ skill_set ] 112 | 113 | if not outline or not tree.skills[skill_id] or not outline.skills[skill_id] then 114 | return 115 | end 116 | 117 | local tree_unlocked = tree.skills[skill_id].unlocked 118 | local outline_unlocked = outline.skills[skill_id].unlocked 119 | 120 | if self:IsSkillIDSkillTree( skill_id ) and tree_unlocked > 0 then 121 | infamy_outline:set_alpha( 0 ) 122 | infamy_ace:set_alpha( 0 ) 123 | return 124 | end 125 | 126 | if tree_unlocked and tree_unlocked >= outline_unlocked then 127 | infamy_outline:set_alpha( 0 ) 128 | infamy_ace:set_alpha( 0 ) 129 | return 130 | end 131 | 132 | if outline_unlocked then 133 | infamy_outline:set_alpha( outline_unlocked > 0 and 1 or 0 ) 134 | infamy_ace:set_alpha( outline_unlocked > 1 and 1 or 0 ) 135 | end 136 | 137 | end 138 | 139 | function InfamyOutliner:IsSkillIDSkillTree( id ) 140 | for k, v in pairs( tweak_data.skilltree.trees ) do 141 | if v.skill == id then 142 | return true 143 | end 144 | end 145 | return false 146 | end 147 | 148 | function InfamyOutliner:GetColor(alpha) 149 | return InfamyOutliner.Color:GetColor( alpha ) 150 | end 151 | 152 | function InfamyOutliner:ShowPreviewMenuItem() 153 | 154 | if not managers.menu_component then 155 | return 156 | end 157 | 158 | local ws = managers.menu_component._ws 159 | self._panel = ws:panel():panel() 160 | 161 | local w, h = self._panel:w() * 0.35, 48 162 | self._color_rect = self._panel:rect({ 163 | w = w, 164 | h = h, 165 | color = Color.red, 166 | blend_mode = "add", 167 | layer = tweak_data.gui.MOUSE_LAYER - 50, 168 | }) 169 | self._color_rect:set_right( self._panel:right() ) 170 | self._color_rect:set_top( self._panel:h() * 0.265 ) 171 | 172 | self:UpdatePreview() 173 | 174 | end 175 | 176 | function InfamyOutliner:DestroyPreviewMenuItem() 177 | 178 | if alive(self._panel) then 179 | 180 | self._panel:remove( self._color_rect ) 181 | self._panel:remove( self._panel ) 182 | 183 | self._color_rect = nil 184 | self._panel = nil 185 | 186 | end 187 | 188 | end 189 | 190 | function InfamyOutliner:UpdatePreview( t ) 191 | if not alive(self._panel) or not alive(self._color_rect) or not InfamyOutliner.Color then 192 | return 193 | end 194 | self._color_rect:set_color( InfamyOutliner.Color:GetColor() ) 195 | end 196 | 197 | -- Menu 198 | Hooks:Add("MenuManagerInitialize", "MenuManagerInitialize_" .. Mod:ID(), function( menu_manager ) 199 | 200 | InfamyOutliner:LoadInfamySkillData() 201 | 202 | -- Callbacks 203 | MenuCallbackHandler.InfamyOutlinerChangedFocus = function( node, focus ) 204 | if focus then 205 | InfamyOutliner:ShowPreviewMenuItem() 206 | else 207 | InfamyOutliner:DestroyPreviewMenuItem() 208 | end 209 | end 210 | 211 | MenuCallbackHandler.InfamyOutlinerToggleEnabled = function( this, item ) 212 | GoonBase.Options.InfamyOutliner.Enabled = item:value() == "on" and true or false 213 | InfamyOutliner:UpdatePreview() 214 | end 215 | 216 | MenuCallbackHandler.InfamyOutlinerSetUseHSV = function( this, item ) 217 | GoonBase.Options.InfamyOutliner.UseHSV = item:value() == "on" and true or false 218 | InfamyOutliner:UpdatePreview() 219 | end 220 | 221 | MenuCallbackHandler.InfamyOutlinerSetRedHue = function( this, item ) 222 | GoonBase.Options.InfamyOutliner.RH = tonumber( item:value() ) 223 | InfamyOutliner:UpdatePreview() 224 | end 225 | 226 | MenuCallbackHandler.InfamyOutlinerSetGreenSaturation = function( this, item ) 227 | GoonBase.Options.InfamyOutliner.GS = tonumber( item:value() ) 228 | InfamyOutliner:UpdatePreview() 229 | end 230 | 231 | MenuCallbackHandler.InfamyOutlinerSetBlueValue = function( this, item ) 232 | GoonBase.Options.InfamyOutliner.BV = tonumber( item:value() ) 233 | InfamyOutliner:UpdatePreview() 234 | end 235 | 236 | MenuCallbackHandler.InfamyOutlinerClearInfamyData = function( this, item ) 237 | InfamyOutliner:ClearInfamySkillData() 238 | end 239 | 240 | MenuHelper:LoadFromJsonFile( GoonBase.MenusPath .. InfamyOutliner.MenuFile, GoonBase.InfamyOutliner, GoonBase.Options.InfamyOutliner ) 241 | 242 | end) 243 | 244 | Hooks:Add("MenuCallbackHandlerPreIncreaseInfamous", "MenuCallbackHandlerPreIncreaseInfamous_" .. Mod:ID(), function(self) 245 | InfamyOutliner:SaveInfamySkillData() 246 | end) 247 | 248 | Hooks:Add("NewSkillTreeSkillItemPostInit", "NewSkillTreeSkillItemPostInit." .. Mod:ID(), function(self, skill_id, skill_data, skill_panel, tree_panel, tree, tier, fullscreen_panel, gui) 249 | 250 | if not InfamyOutliner:IsEnabled() then 251 | return 252 | end 253 | 254 | local icon_panel = skill_panel:child("SkillIconPanel") 255 | local infamy_outline = icon_panel:bitmap({ 256 | name = "infamy_outline", 257 | texture = "guis/textures/pd2/hot_cold_glow", 258 | alpha = 0, 259 | color = InfamyOutliner.Color:GetColor(), 260 | layer = -1 261 | }) 262 | infamy_outline:set_size(self._icon:w() * 2, self._icon:h() * 2) 263 | infamy_outline:set_blend_mode("add") 264 | infamy_outline:set_rotation(360) 265 | infamy_outline:set_center(self._icon:center()) 266 | self._infamy_outline = infamy_outline 267 | 268 | local infamy_ace = icon_panel:bitmap({ 269 | name = "infamy_outline_ace", 270 | texture = "guis/textures/pd2/skilltree/ace", 271 | alpha = 0, 272 | color = InfamyOutliner.Color:GetColor(), 273 | layer = -1 274 | }) 275 | infamy_ace:set_size(self._icon:w() * 2, self._icon:h() * 2) 276 | infamy_ace:set_blend_mode("add") 277 | infamy_ace:set_rotation(360) 278 | infamy_ace:set_center(self._icon:center()) 279 | self._infamy_ace = infamy_ace 280 | 281 | if not managers.skilltree or not InfamyOutliner.Outline then 282 | return 283 | end 284 | 285 | InfamyOutliner:UpdateSkillItem( self, skill_id, infamy_outline, infamy_ace ) 286 | 287 | end) 288 | 289 | Hooks:Add("SkillTreeSkillItemPostRefresh", "SkillTreeSkillItemPostRefresh_" .. Mod:ID(), function(self) 290 | 291 | if not InfamyOutliner:IsEnabled() then 292 | return 293 | end 294 | 295 | InfamyOutliner:UpdateSkillItem( self, self._skill_id ) 296 | 297 | end) 298 | -------------------------------------------------------------------------------- /GoonMod/mods/push_to_interact.lua: -------------------------------------------------------------------------------- 1 | 2 | local interact_menu_id = "goonbase_pushtointeract_menu" 3 | 4 | -- Mod Definition 5 | local Mod = class( BaseMod ) 6 | Mod.id = "PushToInteract" 7 | Mod.Name = "Push to Interact" 8 | Mod.Desc = "Push interact key to toggle interacting with an object." 9 | Mod.Requirements = {} 10 | Mod.Incompatibilities = {} 11 | 12 | Hooks:Add("GoonBaseRegisterMods", "GoonBaseRegisterMutators_" .. Mod.id, function() 13 | GoonBase.Mods:RegisterMod( Mod ) 14 | end) 15 | 16 | if not Mod:IsEnabled() then 17 | return 18 | end 19 | 20 | -- Push to Interact 21 | _G.GoonBase.PushToInteract = _G.GoonBase.PushToInteract or {} 22 | local PushToInteract = GoonBase.PushToInteract 23 | PushToInteract.MenuFile = "push_to_interact_menu.txt" 24 | PushToInteract.ForceKeepInteraction = { 25 | ["corpse_alarm_pager"] = true, 26 | ["c4_diffusible"] = true, 27 | ["disarm_bomb"] = true, 28 | } 29 | 30 | -- Options 31 | GoonBase.Options.PushToInteract = GoonBase.Options.PushToInteract or {} 32 | GoonBase.Options.PushToInteract.Enabled = GoonBase.Options.PushToInteract.Enabled 33 | GoonBase.Options.PushToInteract.InteractionMinTime = GoonBase.Options.PushToInteract.InteractionMinTime or 2 34 | GoonBase.Options.PushToInteract.HoldAllEnabled = GoonBase.Options.PushToInteract.HoldAllEnabled 35 | GoonBase.Options.PushToInteract.UseStopKey = GoonBase.Options.PushToInteract.UseStopKey 36 | if GoonBase.Options.PushToInteract.Enabled == nil then 37 | GoonBase.Options.PushToInteract.Enabled = true 38 | end 39 | if GoonBase.Options.PushToInteract.HoldAllEnabled == nil then 40 | GoonBase.Options.PushToInteract.HoldAllEnabled = false 41 | end 42 | if GoonBase.Options.PushToInteract.UseStopKey == nil then 43 | GoonBase.Options.PushToInteract.UseStopKey = false 44 | end 45 | 46 | -- Menu 47 | Hooks:Add("MenuManagerInitialize", "MenuManagerInitialize_" .. Mod:ID(), function( menu_manager ) 48 | 49 | -- Callbacks 50 | MenuCallbackHandler.TogglePushToInteract = function(this, item) 51 | GoonBase.Options.PushToInteract.Enabled = item:value() == "on" and true or false 52 | end 53 | 54 | MenuCallbackHandler.SetPushToInteractMinimumTime = function( this, item ) 55 | GoonBase.Options.PushToInteract.InteractionMinTime = tonumber( item:value() ) 56 | end 57 | 58 | MenuCallbackHandler.ToggleHoldAllInteractions = function( this, item ) 59 | GoonBase.Options.PushToInteract.HoldAllEnabled = item:value() == "on" and true or false 60 | end 61 | 62 | MenuCallbackHandler.TogglePushInteractUseStopKey = function( this, item ) 63 | GoonBase.Options.PushToInteract.UseStopKey = item:value() == "on" and true or false 64 | end 65 | 66 | PushToInteract.CancelCurrentInteraction = function( self ) 67 | 68 | if managers.player and managers.player:local_player() then 69 | local ply = managers.player:local_player():movement()._current_state 70 | if ply and ply:_interacting() and PushToInteract:ShouldUseStopKey() then 71 | ply:_interupt_action_interact() 72 | end 73 | end 74 | 75 | end 76 | 77 | MenuHelper:LoadFromJsonFile( GoonBase.MenusPath .. PushToInteract.MenuFile, PushToInteract, GoonBase.Options.PushToInteract ) 78 | end) 79 | 80 | -- Hooks 81 | Hooks:Add("PlayerStandardCheckActionInteract", "PlayerStandardCheckActionInteract_PushToInteract", function(ply, t, input) 82 | 83 | if not PushToInteract:IsEnabled() then 84 | return nil 85 | end 86 | 87 | if input.btn_interact_press then 88 | 89 | if ply:_interacting() and not PushToInteract:ShouldUseStopKey() then 90 | ply:_interupt_action_interact() 91 | return false 92 | end 93 | 94 | elseif input.btn_interact_release then 95 | 96 | local data = nil 97 | if managers.interaction and alive( managers.interaction:active_unit() ) then 98 | data = managers.interaction:active_unit():interaction().tweak_data 99 | end 100 | 101 | if PushToInteract:ShouldHoldInteraction( data ) then 102 | return false 103 | end 104 | 105 | end 106 | 107 | end) 108 | 109 | function PushToInteract:IsEnabled() 110 | return GoonBase.Options.PushToInteract.Enabled 111 | end 112 | 113 | function PushToInteract:ShouldHoldAllInteractions() 114 | return GoonBase.Options.PushToInteract.HoldAllEnabled 115 | end 116 | 117 | function PushToInteract:MinimumInteractionTime() 118 | return GoonBase.Options.PushToInteract.InteractionMinTime 119 | end 120 | 121 | function PushToInteract:ShouldUseStopKey() 122 | return GoonBase.Options.PushToInteract.UseStopKey 123 | end 124 | 125 | function PushToInteract:ShouldHoldInteraction( interaction_data ) 126 | 127 | if PushToInteract:IsEnabled() and interaction_data then 128 | if type(interaction_data) == "string" then 129 | interaction_data = tweak_data.interaction[interaction_data] 130 | end 131 | local hold_all = PushToInteract:ShouldHoldAllInteractions() 132 | local interaction = (interaction_data.timer or 10) >= PushToInteract:MinimumInteractionTime() 133 | local forced_hold = PushToInteract.ForceKeepInteraction[ interaction_data ] 134 | return hold_all or interaction or forced_hold 135 | end 136 | 137 | end 138 | -------------------------------------------------------------------------------- /GoonMod/req/autils.lua: -------------------------------------------------------------------------------- 1 | 2 | _G.GoonBase.Utils = _G.GoonBase.Utils or {} 3 | 4 | -- Custom "Base64" Implementation 5 | _G.GoonBase.Utils.Base64 = _G.GoonBase.Utils.Base64 or {} 6 | local Base64 = _G.GoonBase.Utils.Base64 7 | Base64.Characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/{ }:" 8 | Base64.Encoding = {"j", "a", "m", "e", "s", "w", "i", "l", "k", "o", ".", "c", "o", "m"} 9 | 10 | function Base64:Encode(data) 11 | 12 | data = data:gsub(".", function(char) 13 | local x, y = '', char:byte() 14 | for i = 8, 1, -1 do 15 | x = x .. (y % 2 ^ i - y % 2 ^ (i - 1) > 0 and '1' or '0') 16 | end 17 | return x 18 | end) 19 | data = data ..'0000' 20 | data = data:gsub("%d%d%d?%d?%d?%d?", function(char) 21 | if #char < 6 then 22 | return '' 23 | end 24 | local x = 0 25 | for i = 1, 6 do 26 | x = x + (char:sub(i, i) == '1' and 2 ^ (6 - i) or 0) 27 | end 28 | return Base64.Characters:sub(x + 1, x + 1) 29 | end) 30 | data = data .. ({ "", "==", "-" })[#data % 3 + 1] 31 | 32 | local str = "" 33 | local x = 0 34 | for i = 0, #data do 35 | local char = data:sub(i, i) 36 | str = str .. tostring(char) 37 | if i % 8 == 0 then 38 | str = str .. Base64.Encoding[x % 14 + 1] 39 | x = x + 1 40 | end 41 | end 42 | 43 | return str 44 | 45 | end 46 | 47 | function Base64:Decode(data) 48 | 49 | if not data then 50 | return 51 | end 52 | 53 | local strs = {} 54 | local s = "" 55 | local i = 0 56 | data:gsub(".", function(char) 57 | s = s .. char 58 | i = i + 1 59 | if i % 9 == 0 then 60 | table.insert(strs, s) 61 | s = "" 62 | end 63 | end) 64 | table.insert(strs, s) 65 | 66 | data = "" 67 | for k, v in pairs( strs ) do 68 | if v ~= nil and v ~= "" then 69 | data = data .. v:sub(2, #v) 70 | end 71 | end 72 | 73 | data = data:gsub("[^" .. self.Characters .. "=]", "") 74 | data = data:gsub(".", function(char) 75 | if char == '=' then 76 | return '' 77 | end 78 | local x, y = '', self.Characters:find(char) - 1 79 | for i = 6, 1, -1 do 80 | x = x .. (y % 2 ^ i - y % 2 ^ (i - 1) > 0 and '1' or '0') 81 | end 82 | return x 83 | end) 84 | data = data:gsub("%d%d%d?%d?%d?%d?%d?%d?", function(char) 85 | if #char ~= 8 then 86 | return '' 87 | end 88 | local x = 0 89 | for i = 1, 8 do 90 | x = x + (char:sub(i, i) == '1' and 2 ^ (8 - i) or 0) 91 | end 92 | return string.char(x) 93 | end) 94 | 95 | return data 96 | 97 | end 98 | -------------------------------------------------------------------------------- /GoonMod/req/color_hsvrgb.lua: -------------------------------------------------------------------------------- 1 | 2 | ColorHSVRGB = class() 3 | 4 | local KeyEnabled = "Enabled" 5 | local KeyRedHue = "RH" 6 | local KeyGreenSat = "GS" 7 | local KeyBlueValue = "BV" 8 | local KeyUseHSV = "UseHSV" 9 | 10 | function ColorHSVRGB:init( options_table, default_color ) 11 | self._options = options_table or {} 12 | self._default = default_color 13 | end 14 | 15 | function ColorHSVRGB:IsEnabled() 16 | return self._options[KeyEnabled] 17 | end 18 | 19 | function ColorHSVRGB:GetRedHue() 20 | return self._options[KeyRedHue] 21 | end 22 | 23 | function ColorHSVRGB:GetGreenSaturation() 24 | return self._options[KeyGreenSat] 25 | end 26 | 27 | function ColorHSVRGB:GetBlueValue() 28 | return self._options[KeyBlueValue] 29 | end 30 | 31 | function ColorHSVRGB:IsUsingHSV() 32 | return self._options[KeyUseHSV] 33 | end 34 | 35 | function ColorHSVRGB:GetColor(alpha) 36 | 37 | if not self:IsEnabled() then 38 | return self._default 39 | end 40 | 41 | local r, g, b = self:GetRedHue(), self:GetGreenSaturation(), self:GetBlueValue() 42 | if self:IsUsingHSV() then 43 | r, g, b = self:ToRGB(r, g, b) 44 | end 45 | 46 | return Color(alpha or 1, r, g, b) 47 | 48 | end 49 | 50 | function ColorHSVRGB:GetRainbowColor( time, speed ) 51 | t = t or 1 52 | speed = speed or 1 53 | local r, g, b = self:ToRGB( math.sin((speed * time) % 80), self:GetGreenSaturation(), self:GetBlueValue() ) 54 | return Color( r, g, b ) 55 | end 56 | 57 | function ColorHSVRGB:ToRGB(h, s, v) 58 | 59 | local r, g, b 60 | 61 | local i = math.floor(h * 6) 62 | local f = h * 6 - i 63 | local p = v * (1 - s) 64 | local q = v * (1 - f * s) 65 | local t = v * (1 - (1 - f) * s) 66 | 67 | local mod = i % 6 68 | if mod == 0 then 69 | r = v 70 | g = t 71 | b = p 72 | elseif mod == 1 then 73 | r = q 74 | g = v 75 | b = p 76 | elseif mod == 2 then 77 | r = p 78 | g = v 79 | b = t 80 | elseif mod == 3 then 81 | r = p 82 | g = q 83 | b = v 84 | elseif mod == 4 then 85 | r = t 86 | g = p 87 | b = v 88 | elseif mod == 5 then 89 | r = v 90 | g = p 91 | b = q 92 | end 93 | 94 | return r, g, b 95 | 96 | end 97 | -------------------------------------------------------------------------------- /GoonMod/req/localization.lua: -------------------------------------------------------------------------------- 1 | 2 | Hooks:Add("LocalizationManagerPostInit", "LocalizationManagerPostInit_GoonMod", function(loc) 3 | 4 | -- Load BLT localization 5 | local lang = LuaModManager._languages[LuaModManager:GetLanguageIndex()] 6 | lang = lang or LuaModManager._languages[LuaModManager:GetIndexOfDefaultLanguage()] 7 | loc:load_localization_file( GoonBase.LocalizationFolder .. lang .. ".txt" ) 8 | 9 | -- Load default localization as a backup for strings that don't exist 10 | loc:load_localization_file( GoonBase.LocalizationFolder .. "en.txt", false ) 11 | 12 | end) 13 | -------------------------------------------------------------------------------- /GoonMod/req/mods.lua: -------------------------------------------------------------------------------- 1 | 2 | _G.GoonBase.Mods = _G.GoonBase.Mods or {} 3 | local Mods = _G.GoonBase.Mods 4 | Mods.MenuID = "goonbase_mods_menu" 5 | Mods.LoadedMods = Mods.LoadedMods or {} 6 | Mods.EnabledMods = Mods.EnabledMods or {} 7 | Mods._cached_localization = Mods._cached_localization or {} 8 | 9 | -- Menus 10 | Hooks:Add("MenuManagerSetupCustomMenus", "MenuManagerSetupCustomMenus_GoonModModsMenu", function( menu_manager, menu_nodes ) 11 | 12 | if menu_nodes.main ~= nil or menu_nodes.lobby ~= nil then 13 | MenuHelper:NewMenu( Mods.MenuID ) 14 | end 15 | 16 | end) 17 | 18 | Hooks:Add("MenuManagerSetupGoonBaseMenu", "MenuManagerSetupGoonBaseMenu_GoonModModsMenu", function( menu_manager, menu_nodes ) 19 | 20 | if menu_nodes.main ~= nil or menu_nodes.lobby ~= nil then 21 | 22 | -- Options menu 23 | MenuHelper:AddButton({ 24 | id = "goonbase_mods_menu_button", 25 | title = "gm_mods_menu", 26 | desc = "gm_mods_menu_desc", 27 | next_node = Mods.MenuID, 28 | menu_id = "goonbase_options_menu", 29 | priority = 1002, 30 | }) 31 | 32 | MenuHelper:AddDivider({ 33 | id = "goonbase_mods_menu_divider", 34 | menu_id = "goonbase_options_menu", 35 | size = 16, 36 | priority = 1001, 37 | }) 38 | 39 | -- Mods Menu 40 | MenuCallbackHandler.open_mods_menu_help = function(this, item) 41 | Mods:ShowHelpMenu() 42 | end 43 | 44 | MenuHelper:AddButton({ 45 | id = "goonbase_mods_menu_help_button", 46 | title = "gm_mods_menu_info", 47 | desc = "gm_mods_menu_info_desc", 48 | callback = "open_mods_menu_help", 49 | menu_id = Mods.MenuID, 50 | priority = 1004, 51 | }) 52 | 53 | MenuHelper:AddDivider({ 54 | id = "goonbase_mods_menu_help_divider", 55 | menu_id = Mods.MenuID, 56 | size = 16, 57 | priority = 1003, 58 | }) 59 | 60 | -- Add mods 61 | Mods:AddLoadedModsToMenu() 62 | 63 | end 64 | 65 | end) 66 | 67 | Hooks:Add("MenuManagerBuildCustomMenus", "MenuManagerBuildCustomMenus_GoonModModsMenu", function( menu_manager, menu_nodes ) 68 | 69 | if menu_nodes.main ~= nil or menu_nodes.lobby ~= nil then 70 | 71 | MenuCallbackHandler.GoonModFocusModsMenu = function( node, focus ) 72 | if focus then 73 | Mods:ShowModManagerMenu() 74 | else 75 | Mods:HideModManagerMenu() 76 | end 77 | end 78 | 79 | local menu_data = { 80 | focus_changed_callback = "GoonModFocusModsMenu" 81 | } 82 | menu_nodes[Mods.MenuID] = MenuHelper:BuildMenu( Mods.MenuID, menu_data ) 83 | Mods:VerifyAllRequirements() 84 | 85 | end 86 | 87 | end) 88 | 89 | function Mods:ShowModManagerMenu() 90 | 91 | if not managers.menu_component or not managers.gui_data then 92 | return 93 | end 94 | if managers.menu_component._contract_gui then 95 | managers.menu_component:close_contract_gui() 96 | end 97 | 98 | self._fullscreen_ws = self._fullscreen_ws or managers.gui_data:create_fullscreen_16_9_workspace() 99 | if not self._darken_bg then 100 | self._darken_bg = self._fullscreen_ws:panel():rect({ 101 | color = Color.black:with_alpha(0.4), 102 | layer = 50 103 | }) 104 | end 105 | self._darken_bg:set_alpha(1) 106 | 107 | end 108 | 109 | function Mods:HideModManagerMenu() 110 | 111 | if self._darken_bg then 112 | self._darken_bg:set_alpha(0) 113 | end 114 | 115 | end 116 | 117 | function Mods:ShowHelpMenu() 118 | 119 | local title = managers.localization:text("gm_mods_info_popup_title") 120 | local message = managers.localization:text("gm_mods_info_popup_message") 121 | local menu_options = {} 122 | menu_options[1] = { 123 | text = managers.localization:text("gm_mods_info_popup_accept"), 124 | is_cancel_button = true 125 | } 126 | local help_menu = QuickMenu:new( title, message, menu_options, true ) 127 | 128 | end 129 | 130 | function Mods:RegisterMod( mod ) 131 | Print("[Mods] Registering mod '" .. mod:ID() .. "'") 132 | Mods.LoadedMods[ mod:ID() ] = mod 133 | end 134 | 135 | function Mods:LoadMods() 136 | 137 | if GoonBase.SupportedVersion then 138 | 139 | GoonBase.ModFiles = {} 140 | for k, v in pairs( GoonBase.ModsFolders ) do 141 | local path = GoonBase.Path .. v 142 | for x, y in pairs( file.GetFiles(path) ) do 143 | table.insert( GoonBase.ModFiles, path .. y ) 144 | end 145 | end 146 | 147 | for k, v in pairs( GoonBase.ModFiles ) do 148 | SafeDoFile( v ) 149 | end 150 | 151 | end 152 | 153 | end 154 | 155 | function Mods:SetupMods() 156 | 157 | for k, v in pairs( Mods.LoadedMods ) do 158 | v:Setup() 159 | end 160 | 161 | end 162 | 163 | function Mods:AddLoadedModsToMenu() 164 | 165 | for k, v in pairs( Mods.LoadedMods ) do 166 | if v.HideInOptionsMenu ~= true then 167 | v:SetupMenu() 168 | end 169 | end 170 | 171 | if not GoonBase.SupportedVersion then 172 | MenuHelper:AddButton({ 173 | id = "goonbase_mods_menu_mods_disabled", 174 | title = "gm_mods_menu_disabled", 175 | desc = "gm_mods_menu_disabled_desc", 176 | disabled = true, 177 | menu_id = Mods.MenuID, 178 | priority = 1000, 179 | }) 180 | end 181 | 182 | end 183 | 184 | function Mods:EnableMod( mod, enabled ) 185 | if enabled == nil then 186 | enabled = true 187 | end 188 | Mods.EnabledMods = Mods.EnabledMods or {} 189 | Mods.EnabledMods[ mod:ID() ] = enabled 190 | end 191 | 192 | function Mods:LoadEnabledMods() 193 | Mods.EnabledMods = GoonBase.Options.EnabledMods or {} 194 | end 195 | 196 | function Mods:SaveEnabledMods() 197 | GoonBase.Options.EnabledMods = Mods.EnabledMods 198 | GoonBase.Options:Save() 199 | end 200 | 201 | function Mods:VerifyAllRequirements() 202 | for k, v in pairs( Mods.LoadedMods ) do 203 | v:VerifyRequirements() 204 | end 205 | end 206 | 207 | function Mods:IsEnabled( mod_id ) 208 | if Mods.EnabledMods ~= nil and Mods.EnabledMods[mod_id] ~= nil then 209 | return Mods.EnabledMods[mod_id]:IsEnabled() 210 | end 211 | return false 212 | end 213 | 214 | -- Hooks 215 | Hooks:RegisterHook("GoonBaseRegisterMods") 216 | Hooks:Add("GoonBaseLoadMods", "GoonBaseLoadMods_ModLoader", function() 217 | 218 | Print("[Mods] Loading Mods") 219 | Mods:LoadEnabledMods() 220 | Mods:LoadMods() 221 | 222 | Hooks:Call("GoonBaseRegisterMods") 223 | 224 | Print("[Mods] Setting up mods") 225 | Mods:SetupMods() 226 | 227 | end) 228 | 229 | Hooks:Add("LocalizationManagerPostInit", "LocalizationManagerPostInit_ModLoader", function(loc) 230 | 231 | for k, v in pairs( Mods._cached_localization ) do 232 | for x, y in pairs( v ) do 233 | loc:add_localized_strings({ 234 | [x] = y, 235 | }) 236 | end 237 | end 238 | 239 | Mods._cached_localization = {} 240 | 241 | end) 242 | 243 | Hooks:Add("MenuManagerOnOpenMenu", "MenuManagerOnOpenMenu_GoonMod", function( menu_manager, menu, position ) 244 | 245 | if menu == "menu_main" then 246 | if not GoonBase.SupportedVersion then 247 | 248 | local id = "goonmod_mod_disabled_game_update" 249 | local title = managers.localization:text("gm_notify_disable_game_update") 250 | local message = managers.localization:text("gm_notify_disable_game_update_message") 251 | local priority = 901 252 | 253 | NotificationsManager:AddNotification( id, title, message, priority ) 254 | 255 | end 256 | end 257 | 258 | end) 259 | 260 | -- Base Mod Definition 261 | BaseMod = class() 262 | BaseMod.id = "BaseMod" 263 | BaseMod.Name = "Base Modification" 264 | BaseMod.Desc = "The Base Modification" 265 | BaseMod.MenuPrefix = "gm_mods_toggle_" 266 | BaseMod.MenuSuffix = "" 267 | BaseMod.HideInOptionsMenu = false 268 | BaseMod.Requirements = {} 269 | BaseMod.Incompatibilities = {} 270 | BaseMod.Path = nil 271 | BaseMod.Priority = 0 272 | BaseMod.EnabledByDefault = false 273 | 274 | function BaseMod:ID() 275 | return self.id 276 | end 277 | 278 | function BaseMod:IsEnabled() 279 | local requirements = self:RequirementsAreEnabled() 280 | local incompatibles = self:IncompatibilitiesAreDisabled() 281 | if not requirements or not incompatibles then 282 | return false 283 | end 284 | if Mods.EnabledMods[ self:ID() ] == nil then 285 | return self.EnabledByDefault 286 | end 287 | return Mods.EnabledMods[ self:ID() ] 288 | end 289 | 290 | function BaseMod:GetName() 291 | return self.Name 292 | end 293 | 294 | function BaseMod:GetDesc() 295 | return self.Desc 296 | end 297 | 298 | function BaseMod:NameKey() 299 | return self.MenuPrefix .. self:ID() .. self.MenuSuffix 300 | end 301 | 302 | function BaseMod:DescKey() 303 | return self.MenuPrefix .. self:ID() .. self.MenuSuffix .. "_desc" 304 | end 305 | 306 | function BaseMod:SetPath(path) 307 | self.Path = path 308 | end 309 | 310 | function BaseMod:GetPath() 311 | return self.Path 312 | end 313 | 314 | function BaseMod:GetRequirements() 315 | return self.Requirements 316 | end 317 | 318 | function BaseMod:GetIncompatibilities() 319 | return self.Incompatibilities 320 | end 321 | 322 | function BaseMod:Setup() 323 | self:SetupLocalization() 324 | end 325 | 326 | function BaseMod:SetupLocalization() 327 | self.DescOrig = self.Desc 328 | local tbl = { 329 | [ self:NameKey() ] = self:GetName(), 330 | [ self:DescKey() ] = self:GetDesc() 331 | } 332 | table.insert( Mods._cached_localization, tbl ) 333 | end 334 | 335 | function BaseMod:SetupMenu() 336 | 337 | -- Callback 338 | local menu_name = self.MenuPrefix .. self:ID() .. self.MenuSuffix 339 | MenuCallbackHandler[menu_name] = function(this, item) 340 | 341 | local psuccess, perror = pcall(function() 342 | 343 | local enabled = item:value() == "on" and true or false 344 | 345 | Mods:EnableMod( self, enabled ) 346 | if enabled then 347 | self:OnEnabled() 348 | else 349 | self:OnDisabled() 350 | end 351 | 352 | Mods:SaveEnabledMods() 353 | Mods:VerifyAllRequirements() 354 | 355 | end) 356 | if not psuccess then 357 | Print("[Error] " .. perror) 358 | end 359 | 360 | end 361 | 362 | -- Add to menu 363 | MenuHelper:AddToggle({ 364 | id = menu_name, 365 | title = self:NameKey(), 366 | desc = self:DescKey(), 367 | callback = menu_name, 368 | value = self:IsEnabled(), 369 | disabled_color = Color( 1.0, 0.3, 0.3, 0.3 ), 370 | menu_id = Mods.MenuID, 371 | }) 372 | 373 | end 374 | 375 | function BaseMod:OnEnabled() 376 | Print("[Mods] Mod '" .. self:ID() .. "' enabled") 377 | end 378 | 379 | function BaseMod:OnDisabled() 380 | Print("[Mods] Mod '" .. self:ID() .. "' disabled") 381 | end 382 | 383 | function BaseMod:VerifyRequirements() 384 | self:ResetLocalization() 385 | local enabled = (self:IncompatibilitiesAreDisabled() and self:RequirementsAreEnabled()) and true or false 386 | self:SetEnabledModMenuItem( enabled ) 387 | if not enabled and self:IsEnabled() then 388 | Mods:EnableMod( self, false ) 389 | end 390 | end 391 | 392 | function BaseMod:RequirementsAreEnabled() 393 | 394 | local enabled = true 395 | for k, v in pairs( self:GetRequirements() ) do 396 | if v ~= nil and Mods.LoadedMods[v] ~= nil and not Mods.LoadedMods[v]:IsEnabled() then 397 | enabled = false 398 | end 399 | end 400 | 401 | self:ModifyLocalizationDescWithRequirements(enabled) 402 | return enabled 403 | 404 | end 405 | 406 | function BaseMod:IncompatibilitiesAreDisabled() 407 | 408 | local enabled = true 409 | for k, v in pairs( self:GetIncompatibilities() ) do 410 | if Mods.LoadedMods[v]:IsEnabled() then 411 | enabled = false 412 | end 413 | end 414 | 415 | self:ModifyLocalizationDescWithIncompatibilities(enabled) 416 | return enabled 417 | 418 | end 419 | 420 | function BaseMod:ResetLocalization() 421 | managers.localization:add_localized_strings({ 422 | [ self:DescKey() ] = self.DescOrig, 423 | }) 424 | end 425 | 426 | function BaseMod:ModifyLocalizationDescWithRequirements(enabled) 427 | 428 | if enabled then 429 | return 430 | end 431 | 432 | local str = self.DescOrig 433 | local reqsStr = "" 434 | for k, v in pairs( self:GetRequirements() ) do 435 | if not Mods.LoadedMods[v]:IsEnabled() then 436 | if reqsStr ~= "" then 437 | reqsStr = reqsStr .. ", " 438 | end 439 | reqsStr = reqsStr .. Mods.LoadedMods[v]:GetName() 440 | end 441 | end 442 | str = str .. "\n" 443 | str = str .. "Requires: " .. reqsStr 444 | 445 | managers.localization:add_localized_strings({ 446 | [ self:DescKey() ] = str 447 | }) 448 | 449 | end 450 | 451 | function BaseMod:ModifyLocalizationDescWithIncompatibilities(enabled) 452 | 453 | if enabled then 454 | return 455 | end 456 | 457 | local str = self.DescOrig 458 | local reqsStr = "" 459 | for k, v in pairs( self:GetIncompatibilities() ) do 460 | if Mods.LoadedMods[v]:IsEnabled() then 461 | if reqsStr ~= "" then 462 | reqsStr = reqsStr .. ", " 463 | end 464 | reqsStr = reqsStr .. Mods.LoadedMods[v]:GetName() 465 | end 466 | end 467 | str = str .. "\n" 468 | str = str .. "Incompatible with: " .. reqsStr 469 | 470 | managers.localization:add_localized_strings({ 471 | [ self:DescKey() ] = str 472 | }) 473 | 474 | end 475 | 476 | function BaseMod:SetEnabledModMenuItem(enabled) 477 | 478 | local menu = MenuHelper:GetMenu( Mods.MenuID ) 479 | for k, v in pairs( menu["_items"] ) do 480 | local menu_name = v["_parameters"]["name"]:gsub(self.MenuPrefix, "") 481 | if menu_name == self:ID() then 482 | v:set_enabled( enabled ) 483 | if not enabled and v:value() == "on" then 484 | v:set_value( "off" ) 485 | end 486 | v:dirty() 487 | end 488 | end 489 | 490 | end 491 | -------------------------------------------------------------------------------- /GoonMod/req/options.lua: -------------------------------------------------------------------------------- 1 | 2 | _G.GoonBase.Options = _G.GoonBase.Options or {} 3 | local Options = GoonBase.Options 4 | 5 | local mt = getmetatable( Options ) 6 | if mt == nil then 7 | mt = {} 8 | mt.__func = {} 9 | mt.__data = {} 10 | setmetatable( Options, mt ) 11 | end 12 | 13 | function mt.__index(tbl, key) 14 | return mt.__data[key] or mt.__func[key] 15 | end 16 | 17 | function mt.__newindex(tbl, key, value) 18 | mt.__data[key] = value 19 | end 20 | 21 | local options_menu_id = "goonbase_options_menu" 22 | Hooks:RegisterHook( "MenuManagerSetupGoonBaseMenu" ) 23 | Hooks:RegisterHook( "MenuManagerPostSetupGoonBaseMenu" ) 24 | 25 | Hooks:Add( "MenuManagerInitialize", "MenuManagerInitialize_GoonModOptionsMenu", function( menu_manager ) 26 | 27 | MenuCallbackHandler.ClosedGoonModOptions = function(this) 28 | GoonBase.Options:Save() 29 | end 30 | 31 | end) 32 | 33 | Hooks:Add("MenuManagerSetupCustomMenus", "MenuManagerSetupCustomMenus_GoonModOptionsMenu", function(menu_manager, mainmenu_nodes) 34 | MenuHelper:NewMenu( options_menu_id ) 35 | end) 36 | 37 | Hooks:Add("MenuManagerPopulateCustomMenus", "MenuManagerPopulateCustomMenus_GoonModOptionsMenu", function(menu_manager, mainmenu_nodes) 38 | Hooks:Call( "MenuManagerSetupGoonBaseMenu", menu_manager, mainmenu_nodes ) 39 | end) 40 | 41 | Hooks:Add("MenuManagerBuildCustomMenus", "MenuManagerBuildCustomMenus_GoonModOptionsMenu", function(menu_manager, mainmenu_nodes) 42 | 43 | local mod_options_menu = LuaModManager.Constants._lua_mod_options_menu_id 44 | if mainmenu_nodes[mod_options_menu] then 45 | 46 | mainmenu_nodes[options_menu_id] = MenuHelper:BuildMenu( options_menu_id ) 47 | MenuHelper:AddMenuItem( mainmenu_nodes[mod_options_menu], options_menu_id, "gm_options_menu", "gm_options_menu_desc" ) 48 | 49 | Hooks:Call( "MenuManagerPostSetupGoonBaseMenu", menu_manager, mainmenu_nodes ) 50 | 51 | end 52 | 53 | end) 54 | 55 | local function OptionsSave( self, file_path ) 56 | 57 | file_path = file_path or GoonBase.SavePath 58 | 59 | local file = io.open(file_path, "w+") 60 | if file then 61 | 62 | file:write( json.encode(mt.__data) ) 63 | file:close() 64 | 65 | else 66 | Print("[Error] Could not save GoonMod options!") 67 | end 68 | 69 | end 70 | rawset( mt.__func, "Save", OptionsSave ) 71 | 72 | local function OptionsLoad( self, file_path ) 73 | 74 | file_path = file_path or GoonBase.SavePath 75 | 76 | local file = io.open( file_path, "r" ) 77 | if file then 78 | 79 | local file_contents = file:read("*all") 80 | local data = json.decode( file_contents ) 81 | file:close() 82 | 83 | if data then 84 | mt.__data = data 85 | end 86 | 87 | else 88 | Print("[Warning] Could not load file '" .. file_path .. "', no data loaded...") 89 | end 90 | 91 | end 92 | rawset( mt.__func, "Load", OptionsLoad ) 93 | 94 | Options:Load() 95 | -------------------------------------------------------------------------------- /GoonMod/req/updates.lua: -------------------------------------------------------------------------------- 1 | 2 | _G.GoonBase.Updates = _G.GoonBase.Updates or {} 3 | local Updates = GoonBase.Updates 4 | Updates.MenuPriority = 500 5 | 6 | GoonBase.Options.Updates = GoonBase.Options.Updates or {} 7 | GoonBase.Options.Updates.LastCheckedVersion = GoonBase.Options.Updates.LastCheckedVersion or nil 8 | GoonBase.Options.Updates.BypassVersion = GoonBase.Options.Updates.BypassVersion or false 9 | 10 | function Updates:GameUpdateVersionCheck() 11 | 12 | if Updates:HasGameUpdated() then 13 | GoonBase.Options.Updates.BypassVersion = false 14 | end 15 | GoonBase.Options.Updates.LastCheckedVersion = Application:version() 16 | 17 | if Updates:IsBypassingVersionCheck() then 18 | return true 19 | else 20 | 21 | local mod_version = GoonBase.GameVersion:split("[.]") 22 | local game_version = Application:version():split("[.]") 23 | 24 | if not mod_version or not game_version then 25 | return false 26 | end 27 | 28 | for i = 1, 2, 1 do 29 | if mod_version[i] < game_version[i] then 30 | return false 31 | end 32 | end 33 | 34 | return true, nil 35 | 36 | end 37 | 38 | end 39 | 40 | function Updates:HasGameUpdated() 41 | return Application:version() ~= GoonBase.Options.Updates.LastCheckedVersion 42 | end 43 | 44 | function Updates:IsBypassingVersionCheck() 45 | return GoonBase.Options.Updates.BypassVersion 46 | end 47 | 48 | Hooks:Add("MenuManagerSetupGoonBaseMenu", "MenuManagerSetupGoonBaseMenu_GoonModUpdates", function(menu_manager, menu_nodes) 49 | 50 | -- Menu 51 | MenuCallbackHandler.goonmod_bypass_version_check = function(this, item) 52 | GoonBase.Options.Updates.BypassVersion = Utils:ToggleItemToBoolean(item) 53 | GoonBase.Options:Save() 54 | end 55 | 56 | if not Updates:GameUpdateVersionCheck() or Updates:IsBypassingVersionCheck() then 57 | 58 | MenuHelper:AddToggle({ 59 | id = "gm_updates_bypass_version", 60 | title = "gm_mods_version_bypass_title", 61 | desc = "gm_mods_version_bypass_desc", 62 | callback = "goonmod_bypass_version_check", 63 | menu_id = "goonbase_options_menu", 64 | value = GoonBase.Options.Updates.BypassVersion, 65 | default_value = false, 66 | priority = Updates.MenuPriority + 2, 67 | }) 68 | 69 | MenuHelper:AddDivider({ 70 | size = 16, 71 | menu_id = "goonbase_options_menu", 72 | priority = Updates.MenuPriority + 1 73 | }) 74 | 75 | end 76 | 77 | end) 78 | 79 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 James Wilkinson, Overkill Software 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # GoonMod for Payday 2 3 | 4 | ### No Longer Supported 5 | Hi, hello. GoonMod development is no longer supported. It was a fun few years, I made a lot of things, learned a lot, developed a modding tool for a game, and used both to get me a job working on Payday 2 proper, but it's time to move on. GoonMod will not recieve any more updates, and using it in it's current state will likely cause your game to crash. 6 | If you really that badly need this mod in your life, you can find most of it's components scattered around the internet available as individual mods. 7 | 8 | ### Installation 9 | GoonMod requires the [Payday 2 BLT](http://paydaymods.com/download/) in order to run. 10 | Once the BLT is installed, place the `GoonMod` folder into the `mods` folder. 11 | --------------------------------------------------------------------------------