Fixed up and added back limit ghost feature (#353)

This commit is contained in:
thegrb93 2021-01-30 04:16:54 -05:00 committed by GitHub
parent 72dff27b04
commit 92442ff183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -176,7 +176,7 @@ local function SpawnGhosts()
if AdvDupe2.CurrentGhost==AdvDupe2.HeadEnt then AdvDupe2.CurrentGhost = AdvDupe2.CurrentGhost + 1 end
local g = AdvDupe2.GhostToSpawn[AdvDupe2.CurrentGhost]
if g then
if g and AdvDupe2.CurrentGhost/AdvDupe2.TotalGhosts*100 <= GetConVarNumber("advdupe2_limit_ghost") then
AdvDupe2.GhostEntities[AdvDupe2.CurrentGhost] = MakeGhostsFromTable(g)
if(not AdvDupe2.BusyBar)then
AdvDupe2.ProgressBar.Percent = AdvDupe2.CurrentGhost/AdvDupe2.TotalGhosts*100
@ -250,7 +250,7 @@ function AdvDupe2.StartGhosting()
AdvDupe2.TotalGhosts = #AdvDupe2.GhostToSpawn
if AdvDupe2.TotalGhosts > 1 then
if(not AdvDupe2.BusyBar)then
if not AdvDupe2.BusyBar then
AdvDupe2.InitProgressBar("Ghosting: ")
AdvDupe2.BusyBar = false
end

View File

@ -934,6 +934,7 @@ if(CLIENT)then
CreateClientConVar("advdupe2_preserve_freeze", 0, false, true)
CreateClientConVar("advdupe2_copy_outside", 0, false, true)
CreateClientConVar("advdupe2_copy_only_mine", 1, false, true)
CreateClientConVar("advdupe2_limit_ghost", 100, false, true)
CreateClientConVar("advdupe2_area_copy_size", 300, false, true)
CreateClientConVar("advdupe2_auto_save_contraption", 0, false, true)
CreateClientConVar("advdupe2_auto_save_overwrite", 1, false, true)
@ -1039,6 +1040,23 @@ if(CLIENT)then
CPanel:AddItem(Check)
local NumSlider = vgui.Create( "DNumSlider" )
NumSlider:SetText( "Ghost Percentage:" )
NumSlider.Label:SetDark(true)
NumSlider:SetMin( 0 )
NumSlider:SetMax( 100 )
NumSlider:SetDecimals( 0 )
NumSlider:SetConVar( "advdupe2_limit_ghost" )
NumSlider:SetToolTip("Change the percent of ghosts to spawn")
--If these funcs are not here, problems occur for each
local func = NumSlider.Slider.OnMouseReleased
NumSlider.Slider.OnMouseReleased = function(self, mcode) func(self, mcode) AdvDupe2.StartGhosting() end
local func2 = NumSlider.Slider.Knob.OnMouseReleased
NumSlider.Slider.Knob.OnMouseReleased = function(self, mcode) func2(self, mcode) AdvDupe2.StartGhosting() end
local func3 = NumSlider.Wang.Panel.OnLoseFocus
NumSlider.Wang.Panel.OnLoseFocus = function(txtBox) func3(txtBox) AdvDupe2.StartGhosting() end
CPanel:AddItem(NumSlider)
NumSlider = vgui.Create( "DNumSlider" )
NumSlider:SetText( "Area Copy Size:" )
NumSlider.Label:SetDark(true)
NumSlider:SetMin( 0 )