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,49 @@
include("shared.lua")
if CLIENT then
local jammat = Material( "models/shtormer/sania/jam.png" )
local flag1 = false
function ENT:Think()
if LocalPlayer():lvsGetVehicle():IsValid() then
if LocalPlayer():lvsGetVehicle():GetNWEntity("UAVControl"):IsValid() then
self:SetNWEntity("Jamming", LocalPlayer():lvsGetVehicle())
jammer = ents.FindByClass( "sw_sania" )
if jammer != nil then
for i =1, #jammer do
if jammer[i]:IsValid() then
if LocalPlayer():lvsGetVehicle():GetPos():Distance(jammer[i]:GetPos()) < jammer[i].JamDistance then
flag1 = true
end
end
end
if LocalPlayer():lvsGetVehicle():GetNWBool("Jammed") and !flag1 then
LocalPlayer():lvsGetVehicle():SetNWBool("Jammed", false)
flag1 = false
elseif flag1 then
LocalPlayer():lvsGetVehicle():SetNWBool("Jammed", true)
end
else
flag1 = false
end
end
if LocalPlayer():lvsGetVehicle():GetNWBool("Jammed") and LocalPlayer():lvsGetVehicle():GetPos():Distance(self:GetPos()) < self.JamDistance and self:IsValid() and LocalPlayer():lvsGetVehicle():IsValid() and self != NULL then
print(LocalPlayer():lvsGetVehicle():GetNWEntity("UAVControl"):IsValid())
hook.Add( "HUDPaint", "uavjamsania", function()
if self != NULL and LocalPlayer():lvsGetVehicle() != NULL then
surface.SetDrawColor( 255, 255, 255, 255/(LocalPlayer():lvsGetVehicle():GetPos():Distance(self:GetPos())/self.FullJamDistance) ) -- Set the drawing color
surface.SetMaterial( jammat ) -- Use our cached material
surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() ) -- Actually draw the rectangle
end
end )
elseif !LocalPlayer():lvsGetVehicle():GetNWBool("Jammed") or !LocalPlayer():lvsGetVehicle():IsValid() or !self:IsValid() or self == NULL or LocalPlayer():lvsGetVehicle() == NULL or LocalPlayer():lvsGetVehicle():GetNWEntity("UAVControl"):IsValid() == NULL then
hook.Remove( "HUDPaint", "uavjamsania" )
end
end
end
function ENT:Draw()
self:DrawModel()
end
end

View File

@@ -0,0 +1,158 @@
AddCSLuaFile("shared.lua")
AddCSLuaFile("cl_init.lua")
include("shared.lua")
AddCSLuaFile("autorun/mur_drone_fx.lua")
if SERVER then
function ENT:Initialize()
self:SetModel("models/shtormer/sania.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetNWBool("JamEnabled", true)
local phys = self:GetPhysicsObject()
if IsValid(phys) then phys:Wake() end
self.HP = self.HP or 500
end
function ENT:OnTakeDamage(dmginfo)
local dmg = dmginfo:GetDamage()
self.HP = self.HP - dmg
if self.HP <= 0 then
self:Remove()
end
end
-- Глушение дронов
function ENT:JamDrone(drone)
if not IsValid(drone) then return end
local dist = drone:GetPos():Distance(self:GetPos())
local jammed = dist <= self.JamDistance
drone:SetNWBool("Jammed", jammed)
if jammed then
drone:SetNWFloat("JamStrength", 1 - dist / self.JamDistance)
else
drone:SetNWFloat("JamStrength", 0)
end
end
hook.Add("KeyPress", "SaniaToggle", function(ply, key)
if key ~= IN_USE then return end
local tr = ply:GetEyeTrace()
local ent = tr.Entity
if not IsValid(ent) then return end
if ent:GetClass() ~= "sw_sania" then return end
if tr.HitPos:Distance(ply:GetPos()) > 150 then return end
local newState = not ent:GetNWBool("JamEnabled")
ent:SetNWBool("JamEnabled", newState)
if newState then
ply:ChatPrint("РЭБ: ВКЛЮЧЕНА")
ent:EmitSound("buttons/button3.wav", 75, 120)
else
ply:ChatPrint("РЭБ: ВЫКЛЮЧЕНА")
ent:EmitSound("buttons/button19.wav", 75, 80)
end
end)
function ENT:Think()
local sph = ents.FindInSphere(self:GetPos(), self.JamDistance)
if not self:GetNWBool("JamEnabled") then
for drone, _ in pairs(self.JammedDrones or {}) do
if IsValid(drone) then
drone:SetNWBool("Jammed", false)
drone:SetNWFloat("JamStrength", 0)
end
end
self.JammedDrones = {}
self:NextThink(CurTime() + 0.1)
return true
end
self.JammedDrones = self.JammedDrones or {}
-- временная таблица для отметки "кто сейчас в зоне"
local inZone = {}
for i = 1, #sph do
local ent = sph[i]
if not IsValid(ent) then continue end
local class = ent:GetClass()
-- 1) Игрок в UAV
if ent:IsPlayer() then
local veh = ent:lvsGetVehicle()
if IsValid(veh) then
local uav = veh:GetNWEntity("UAVControl")
if IsValid(uav) then
local dist = veh:GetPos():Distance(self:GetPos())
if dist < self.JamDistance then
if not self._savedRates then
self._savedRates = {
pitch = veh.TurnRatePitch,
yaw = veh.TurnRateYaw,
roll = veh.TurnRateRoll
}
end
local mul = math.max(0.1, dist / self.FullJamDistance)
veh.TurnRatePitch = self._savedRates.pitch * mul
veh.TurnRateYaw = self._savedRates.yaw * mul
veh.TurnRateRoll = self._savedRates.roll * mul
else
if self._savedRates then
veh.TurnRatePitch = self._savedRates.pitch
veh.TurnRateYaw = self._savedRates.yaw
veh.TurnRateRoll = self._savedRates.roll
self._savedRates = nil
end
end
end
end
end
-- 2) Дроны
if class == "mur_drone_entity"
or class == "mur_drone_grenade"
or class == "mur_drone_spy" then
inZone[ent] = true
self.JammedDrones[ent] = true
local dist = ent:GetPos():Distance(self:GetPos())
ent:SetNWBool("Jammed", true)
ent:SetNWFloat("JamStrength", 1 - dist / self.JamDistance)
end
end
for drone, _ in pairs(self.JammedDrones) do
if not IsValid(drone) then
self.JammedDrones[drone] = nil
continue
end
if not inZone[drone] then
drone:SetNWBool("Jammed", false)
drone:SetNWFloat("JamStrength", 0)
self.JammedDrones[drone] = nil
end
end
self:NextThink(CurTime() + 0.1)
return true
end
end

View File

@@ -0,0 +1,15 @@
ENT.Base = "base_gmodentity"
ENT.Type = "anim"
ENT.PrintName = "Sania UAV Jammer" -- название энтити в меню Q
ENT.Author = "Shtormer" -- автор
ENT.Contact = "" -- контакты с автором
ENT.Information = "" -- описание энтити
ENT.Category = "SW Weapons Factory" -- категория в меню Q
ENT.Model = "models/shtormer/sania.mdl"
ENT.Spawnable = true -- разрешается спавнить через спавн-меню Q
ENT.AdminSpawnable = false -- разрешается спавнить только админам
ENT.JamDistance = 5000
ENT.FullJamDistance = 2000
ENT.HP = 200
ENT.JamEnabled = true