Skip to content

Commit

Permalink
Added: Proper clean-up, and limit messages
Browse files Browse the repository at this point in the history
Added: Local and global tracks limit. Track piece is now
       registered to "maxprops" and "maxasmtracks"
       Even affected when using wire to spawn tracks
       Look: "Dude how can I control the spawned tracks in multilayer"
       for more information ho these are triggered
Changed: Track piece ownership is not set properly and it is not
         affected by prop protection environment by any way
         It s applied even by using wire extension
Removed: The usage of probably discontinued functions as:
         A:DotProduct(B) > For vector dot product. Replaced with A:Dot(B)
         Panel:AddControl(String,Table) to its own element method creator
  • Loading branch information
dvdvideo1234 committed Jun 5, 2016
1 parent 6f4ff68 commit e988d4b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 59 deletions.
6 changes: 3 additions & 3 deletions lua/autorun/trackassembly_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local asmlib = trackasmlib

------ CONFIGURE ASMLIB ------
asmlib.InitAssembly("track","assembly")
asmlib.SetOpVar("TOOL_VERSION","5.243")
asmlib.SetOpVar("TOOL_VERSION","5.244")
asmlib.SetLogControl(0,"")
asmlib.SetIndexes("V",1,2,3)
asmlib.SetIndexes("A",1,2,3)
Expand All @@ -41,8 +41,8 @@ asmlib.MakeCoVar("devmode" , "0" , {0, 1 } ,bitBor(FCVAR_ARCHIVE, FCVAR_ARCHIV
asmlib.MakeCoVar("maxstcnt" , "200", {1,200} ,bitBor(FCVAR_ARCHIVE, FCVAR_ARCHIVE_XBOX, FCVAR_NOTIFY, FCVAR_REPLICATED, FCVAR_PRINTABLEONLY), "Maximum pieces to spawn in stack mode")
if(SERVER) then
CreateConVar("sbox_max"..asmlib.GetOpVar("CVAR_LIMITNAME"), "1500", bitBor(FCVAR_ARCHIVE, FCVAR_ARCHIVE_XBOX, FCVAR_NOTIFY, FCVAR_REPLICATED, FCVAR_PRINTABLEONLY), "Maximum number of tracks to be spawned")
asmlib.MakeCoVar("bnderrmod" , "LOG", nil ,bitBor(FCVAR_ARCHIVE, FCVAR_ARCHIVE_XBOX, FCVAR_NOTIFY, FCVAR_REPLICATED, FCVAR_PRINTABLEONLY), "Unreasonable position error handling mode")
asmlib.MakeCoVar("maxfruse" , "50" , {1,100} ,bitBor(FCVAR_ARCHIVE, FCVAR_ARCHIVE_XBOX, FCVAR_NOTIFY, FCVAR_REPLICATED, FCVAR_PRINTABLEONLY), "Maximum frequent pieces to be listed")
asmlib.MakeCoVar("bnderrmod", "LOG", nil ,bitBor(FCVAR_ARCHIVE, FCVAR_ARCHIVE_XBOX, FCVAR_NOTIFY, FCVAR_REPLICATED, FCVAR_PRINTABLEONLY), "Unreasonable position error handling mode")
asmlib.MakeCoVar("maxfruse" , "50" , {1,100} ,bitBor(FCVAR_ARCHIVE, FCVAR_ARCHIVE_XBOX, FCVAR_NOTIFY, FCVAR_REPLICATED, FCVAR_PRINTABLEONLY), "Maximum frequent pieces to be listed")
end
------ CONFIGURE NON-REPLICATED CVARS ----- Client's got a mind of its own
asmlib.MakeCoVar("modedb" , "SQL", nil, bitBor(FCVAR_ARCHIVE, FCVAR_ARCHIVE_XBOX, FCVAR_NOTIFY, FCVAR_PRINTABLEONLY), "Database operating mode")
Expand Down
68 changes: 14 additions & 54 deletions lua/weapons/gmod_tool/stools/trackassembly.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local entsCreate = ents and ents.Create
local entsCreateClientProp = ents and ents.CreateClientProp
local fileExists = file and file.Exists
local fileDelete = file and file.Delete
local tableGetKeys = table and table.GetKeys
local stringLen = string and string.len
local stringRep = string and string.rep
local stringSub = string and string.sub
Expand Down Expand Up @@ -96,6 +97,8 @@ local conPalette = asmlib.MakeContainer("Colours")
conPalette:Insert("an",Color(180,255,150,255)) -- Selected anchor
conPalette:Insert("db",Color(220,164,52 ,255)) -- Database mode

cleanupRegister(asmlib.GetOpVar("CVAR_LIMITNAME"))

if(CLIENT) then
languageAdd("tool."..gsToolNameL..".category" , "Construction")
languageAdd("tool."..gsToolNameL..".name" , gsNameInitF.." "..gsNamePerpF)
Expand Down Expand Up @@ -128,17 +131,14 @@ if(CLIENT) then
languageAdd("tool."..gsToolNameL..".adviser" , "Controls rendering the tool position/angle adviser")
languageAdd("tool."..gsToolNameL..".pntasist" , "Controls rendering the tool snap point assistant")
languageAdd("tool."..gsToolNameL..".ghosthold", "Controls rendering the tool ghosted holder piece")
languageAdd("Cleanup_"..gsToolNameL, "Track pieces")
languageAdd("Cleaned_"..gsToolNameL, "Cleaned up all track pieces")
-- languageAdd("cleanup."..asmlib.GetOpVar("CVAR_LIMITNAME"), "Undone track assembly")
-- languageAdd("cleaned."..asmlib.GetOpVar("CVAR_LIMITNAME"), "Cleaned up all track assembly")
languageAdd("Cleanup_"..asmlib.GetOpVar("CVAR_LIMITNAME"), gsNameInitF.." "..asmlib.GetOpVar("NAME_PERP").." pieces")
languageAdd("Cleaned_"..asmlib.GetOpVar("CVAR_LIMITNAME"), "Cleaned up all track pieces")
languageAdd("SBoxLimit_"..asmlib.GetOpVar("CVAR_LIMITNAME"), "You've hit the Spawned tracks limit!")
concommandAdd(gsToolPrefL.."openframe", asmlib.GetActionCode("OPEN_FRAME"))
concommandAdd(gsToolPrefL.."resetvars", asmlib.GetActionCode("RESET_VARIABLES"))
end

if(SERVER) then
cleanupRegister(asmlib.GetOpVar("CVAR_LIMITNAME"))
duplicatorRegisterEntityModifier(gsToolPrefL.."dupe_phys_set",asmlib.GetActionCode("DUPE_PHYS_SETTINGS"))
end

Expand Down Expand Up @@ -948,59 +948,19 @@ function TOOL:DrawToolScreen(w, h)
goToolScr:DrawText(osDate(),"w")
end

local ConVarList = TOOL:BuildConVarList()
function TOOL.BuildCPanel(CPanel)
local CurY = 0 -- pItem is the current panel created
pItem = CPanel:SetName(languageGetPhrase("tool."..gsToolNameL..".name"))
CurY = CurY + pItem:GetTall() + 2

local CurY, pItem = 0 -- pItem is the current panel created
CPanel:SetName(languageGetPhrase("tool."..gsToolNameL..".name"))
pItem = CPanel:Help(languageGetPhrase("tool."..gsToolNameL..".desc"))
CurY = CurY + pItem:GetTall() + 2

pItem = vguiCreate("ControlPresets")
pItem:SetPos(2, CurY)
pItem:SetLabel("Presets")
pItem:SetPreset(gsToolNameL)
for k, v in pairs(self.ClientConVar) do
pItem:AddConVar(k)
end; CurY = CurY + pItem:GetTall() + 2
pItem:Update()
CPanel:AddItem(pItem)

--[[
local Combo = {}
Combo["Label"] = "#Presets"
Combo["MenuButton"] = "1"
Combo["Folder"] = gsToolNameL
Combo["CVars"] = {}
Combo["CVars"][0 ] = gsToolPrefL.."weld"
Combo["CVars"][1 ] = gsToolPrefL.."ignphysgn"
Combo["CVars"][2 ] = gsToolPrefL.."mass"
Combo["CVars"][3 ] = gsToolPrefL.."model"
Combo["CVars"][4 ] = gsToolPrefL.."nextx"
Combo["CVars"][5 ] = gsToolPrefL.."nexty"
Combo["CVars"][6 ] = gsToolPrefL.."nextz"
Combo["CVars"][7 ] = gsToolPrefL.."count"
Combo["CVars"][8 ] = gsToolPrefL.."freeze"
Combo["CVars"][9 ] = gsToolPrefL.."adviser"
Combo["CVars"][10] = gsToolPrefL.."adviser"
Combo["CVars"][11] = gsToolPrefL.."igntype"
Combo["CVars"][12] = gsToolPrefL.."spnflat"
Combo["CVars"][13] = gsToolPrefL.."pointid"
Combo["CVars"][14] = gsToolPrefL.."pnextid"
Combo["CVars"][15] = gsToolPrefL.."nextpic"
Combo["CVars"][16] = gsToolPrefL.."nextyaw"
Combo["CVars"][17] = gsToolPrefL.."nextrol"
Combo["CVars"][18] = gsToolPrefL.."ghosthold"
Combo["CVars"][19] = gsToolPrefL.."ydegsnp"
Combo["CVars"][20] = gsToolPrefL.."mcspawn"
Combo["CVars"][21] = gsToolPrefL.."activrad"
Combo["CVars"][22] = gsToolPrefL.."nocollide"
Combo["CVars"][23] = gsToolPrefL.."gravity"
Combo["CVars"][24] = gsToolPrefL.."physmater"
pItem = CPanel:AddControl("ComboBox",Combo)
CurY = CurY + pItem:GetTall() + 2
]]--
pItem = CPanel:AddControl( "ComboBox",{
MenuButton = 1,
Folder = gsToolNameL,
Options = {["#Default"] = ConVarList},
CVars = tableGetKeys(ConVarList)
}); CurY = CurY + pItem:GetTall() + 2

local Panel = asmlib.CacheQueryPanel()
if(not Panel) then return asmlib.StatusPrint(nil,"TOOL:BuildCPanel(cPanel): Panel population empty") end
Expand Down
15 changes: 13 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@ A: Easy. First you need to enable the developer mode via "trackassembly_devmode
to delete the client or server or both instance generated databases
N: The console variables being set in this question will be reset also
Q: Dude how can I control the spawned tracks in multilayer
A: Easy. The track pieces are props, so they are registered to:
1) Variable "sbox_maxprops" the maximum props on the server
2) Variable "sbox_maxasmtracks" a variable for the maximum things spawned via TA
You can trigger these limits independently from one another. For example:
"maxprops" is 50 and "maxasmtracks" is 30 will trigger maxasmtracks
"maxprops" is 30 and "maxasmtracks" is 50 will trigger maxprops
"maxprops" is 50 and "maxasmtracks" is 50 will trigger maxasmtracks
N: If you want a server with many props and less tracks, then lower maxasmtracks
Default value is 1500 for "maxasmtracks" to relay on the props limit
Q: How can I control errors when the clients are flooding my server with rails,
and stacking/spawning outside of the map bounds?
A: Easy, :D Just set "trackassembly_bnderrmod" to one of the following values
Expand Down Expand Up @@ -272,8 +283,8 @@ Q: Hay, how should I proceed when I am experiencing errors ?
A: First of all if the the error origin is not the TA,
I can't pretty much help you with it, but I will do my best
If the error is related to the TA then:
1) Delete database ( if any ) located in ..common\GarrysMod\garrysmod\data\trackassembly\*.*
2) Delete the TA's *.gma file
1) Delete database ( if any ) located in ..common\GarrysMod\garrysmod\data\trackassembly\dsv\*.*
2) Delete the TA's *.gma file from garrysmod\addons
3) Delete the cache "..\GarrysMod\garrysmod\cache"
4) In the game library, right click on Gmod and select "Properties"
5) Navigate to "Local Files" and click "Verify integrity of the game cache"
Expand Down

0 comments on commit e988d4b

Please sign in to comment.