Skip to content

Commit c4e487c

Browse files
authored
Merge pull request #886 from Malivil/dev
Added ability for the Tracker to be a special innocent instead of a special detective (disabled by default)
2 parents 8a0cd57 + aad11f2 commit c4e487c

5 files changed

Lines changed: 42 additions & 20 deletions

File tree

CONVARS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ ttt_paladin_heal_self 1 // Whether the Paladin's
525525
ttt_paladin_credits_starting 1 // The number of credits a Paladin should start with
526526

527527
// Tracker
528+
ttt_tracker_is_innocent 0 // Whether the Tracker should be treated as a special innocent
528529
ttt_tracker_footstep_time 15 // The amount of time players' footsteps should show to the Tracker before fading. Set to 0 to disable
529530
ttt_tracker_footstep_color 1 // Whether players' footsteps should have different colors
530531
ttt_tracker_credits_starting 1 // The number of credits a Tracker should start with

RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Added ability to control whether the mercenary gets body armor as part of their loadout (defaults to `true`)
99
- Added ability to change vampire's fang drain overheal to overheal (default), increase max health, or do both
1010
- Added ability to disable automatically confirming a players death when searching their body (disabled by default)
11+
- Added ability for the Tracker to be a special innocent instead of a special detective (disabled by default)
1112

1213
### Changes
1314
- Updated weapon switch and pickup HUD elements to use the same logic for getting weapon names

docs/teams/detective.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ <h3 style="margin: 10px 0; padding: 0;">Role Configuration:</h3>
668668
</div>
669669
</div>
670670
<div id="tracker" class="collapsible">
671-
<button class="header" style="background-color:var(--special-detective);"><i class="icon-tracker"></i>Tracker</button>
671+
<button class="header" style="background-image:linear-gradient(110deg, var(--special-detective) 0%, var(--special-detective) 70%, var(--special-innocent) 70%, var(--special-innocent) 100%);"><i class="icon-tracker"></i>Tracker</button>
672672
<div class="content">
673673
<div class="moreless">[more]</div>
674674
<p>The <span class="inline-icon" style="color:var(--special-detective);"><i class="icon-tracker"></i><a href="#tracker">Tracker</a></span> can see a trail of footsteps left by other players.</p>
@@ -706,6 +706,12 @@ <h3 style="margin: 10px 0; padding: 0;">Role Configuration:</h3>
706706
<td>Integer</td>
707707
<td>The time in seconds a player's footsteps should show to the Tracker before fading. <i>(Set to 0 to disable.)</i></td>
708708
</tr>
709+
<tr>
710+
<td>ttt_tracker_is_innocent <span data-text="Beta Only" class="betaonly betaicon tooltip">&nbsp;</span></td>
711+
<td>0</td>
712+
<td>Boolean</td>
713+
<td>Whether the Tracker should be treated as a special innocent.</td>
714+
</tr>
709715
<tr>
710716
<td>ttt_tracker_radar_loadout</td>
711717
<td>0</td>

docs/teams/innocent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ <h3 style="margin: 10px 0; padding: 0;">Role Configuration:</h3>
10551055
<div class="noncollapsible">
10561056
<button class="header" style="cursor: default; background-color:var(--special-innocent);"><i class="icon-team"></i>Configurable Innocents</button>
10571057
<div class="content">
1058-
<p>The following roles can be configured to be a <span style="color:var(--special-innocent);">special innocent</span> instead of their default team: <span class="inline-icon" style="color:var(--special-detective);"><i class="icon-sapper"></i><a href="../teams/detective.html#sapper">Sapper</a></span>.</p>
1058+
<p>The following roles can be configured to be a <span style="color:var(--special-innocent);">special innocent</span> instead of their default team: <span class="inline-icon" style="color:var(--special-detective);"><i class="icon-sapper"></i><a href="../teams/detective.html#sapper">Sapper</a></span> and <span class="inline-icon" style="color:var(--special-detective);"><i class="icon-tracker"></i><a href="../teams/detective.html#tracker">Tracker</a></span>.</p>
10591059
</div>
10601060
</div>
10611061
</div>

gamemodes/terrortown/gamemode/roles/tracker/shared.lua

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,13 @@ AddCSLuaFile()
22

33
local hook = hook
44

5-
local function InitializeEquipment()
6-
if DefaultEquipment then
7-
DefaultEquipment[ROLE_TRACKER] = {
8-
EQUIP_ARMOR,
9-
EQUIP_RADAR
10-
}
11-
end
12-
end
13-
InitializeEquipment()
14-
15-
hook.Add("Initialize", "Tracker_Shared_Initialize", function()
16-
InitializeEquipment()
17-
end)
18-
hook.Add("TTTPrepareRound", "Tracker_Shared_TTTPrepareRound", function()
19-
InitializeEquipment()
20-
end)
21-
225
------------------
236
-- ROLE CONVARS --
247
------------------
258

269
CreateConVar("ttt_tracker_footstep_time", "15", FCVAR_REPLICATED, "The amount of time players' footsteps should show to the tracker before fading. Set to 0 to disable", 0, 60)
2710
CreateConVar("ttt_tracker_footstep_color", "1", FCVAR_REPLICATED)
11+
local tracker_is_innocent = CreateConVar("ttt_tracker_is_innocent", "0", FCVAR_REPLICATED, "Whether the tracker should be treated as a special innocent", 0, 1)
2812

2913
ROLE_CONVARS[ROLE_TRACKER] = {}
3014
table.insert(ROLE_CONVARS[ROLE_TRACKER], {
@@ -39,4 +23,34 @@ table.insert(ROLE_CONVARS[ROLE_TRACKER], {
3923
table.insert(ROLE_CONVARS[ROLE_TRACKER], {
4024
cvar = "ttt_tracker_radar_loadout",
4125
type = ROLE_CONVAR_TYPE_BOOL
42-
})
26+
})
27+
table.insert(ROLE_CONVARS[ROLE_TRACKER], {
28+
cvar = "ttt_tracker_is_innocent",
29+
type = ROLE_CONVAR_TYPE_BOOL
30+
})
31+
32+
-------------------
33+
-- ROLE FEATURES --
34+
-------------------
35+
36+
local function InitializeEquipment()
37+
if DefaultEquipment then
38+
DefaultEquipment[ROLE_TRACKER] = {
39+
EQUIP_ARMOR,
40+
EQUIP_RADAR
41+
}
42+
end
43+
end
44+
InitializeEquipment()
45+
46+
hook.Add("Initialize", "Tracker_Shared_Initialize", function()
47+
InitializeEquipment()
48+
end)
49+
hook.Add("TTTPrepareRound", "Tracker_Shared_TTTPrepareRound", function()
50+
InitializeEquipment()
51+
end)
52+
53+
hook.Add("TTTUpdateRoleState", "Tracker_TTTUpdateRoleState", function()
54+
local is_innocent = tracker_is_innocent:GetBool()
55+
DETECTIVE_ROLES[ROLE_TRACKER] = not is_innocent
56+
end)

0 commit comments

Comments
 (0)