Залив

This commit is contained in:
Refosel
2026-03-30 10:39:52 +03:00
commit 2b57c019cb
2010 changed files with 185745 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
local meta = FindMetaTable("Player")
function meta:IsDowned()
return self:GetNWBool('Downed')
end
function meta:MovingDirection(threshold) --This function was made by OpenAI ChatGPT
threshold = threshold or 0.1
local vel = self:GetVelocity()
local forward = self:GetForward()
local right = self:GetRight()
local forwardDot = vel:Dot(forward)
local rightDot = vel:Dot(right)
if forwardDot > threshold then
return "forward"
elseif forwardDot < -threshold then
return "backward"
end
if rightDot > threshold then
return "right"
elseif rightDot < -threshold then
return "left"
end
return "stand"
end
hook.Add("CalcMainActivity", "TDMAnimsRevive", function(ply, vel)
if ply:IsDowned() and ply:GetNWString('SVAnim') == "" then
local anim1 = ply:LookupSequence("laststand_idle")
local anim2 = ply:LookupSequence("laststand_crawl_forward")
local anim3 = ply:LookupSequence("laststand_crawl_backward")
local anim4 = ply:LookupSequence("laststand_crawl_left")
local anim5 = ply:LookupSequence("laststand_crawl_right")
local dir = ply:MovingDirection(4)
local vel = ply:GetVelocity():Length2D() > 10
if dir == "forward" and vel then
return -1, anim2
elseif dir == "backward" and vel then
return -1, anim3
elseif dir == "left" and vel then
return -1, anim4
elseif dir == "right" and vel then
return -1, anim5
else
return -1, anim1
end
end
end)
hook.Add("Think", "TDMRevive", function()
local ply = LocalPlayer()
if ply:IsDowned() and ply:Alive() and !ply:ShouldDrawLocalPlayer() then
if not model then
model = ClientsideModel(ply:GetModel())
end
model:SetNoDraw(false)
model:SetAngles(Angle(0,ply:GetAngles().y+10,0))
model:ManipulateBoneAngles(model:LookupBone('ValveBiped.Bip01_R_Forearm'), Angle(0,270,0))
model:ManipulateBoneAngles(model:LookupBone('ValveBiped.Bip01_L_Forearm'), Angle(0,270,0))
model:ManipulateBoneAngles(model:LookupBone('ValveBiped.Bip01_R_UpperArm'), Angle(0,270,0))
model:SetCycle(ply:GetCycle())
model:SetModel(ply:GetModel())
local vel = ply:GetVelocity()
local anim1 = ply:LookupSequence("laststand_idle")
local anim2 = ply:LookupSequence("laststand_crawl_forward")
local anim3 = ply:LookupSequence("laststand_crawl_backward")
local anim4 = ply:LookupSequence("laststand_crawl_left")
local anim5 = ply:LookupSequence("laststand_crawl_right")
local speed = vel:Length2D() > 5
local dir = ply:MovingDirection(8)
if ply:EyeAngles().x > 25 then
ply:SetEyeAngles(Angle(25, ply:EyeAngles().y, 0))
end
if ply:EyeAngles().x < -25 then
ply:SetEyeAngles(Angle(-25, ply:EyeAngles().y, 0))
end
if dir == "forward" and speed then
model:ResetSequence(anim2)
elseif dir == "backward" and speed then
model:ResetSequence(anim3)
elseif dir == "left" and speed then
model:ResetSequence(anim4)
elseif dir == "right" and speed then
model:ResetSequence(anim5)
else
model:ResetSequence(anim1)
end
model:SetPos(ply:GetPos()+Vector(0,0,4)+ply:GetForward()*8+ply:GetRight()*8)
else
if model then
model:SetNoDraw(true)
end
end
end)
local delay = CurTime()+5
hook.Add("Think", "TDMApplyCommands", function()
if delay < CurTime() then
delay = CurTime()+5
for k, v in pairs(COD.ApplyCommands["Client"]) do
RunConsoleCommand(k, v)
end
end
end)

View File

@@ -0,0 +1,58 @@
local cutscene_table = {
[1] = {},
[2] = {},
[3] = {},
[4] = {},
}
function COD:PrecacheCutscene(path, frames, dest)
for i=1,frames do
local num = i
if num < 10 then
num = "000"..num
elseif num < 100 then
num = "00"..num
elseif num < 1000 then
num = "0"..num
end
local mat = Material(path..num..".jpg")
table.insert(dest, mat)
end
end
function COD:PlayCutscene(tab, sound, fps, screenfade)
local time = 0
local tab = cutscene_table[tab]
surface.PlaySound(sound)
hook.Add("HUDPaint", "!!!CODCutscene", function()
time = time + FrameTime()
local frame = math.ceil(time/(1/fps))
if frame > #tab then
hook.Remove("HUDPaint", "!!!CODCutscene")
COD.HideHUD = false
if screenfade then
LocalPlayer():ScreenFade(SCREENFADE.IN, color_black, 1, 1)
end
else
surface.SetMaterial(tab[frame])
surface.SetDrawColor(255,255,255)
surface.DrawTexturedRect(0, 0, ScrW(), ScrH())
COD.HideHUD = true
end
end)
end
COD:PrecacheCutscene("tdmg/heli/spawn_cutscene/", 111, cutscene_table[1])
COD:PrecacheCutscene("tdmg/heli/shotdown_bullet_cutscene/", 117, cutscene_table[2])
COD:PrecacheCutscene("tdmg/heli/shotdown_rocket_cutscene/", 100, cutscene_table[3])
COD:PrecacheCutscene("tdmg/nuke/explode_cutscene/", 296, cutscene_table[4])
net.Receive("COD.Cutscene", function()
local tab = net.ReadTable()
local num = tab.num_of_cutscene
local snd = tab.path_of_sound
local fps = tab.fps
local scr = tab.screenfade
COD:PlayCutscene(num, snd, fps, scr)
end)

View File

@@ -0,0 +1,46 @@
local noafk = false
hook.Add("Think", "ButtonCheckErrors", function()
local ply = LocalPlayer()
if ply:KeyDown(IN_FORWARD) then
noafk = true
end
if noafk then
hook.Remove("Think", "ButtonCheckErrors")
local mod = ClientsideModel("models/player/breen.mdl")
timer.Simple(1, function()
local seq = mod:LookupSequence("laststand_idle")
mod:Remove()
if seq == -1 then
local frame = vgui.Create("DFrame")
frame:SetSize( 300, 150 )
frame:Center()
frame:SetTitle("CUSTOM ANIMS DONT WORK!")
frame:MakePopup()
local Labels = vgui.Create("DLabel", frame)
Labels:SetText("Animations don't work! You can try to fix them using this button. If you still see T-Pose animations or game crashing, then try restarting the game and removing the animation mods.")
Labels:SetWrap(true)
Labels:SetPos( 25, 25 )
Labels:SetSize( 250, 75 )
local DermaButton = vgui.Create("DButton", frame)
DermaButton:SetText("Try Fix")
DermaButton:SetPos( 25, 100 )
DermaButton:SetSize( 250, 30 )
DermaButton.DoClick = function()
RunConsoleCommand("wos_dynabase_fixconflicts")
RunConsoleCommand("wos_dynabase_reloadmodels")
frame:Remove()
end
end
if jit.version_num != 20100 then
surface.PlaySound("npc/turret_floor/ping.wav")
chat.AddText(Color(255,0,0), "[WARNING] ", Color(255,255,255), "I advise you to install the x64 version to avoid errors and improve performance.")
end
end)
end
end)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,225 @@
local TickTable = {}
local KillCamStore = {}
local hm_mat = Material('tdmg/hud/hitmark.png')
local function TransferBones(base, ragdoll)
if !IsValid(base) or !IsValid(ragdoll) then return end
for i = 0, ragdoll:GetPhysicsObjectCount() - 1 do
local bone = ragdoll:GetPhysicsObjectNum( i )
if ( IsValid( bone ) ) then
local pos, ang = base:GetBonePosition( ragdoll:TranslatePhysBoneToBone( i ) )
if ( pos ) then bone:SetPos( pos ) end
if ( ang ) then bone:SetAngles( ang ) end
end
end
end
local function GiveHitMarker(kill)
local alpha = 255
if not kill then
surface.PlaySound("tdmg/impacts/hit.wav")
hook.Add("HUDPaint", "TDMGHitsMark", function()
surface.SetDrawColor(255,255,255,alpha)
surface.SetMaterial(hm_mat)
surface.DrawTexturedRect(ScrW()/2-32, ScrH()/2-32, 64, 64)
alpha = alpha - FrameTime()*500
if alpha <= 0 then
hook.Remove("HUDPaint", "TDMGHitsMark")
end
end)
else
surface.PlaySound("tdmg/impacts/kill.wav")
hook.Add("HUDPaint", "TDMGHitsMark", function()
surface.SetDrawColor(220,40,40,alpha)
surface.SetMaterial(hm_mat)
surface.DrawTexturedRect(ScrW()/2-32, ScrH()/2-32, 64, 64)
alpha = alpha - FrameTime()*500
if alpha <= 0 then
hook.Remove("HUDPaint", "TDMGHitsMark")
end
end)
end
end
function COD:StopKillcam()
local ply = LocalPlayer()
hook.Remove("HUDPaint", "!!!KillCamTDM")
hook.Remove("Tick", "!!!KillCamTDM")
hook.Remove("CalcView", "!!!KillCamTDM")
ply.InKillCam = false
COD.HideHUD = false
ply:ConCommand("-jump")
ply:ConCommand("+jump")
timer.Simple(0.1, function()
ply:ConCommand("-jump")
end)
ply:ScreenFade(SCREENFADE.IN, color_black, 0.5, 0)
for _, ent in ipairs(ents.GetAll()) do
if not ent.IsKillcamEnt and (ent:IsPlayer() or ent:IsNPC() or ent:IsWeapon() or ent:GetClass() == "prop_ragdoll" or string.match(ent:GetClass(), "tdm_")) then
ent:SetNoDraw(false)
end
end
for _, ent in pairs(KillCamStore) do
ent:SetNoDraw(true)
ent:Remove()
end
KillCamStore = {}
end
function COD:GetMeFromTable(tab)
local tab2 = tab.other
for k=1,#tab2.ent do
local v = tab2.ent[k]
if v == LocalPlayer():EntIndex() then
return tab.other.alive[k], tab.other.pos[k], tab.other.ang[k]
end
end
end
function COD:PlayKillcam(tabl, islast)
if !GetConVar("cod_killcam_enable"):GetBool() and not islast then return end
local frame = 0
local tab = tabl[frame]
LocalPlayer():ScreenFade(SCREENFADE.IN, color_black, 0.5, 0)
hook.Add("HUDPaint", "!!!KillCamTDM", function()
if istable(tab) then
local alive, opos = COD:GetMeFromTable(tab)
if alive then
local pos = (opos+Vector(0,0,72)):ToScreen()
draw.SimpleText("YOU", "TDMG_SmallFont1", pos.x, pos.y-16, Color(200,150,0), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
draw.SimpleText("", "TDMG_SmallFont1", pos.x, pos.y, Color(200,150,0), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
end
surface.SetDrawColor(0,0,0,200)
surface.DrawRect(0, 0, ScrW(), 100)
surface.SetDrawColor(0,0,0,200)
surface.DrawRect(0, ScrH()-100, ScrW(), 100)
if islast then
draw.SimpleText(COD.Language["killcam_2"], "TDMG_LargeFont1", ScrW()/2, 50, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
else
draw.SimpleText(COD.Language["killcam_1"], "TDMG_LargeFont1", ScrW()/2, 50, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
draw.SimpleText(COD.Language["killcam_3"], "TDMG_MediumFont1", ScrW()/2, ScrH()-50, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
end)
hook.Add("Tick", "!!!KillCamTDM", function(ply, origin, angles, fov)
local ply = LocalPlayer()
local drawframes = true
ply.InKillCam = true
frame = frame + 1
tab = tabl[math.ceil(frame)]
COD.HideHUD = true
if frame >= #tabl or ply:KeyDown(IN_JUMP) or COD.HUD_DisableSomeThink then
COD:StopKillcam()
drawframes = false
end
if drawframes then
if istable(tab) then
local s1 = tab.ply.snd
if istable(s1) then
for _, ss in ipairs(s1) do
ply:EmitSound(ss)
end
tab.ply.snd = ""
end
local b1 = tab.ply.blt
if b1 != {} then
b1.Callback = nil
b1.Tracer = 0
ply:FireBullets(b1)
tab.ply.blt = {}
end
local hit = tab.ply.hit
if hit == 1 then
GiveHitMarker()
elseif hit == 2 then
GiveHitMarker(true)
end
local tab2 = tab.other
for v, ent in pairs(tab2.ent) do
local ent = Entity(ent)
if !IsValid(ent.KCModel) and tab2.model[v] != "" then
ent.KCModel = ClientsideModel(tab2.model[v])
table.insert(KillCamStore, ent.KCModel)
else
ent.KCModel.IsKillcamEnt = true
ent.KCModel:SetPos(tab2.pos[v])
ent.KCModel:SetAngles(tab2.ang[v])
ent.KCModel:SetModel(tab2.model[v])
ent.KCModel:SetSequence(tab2.seq[v])
ent.KCModel:SetPoseParameter("move_x", 1)
ent.KCModel:SetCycle(tab2.cycle[v])
ent.KCModel:SetNoDraw(!tab2.alive[v])
if tab2.alive[v] then
ent.SpawnRagdoll = false
end
if !tab2.alive[v] and !ent.SpawnRagdoll then
ent.SpawnRagdoll = true
local rag = ClientsideRagdoll(tab2.model[v])
rag:SetPos(tab2.pos[v])
rag.IsKillcamEnt = true
rag:SetNoDraw(false)
table.insert(KillCamStore, rag)
TransferBones(ent.KCModel, rag)
end
end
end
end
for _, ent in ipairs(ents.GetAll()) do
if not ent.IsKillcamEnt and (ent:IsPlayer() or ent:IsNPC() or ent:IsWeapon() or ent:GetClass() == "prop_ragdoll" or string.match(ent:GetClass(), "tdm_")) then
ent:SetNoDraw(true)
end
end
end
end)
local lastang =
hook.Add("CalcView", "!!!KillCamTDM", function(ply, origin, angles, fov)
if istable(tab) then
lastang = tab.ply.ang
if tab.ply.lock then
local alive, pos = COD:GetMeFromTable(tab)
if alive and isvector(pos) then
pos = pos+Vector(0,0,32)
lastang = (pos-tab.ply.pos):GetNormalized():Angle()
end
end
local view = {
origin = tab.ply.pos,
angles = lastang,
fov = fov,
drawviewer = false,
znear = 0.1,
zfar = 10000,
}
return view
end
end)
end
net.Receive("COD.KillcamSend", function()
local flt = net.ReadUInt(32)
local tab = net.ReadData(flt)
local bool = net.ReadBool()
tab = util.Decompress(tab)
local tab2 = util.JSONToTable(tab)
COD:PlayKillcam(tab2, bool)
end)

View File

@@ -0,0 +1,84 @@
local killfeed = vgui.Create("DPanel")
killfeed:SetSize(500, 290)
killfeed:SetPos(10, 400)
killfeed.Paint = function(self, w, h) end
local nametab = {
["prop_dynamic"] = "Killstreak",
["env_explosion"] = "Explosion",
["tdm_package"] = "Care Package",
["vj_tdm_k9"] = "Dog",
["vj_tdm_npc"] = "AI Soldier",
}
killicon.Add("default", "tdmg/hud/skull", Color(255,255,255))
killicon.Add("takedown", "tdmg/hud/takedown", Color(255,255,255))
killicon.Add("knife", "tdmg/hud/knife", Color(255,255,255))
killicon.Add("explosion", "tdmg/hud/explosion", Color(255,255,255))
local function AddKillfeedEntry(attacker, inflictor, killed)
if !IsValid(killed) then return end
local entry = vgui.Create("DPanel", killfeed)
entry:SetSize(200, 30)
entry:Dock(TOP)
entry:DockMargin(5, 5, 5, 0)
entry.Paint = function(self, w, h) end
local color1 = Color(255, 255, 255)
local name = ""
if IsValid(attacker) and attacker != killed then
if attacker:IsPlayer() then
name = attacker:Nick()
color1 = team.GetColor(attacker:Team())
elseif attacker:GetNWFloat('Team') then
name = nametab[attacker:GetClass()] or attacker.PrintName or attacker:GetClass()
color1 = team.GetColor(attacker:GetNWFloat('Team'))
else
name = nametab[attacker:GetClass()] or attacker.PrintName or attacker:GetClass()
color1 = Color(200,200,200)
end
local attackerLabel = vgui.Create("DLabel", entry)
attackerLabel:SetText(name.." ")
attackerLabel:SetFont("TDMG_SmallFont1")
attackerLabel:SetColor(color1)
attackerLabel:SizeToContents()
attackerLabel:Dock(LEFT)
end
local inflictorLabel = vgui.Create("DKillIcon", entry)
inflictorLabel:SetPos(entry:GetPos())
inflictorLabel:SetName(inflictor)
inflictorLabel:SizeToContents()
inflictorLabel:Dock(LEFT)
if killed:IsPlayer() then
name = killed:Nick()
color1 = team.GetColor(killed:Team())
else
name = killed:GetPrintName()
color1 = Color(200,200,200)
end
local killedLabel = vgui.Create("DLabel", entry)
killedLabel:SetText(" "..name)
killedLabel:SetFont("TDMG_SmallFont1")
killedLabel:SetColor(color1)
killedLabel:SizeToContents()
killedLabel:Dock(LEFT)
timer.Simple(10, function()
if !IsValid(entry) then return end
entry:AlphaTo(0, 1, 0, function(ad, pnl)
pnl:Remove()
end)
end)
end
net.Receive("COD.Killfeed", function()
local tab = net.ReadTable()
local att = tab.attacker
local inf = tab.inflictor
local tar = tab.target
AddKillfeedEntry(att, inf, tar)
end)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,164 @@
OUTLINE_MODE_BOTH = 0
OUTLINE_MODE_NOTVISIBLE = 1
OUTLINE_MODE_VISIBLE = 2
local istable = istable
local render = render
local LocalPlayer = LocalPlayer
local Material = Material
local CreateMaterial = CreateMaterial
local hook = hook
local cam = cam
local ScrW = ScrW
local ScrH = ScrH
local IsValid = IsValid
local surface = surface
module( "outline", package.seeall )
local List, ListSize = {}, 0
local RenderEnt = NULL
local OutlineMatSettings = {
[ "$ignorez" ] = 1,
[ "$alphatest" ] = 1
}
local CopyMat = Material( "pp/copy" )
local OutlineMat = CreateMaterial( "OutlineMat", "UnlitGeneric", OutlineMatSettings )
local StoreTexture = render.GetScreenEffectTexture( 0 )
local DrawTexture = render.GetScreenEffectTexture( 1 )
local ENTS = 1
local COLOR = 2
local MODE = 3
function Add( ents, color, mode )
if ( ListSize >= 255 ) then return end --Maximum 255 reference values
if ( !istable( ents ) ) then ents = { ents } end --Support for passing Entity as first argument
if ( ents[ 1 ] == nil ) then return end --Do not pass empty tables
local t = {
[ ENTS ] = ents,
[ COLOR ] = color,
[ MODE ] = mode or OUTLINE_MODE_BOTH
}
ListSize = ListSize + 1
List[ ListSize ] = t
end
function RenderedEntity()
return RenderEnt
end
local function Render()
local ply = LocalPlayer()
local IsLineOfSightClear = ply.IsLineOfSightClear
local scene = render.GetRenderTarget()
render.CopyRenderTargetToTexture( StoreTexture )
local w = ScrW()
local h = ScrH()
render.Clear( 0, 0, 0, 0, true, true )
render.SetStencilEnable( true )
cam.IgnoreZ( true )
render.SuppressEngineLighting( true )
render.SetStencilWriteMask( 0xFF )
render.SetStencilTestMask( 0xFF )
render.SetStencilCompareFunction( STENCIL_ALWAYS )
render.SetStencilFailOperation( STENCIL_KEEP )
render.SetStencilZFailOperation( STENCIL_REPLACE )
render.SetStencilPassOperation( STENCIL_REPLACE )
cam.Start3D()
for i = 1, ListSize do
local v = List[ i ]
local mode = v[ MODE ]
local ents = v[ ENTS ]
render.SetStencilReferenceValue( i )
for j = 1, #ents do
local ent = ents[ j ]
if ( !IsValid( ent ) ) then continue end
if ( ( mode == OUTLINE_MODE_NOTVISIBLE && IsLineOfSightClear( ply, ent ) ) || ( mode == OUTLINE_MODE_VISIBLE && !IsLineOfSightClear( ply, ent ) ) ) then
continue
end
RenderEnt = ent
ent:DrawModel()
end
end
RenderEnt = NULL
cam.End3D()
render.SetStencilCompareFunction( STENCIL_EQUAL )
cam.Start2D()
for i = 1, ListSize do
render.SetStencilReferenceValue( i )
surface.SetDrawColor( List[ i ][ COLOR ] )
surface.DrawRect( 0, 0, w, h )
end
cam.End2D()
render.SuppressEngineLighting( false )
cam.IgnoreZ( false )
render.SetStencilEnable( false )
render.CopyRenderTargetToTexture( DrawTexture )
render.SetRenderTarget( scene )
CopyMat:SetTexture( "$basetexture", StoreTexture )
render.SetMaterial( CopyMat )
render.DrawScreenQuad()
render.SetStencilEnable( true )
render.SetStencilReferenceValue( 0 )
render.SetStencilCompareFunction( STENCIL_EQUAL )
OutlineMat:SetTexture( "$basetexture", DrawTexture )
render.SetMaterial( OutlineMat )
render.DrawScreenQuadEx( -1, -1, w ,h )
render.DrawScreenQuadEx( -1, 0, w, h )
render.DrawScreenQuadEx( -1, 1, w, h )
render.DrawScreenQuadEx( 0, -1, w, h )
render.DrawScreenQuadEx( 0, 1, w, h )
render.DrawScreenQuadEx( 1, 1, w, h )
render.DrawScreenQuadEx( 1, 0, w, h )
render.DrawScreenQuadEx( 1, 1, w, h )
render.SetStencilEnable( false )
end
hook.Add( "PostDrawEffects", "RenderOutlines", function()
hook.Run( "PreDrawOutlines" )
if ( ListSize == 0 ) then return end
Render()
List, ListSize = {}, 0
end )

View File

@@ -0,0 +1,213 @@
local cachedEntities = {}
local max_radar_distance = 800
local max_radar_distance_sqr = max_radar_distance ^ 2
local radar_scale = 2
local uav_update_rate = 5
local radarMat = Material("tdmg/hud/radar.png", "noclamp")
local glitchMat = Material("tdmg/hud/glitch.png", "noclamp")
local playerMat = Material("tdmg/hud/radar/player.png", "noclamp")
local enemyColor = Color(200, 50, 0)
local playerColor = Color(0, 150, 250)
local yourColor = Color(255, 255, 0)
local enemyMat = Material("tdmg/hud/radar/enemy.png", "noclamp")
local UAVEnemies = {}
local function GetFriends()
cachedEntities = {}
for k, v in pairs(ents.FindInSphere(LocalPlayer():GetPos(), max_radar_distance * radar_scale)) do
if !v:IsPlayer() or v == LocalPlayer() or !v:Alive() or v:Team() != LocalPlayer():Team() then continue end
table.insert(cachedEntities, v)
end
return cachedEntities
end
local function GetEnemies(ismuav)
cachedEntities = {}
for k, v in pairs(ents.FindInSphere(LocalPlayer():GetPos(), max_radar_distance * radar_scale)) do
if !v:IsPlayer() or v == LocalPlayer() or !v:Alive() or v:Team() == LocalPlayer():Team() then continue end
if not ismuav then
table.insert(cachedEntities, {pos = v:GetPos(), alpha = 255})
UAVEnemies = cachedEntities
else
table.insert(cachedEntities, v)
end
end
return cachedEntities
end
local function GetEntities()
cachedEntities = {}
for k, v in pairs(ents.FindInSphere(LocalPlayer():GetPos(), max_radar_distance * radar_scale)) do
if v:IsPlayer() or v:Health() <= 0 then continue end
if v:GetNWFloat('Team') > 0 then
table.insert(cachedEntities, v)
end
end
return cachedEntities
end
local IconsEntityTab = {
["tdm_harrier"] = {mat = Material("tdmg/hud/radar/jet.png"), rotate = true, size = 32, without_uav = true, bone = "tag_body"},
["tdm_infil"] = {mat = Material("tdmg/hud/radar/heli.png"), rotate = true, size = 32, without_uav = true, bone = "tag_body"},
["tdm_mi24"] = {mat = Material("tdmg/hud/radar/heli.png"), rotate = true, size = 32, without_uav = true, bone = "Body"},
["tdm_ah64"] = {mat = Material("tdmg/hud/radar/heli.png"), rotate = true, size = 32, without_uav = true, bone = "root"},
["tdm_drone"] = {mat = Material("tdmg/hud/radar/drone.png"), rotate = true, size = 16, without_uav = false},
["tdm_sentry"] = {mat = Material("tdmg/hud/radar/turret.png"), rotate = false, size = 24, without_uav = false},
["vj_tdm_k9"] = {mat = Material("tdmg/hud/radar/dog.png"), rotate = false, size = 20, without_uav = false},
["vj_tdm_npc"] = {mat = Material("tdmg/hud/radar/soldier.png"), rotate = false, size = 20, without_uav = false},
["vj_tdm_invasion_soldier1"] = {mat = Material("tdmg/hud/radar/enemy.png"), rotate = false, size = 16, without_uav = false},
["vj_tdm_invasion_soldier2"] = {mat = Material("tdmg/hud/radar/enemy.png"), rotate = false, size = 16, without_uav = false},
}
local function Draw()
if COD.HideHUD or !LocalPlayer():Alive() then return end
local w, h = ScrW(), ScrH()
local x, y, size = 10, 10, 250
local cx, cy = x + size / 2, y + size / 2
local playerSize = 24
local enemySize = 16
local IsMUAV = false
local ply = LocalPlayer()
draw.RoundedBox(0, x, y, size, size, Color(0, 0, 0, 200))
local localPos = ply:GetPos()
local localAng = ply:GetAngles()
if not COD.Counter_UAV_Active then
local entities = GetFriends()
for k, ent in pairs(entities) do
if !IsValid(ent) then continue end
local enemyPos = ply:GetPos() - ent:GetPos()
enemyPos:Rotate(Angle(180, (ply:EyeAngles().y) * -1, -180))
local ex = size / 2 * (enemyPos.y / max_radar_distance / radar_scale)
local ey = size / 2 * (enemyPos.x / max_radar_distance / radar_scale)
local posx = cx - ex - (enemySize / 2)
local posy = cy - ey - (enemySize / 2)
local mat = enemyMat
posx = math.Clamp(posx, x, x + size - playerSize / 2)
posy = math.Clamp(posy, y, y + size - playerSize / 2)
local size = playerSize
surface.SetDrawColor(playerColor)
surface.SetMaterial(playerMat)
surface.DrawTexturedRectRotated(posx + size / 4, posy + size / 4, size, size, (ent:IsPlayer() and ent:EyeAngles() or ent:GetAngles()).y + ply:EyeAngles().y * -1)
end
local entnpc = GetEntities()
for k, ent in pairs(entnpc) do
if !IsValid(ent) then continue end
local data = IconsEntityTab[ent:GetClass()]
local enemyPos = ply:GetPos() - ent:GetPos()
local enemyAng = ent:GetAngles().y
if data and data.bone then
local bonepos, boneang = ent:GetBonePosition(ent:LookupBone(data.bone))
enemyPos = ply:GetPos() - bonepos
enemyAng = boneang.y
end
enemyPos:Rotate(Angle(180, (ply:EyeAngles().y) * -1, -180))
local ex = size / 2 * (enemyPos.y / max_radar_distance / radar_scale)
local ey = size / 2 * (enemyPos.x / max_radar_distance / radar_scale)
local posx = cx - ex - (enemySize / 2)
local posy = cy - ey - (enemySize / 2)
posx = math.Clamp(posx, x, x + size - playerSize / 2)
posy = math.Clamp(posy, y, y + size - playerSize / 2)
local size = playerSize
if ent:GetNWFloat('Team') == LocalPlayer():Team() then
surface.SetDrawColor(playerColor)
else
surface.SetDrawColor(enemyColor)
end
if data then
if not data.without_uav and ent:GetNWFloat('Team') != LocalPlayer():Team() and (not COD.UAV_Active and not COD.Adv_UAV_Active) then continue end
surface.SetMaterial(data.mat)
size = data.size
if data.rotate then
surface.DrawTexturedRectRotated(posx + size / 4, posy + size / 4, size, size, enemyAng + ply:EyeAngles().y * -1)
else
surface.DrawTexturedRectRotated(posx + size / 4, posy + size / 4, size, size, 0)
end
else
surface.SetMaterial(enemyMat)
size = 12
surface.DrawTexturedRectRotated(posx + size / 4, posy + size / 4, size, size, 0)
end
end
if not COD.Adv_UAV_Active and COD.UAV_Active then
if uav_update_rate < CurTime() then
uav_update_rate = CurTime() + 4
GetEnemies()
end
local entities = UAVEnemies
for k, ent in pairs(entities) do
ent.alpha = math.max(ent.alpha - FrameTime()*75, 0)
local enemyPos = ply:GetPos() - ent.pos
enemyPos:Rotate(Angle(180, (ply:EyeAngles().y) * -1, -180))
local ex = size / 2 * (enemyPos.y / max_radar_distance / radar_scale)
local ey = size / 2 * (enemyPos.x / max_radar_distance / radar_scale)
local posx = cx - ex - (enemySize / 2)
local posy = cy - ey - (enemySize / 2)
local mat = enemyMat
posx = math.Clamp(posx, x, x + size - playerSize / 2)
posy = math.Clamp(posy, y, y + size - playerSize / 2)
local size = enemySize
surface.SetDrawColor(Color(enemyColor.r, enemyColor.g, enemyColor.b, ent.alpha))
surface.SetMaterial(enemyMat)
surface.DrawTexturedRectRotated(posx + size / 4, posy + size / 4, size, size, 0)
end
end
if COD.Adv_UAV_Active then
local entities = GetEnemies(true)
for k, ent in pairs(entities) do
if !IsValid(ent) then continue end
local enemyPos = ply:GetPos() - ent:GetPos()
enemyPos:Rotate(Angle(180, (ply:EyeAngles().y) * -1, -180))
local ex = size / 2 * (enemyPos.y / max_radar_distance / radar_scale)
local ey = size / 2 * (enemyPos.x / max_radar_distance / radar_scale)
local posx = cx - ex - (enemySize / 2)
local posy = cy - ey - (enemySize / 2)
local mat = enemyMat
posx = math.Clamp(posx, x, x + size - playerSize / 2)
posy = math.Clamp(posy, y, y + size - playerSize / 2)
local size = playerSize
surface.SetDrawColor(enemyColor)
surface.SetMaterial(playerMat)
surface.DrawTexturedRectRotated(posx + size / 4, posy + size / 4, size, size, (ent:IsPlayer() and ent:EyeAngles() or ent:GetAngles()).y + ply:EyeAngles().y * -1)
end
end
surface.SetMaterial(playerMat)
surface.SetDrawColor(yourColor)
surface.DrawTexturedRect(cx - playerSize / 2, cy - playerSize / 2, playerSize, playerSize)
else
surface.SetDrawColor(Color(255, 255, 255, 255))
surface.SetMaterial(glitchMat)
surface.DrawTexturedRect(x, y, size, size)
end
surface.SetDrawColor(Color(255, 255, 255, 255))
surface.SetMaterial(radarMat)
surface.DrawTexturedRect(x, y, size, size)
end
hook.Add("HUDPaint", "MWRadar", Draw)

View File

@@ -0,0 +1,238 @@
surface.CreateFont( "mw2score_servername", {
font = "ChatFont",
extended = false,
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "mw2score_gamemodename", {
font = "ChatFont",
extended = false,
size = 40,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "mw2score_playername", {
font = "ChatFont",
extended = false,
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
local Scoredefault_black = Color(0,0,0,200)
local plycolor = Color(255,255,255)
local servername = GetHostName()
local gamemodename = COD.Language["gamemode_"..COD.DataTable["Gamemode"]]
local servernamedata = {
text = servername,
xalign = TEXT_ALIGN_CENTER,
font = "mw2score_servername"
}
local gamemodenamedata = {
text = gamemodename,
xalign = TEXT_ALIGN_CENTER,
font = "mw2score_gamemodename"
}
local playertextdata= {
xalign = TEXT_ALIGN_LEFT,
font = "mw2score_playername"
}
local detaildata = {
xalign = TEXT_ALIGN_LEFT,
font = "ChatFont"
}
local avtab = {}
local function CreatePlayerAvatar(ply,x,y)
if !ply.mw2avatar then
local avatar = vgui.Create("AvatarImage")
avatar:SetPos(x,y)
avatar:SetSize(27,27)
avatar:SetPlayer(ply)
ply.mw2avatar = avatar
table.insert(avtab, avatar)
end
end
local function RemoveAvatars()
local players = player.GetAll()
for k, ply in ipairs(players) do
if ply.mw2avatar then
ply.mw2avatar:Remove()
ply.mw2avatar = nil
table.RemoveByValue(avtab, ply.mw2avatar)
end
end
for k, v in ipairs(avtab) do
v:Remove()
table.remove(avtab, k)
end
end
local team1_mat = Material('tdmg/hud/teams/specgru.png')
local team2_mat = Material('tdmg/hud/teams/kortac.png')
local function MW2SCORE_RenderScoreboard()
gamemodename = COD.Language["gamemode_"..COD.DataTable["Gamemode"]]
gamemodenamedata = {
text = gamemodename,
xalign = TEXT_ALIGN_CENTER,
font = "mw2score_gamemodename"
}
hook.Add("HUDPaint","MW2SCORE_RENDER",function()
local w,h = ScrW(),ScrH()
local xoffset = 50
local players = team.GetPlayers(1)
local players2 = team.GetPlayers(2)
table.sort(players, function(a,b)
return a:GetNWFloat('Score') > b:GetNWFloat('Score')
end)
table.sort(players2, function(a,b)
return a:GetNWFloat('Score') > b:GetNWFloat('Score')
end)
-- Server Name
surface.SetDrawColor(Scoredefault_black)
surface.DrawRect(0, h/15, w, 50)
servernamedata.pos = {w/2,h/8.5}
draw.TextShadow(servernamedata,2,255)
gamemodenamedata.pos = {w/2,h/14}
draw.TextShadow(gamemodenamedata,2,255)
detaildata.xalign = 1
detaildata.pos = {w-245,h/5.7}
detaildata.text = COD.Language["scoreboard_score"]
draw.TextShadow(detaildata,2,255)
detaildata.xalign = 1
detaildata.pos = {w-145,h/5.7}
detaildata.text = COD.Language["scoreboard_kd"]
draw.TextShadow(detaildata,2,255)
surface.SetDrawColor(color_white)
surface.SetMaterial(team2_mat)
surface.DrawTexturedRect(w-600, h/5.7-25, 72, 72)
draw.SimpleText(COD.Language["team2_name"], "mw2score_gamemodename", w-512, h/5.7+10, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
detaildata.xalign = 1
detaildata.pos = {400+xoffset,h/5.7}
detaildata.text = COD.Language["scoreboard_score"]
draw.TextShadow(detaildata,2,255)
detaildata.xalign = 1
detaildata.pos = {550,h/5.7}
detaildata.text = COD.Language["scoreboard_kd"]
draw.TextShadow(detaildata,2,255)
surface.SetDrawColor(color_white)
surface.SetMaterial(team1_mat)
surface.DrawTexturedRect(80, h/5.7-40, 80, 96)
draw.SimpleText(COD.Language["team1_name"], "mw2score_gamemodename", 170, h/5.7+10, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
for index, ply in ipairs(players) do
if !IsValid(ply) then continue end
if ply:IsPlayer() then
local name = ply:GetName()
local kills = ply:Frags()
local deaths = ply:Deaths()
local curteam = ply:Team()
local teamcolor = team.GetColor(curteam)
local row = (h/5)+(index*40)
CreatePlayerAvatar(ply, 100,row)
plycolor.r = teamcolor.r
plycolor.g = teamcolor.g
plycolor.b = teamcolor.b
surface.SetDrawColor(Scoredefault_black)
surface.DrawRect(95, row-5, 500, 35)
playertextdata.text = name
playertextdata.pos = {150,row}
playertextdata.color = plycolor
draw.TextShadow(playertextdata,2,255)
detaildata.pos = {450,row}
detaildata.text = tostring(ply:GetNWFloat('Score'))
draw.TextShadow(detaildata,2,255)
detaildata.pos = {550,row}
detaildata.text = tostring(kills.."/"..deaths)
draw.TextShadow(detaildata,2,255)
end
end
for index, ply in ipairs(players2) do
if !IsValid(ply) then continue end
if ply:IsPlayer() then
local name = ply:GetName()
local kills = ply:Frags()
local deaths = ply:Deaths()
local curteam = ply:Team()
local teamcolor = team.GetColor(curteam)
local row = (h/5)+(index*40)
CreatePlayerAvatar(ply, w-590 ,row)
plycolor.r = teamcolor.r
plycolor.g = teamcolor.g
plycolor.b = teamcolor.b
surface.SetDrawColor(Scoredefault_black)
surface.DrawRect(w-595, row-5, 500, 35)
playertextdata.text = name
playertextdata.pos = {w-540,row}
playertextdata.color = plycolor
draw.TextShadow(playertextdata,2,255)
detaildata.pos = {w-245,row}
detaildata.text = tostring(ply:GetNWFloat('Score'))
draw.TextShadow(detaildata,2,255)
detaildata.pos = {w-145,row}
detaildata.text = tostring(kills.."/"..deaths)
draw.TextShadow(detaildata,2,255)
end
end
end)
end
local function MW2SCORE_HideScoreboard()
hook.Remove("HUDPaint","MW2SCORE_RENDER")
RemoveAvatars()
end
hook.Add("ScoreboardShow","MW2SCORE_NoDefault",function()
MW2SCORE_RenderScoreboard()
COD.HideHUD = true
return true
end)
hook.Add("ScoreboardHide","MW2SCORE_HideScore",function()
MW2SCORE_HideScoreboard()
COD.HideHUD = false
end)
--original by StarFrost, i edited it for gamemode

View File

@@ -0,0 +1,132 @@
local sdeltaTime = sdeltaTime or 0
local SysTime = SysTime
local FrameTime = FrameTime
local start_delta_time = 0
local is_second_tick = false
hook.Add('Tick', 'sFixedDeltaTime', function()
if is_second_tick then
sdeltaTime = SysTime() - start_delta_time
else
start_delta_time = SysTime()
end
is_second_tick = not is_second_tick
end)
local function magnitude(vec)
local magnitude = vec
magnitude = magnitude.x ^ 2 + magnitude.y ^ 2 + magnitude.z ^ 2
magnitude = math.sqrt(magnitude)
return magnitude
end
local function MoveTowardsVector(current_vector, target_vector, delta_time)
local direction_vector = target_vector - current_vector
local magnitude = magnitude(direction_vector)
if magnitude <= delta_time or magnitude == 0 then
return target_vector
end
return current_vector + direction_vector / magnitude * delta_time
end
local rndhooks = {}
net.Receive("COD.TakedownCam", function()
local cam1 = net.ReadBool()
local float = net.ReadFloat()
local toplayer = net.ReadBool()
local rnd = math.random(1,999999999)
table.insert(rndhooks, "TakedownCam"..rnd)
if true then
local ply = LocalPlayer()
local delta = sdeltaTime
local deltanum = 2
local deltamult = 16
local ang_fix = ply:GetAngles()
local forwardplus = ang_fix:Forward()*math.Rand(32,64)
local rightplus = ang_fix:Right()*math.Rand(32,64)
local upplus = Vector(0,0,math.Rand(16,32))
if math.random(1,2) == 2 then
forwardplus = ply:GetForward()*math.Rand(-64,-32)
end
if math.random(1,2) == 2 then
rightplus = ply:GetRight()*math.Rand(-64,-32)
end
local endpos = ply:GetBonePosition(ply:LookupBone("ValveBiped.Bip01_Head1"))+forwardplus+rightplus+upplus
local curpos = ply:GetBonePosition(ply:LookupBone("ValveBiped.Bip01_Head1"))
local angle1 = Angle(0,0,0)
local dist = 0
local drawv = true
local tohead = false
timer.Simple(float/2, function()
deltamult = 0
end)
if toplayer then
timer.Simple(float, function()
tohead = true
deltamult = 128
end)
end
if cam1 then
hook.Add("CalcView", "TakedownCam"..rnd, function( ply, pos, angles, fov )
curpos = MoveTowardsVector(curpos, endpos, delta*deltanum)
angle1 = (ply:GetBonePosition(ply:LookupBone("ValveBiped.Bip01_Head1"))-curpos):GetNormalized():Angle()
dist = curpos:Distance(ply:GetBonePosition(ply:LookupBone("ValveBiped.Bip01_Head1")))
if tohead then
endpos = ply:GetBonePosition(ply:LookupBone("ValveBiped.Bip01_Head1"))
end
if deltamult > 0 then
deltanum = deltanum+FrameTime()*deltamult
end
if dist < 8 and tohead then
drawv = false
angle1 = ply:EyeAngles()
else
drawv = true
end
local view = {
angles = angle1,
origin = curpos,
fov = fov,
drawviewer = drawv,
nearz = 16,
}
if ply:Alive() then
COD.HideHUD = true
return view
end
end)
timer.Simple(float+0.7, function()
hook.Remove("CalcView", "TakedownCam"..rnd)
table.RemoveByValue(rndhooks, "TakedownCam"..rnd)
COD.HideHUD = false
end)
else
for _, v in pairs(rndhooks) do
hook.Remove("CalcView", v)
table.RemoveByValue(rndhooks, v)
end
COD.HideHUD = false
end
end
end)
hook.Add("CalcMainActivity", "!TDMAnims", function(ply, vel)
local str = ply:GetNWString('SVAnim')
local num = ply:GetNWFloat('SVAnimDelay')
local st = ply:GetNWFloat('SVAnimStartTime')
if str != "" then
ply:SetCycle((CurTime()-st)/num)
return -1, ply:LookupSequence(str)
end
end)