Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge of bsnuggs-master1 + additional changes to let this work
- Loading branch information
Showing
43 changed files
with
253 additions
and
38 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
surface.CreateFont( "AutoTauntFont", | ||
{ | ||
font = "coolvetica", | ||
size = 30, | ||
weight = 1000, | ||
antialias = true, | ||
outline = false | ||
}) | ||
|
||
local opacity = .5 * 255 | ||
local brightBlue = Color(14, 54, 100, 100) | ||
local brightYellow = Color(150, 54, 100, 100) | ||
local brightRed = Color(255, 54, 100, 100) | ||
local lightGray = Color(80, 80, 80, opacity) | ||
local brightWhite = Color(255, 255, 255, 255) | ||
|
||
function draw.Circle( x, y, radius, seg ) | ||
local cir = {} | ||
|
||
table.insert( cir, { x = x, y = y, u = 0.5, v = 0.5 } ) | ||
for i = 0, seg do | ||
local a = math.rad( ( i / seg ) * -360 ) | ||
table.insert( cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 } ) | ||
end | ||
|
||
local a = math.rad( 0 ) -- This is need for non absolute segment counts | ||
table.insert( cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 } ) | ||
|
||
surface.DrawPoly( cir ) | ||
end | ||
|
||
function loadExtraHuds() | ||
|
||
--Loads the auto-taunt HUD | ||
autotauntHud() | ||
|
||
end | ||
|
||
function validateProp(ply) | ||
return (ply:IsValid() && ply:Alive() && ply:Team() == TEAM_PROPS ) | ||
end | ||
|
||
function autotauntHud() | ||
|
||
local ply = LocalPlayer() | ||
local padding = 60 | ||
local paddingL = 100 | ||
|
||
-- Check if the player is valid, alive, and is a prop | ||
if ( !validateProp(ply) ) then return end | ||
|
||
local radius = 50 | ||
local timer = 30.00 | ||
local timerRadius = 0 | ||
|
||
if ply.lastTaunt != nil then | ||
local tDiff = CurTime() - ply.lastTaunt | ||
timer = math.Round(ply.autoTauntInterval - tDiff, 0) | ||
timerRadius = (tDiff/ply.autoTauntInterval) * radius | ||
end | ||
|
||
local x = surface.ScreenWidth() - paddingL | ||
local y = surface.ScreenHeight() - padding | ||
|
||
--Set the text Position and Text | ||
local timertext = tostring(timer) | ||
if timer <= 0 then | ||
timertext = "!" | ||
end | ||
draw.SimpleText(timertext, "ObjHUDFont", x, y, brightWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) | ||
|
||
|
||
-- This is the outer circle | ||
surface.SetDrawColor(lightGray) | ||
draw.NoTexture() | ||
draw.Circle( x, y, radius, radius) | ||
|
||
-- This is the growing inner circle | ||
local color = nil | ||
local percentage = timerRadius/radius | ||
if (percentage > .8) then | ||
color = brightRed | ||
elseif (percentage > .6) then | ||
color = brightYellow | ||
else | ||
color = brightBlue | ||
end | ||
surface.SetDrawColor(color) | ||
draw.NoTexture() | ||
draw.Circle( x, y, timerRadius , radius) | ||
draw.SimpleText("Auto-Taunt", "AutoTauntFont", x, y - radius, brightWhite, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) | ||
|
||
end | ||
|
||
|
||
hook.Add("HUDPaint", "Load Additional HUDS", loadExtraHuds ) | ||
hook.Add("AutoTauntHUDRerender", "Re-render Auto Taunt HUD", autotauntHud ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
local function runAutoTaunter() | ||
local players = team.GetPlayers(TEAM_PROPS) | ||
local pRange = TAUNT_MAX_PITCH - TAUNT_MIN_PITCH | ||
|
||
--Render the Auto-taunt HUD | ||
|
||
for _,ply in pairs(players) do | ||
local taunt = table.Random( PROP_TAUNTS ) | ||
|
||
if ply:Alive() && ply:Team() == TEAM_PROPS then | ||
if ply.lastTaunt != nil then | ||
local lastAutoTaunt = math.Round(CurTime() - ply.lastTaunt) | ||
|
||
--Check if the lastAutoTaunt exceeds the autoTauntInterval | ||
if (lastAutoTaunt > ply.autoTauntInterval) then | ||
--Send the Taunt to the player | ||
local pRange = TAUNT_MAX_PITCH - TAUNT_MIN_PITCH | ||
local pitch = math.random()*pRange + TAUNT_MIN_PITCH | ||
SendTaunt(ply, taunt, pitch ) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
function CreateAutoTauntTimer() | ||
timer.Create("AutoTauntTimer", 0.1, 0, runAutoTaunter) | ||
end | ||
|
||
hook.Add( "Initialize", "Set Map Time", function () | ||
mapStartTime = os.time() | ||
CreateAutoTauntTimer() | ||
end) | ||
|
||
hook.Add("OBJHUNT_RoundStart", "Restart the Timer", function () | ||
local players = team.GetPlayers(TEAM_PROPS) | ||
for _,ply in pairs(players) do | ||
|
||
ply.autoTauntInterval = OBJHUNT_AUTOTAUNT_INTERVAL + OBJHUNT_HIDE_TIME | ||
ply.lastTaunt = CurTime() | ||
|
||
net.Start( "AutoTaunt Update" ) | ||
net.WriteUInt( ply:EntIndex(), 8 ) | ||
net.WriteFloat( ply.lastTaunt ) | ||
net.WriteFloat( ply.autoTauntInterval ) | ||
net.Broadcast() | ||
end | ||
|
||
if timer.Exists("AutoTauntTimer") then | ||
timer.Start("AutoTauntTimer") | ||
else | ||
CreateAutoTauntTimer() | ||
end | ||
|
||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.