Code commit
This commit is contained in:
parent
05baae4763
commit
ec797a245d
5 changed files with 80 additions and 0 deletions
16
addon.json
Normal file
16
addon.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"ignore": [
|
||||
".git/*",
|
||||
".gitignore",
|
||||
".gitattributes",
|
||||
"README.md",
|
||||
"LICENSE",
|
||||
"out.gma"
|
||||
],
|
||||
"tags": [
|
||||
"fun"
|
||||
],
|
||||
"title": "TTT-Silentstep",
|
||||
"type": "tool",
|
||||
"workshopid": 1137482209
|
||||
}
|
57
lua/terrortown/entities/items/item_ttt_silentstep.lua
Normal file
57
lua/terrortown/entities/items/item_ttt_silentstep.lua
Normal file
|
@ -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)
|
7
materials/vgui/ttt/icon_silentstep.vmt
Normal file
7
materials/vgui/ttt/icon_silentstep.vmt
Normal file
|
@ -0,0 +1,7 @@
|
|||
"UnlitGeneric"
|
||||
{
|
||||
"$basetexture" "vgui/ttt/icon_silentstep"
|
||||
"$vertexcolor" 1
|
||||
"$vertexalpha" 1
|
||||
"$translucent" 1
|
||||
}
|
BIN
materials/vgui/ttt/icon_silentstep.vtf
Normal file
BIN
materials/vgui/ttt/icon_silentstep.vtf
Normal file
Binary file not shown.
BIN
materials/vgui/ttt/perks/hud_silentstep.png
Normal file
BIN
materials/vgui/ttt/perks/hud_silentstep.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
Loading…
Add table
Reference in a new issue