Skip to content

Commit

Permalink
Parse only certain TFA knife skins and not guns
Browse files Browse the repository at this point in the history
  • Loading branch information
xDShot committed Dec 31, 2016
1 parent dcc96b2 commit 7efbc61
Showing 1 changed file with 33 additions and 28 deletions.
61 changes: 33 additions & 28 deletions lua/autorun/add_tfa_skins.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
CreateConVar("csgo_knives_tfaskins", 1, FCVAR_ARCHIVE, "Add skins for TFA knives using this pack's base if any of them installed")

local Synonyms = {}
local Knifetable = {}

Synonyms["tfa_csgo_bayonet"] = "csgo_bayonet"
Synonyms["tfa_csgo_butfly"] = "csgo_butterfly"
Synonyms["tfa_csgo_ctknife"] = "csgo_default_knife"
Synonyms["tfa_csgo_falch"] = "csgo_falchion"
Synonyms["tfa_csgo_flip"] = "csgo_flip"
Synonyms["tfa_csgo_gut"] = "csgo_gut"
Synonyms["tfa_csgo_karam"] = "csgo_karambit"
Synonyms["tfa_csgo_m9"] = "csgo_m9"
Synonyms["tfa_csgo_pushkn"] = "csgo_daggers"
Synonyms["tfa_csgo_tackni"] = "csgo_huntsman"
Synonyms["tfa_csgo_tknife"] = "csgo_default_t"
Knifetable["tfa_csgo_bayonet"] = "csgo_bayonet"
Knifetable["tfa_csgo_butfly"] = "csgo_butterfly"
Knifetable["tfa_csgo_ctknife"] = "csgo_default_knife"
Knifetable["tfa_csgo_falch"] = "csgo_falchion"
Knifetable["tfa_csgo_flip"] = "csgo_flip"
Knifetable["tfa_csgo_gut"] = "csgo_gut"
Knifetable["tfa_csgo_karam"] = "csgo_karambit"
Knifetable["tfa_csgo_m9"] = "csgo_m9"
Knifetable["tfa_csgo_pushkn"] = "csgo_daggers"
Knifetable["tfa_csgo_tackni"] = "csgo_huntsman"
Knifetable["tfa_csgo_tknife"] = "csgo_default_t"



local function getSynonymOf( string )
local function getSynonymOf( string, table )

if Synonyms and Synonyms[ string ] then return Synonyms[ string ] end
if table and table[ string ] then return table[ string ] end

print("Couldn't find synonym for " .. string ..". Returning this itself.")
return string
Expand All @@ -35,26 +35,31 @@ local function myinit()
end

for classname, v in pairs(TFA_CSGO_SKINS) do
--print("classname", classname, "v", v)
--print("Parsing", classname, "knives:")
for skinid, v1 in pairs(v) do

--print("skinid",skinid,"v1",v1,"\nname",v1["name"],"\nmaterial",v1["tbl"][1])
local sweptable = weapons.Get( getSynonymOf( classname ) )
if Knifetable[ classname ] then -- we don't need to parse guns skins

for skinid, v1 in pairs(v) do

local sweptable = weapons.Get( getSynonymOf( classname, Knifetable ) )

if sweptable then
if sweptable then

sweptable.PrintName = sweptable.PrintName .. " | " .. v1["name"]
sweptable.Category = 'CS:GO Knives (TFA Skins)'
sweptable.PaintMaterial = v1["tbl"][1]
sweptable.PrintName = sweptable.PrintName .. " | " .. v1["name"]
sweptable.Category = 'CS:GO Knives (TFA Skins)'
sweptable.PaintMaterial = v1["tbl"][1]

weapons.Register( sweptable, "csgo_tfa_" .. skinid )
weapons.Register( sweptable, "csgo_tfa_" .. skinid )

else
print( "Failed to register new knife.","\nClassname", classname, "\nSkinid:", skinid, "\nName", v1["name"],"\nMaterial", v1["tbl"][1] )
end -- if sweptable
else -- if sweptable
print( "Failed to register new knife.","\nClassname", classname, "\nSkinid:", skinid, "\nName", v1["name"],"\nMaterial", v1["tbl"][1] )
end -- if sweptable

end -- for skinid, v1
end -- for skinid, v1

else -- Knifetable[ classname ]
print( "Ignoring " .. classname )
end -- Knifetable[ classname ]

end -- for classname, v

end
Expand Down

0 comments on commit 7efbc61

Please sign in to comment.