1
0
Fork 0

Code commit

This commit is contained in:
saibotk 2020-05-30 15:44:44 +02:00
parent 47bb47bcce
commit 134ec8784f
No known key found for this signature in database
GPG key ID: A3299C587D5DF523
2 changed files with 67 additions and 0 deletions

16
addon.json Normal file
View file

@ -0,0 +1,16 @@
{
"ignore": [
".git/*",
".gitignore",
".gitattributes",
"README.md",
"LICENSE",
"out.gma"
],
"tags": [
"fun"
],
"title": "TTT-Glowing-Teammates",
"type": "tool",
"workshopid": 1137493106
}

View 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)