add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
if not ATTACHMENT then
ATTACHMENT = {}
end
-- ATTACHMENT.TFADataVersion = 1 -- Uncomment this in your attachment file
-- If it is undefined, if fallback to 0 and WeaponTable gets migrated like SWEPs do
ATTACHMENT.Name = "Base Attachment"
ATTACHMENT.ShortName = nil --Abbreviation, 5 chars or less please
ATTACHMENT.Description = {} --TFA.Attachments.Colors["+"], "Does something good", TFA.Attachments.Colors["-"], "Does something bad" }
ATTACHMENT.Icon = nil --Revers to label, please give it an icon though! This should be the path to a png, like "entities/tfa_ammo_match.png"
ATTACHMENT.WeaponTable = {} --put replacements for your SWEP talbe in here e.g. ["Primary"] = {}
ATTACHMENT.DInv2_GridSizeX = nil -- DInventory/2 Specific. Determines attachment's width in grid.
ATTACHMENT.DInv2_GridSizeY = nil -- DInventory/2 Specific. Determines attachment's height in grid.
ATTACHMENT.DInv2_Volume = nil -- DInventory/2 Specific. Determines attachment's volume in liters.
ATTACHMENT.DInv2_Mass = nil -- DInventory/2 Specific. Determines attachment's mass in kilograms.
ATTACHMENT.DInv2_StackSize = nil -- DInventory/2 Specific. Determines attachment's maximal stack size.
ATTACHMENT.TFADataVersion = nil -- TFA.LatestDataVersion, specifies version of TFA Weapon Data this attachment utilize in `WeaponTable`
-- 0 is original, M9K-like data, and is the fallback if `TFADataVersion` is undefined
function ATTACHMENT:CanAttach(wep)
return true --can be overridden per-attachment
end
function ATTACHMENT:Attach(wep)
end
function ATTACHMENT:Detach(wep)
end
if not TFA_ATTACHMENT_ISUPDATING then
TFAUpdateAttachments()
end

View File

@@ -0,0 +1,109 @@
if not ATTACHMENT then
ATTACHMENT = {}
end
ATTACHMENT.Name = "RT Scope Base"
ATTACHMENT.Description = {}
ATTACHMENT.WeaponTable = {
["RTDrawEnabled"] = true,
-- ["RTScopeFOV"] = 90 / 1 / 2, -- Default FOV / Scope Zoom / screenscale
-- ["RTScopeAttachment"] = -1,
-- ["RTReticleMaterial"] = Material("scope/gdcw_acog"),
-- ["RTReticleColor"] = color_white,
-- ["RTReticleScale"] = 1,
-- ["RTShadowMaterial"] = Material("vgui/scope_shadowmask_test"),
-- ["RTShadowColor"] = color_white,
-- ["RTShadowScale"] = 2,
}
local cd = {}
local fallbackReticle = Material("scope/gdcw_scopesightonly")
local fallbackShadow = Material("vgui/scope_shadowmask_test")
local flipcv = GetConVar("cl_tfa_viewmodel_flip")
function ATTACHMENT:RTCode(wep, rt, scrw, scrh)
if not wep.OwnerIsValid or not wep:VMIV() then return end
local rtw, rth = rt:Width(), rt:Height()
-- clearing view
render.OverrideAlphaWriteEnable(true, true)
surface.SetDrawColor(color_white)
surface.DrawRect(-rtw, -rth, rtw * 2, rth * 2)
local vm = wep.OwnerViewModel
local ang = vm:GetAngles()
local isang = wep:GetStatL("IronSightsAngle") * wep:GetIronSightsProgress()
ang:RotateAroundAxis(ang:Forward(), -isang.z)
ang:RotateAroundAxis(ang:Right(), -isang.x)
ang:RotateAroundAxis(ang:Up(), -isang.y)
ang:RotateAroundAxis(ang:Forward(), isang.z)
local scopeAtt = wep:GetStatL("RTScopeAttachment", -1)
if scopeAtt > 0 then
local AngPos = vm:GetAttachment(scopeAtt)
if AngPos then
ang = AngPos.Ang
if flipcv:GetBool() then
ang.y = -ang.y
end
end
end
cd.angles = ang
cd.origin = wep:GetOwner():GetShootPos()
cd.x = 0
cd.y = 0
cd.w = rtw
cd.h = rth
cd.fov = wep:GetStatL("RTScopeFOV", 90 / wep:GetStatL("ScopeZoom", 1) / 2)
cd.drawviewmodel = false
cd.drawhud = false
-- main RT render view
render.Clear(0, 0, 0, 255, true, true)
render.SetScissorRect(0, 0, rtw, rth, true)
if wep:GetIronSightsProgress() > 0.005 then
render.RenderView(cd)
end
render.SetScissorRect(0, 0, rtw, rth, false)
render.OverrideAlphaWriteEnable(false, true)
cam.Start2D()
-- ADS transition darkening
draw.NoTexture()
surface.SetDrawColor(ColorAlpha(color_black, 255 * (1 - wep:GetIronSightsProgress())))
surface.DrawRect(0, 0, rtw, rth)
surface.SetMaterial(wep:GetStatL("RTReticleMaterial", fallbackReticle))
surface.SetDrawColor(wep:GetStatL("RTReticleColor", color_white))
local retScale = wep:GetStatL("RTReticleScale", 1)
surface.DrawTexturedRect(rtw / 2 - rtw * retScale / 2, rth / 2 - rth * retScale / 2, rtw * retScale, rth * retScale)
surface.SetMaterial(wep:GetStatL("RTShadowMaterial", fallbackShadow))
surface.SetDrawColor(wep:GetStatL("RTShadowColor", color_white))
local shadScale = wep:GetStatL("RTShadowScale", 2)
surface.DrawTexturedRect(rtw / 2 - rtw * shadScale / 2, rth / 2 - rth * shadScale / 2, rtw * shadScale, rth * shadScale)
cam.End2D()
end
if not TFA_ATTACHMENT_ISUPDATING then
TFAUpdateAttachments()
end