diff --git a/addon.json b/addon.json new file mode 100644 index 0000000..ad41b6f --- /dev/null +++ b/addon.json @@ -0,0 +1,16 @@ +{ + "ignore": [ + ".git/*", + ".gitignore", + ".gitattributes", + "README.md", + "LICENSE", + "out.gma" + ], + "tags": [ + "fun" + ], + "title": "TTT-Silentstep", + "type": "tool", + "workshopid": 1137482209 +} diff --git a/lua/terrortown/entities/items/item_ttt_silentstep.lua b/lua/terrortown/entities/items/item_ttt_silentstep.lua new file mode 100644 index 0000000..a3b47b6 --- /dev/null +++ b/lua/terrortown/entities/items/item_ttt_silentstep.lua @@ -0,0 +1,57 @@ +if SERVER then + AddCSLuaFile() + + resource.AddFile("materials/vgui/ttt/icon_silentstep.vmt") + resource.AddFile("materials/vgui/ttt/perks/hud_silentstep.png") + + util.AddNetworkString("TTTSilentstepBought") +end + +ITEM.hud = Material("vgui/ttt/perks/hud_silentstep.png") +ITEM.EquipMenuData = { + type = "item_passive", + name = "item_silentstep_name", + desc = "item_silentstep_desc" +} +ITEM.material = "vgui/ttt/icon_silentstep" +ITEM.CanBuy = {ROLE_TRAITOR, ROLE_DETECTIVE} + +if SERVER then + function ITEM:Bought(ply) + net.Start("TTTSilentstepBought") + net.WriteEntity(ply) + net.Broadcast() + end +else + hook.Add("TTT2Initialize", "TTTItemSilentStepLang", function() + LANG.AddToLanguage("English", "item_silentstep_name", "Silent Step") + LANG.AddToLanguage("English", "item_silentstep_desc", "Silent Step Perk.\nLets you walk like a ninja without any steps!") + end) + + net.Receive("TTTSilentstepBought", function() + local ply = net.ReadEntity() + + if ply == LocalPlayer() then return end + + if not ply:HasEquipmentItem("item_ttt_silentstep") then + ply.equipmentItems = ply.equipmentItems or {} + ply.equipmentItems[#ply.equipmentItems + 1] = "item_ttt_silentstep" + end + end) + + hook.Add("TTTEndRound", "TTTSilentStepCleanUp", function() + local lcply = LocalPlayer() + + for _, v in ipairs(player.GetAll()) do + if v ~= lcply then + v.equipmentItems = {} + end + end + end) +end + +hook.Add("PlayerFootstep", "TTTSilentStepNoSound", function(ply) + if ply:HasEquipmentItem("item_ttt_silentstep") then + return true + end +end) diff --git a/materials/vgui/ttt/icon_silentstep.vmt b/materials/vgui/ttt/icon_silentstep.vmt new file mode 100644 index 0000000..97664f5 --- /dev/null +++ b/materials/vgui/ttt/icon_silentstep.vmt @@ -0,0 +1,7 @@ +"UnlitGeneric" +{ + "$basetexture" "vgui/ttt/icon_silentstep" + "$vertexcolor" 1 + "$vertexalpha" 1 + "$translucent" 1 +} diff --git a/materials/vgui/ttt/icon_silentstep.vtf b/materials/vgui/ttt/icon_silentstep.vtf new file mode 100644 index 0000000..3ff56ec Binary files /dev/null and b/materials/vgui/ttt/icon_silentstep.vtf differ diff --git a/materials/vgui/ttt/perks/hud_silentstep.png b/materials/vgui/ttt/perks/hud_silentstep.png new file mode 100644 index 0000000..f743184 Binary files /dev/null and b/materials/vgui/ttt/perks/hud_silentstep.png differ