Code commit
This commit is contained in:
parent
47bb47bcce
commit
134ec8784f
2 changed files with 67 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-Glowing-Teammates",
|
||||
"type": "tool",
|
||||
"workshopid": 1137493106
|
||||
}
|
51
lua/autorun/client/glowing_teammates.lua
Normal file
51
lua/autorun/client/glowing_teammates.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
local tttGlowingDetective = CreateConVar("ttt_glowing_detective", "1", {FCVAR_SERVER_CAN_EXECUTE, FCVAR_ARCHIVE, FCVAR_NOTIFY}, "Should the detective be seen through walls?"):GetBool();
|
||||
|
||||
local function GlowingTTT()
|
||||
local mates = {}
|
||||
local ply = LocalPlayer()
|
||||
|
||||
if ply.GetTeam then
|
||||
for k, v in pairs(player.GetAll()) do
|
||||
if v ~= ply and v:IsActive() and ply:IsSpecial() and not v:IsInnocent() and ((v:GetTeam() == ply:GetTeam() and not ply:GetDetective()) or (v:GetRole() == ply:GetRole())) and (not ply.IsShinigami or not ply:IsShinigami()) then
|
||||
table.insert(mates, v)
|
||||
end
|
||||
end
|
||||
else
|
||||
for k, v in pairs(player.GetAll()) do
|
||||
if v:IsActiveTraitor() and v ~= ply then
|
||||
table.insert(mates, v)
|
||||
elseif tttGlowingDetective and v:IsActiveDetective() and v ~= ply then
|
||||
table.insert(mates, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #mates == 0 then return end
|
||||
|
||||
for _, v in pairs(mates) do
|
||||
local clr = Color(255, 0, 0)
|
||||
if v.GetRoleTable and v:GetRoleTable().DefaultColor then
|
||||
clr = v:GetRoleTable().DefaultColor
|
||||
elseif v.GetRoleColor and v:GetRoleColor() then
|
||||
clr = v:GetRoleColor()
|
||||
elseif v:IsTraitor() then
|
||||
clr = Color(255, 0, 0)
|
||||
elseif v:IsDetective() then
|
||||
clr = Color(0, 0, 255)
|
||||
end
|
||||
|
||||
if TTT2 then
|
||||
outline.Add(v, clr, OUTLINE_MODE_VISIBLE)
|
||||
else
|
||||
halo.Add({ v }, clr, 0, 0, 3, true, true)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function CheckTTTGlow()
|
||||
if gamemode.Get("terrortown") then
|
||||
hook.Add("PreDrawHalos", "AddTTTTeamGlow", GlowingTTT)
|
||||
end
|
||||
end
|
||||
hook.Add("PostGamemodeLoaded", "LoadTTTTeamGlow", CheckTTTGlow)
|
Loading…
Add table
Reference in a new issue