Add other mods
This commit is contained in:
12
Performance Fix/Lua/Autorun/init.lua
Normal file
12
Performance Fix/Lua/Autorun/init.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
if SERVER then
|
||||
PerformanceFix = {}
|
||||
PerformanceFix.Path = ...
|
||||
|
||||
if not File.Exists(PerformanceFix.Path .. "/config.json") then
|
||||
File.Write(PerformanceFix.Path .. "/config.json", json.serialize(dofile(PerformanceFix.Path .. "/Lua/defaultconfig.lua")))
|
||||
end
|
||||
|
||||
PerformanceFix.Config = json.parse(File.Read(PerformanceFix.Path .. "/config.json"))
|
||||
|
||||
dofile(PerformanceFix.Path .. "/Lua/performancefix.lua")
|
||||
end
|
17
Performance Fix/Lua/ForcedAutorun/init.lua
Normal file
17
Performance Fix/Lua/ForcedAutorun/init.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
if CLIENT then
|
||||
PerformanceFix = {}
|
||||
PerformanceFix.Path = ...
|
||||
|
||||
if not File.Exists(PerformanceFix.Path .. "/config.json") then
|
||||
File.Write(PerformanceFix.Path .. "/config.json", json.serialize(dofile(PerformanceFix.Path .. "/Lua/defaultconfig.lua")))
|
||||
end
|
||||
|
||||
PerformanceFix.Config = json.parse(File.Read(PerformanceFix.Path .. "/config.json"))
|
||||
|
||||
Game.AddCommand("performancefix_reload", "reloads config", function ()
|
||||
dofile(PerformanceFix.Path .. "/Lua/performancefix.lua")
|
||||
end)
|
||||
|
||||
dofile(PerformanceFix.Path .. "/Lua/performancefix_gui.lua")
|
||||
dofile(PerformanceFix.Path .. "/Lua/performancefix.lua")
|
||||
end
|
49
Performance Fix/Lua/MultiLineTextBox.lua
Normal file
49
Performance Fix/Lua/MultiLineTextBox.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
-- why barotrauma's GUI libraries don't have this implemented by default? this is stupid
|
||||
|
||||
local function updateServerMessageScrollBasedOnCaret(textBox, listBox)
|
||||
local caretY = textBox.CaretScreenPos.Y;
|
||||
local bottomCaretExtent = textBox.Font.LineHeight * 1.5
|
||||
local topCaretExtent = -textBox.Font.LineHeight * 0.5
|
||||
|
||||
if caretY + bottomCaretExtent > listBox.Rect.Bottom then
|
||||
listBox.ScrollBar.BarScroll
|
||||
= (caretY - textBox.Rect.Top - listBox.Rect.Height + bottomCaretExtent)
|
||||
/ (textBox.Rect.Height - listBox.Rect.Height)
|
||||
elseif (caretY + topCaretExtent < listBox.Rect.Top) then
|
||||
listBox.ScrollBar.BarScroll
|
||||
= (caretY - textBox.Rect.Top + topCaretExtent)
|
||||
/ (textBox.Rect.Height - listBox.Rect.Height)
|
||||
end
|
||||
end
|
||||
|
||||
local function CreateMultiLineTextBox(rectransform, text, size)
|
||||
local multineListBox = GUI.ListBox(GUI.RectTransform(Vector2(1, size or 0.2), rectransform))
|
||||
|
||||
local textBox = GUI.TextBox(GUI.RectTransform(Vector2(1, 1), multineListBox.Content.RectTransform), text, nil, nil, nil, true, "GUITextBoxNoBorder")
|
||||
|
||||
textBox.add_OnSelected(function ()
|
||||
updateServerMessageScrollBasedOnCaret(textBox, multineListBox)
|
||||
end)
|
||||
|
||||
textBox.OnTextChangedDelegate = function ()
|
||||
local textSize = textBox.Font.MeasureString(textBox.WrappedText);
|
||||
textBox.RectTransform.NonScaledSize = Point(textBox.RectTransform.NonScaledSize.X, math.max(multineListBox.Content.Rect.Height, textSize.Y + 10))
|
||||
multineListBox.UpdateScrollBarSize()
|
||||
|
||||
return true;
|
||||
end
|
||||
|
||||
textBox.OnEnterPressed = function ()
|
||||
local str = textBox.Text
|
||||
local caretIndex = textBox.CaretIndex
|
||||
|
||||
textBox.Text = str:sub(1, caretIndex) .. "\n" .. str:sub(caretIndex + 1)
|
||||
textBox.CaretIndex = caretIndex + 1
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return textBox
|
||||
end
|
||||
|
||||
return CreateMultiLineTextBox
|
43
Performance Fix/Lua/defaultconfig.lua
Normal file
43
Performance Fix/Lua/defaultconfig.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
-- DO NOT EDIT THIS CONFIG, THIS IS JUST A TEMPLATE
|
||||
|
||||
local config = {}
|
||||
|
||||
config.accumulatorMax = 150
|
||||
|
||||
config.clientMapEntityUpdateInterval = 4
|
||||
config.serverMapEntityUpdateInterval = 1
|
||||
|
||||
config.clientCharacterUpdateInterval = 1
|
||||
config.serverCharacterUpdateInterval = 1
|
||||
|
||||
config.poweredUpdateInterval = 1
|
||||
|
||||
config.clientItemHighPriority = {
|
||||
"door", "doorwbuttons", "windoweddoorwbuttons", "windoweddoor", "hatchwbuttons", "sonartransducer", "divingsuit",
|
||||
"combatdivingsuit", "abyssdivingsuit", "pucs", "slipsuit",
|
||||
"battery", "delaycomponent", "acidmistemitter"
|
||||
}
|
||||
|
||||
config.serverItemHighPriority = { "battery",
|
||||
"delaycomponent", "acidmistemitter"
|
||||
}
|
||||
|
||||
config.clientComponentPriority = { "Engine", "Pump", "Sonar", "Fabricator", "Deconstructor", "Reactor", "Turret",
|
||||
"Controller" }
|
||||
config.serverComponentPriority = { "Engine", "Pump", "Sonar", "Fabricator", "Deconstructor", "Reactor", "Turret",
|
||||
"Controller" }
|
||||
|
||||
config.highPriorityCharacters = { "Human" }
|
||||
|
||||
config.serverHighPriorityHands = true
|
||||
config.clientHighPriorityHands = true
|
||||
|
||||
|
||||
config.allowSingleplayerPermanentConfigs = false
|
||||
|
||||
config.disableShadowCastingLights = false
|
||||
config.disableDrawBehindSubsLights = false
|
||||
config.hideInGameWires = false
|
||||
config.hideInGameComponents = false
|
||||
|
||||
return config
|
98
Performance Fix/Lua/easysettings.lua
Normal file
98
Performance Fix/Lua/easysettings.lua
Normal file
@@ -0,0 +1,98 @@
|
||||
local easySettings = {}
|
||||
|
||||
easySettings.Settings = {}
|
||||
|
||||
local GUIComponent = LuaUserData.CreateStatic("Barotrauma.GUIComponent")
|
||||
|
||||
local function GetChildren(comp)
|
||||
local tbl = {}
|
||||
for value in comp.GetAllChildren() do
|
||||
table.insert(tbl, value)
|
||||
end
|
||||
return tbl
|
||||
end
|
||||
|
||||
Hook.Patch("Barotrauma.GUI", "TogglePauseMenu", {}, function ()
|
||||
if GUI.GUI.PauseMenuOpen then
|
||||
local frame = GUI.GUI.PauseMenu
|
||||
|
||||
local list = GetChildren(GetChildren(frame)[2])[1]
|
||||
|
||||
for key, value in pairs(easySettings.Settings) do
|
||||
local button = GUI.Button(GUI.RectTransform(Vector2(1, 0.1), list.RectTransform), value.Name, GUI.Alignment.Center, "GUIButtonSmall")
|
||||
|
||||
button.OnClicked = function ()
|
||||
value.OnOpen(frame)
|
||||
end
|
||||
end
|
||||
end
|
||||
end, Hook.HookMethodType.After)
|
||||
|
||||
easySettings.SaveTable = function (path, tbl)
|
||||
File.Write(path, json.serialize(tbl))
|
||||
end
|
||||
easySettings.LoadTable = function (path)
|
||||
if not File.Exists(path) then
|
||||
return {}
|
||||
end
|
||||
|
||||
return json.parse(File.Read(path))
|
||||
end
|
||||
|
||||
easySettings.AddMenu = function (name, onOpen)
|
||||
table.insert(easySettings.Settings, {Name = name, OnOpen = onOpen})
|
||||
end
|
||||
|
||||
easySettings.BasicList = function (parent, size)
|
||||
local menuContent = GUI.Frame(GUI.RectTransform(size or Vector2(0.6, 0.6), parent.RectTransform, GUI.Anchor.Center))
|
||||
local menuList = GUI.ListBox(GUI.RectTransform(Vector2(1, 0.95), menuContent.RectTransform, GUI.Anchor.TopCenter))
|
||||
|
||||
easySettings.CloseButton(menuContent)
|
||||
|
||||
return menuList
|
||||
end
|
||||
|
||||
easySettings.TickBox = function (parent, text, onSelected, state)
|
||||
if state == nil then state = true end
|
||||
|
||||
local tickBox = GUI.TickBox(GUI.RectTransform(Vector2(1, 0.2), parent.RectTransform), text)
|
||||
tickBox.Selected = state
|
||||
tickBox.OnSelected = function ()
|
||||
onSelected(tickBox.State == GUIComponent.ComponentState.Selected)
|
||||
end
|
||||
|
||||
return tickBox
|
||||
end
|
||||
|
||||
easySettings.Slider = function (parent, min, max, onSelected, value)
|
||||
local scrollBar = GUI.ScrollBar(GUI.RectTransform(Vector2(1, 0.1), parent.RectTransform), 0.1, nil, "GUISlider")
|
||||
scrollBar.Range = Vector2(min, max)
|
||||
scrollBar.BarScrollValue = value or max / 2
|
||||
scrollBar.OnMoved = function ()
|
||||
onSelected(scrollBar.BarScrollValue)
|
||||
end
|
||||
|
||||
return scrollBar
|
||||
end
|
||||
|
||||
easySettings.CloseButton = function (parent)
|
||||
local button = GUI.Button(GUI.RectTransform(Vector2(1, 0.05), parent.RectTransform, GUI.Anchor.BottomCenter), "Close", GUI.Alignment.Center, "GUIButton")
|
||||
|
||||
button.OnClicked = function ()
|
||||
GUI.GUI.TogglePauseMenu()
|
||||
end
|
||||
|
||||
return button
|
||||
end
|
||||
|
||||
easySettings.Open = function (name)
|
||||
for key, value in pairs(easySettings.Settings) do
|
||||
if value.Name == name then
|
||||
local frame = GUI.GUI.PauseMenu
|
||||
|
||||
value.OnOpen(frame)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return easySettings
|
166
Performance Fix/Lua/performancefix.lua
Normal file
166
Performance Fix/Lua/performancefix.lua
Normal file
@@ -0,0 +1,166 @@
|
||||
local invertedHighPriorityItems = {}
|
||||
local invertedHighPriorityCharacters = {}
|
||||
local highPriorityComponents = {}
|
||||
|
||||
local signalComponents = {}
|
||||
|
||||
if SERVER then
|
||||
Game.mapEntityUpdateInterval = PerformanceFix.Config.serverMapEntityUpdateInterval
|
||||
Game.characterUpdateInterval = PerformanceFix.Config.serverCharacterUpdateInterval
|
||||
|
||||
highPriorityComponents = PerformanceFix.Config.serverComponentPriority
|
||||
|
||||
for key, value in pairs(PerformanceFix.Config.serverItemHighPriority) do
|
||||
invertedHighPriorityItems[value] = key
|
||||
end
|
||||
|
||||
for key, value in pairs(PerformanceFix.Config.highPriorityCharacters) do
|
||||
invertedHighPriorityCharacters[value] = key
|
||||
end
|
||||
|
||||
Hook.Add("item.equip", "highPriorityHands", function(item, char)
|
||||
Game.RemovePriorityItem(item)
|
||||
Game.AddPriorityItem(item)
|
||||
end)
|
||||
else
|
||||
local result, error = pcall(function()
|
||||
Game.mapEntityUpdateInterval = PerformanceFix.Config.clientMapEntityUpdateInterval
|
||||
Game.characterUpdateInterval = PerformanceFix.Config.clientCharacterUpdateInterval
|
||||
|
||||
if Game.IsMultiplayer then
|
||||
Game.poweredUpdateInterval = PerformanceFix.Config.poweredUpdateInterval or 1
|
||||
end
|
||||
|
||||
Timer.AccumulatorMax = (PerformanceFix.Config.accumulatorMax or 50) / 1000
|
||||
end)
|
||||
|
||||
if error then
|
||||
printerror("The below error most likely was thrown because of an outdated Lua client, please consider updating.")
|
||||
printerror(error)
|
||||
end
|
||||
|
||||
highPriorityComponents = PerformanceFix.Config.clientComponentPriority
|
||||
|
||||
for key, value in pairs(PerformanceFix.Config.clientItemHighPriority) do
|
||||
invertedHighPriorityItems[value] = key
|
||||
end
|
||||
|
||||
for key, value in pairs(PerformanceFix.Config.highPriorityCharacters) do
|
||||
invertedHighPriorityCharacters[value] = key
|
||||
end
|
||||
|
||||
Hook.Add("item.equip", "highPriorityHands", function(item, char)
|
||||
Game.RemovePriorityItem(item)
|
||||
Game.AddPriorityItem(item)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Hook.Add("think", "signalUpdatePerformanceFix", function()
|
||||
for key, value in pairs(signalComponents) do
|
||||
value.SendSignal(tostring(Game.mapEntityUpdateInterval), "signal_out")
|
||||
end
|
||||
end)
|
||||
|
||||
local function IsPriority(item)
|
||||
if item.HasTag("highpriority") or invertedHighPriorityItems[item.Prefab.Identifier.Value] ~= nil then
|
||||
return true
|
||||
end
|
||||
|
||||
for _, comp in pairs(highPriorityComponents) do
|
||||
if item.GetComponentString(comp) ~= nil then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local function SetPriority()
|
||||
if CLIENT then
|
||||
for k, v in pairs(Item.ItemList) do
|
||||
if PerformanceFix.Config.allowSingleplayerPermanentConfigs and Game.IsSingleplayer then
|
||||
break
|
||||
end
|
||||
|
||||
if string.find(v.Tags, "performancefix") then
|
||||
table.insert(signalComponents, v)
|
||||
end
|
||||
|
||||
local light = v.GetComponentString("LightComponent")
|
||||
|
||||
if light ~= nil then
|
||||
if PerformanceFix.Config.disableShadowCastingLights then
|
||||
light.CastShadows = false
|
||||
end
|
||||
if PerformanceFix.Config.disableDrawBehindSubsLights then
|
||||
light.DrawBehindSubs = false
|
||||
end
|
||||
end
|
||||
|
||||
if PerformanceFix.Config.hideInGameWires then
|
||||
local wire = v.GetComponentString("Wire")
|
||||
|
||||
if wire and #wire.Connections ~= 0 then
|
||||
wire.Item.HiddenInGame = true
|
||||
end
|
||||
end
|
||||
|
||||
if PerformanceFix.Config.hideInGameComponents then
|
||||
if v.HasTag("logic") then
|
||||
v.HiddenInGame = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Game.ClearPriorityItem()
|
||||
Game.ClearPriorityCharacter()
|
||||
|
||||
for key, value in pairs(Item.ItemList) do
|
||||
if IsPriority(value) then
|
||||
Game.AddPriorityItem(value)
|
||||
end
|
||||
end
|
||||
|
||||
for key, value in pairs(Character.CharacterList) do
|
||||
if invertedHighPriorityCharacters[value.SpeciesName.Value] then
|
||||
Game.AddPriorityCharacter(value)
|
||||
end
|
||||
|
||||
if value.Inventory ~= nil then
|
||||
local rightItem = value.Inventory.GetItemInLimbSlot(InvSlotType.RightHand)
|
||||
local leftItem = value.Inventory.GetItemInLimbSlot(InvSlotType.LeftHand)
|
||||
|
||||
if rightItem ~= nil then
|
||||
Game.AddPriorityItem(rightItem)
|
||||
end
|
||||
|
||||
if leftItem ~= nil then
|
||||
Game.AddPriorityItem(leftItem)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Hook.Add("roundStart", "initRoundStart", function()
|
||||
Timer.Wait(function()
|
||||
SetPriority()
|
||||
end, 1000)
|
||||
end)
|
||||
|
||||
|
||||
Hook.Add("characterCreated", "addToPriority", function(character)
|
||||
if invertedHighPriorityCharacters[character.SpeciesName.Value] then
|
||||
Game.AddPriorityCharacter(character)
|
||||
end
|
||||
end)
|
||||
|
||||
Hook.Add("item.created", "addToPriority", function (item)
|
||||
if IsPriority(item) then
|
||||
Game.AddPriorityItem(item)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
SetPriority()
|
301
Performance Fix/Lua/performancefix_gui.lua
Normal file
301
Performance Fix/Lua/performancefix_gui.lua
Normal file
@@ -0,0 +1,301 @@
|
||||
-- I'm sorry for the eyes of anyone looking at the GUI code.
|
||||
|
||||
local MultiLineTextBox = dofile(PerformanceFix.Path .. "/Lua/MultiLineTextBox.lua")
|
||||
local easySettings = dofile(PerformanceFix.Path .. "/Lua/easysettings.lua")
|
||||
|
||||
Game.AddCommand("performancefix", "opens performance fix gui", function ()
|
||||
PerformanceFix.ToggleGUI()
|
||||
end)
|
||||
|
||||
local GUIComponent = LuaUserData.CreateStatic("Barotrauma.GUIComponent")
|
||||
|
||||
local function CommaStringToTable(str)
|
||||
local tbl = {}
|
||||
|
||||
for word in string.gmatch(str, '([^,]+)') do
|
||||
table.insert(tbl, word)
|
||||
end
|
||||
|
||||
return tbl
|
||||
end
|
||||
|
||||
local function ClearElements(guicomponent, removeItself)
|
||||
local toRemove = {}
|
||||
|
||||
for value in guicomponent.GetAllChildren() do
|
||||
table.insert(toRemove, value)
|
||||
end
|
||||
|
||||
for index, value in pairs(toRemove) do
|
||||
value.RemoveChild(value)
|
||||
end
|
||||
|
||||
if guicomponent.Parent and removeItself then
|
||||
guicomponent.Parent.RemoveChild(guicomponent)
|
||||
end
|
||||
end
|
||||
|
||||
local function GetAmountOfPrefab(prefabs)
|
||||
local amount = 0
|
||||
for key, value in prefabs do
|
||||
amount = amount + 1
|
||||
end
|
||||
|
||||
return amount
|
||||
end
|
||||
|
||||
Hook.Add("stop", "PerformanceFix.CleanupGUI", function ()
|
||||
if selectedGUIText then
|
||||
selectedGUIText.Parent.RemoveChild(selectedGUIText)
|
||||
end
|
||||
|
||||
if PerformanceFix.GUIFrame then
|
||||
ClearElements(PerformanceFix.GUIFrame, true)
|
||||
end
|
||||
end)
|
||||
|
||||
PerformanceFix.ShowGUI = function (frame)
|
||||
PerformanceFix.GUIFrame = frame
|
||||
|
||||
local config = easySettings.BasicList(frame)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Active Items: " .. tostring(#Item.ItemList), nil, nil)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Active Characters: " .. tostring(#Character.CharacterList), nil, nil)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Active Walls: " .. tostring(#Structure.WallList), nil, nil)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Active Submarines: " .. tostring(#Submarine.Loaded), nil, nil)
|
||||
|
||||
local shadowCastingLights = 0
|
||||
local drawBehindSubLights = 0
|
||||
for key, value in pairs(Item.ItemList) do
|
||||
local light = value.GetComponentString("LightComponent")
|
||||
|
||||
if light and light.IsOn then
|
||||
if light.CastShadows then shadowCastingLights = shadowCastingLights + 1 end
|
||||
if light.DrawBehindSubs then drawBehindSubLights = drawBehindSubLights + 1 end
|
||||
end
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Draw Behind Sub Lights: " .. tostring(shadowCastingLights), nil, nil)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Shadow Casting Lights: " .. tostring(drawBehindSubLights), nil, nil)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "", nil, nil)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Item Prefabs Loaded: " .. tostring(GetAmountOfPrefab(ItemPrefab.Prefabs)), nil, nil)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Character Prefabs Loaded: " .. tostring(GetAmountOfPrefab(CharacterPrefab.Prefabs)), nil, nil)
|
||||
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Submarines Loaded In Memory: " .. tostring(#SubmarineInfo.SavedSubmarines), nil, nil)
|
||||
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), "Performance Fix Config", nil, nil, GUI.Alignment.Center)
|
||||
|
||||
local btn = GUI.Button(GUI.RectTransform(Vector2(1, 0.2), config.Content.RectTransform), "Save Config and Reload Client-Side Performance Fix", GUI.Alignment.Center, "GUIButtonSmall")
|
||||
btn.OnClicked = function ()
|
||||
File.Write(PerformanceFix.Path .. "/config.json", json.serialize(PerformanceFix.Config))
|
||||
|
||||
dofile(PerformanceFix.Path .. "/Lua/performancefix.lua")
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), "Note: Server configurations require you to either restart or use the command reloadlua to change it. For dedicated servers you need to edit the file config.json, this GUI wont work.", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Timing Accumulator Max", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), "Lower values of Timing Accumulator Max means the game will more aggressively skip ticks, thus it can improve performance when your game is running really slowly. The games default is 250.", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local accumulatorMax = GUI.NumberInput(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), NumberType.Int)
|
||||
|
||||
accumulatorMax.MinValueInt = 1
|
||||
accumulatorMax.MaxValueInt = 1000
|
||||
accumulatorMax.valueStep = 10
|
||||
|
||||
if PerformanceFix.Config.accumulatorMax == nil then
|
||||
accumulatorMax.IntValue = 250
|
||||
else
|
||||
accumulatorMax.IntValue = PerformanceFix.Config.accumulatorMax
|
||||
end
|
||||
|
||||
accumulatorMax.OnValueChanged = function ()
|
||||
PerformanceFix.Config.accumulatorMax = accumulatorMax.IntValue
|
||||
end
|
||||
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Client Map Entity Interval", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local clientMapEntityUpdateInterval = GUI.NumberInput(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), NumberType.Int)
|
||||
|
||||
clientMapEntityUpdateInterval.MinValueInt = 1
|
||||
clientMapEntityUpdateInterval.MaxValueInt = 60
|
||||
|
||||
clientMapEntityUpdateInterval.IntValue = PerformanceFix.Config.clientMapEntityUpdateInterval
|
||||
|
||||
clientMapEntityUpdateInterval.OnValueChanged = function ()
|
||||
PerformanceFix.Config.clientMapEntityUpdateInterval = clientMapEntityUpdateInterval.IntValue
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Server Map Entity Interval", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local serverMapEntityUpdateInterval = GUI.NumberInput(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), NumberType.Int)
|
||||
|
||||
serverMapEntityUpdateInterval.MinValueInt = 1
|
||||
serverMapEntityUpdateInterval.MaxValueInt = 60
|
||||
|
||||
serverMapEntityUpdateInterval.IntValue = PerformanceFix.Config.serverMapEntityUpdateInterval
|
||||
|
||||
serverMapEntityUpdateInterval.OnValueChanged = function ()
|
||||
PerformanceFix.Config.serverMapEntityUpdateInterval = serverMapEntityUpdateInterval.IntValue
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Powered Update Interval (Client-Side only and only works on multiplayer)", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local poweredUpdateInterval = GUI.NumberInput(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), NumberType.Int)
|
||||
|
||||
poweredUpdateInterval.MinValueInt = 1
|
||||
poweredUpdateInterval.MaxValueInt = 60
|
||||
|
||||
poweredUpdateInterval.IntValue = PerformanceFix.Config.poweredUpdateInterval or 1
|
||||
|
||||
poweredUpdateInterval.OnValueChanged = function ()
|
||||
PerformanceFix.Config.poweredUpdateInterval = poweredUpdateInterval.IntValue
|
||||
end
|
||||
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Client High Priority Items", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local clientHighPriorityItems = MultiLineTextBox(config.Content.RectTransform, "", 0.2)
|
||||
|
||||
clientHighPriorityItems.Text = table.concat(PerformanceFix.Config.clientItemHighPriority, ",")
|
||||
|
||||
clientHighPriorityItems.OnTextChangedDelegate = function (textBox)
|
||||
PerformanceFix.Config.clientItemHighPriority = CommaStringToTable(textBox.Text)
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Server High Priority Items", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local serverHighPriorityItems = MultiLineTextBox(config.Content.RectTransform, "", 0.2)
|
||||
|
||||
serverHighPriorityItems.Text = table.concat(PerformanceFix.Config.serverItemHighPriority, ",")
|
||||
|
||||
serverHighPriorityItems.OnTextChangedDelegate = function (textBox)
|
||||
PerformanceFix.Config.serverItemHighPriority = CommaStringToTable(textBox.Text)
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Client High Priority Components", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local clientHighPriorityComponents = MultiLineTextBox(config.Content.RectTransform, "", 0.2)
|
||||
|
||||
clientHighPriorityComponents.Text = table.concat(PerformanceFix.Config.clientComponentPriority, ",")
|
||||
|
||||
clientHighPriorityComponents.OnTextChangedDelegate = function (textBox)
|
||||
PerformanceFix.Config.clientComponentPriority = CommaStringToTable(textBox.Text)
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Server High Priority Components", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local serverHighPriorityComponents = MultiLineTextBox(config.Content.RectTransform, "", 0.2)
|
||||
|
||||
serverHighPriorityComponents.Text = table.concat(PerformanceFix.Config.serverComponentPriority, ",")
|
||||
|
||||
serverHighPriorityComponents.OnTextChangedDelegate = function (textBox)
|
||||
PerformanceFix.Config.serverComponentPriority = CommaStringToTable(textBox.Text)
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), "Character Update Config (Extra Experimental)", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Client Character Update Interval", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local clientCharacterUpdateInterval = GUI.NumberInput(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), NumberType.Int)
|
||||
|
||||
clientCharacterUpdateInterval.MinValueInt = 1
|
||||
clientCharacterUpdateInterval.MaxValueInt = 60
|
||||
|
||||
clientCharacterUpdateInterval.IntValue = PerformanceFix.Config.clientCharacterUpdateInterval
|
||||
|
||||
clientCharacterUpdateInterval.OnValueChanged = function ()
|
||||
PerformanceFix.Config.clientCharacterUpdateInterval = clientCharacterUpdateInterval.IntValue
|
||||
end
|
||||
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "Server Character Update Interval", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local serverCharacterUpdateInterval = GUI.NumberInput(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), NumberType.Int)
|
||||
|
||||
serverCharacterUpdateInterval.MinValueInt = 1
|
||||
serverCharacterUpdateInterval.MaxValueInt = 60
|
||||
|
||||
serverCharacterUpdateInterval.IntValue = PerformanceFix.Config.serverCharacterUpdateInterval
|
||||
|
||||
serverCharacterUpdateInterval.OnValueChanged = function ()
|
||||
PerformanceFix.Config.serverCharacterUpdateInterval = serverCharacterUpdateInterval.IntValue
|
||||
end
|
||||
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.05), config.Content.RectTransform), "High Priority Characters", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
local highPriorityCharacters = MultiLineTextBox(config.Content.RectTransform, "", 0.2)
|
||||
|
||||
highPriorityCharacters.Text = table.concat(PerformanceFix.Config.highPriorityCharacters, ",")
|
||||
|
||||
highPriorityCharacters.OnTextChangedDelegate = function (textBox)
|
||||
PerformanceFix.Config.highPriorityCharacters = CommaStringToTable(textBox.Text)
|
||||
end
|
||||
|
||||
GUI.TextBlock(GUI.RectTransform(Vector2(1, 0.1), config.Content.RectTransform), "WARNING: THE BELOW CONFIGS ARE PERMANENT FOR SINGLEPLAYER AND IN MULTIPLAYER ARE REVERSIBLE BY RESTARTING THE ROUND.", nil, nil, GUI.Alignment.Center, true)
|
||||
|
||||
|
||||
local singleplayerPermanent = GUI.TickBox(GUI.RectTransform(Vector2(1, 0.2), config.Content.RectTransform), "Allow Permanent Configs In Singleplayer")
|
||||
|
||||
singleplayerPermanent.Selected = PerformanceFix.Config.allowSingleplayerPermanentConfigs or false
|
||||
|
||||
singleplayerPermanent.OnSelected = function ()
|
||||
PerformanceFix.Config.allowSingleplayerPermanentConfigs = singleplayerPermanent.State == GUIComponent.ComponentState.Selected
|
||||
end
|
||||
|
||||
|
||||
local shadowCasting = GUI.TickBox(GUI.RectTransform(Vector2(1, 0.2), config.Content.RectTransform), "Disable Shadow Casting Lights")
|
||||
|
||||
shadowCasting.Selected = PerformanceFix.Config.disableShadowCastingLights
|
||||
|
||||
shadowCasting.OnSelected = function ()
|
||||
PerformanceFix.Config.disableShadowCastingLights = shadowCasting.State == GUIComponent.ComponentState.Selected
|
||||
end
|
||||
|
||||
local drawBehindSub = GUI.TickBox(GUI.RectTransform(Vector2(1, 0.2), config.Content.RectTransform), "Disable Draw Behind Subs Lights")
|
||||
|
||||
drawBehindSub.Selected = PerformanceFix.Config.disableDrawBehindSubsLights
|
||||
|
||||
drawBehindSub.OnSelected = function ()
|
||||
PerformanceFix.Config.disableDrawBehindSubsLights = drawBehindSub.State == GUIComponent.ComponentState.Selected
|
||||
end
|
||||
|
||||
local hideInGameWires = GUI.TickBox(GUI.RectTransform(Vector2(1, 0.2), config.Content.RectTransform), "Hide In Game Wires")
|
||||
|
||||
hideInGameWires.Selected = PerformanceFix.Config.hideInGameWires
|
||||
|
||||
hideInGameWires.OnSelected = function ()
|
||||
PerformanceFix.Config.hideInGameWires = hideInGameWires.State == GUIComponent.ComponentState.Selected
|
||||
end
|
||||
|
||||
local hideInGameComponents = GUI.TickBox(GUI.RectTransform(Vector2(1, 0.2), config.Content.RectTransform), "Hide In Game Components")
|
||||
|
||||
hideInGameComponents.Selected = PerformanceFix.Config.hideInGameComponents
|
||||
|
||||
hideInGameComponents.OnSelected = function ()
|
||||
PerformanceFix.Config.hideInGameComponents = hideInGameComponents.State == GUIComponent.ComponentState.Selected
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
easySettings.AddMenu("Performance Fix", PerformanceFix.ShowGUI)
|
||||
|
||||
PerformanceFix.ToggleGUI = function ()
|
||||
GUI.GUI.TogglePauseMenu()
|
||||
|
||||
if GUI.GUI.PauseMenuOpen then
|
||||
easySettings.Open("Performance Fix")
|
||||
end
|
||||
end
|
1
Performance Fix/config.json
Normal file
1
Performance Fix/config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"accumulatorMax":150,"clientMapEntityUpdateInterval":4,"serverMapEntityUpdateInterval":1,"clientCharacterUpdateInterval":1,"serverCharacterUpdateInterval":1,"poweredUpdateInterval":1,"clientItemHighPriority":["door","doorwbuttons","windoweddoorwbuttons","windoweddoor","hatchwbuttons","sonartransducer","divingsuit","combatdivingsuit","abyssdivingsuit","pucs","slipsuit","battery","delaycomponent","acidmistemitter"],"serverItemHighPriority":["battery","delaycomponent","acidmistemitter"],"clientComponentPriority":["Engine","Pump","Sonar","Fabricator","Deconstructor","Reactor","Turret","Controller"],"serverComponentPriority":["Engine","Pump","Sonar","Fabricator","Deconstructor","Reactor","Turret","Controller"],"highPriorityCharacters":["Human"],"serverHighPriorityHands":true,"clientHighPriorityHands":true,"allowSingleplayerPermanentConfigs":false,"disableShadowCastingLights":false,"disableDrawBehindSubsLights":false,"hideInGameWires":false,"hideInGameComponents":false}
|
2
Performance Fix/filelist.xml
Normal file
2
Performance Fix/filelist.xml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<contentpackage name="Performance Fix" modversion="1.0.15" corepackage="False" steamworkshopid="2701251094" gameversion="1.7.7.0" altnames="PerformanceFix" expectedhash="E541F1E4532FC4809FCD939E332DE319" />
|
Reference in New Issue
Block a user