Skip to content
This repository was archived by the owner on Mar 11, 2021. It is now read-only.

Commit 2755535

Browse files
committed
Update to 1.7
- Changed "ValidPanel" to "IsValid" (cl_stats and spec_dm_loadout) - Removed trailing white spaces
1 parent f42774b commit 2755535

18 files changed

+145
-145
lines changed

Diff for: VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
TTT Spectator Deathmatch version: 1.6
1+
TTT Spectator Deathmatch version: 1.7
22
von: 1.3.4

Diff for: lua/cl_specdm_hud.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ hook.Add("Initialize", "Initialize_GhostHUD", function()
8989
function GAMEMODE:HUDPaint()
9090
if LocalPlayer():IsGhost() then
9191
self:HUDDrawTargetID()
92-
MSTACK:Draw(LocalPlayer())
92+
MSTACK:Draw(LocalPlayer())
9393
TBHUD:Draw(LocalPlayer())
9494
WSWITCH:Draw(LocalPlayer())
9595
self:HUDDrawPickupHistory()
@@ -150,5 +150,5 @@ hook.Add("Initialize", "Initialize_GhostHUD", function()
150150
end
151151
return old_DrawHUD(self)
152152
end
153-
153+
154154
end)

Diff for: lua/cl_spectator_deathmatch.lua

+19-19
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ end)
2727

2828
net.Receive("SpecDM_Ghost", function()
2929
local enabled = net.ReadUInt(1) == 1
30-
if enabled then
30+
if enabled then
3131
TIPS.Hide()
3232
if SpecDM.MuteAlive then
3333
RunConsoleCommand("ttt_mute_team", TEAM_TERROR)
3434
end
35-
else
35+
else
3636
TIPS:Show()
3737
end
3838
end)
@@ -324,7 +324,7 @@ hook.Add("Initialize", "Initialize_Ghost", function()
324324

325325
return p:IsTerror() and GROUP_TERROR or GROUP_SPEC
326326
end
327-
327+
328328
local function overrideTargetID()
329329
local old_HUDDrawTargetID = GAMEMODE.HUDDrawTargetID
330330
function GAMEMODE:HUDDrawTargetID()
@@ -338,7 +338,7 @@ hook.Add("Initialize", "Initialize_Ghost", function()
338338
old_HUDDrawTargetID(self)
339339
end
340340
end
341-
341+
342342
function TargetIDChangeCallback()
343343
local old_DrawPropSpecLabels = DrawPropSpecLabels_New
344344
function DrawPropSpecLabels_New(client)
@@ -347,7 +347,7 @@ hook.Add("Initialize", "Initialize_Ghost", function()
347347
end
348348
overrideTargetID()
349349
end
350-
350+
351351
-- fuck you ttt and fuck your local functions
352352
-- you are making me write the most stupid code ever
353353
local targetid = file.Read(GAMEMODE.FolderName.."/gamemode/cl_targetid.lua", "LUA")
@@ -376,10 +376,10 @@ end
376376
hook.Add("InitPostEntity", "SpecDM_InitPostEntity", SpecDM.UpdateLoadout)
377377
cvars.AddChangeCallback("ttt_specdm_primaryweapon", SpecDM.UpdateLoadout)
378378
cvars.AddChangeCallback("ttt_specdm_secondaryweapon", SpecDM.UpdateLoadout)
379-
380-
379+
380+
381381
hook.Add("TTTSettingsTabs", "SpecDM_TTTSettingsTab", function(dtabs)
382-
382+
383383
-- rip from damagelog menu and thanks hobbes
384384
local padding = dtabs:GetPadding()
385385
padding = padding * 2
@@ -389,23 +389,23 @@ hook.Add("TTTSettingsTabs", "SpecDM_TTTSettingsTab", function(dtabs)
389389
dsettings:EnableVerticalScrollbar(true)
390390
dsettings:SetPadding(10)
391391
dsettings:SetSpacing(10)
392-
392+
393393
if SpecDM.LoadoutEnabled then
394-
394+
395395
local primary_loadout = vgui.Create("SpecDM_LoadoutPanel")
396396
primary_loadout.cvar = "ttt_specdm_primaryweapon"
397397
primary_loadout:SetCategory("Primary weapons")
398-
primary_loadout:SetWeapons(SpecDM.Ghost_weapons.primary)
398+
primary_loadout:SetWeapons(SpecDM.Ghost_weapons.primary)
399399
dsettings:AddItem(primary_loadout)
400-
400+
401401
local secondary_loadout = vgui.Create("SpecDM_LoadoutPanel")
402402
secondary_loadout.cvar = "ttt_specdm_secondaryweapon"
403403
secondary_loadout:SetCategory("Secondary weapons")
404-
secondary_loadout:SetWeapons(SpecDM.Ghost_weapons.secondary)
404+
secondary_loadout:SetWeapons(SpecDM.Ghost_weapons.secondary)
405405
dsettings:AddItem(secondary_loadout)
406-
406+
407407
end
408-
408+
409409
local dgui = vgui.Create("DForm", dsettings)
410410
dgui:SetName("General settings")
411411
if not SpecDM.ForceDeathmatch then
@@ -418,7 +418,7 @@ hook.Add("TTTSettingsTabs", "SpecDM_TTTSettingsTab", function(dtabs)
418418
dgui:CheckBox("Enable the color effect", "ttt_specdm_enablecoloreffect")
419419
dgui:CheckBox("Enable the hitmarker", "ttt_specdm_hitmarker")
420420
dsettings:AddItem(dgui)
421-
421+
422422
dtabs:AddSheet("Spectator Deathmatch", dsettings, "icon16/gun.png", false, false, "Spectator deathmatch related settings")
423423

424424
end)
@@ -451,7 +451,7 @@ net.Receive("SpecDM_Autoswitch", function()
451451
report_icon:SizeToContents()
452452
local close = vgui.Create("DButton", frame)
453453
close:SetPos(5, 85)
454-
close:SetSize(240, 25)
454+
close:SetSize(240, 25)
455455
close:SetText("No, stay as a spectator")
456456
close.DoClick = function()
457457
frame:Close()
@@ -493,12 +493,12 @@ net.Receive("SpecDM_Hitmarker", function()
493493
end)
494494

495495
hook.Add("OnEntityCreated", "OnEntityCreated_SpecDMRagdoll", function(ent)
496-
if not (LocalPlayer().IsGhost and LocalPlayer():IsGhost()) and ent:GetClass() == "class C_HL2MPRagdoll" then
496+
if not (LocalPlayer().IsGhost and LocalPlayer():IsGhost()) and ent:GetClass() == "class C_HL2MPRagdoll" then
497497
for k,v in pairs(player.GetAll()) do
498498
if v:GetRagdollEntity() == ent and v:IsGhost() then
499499
ent:SetNoDraw(true)
500500
break
501501
end
502502
end
503-
end
503+
end
504504
end)

Diff for: lua/cl_stats.lua

+13-13
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ local function OpenStats()
1414
local General_CurPage = 1
1515

1616
Stats = vgui.Create("DFrame")
17-
Stats:SetPos(50,50)
18-
Stats:SetSize(620, 400)
17+
Stats:SetPos(50,50)
18+
Stats:SetSize(620, 400)
1919
Stats:SetTitle("TTT Spectator Deathmatch Statistics")
2020
Stats:MakePopup()
21-
Stats:Center()
22-
21+
Stats:Center()
22+
2323
local PropertySheet = vgui.Create("DPropertySheet", Stats)
2424
PropertySheet:SetPos(5, 35)
2525
PropertySheet:SetSize(610, 360)
26-
26+
2727
local General = vgui.Create("DPanelList")
2828
General:SetSpacing(2)
2929
local General_Search = vgui.Create("DTextEntry")
@@ -119,7 +119,7 @@ local function OpenStats()
119119
General_Next:SetDisabled(true)
120120
SpecDM_UpdateStats(true, true)
121121
end
122-
122+
123123
local General_Page = vgui.Create("DLabel", General)
124124
General_Page.UpdateText = function(self, text)
125125
self:SetText(text)
@@ -132,7 +132,7 @@ local function OpenStats()
132132
end
133133
General_Page:UpdateText("1/"..math.ceil(general_pages/15))
134134
General_Page:SetTextColor(color_black)
135-
135+
136136
local General_PrevFilter = false
137137
function SpecDM_UpdateStats(general, filter)
138138
if general then
@@ -160,9 +160,9 @@ local function OpenStats()
160160
net.SendToServer()
161161
end
162162
end
163-
163+
164164
PropertySheet:AddSheet("General Statistics", General, "icon16/group.png")
165-
165+
166166
net.Receive("SpecDM_SendStats", function()
167167
local to_update = net.ReadUInt(1) == 1
168168
general_pages = net.ReadUInt(19)
@@ -199,7 +199,7 @@ local function OpenStats()
199199
end
200200
end
201201
end)
202-
202+
203203
local Weapon_stats = vgui.Create("DListView")
204204
Weapon_stats:AddColumn("Weapon name")
205205
Weapon_stats:AddColumn("Number of kills")
@@ -208,10 +208,10 @@ local function OpenStats()
208208
Weapon_stats:AddLine(name, v)
209209
end
210210
PropertySheet:AddSheet("Your weapon statistics", Weapon_stats, "icon16/gun.png")
211-
211+
212212
SpecDM_UpdateStats(true, false)
213213
SpecDM_UpdateStats(false, false)
214-
214+
215215
end
216216
net.Receive("SpecDM_OpenStats", OpenStats)
217217

@@ -233,7 +233,7 @@ hook.Add("Think", "Think_SpecDMStats", function()
233233
if input.IsKeyDown(SpecDM.StatsFKey) then
234234
if not bind then
235235
bind = true
236-
if ValidPanel(Stats) and Stats:IsVisible() then
236+
if IsValid(Stats) and Stats:IsVisible() then
237237
Stats:Close()
238238
return false
239239
else

Diff for: lua/sv_quakesounds.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ local function SpecDM_SendQuake(ply)
1313
end
1414
net.Send(tbl)
1515
end
16-
16+
1717
function SpecDM_Quake(victim, killer)
1818
if not tonumber(killer.specdm_close_kills) then
1919
killer.specdm_close_kills = 1

Diff for: lua/sv_specdm_overrides.lua

+20-20
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ hook.Add("PlayerTraceAttack", "PlayerTraceAttack_SpecDM", function(ply, dmginfo,
1616
local _dmginfo = DamageInfo()
1717
_dmginfo:SetDamage(dmginfo:GetDamage())
1818
_dmginfo:SetDamagePosition(dmginfo:GetDamagePosition())
19-
if IsValid(dmginfo:GetAttacker()) then
20-
_dmginfo:SetAttacker(dmginfo:GetAttacker())
19+
if IsValid(dmginfo:GetAttacker()) then
20+
_dmginfo:SetAttacker(dmginfo:GetAttacker())
2121
end
22-
if IsValid(dmginfo:GetInflictor()) then
23-
_dmginfo:SetInflictor(dmginfo:GetInflictor())
22+
if IsValid(dmginfo:GetInflictor()) then
23+
_dmginfo:SetInflictor(dmginfo:GetInflictor())
2424
end
2525
ply.was_headshot = false
2626
local hs = trace.HitGroup == HITGROUP_HEAD
@@ -33,11 +33,11 @@ hook.Add("PlayerTraceAttack", "PlayerTraceAttack_SpecDM", function(ply, dmginfo,
3333
if hit then s = s-0.2 end
3434
_dmginfo:ScaleDamage(s)
3535
end
36-
else
36+
else
3737
_dmginfo:ScaleDamage(0.55)
3838
end
39-
if not hit or hs then
40-
ply:TakeDamageInfo(_dmginfo)
39+
if not hit or hs then
40+
ply:TakeDamageInfo(_dmginfo)
4141
end
4242
return true
4343
end
@@ -52,7 +52,7 @@ hook.Add("PlayerSpawn", "PlayerSpawn_SpecDM", function(ply)
5252
return
5353
else
5454
ply:SetBloodColor(0)
55-
end
55+
end
5656
end)
5757

5858
local function SpecDM_Respawn(ply)
@@ -136,13 +136,13 @@ hook.Add("Initialize", "Initialize_SpecDM", function()
136136
end
137137
return old_KeyPress(self, ply, key)
138138
end
139-
139+
140140
local old_SpectatorThink = GAMEMODE.SpectatorThink
141141
function GAMEMODE:SpectatorThink(ply)
142142
if IsValid(ply) and ply:IsGhost() then return true end
143-
old_SpectatorThink(self, ply)
143+
old_SpectatorThink(self, ply)
144144
end
145-
145+
146146
local old_PlayerCanPickupWeapon = GAMEMODE.PlayerCanPickupWeapon
147147
function GAMEMODE:PlayerCanPickupWeapon(ply, wep)
148148
if not IsValid(ply) or not IsValid(wep) then return end
@@ -151,7 +151,7 @@ hook.Add("Initialize", "Initialize_SpecDM", function()
151151
end
152152
return old_PlayerCanPickupWeapon(self, ply, wep)
153153
end
154-
154+
155155
local meta = FindMetaTable("Player")
156156

157157
local old_SpawnForRound = meta.SpawnForRound
@@ -161,37 +161,37 @@ hook.Add("Initialize", "Initialize_SpecDM", function()
161161
end
162162
return old_SpawnForRound(self, dead_only)
163163
end
164-
164+
165165
local old_ResetRoundFlags = meta.ResetRoundFlags
166166
function meta:ResetRoundFlags()
167167
if self:IsGhost() then return end
168168
old_ResetRoundFlags(self)
169169
end
170-
170+
171171
local old_spectate = meta.Spectate
172172
function meta:Spectate(mode)
173173
if self:IsGhost() then return end
174174
return old_spectate(self, mode)
175175
end
176-
176+
177177
local old_ShouldSpawn = meta.ShouldSpawn
178178
function meta:ShouldSpawn()
179179
if self:IsGhost() then return true end
180180
return old_ShouldSpawn(self)
181181
end
182-
182+
183183
local old_GiveLoadout = GAMEMODE.PlayerLoadout
184184
function GAMEMODE:PlayerLoadout(ply)
185185
if ply:IsGhost() then return end
186186
old_GiveLoadout(self, ply)
187187
end
188-
188+
189189
local old_KarmaHurt = KARMA.Hurt
190190
function KARMA.Hurt(attacker, victim, dmginfo)
191191
if (IsValid(attacker) and attacker:IsGhost()) or (IsValid(victim) and victim:IsGhost()) then return end
192192
return old_KarmaHurt(attacker, victim, dmginfo)
193193
end
194-
194+
195195
for k,v in pairs(scripted_ents.GetList()) do
196196
if v.ClassName == "base_ammo_ttt" then
197197
local old_PlayerCanPickup = v.PlayerCanPickup
@@ -201,7 +201,7 @@ hook.Add("Initialize", "Initialize_SpecDM", function()
201201
end
202202
end
203203
end
204-
204+
205205
hook.Add("EntityTakeDamage", "EntityTakeDamage_Ghost", function(ent, dmginfo)
206206
if ent:IsPlayer() then
207207
local attacker = dmginfo:GetAttacker()
@@ -218,7 +218,7 @@ hook.Add("Initialize", "Initialize_SpecDM", function()
218218
end
219219
end
220220
end)
221-
221+
222222
local old_Damagelog = DamageLog
223223
function Damagelog_New(str)
224224
return old_Damagelog(str)

Diff for: lua/sv_spectator_deathmatch.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function meta:WantsToDM()
136136
if self:IsActive() then
137137
self:SpecDM_Error("You can't enter spectator deathmatch when you're alive.")
138138
elseif GetRoundState() != ROUND_ACTIVE then
139-
self:SpecDM_Error("Error : round inactive.")
139+
self:SpecDM_Error("Error: Current round is inactive.")
140140
elseif not self.spawning_ghost then
141141
if tonumber(self.DMTimer) and self.DMTimer > 0 then
142142
self:SpecDM_Error("Wait "..tostring(self.DMTimer).." second(s) before using this command again!")

Diff for: lua/sv_stats.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ timer.Create("SpecDM_Time", 1, 0, function()
7474
v.specdm_stats_new.time_dm = v.specdm_stats_new.time_dm + 1
7575
v:SpecDM_EnableUpdate("time_dm")
7676
elseif v:IsActive() and v.specdm_stats_new.time_playing then
77-
v.specdm_stats_new.time_playing = v.specdm_stats_new.time_playing + 1
78-
v:SpecDM_EnableUpdate("time_playing")
77+
v.specdm_stats_new.time_playing = v.specdm_stats_new.time_playing + 1
78+
v:SpecDM_EnableUpdate("time_playing")
7979
end
8080
end
8181
end
8282
end)
8383

8484
hook.Add("PlayerDeath", "PlayerDeath_SpecDMStats", function(ply, killer, inflictor)
85-
if not ply:IsBot() then
86-
ply:SpecDM_CheckKillRows()
85+
if not ply:IsBot() then
86+
ply:SpecDM_CheckKillRows()
8787
end
8888
if ply.specdm_killrows then
8989
ply.specdm_killrows = 0

0 commit comments

Comments
 (0)