add sborka
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
local mdl = "models/v92/bf2/weapons/handheld/medikit_w.mdl"
|
||||
local bags = {}
|
||||
|
||||
-- Настраиваемые конвары для отладки
|
||||
CreateClientConVar("v92_med_back_right", "3", true, false)
|
||||
CreateClientConVar("v92_med_back_forward", "3", true, false)
|
||||
CreateClientConVar("v92_med_back_up", "3", true, false)
|
||||
|
||||
CreateClientConVar("v92_med_rot_right", "7", true, false)
|
||||
CreateClientConVar("v92_med_rot_up", "0", true, false)
|
||||
CreateClientConVar("v92_med_rot_forward", "90", true, false)
|
||||
|
||||
CreateClientConVar("v92_med_bone", "ValveBiped.Bip01_Spine2", true, false)
|
||||
|
||||
local function GetOffsets()
|
||||
local cRight = GetConVar("v92_med_back_right")
|
||||
local cForward = GetConVar("v92_med_back_forward")
|
||||
local cUp = GetConVar("v92_med_back_up")
|
||||
|
||||
local right = cRight and cRight:GetFloat() or 0
|
||||
local forward = cForward and cForward:GetFloat() or 0
|
||||
local up = cUp and cUp:GetFloat() or 0
|
||||
|
||||
return right, forward, up
|
||||
end
|
||||
|
||||
local function GetRotations()
|
||||
local cR = GetConVar("v92_med_rot_right")
|
||||
local cU = GetConVar("v92_med_rot_up")
|
||||
local cF = GetConVar("v92_med_rot_forward")
|
||||
|
||||
local r = cR and cR:GetFloat() or 0
|
||||
local u = cU and cU:GetFloat() or 0
|
||||
local f = cF and cF:GetFloat() or 0
|
||||
|
||||
return r, u, f
|
||||
end
|
||||
|
||||
local medikitRenderData = {}
|
||||
|
||||
hook.Add("PostPlayerDraw", "V92_Medikit_Draw", function(ply)
|
||||
if not IsValid(ply) or not ply:Alive() then return end
|
||||
|
||||
-- Не рисуем на себе в первом лице
|
||||
if ply == LocalPlayer() and not ply:ShouldDrawLocalPlayer() then
|
||||
return
|
||||
end
|
||||
|
||||
local boneName = GetConVar("v92_med_bone"):GetString() or "ValveBiped.Bip01_Spine2"
|
||||
|
||||
-- Проверяем наличие аптечки
|
||||
local hasBag = false
|
||||
for _, ent in ipairs(ents.FindByClass("v92_bf2_medikit_ent")) do
|
||||
if ent:GetNWBool("V92_Medikit_IsAttached", false)
|
||||
and ent:GetNWEntity("V92_Medikit_AttachedPlayer") == ply then
|
||||
hasBag = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not hasBag then
|
||||
if IsValid(bags[ply]) then bags[ply]:Remove() end
|
||||
bags[ply] = nil
|
||||
return
|
||||
end
|
||||
|
||||
if not IsValid(bags[ply]) then
|
||||
bags[ply] = ClientsideModel(mdl, RENDERGROUP_OPAQUE)
|
||||
bags[ply]:SetNoDraw(true)
|
||||
end
|
||||
|
||||
local bag = bags[ply]
|
||||
|
||||
ply:SetupBones()
|
||||
|
||||
local bone = ply:LookupBone(boneName)
|
||||
if not bone then return end
|
||||
|
||||
local m = ply:GetBoneMatrix(bone)
|
||||
if not m then return end
|
||||
|
||||
local pos = m:GetTranslation()
|
||||
local ang = m:GetAngles()
|
||||
|
||||
-- Смещения
|
||||
local rightOff, forwardOff, upOff = GetOffsets()
|
||||
local rotRight, rotUp, rotForward = GetRotations()
|
||||
|
||||
ang:RotateAroundAxis(ang:Right(), rotRight)
|
||||
ang:RotateAroundAxis(ang:Up(), rotUp)
|
||||
ang:RotateAroundAxis(ang:Forward(), rotForward)
|
||||
|
||||
pos = pos + ang:Right() * rightOff + ang:Forward() * forwardOff + ang:Up() * upOff
|
||||
|
||||
bag:SetPos(pos)
|
||||
bag:SetAngles(ang)
|
||||
bag:DrawModel()
|
||||
end)
|
||||
|
||||
hook.Add("PlayerDisconnected", "V92_Medikit_Cleanup", function(ply)
|
||||
if bags[ply] then
|
||||
bags[ply]:Remove()
|
||||
bags[ply] = nil
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("PlayerDeath", "V92_Medikit_CleanupDeath", function(ply)
|
||||
if bags[ply] then
|
||||
bags[ply]:Remove()
|
||||
bags[ply] = nil
|
||||
end
|
||||
end)
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
@@ -0,0 +1,111 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
AddCSLuaFile()
|
||||
|
||||
concommand.Add("VNT_Support_Torch_Toggle", function(ply,cmd,args)
|
||||
bTorch = !bTorch
|
||||
if bTorch then
|
||||
|
||||
GetConVar("VNT_Support_Torch_Vanilla"):SetBool( 0 )
|
||||
ply:AllowFlashlight( true )
|
||||
print( "flashlight enabled" )
|
||||
|
||||
else
|
||||
|
||||
GetConVar("VNT_Support_Torch_Vanilla"):SetBool( 1 )
|
||||
if SERVER then ply:Flashlight( false ) end
|
||||
ply:AllowFlashlight( false )
|
||||
print( "flashlight disabled" )
|
||||
|
||||
end end , nil , "(TOGGLE) Toggle the requirement to use the flashlight weapon." , { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
|
||||
if !ConVarExists("VNT_Support_Torch_Vanilla") then CreateConVar("VNT_Support_Torch_Vanilla" , 1 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "INTERNAL VALUE, DO NOT USE DIRECTLY" , 0 , 1 ) end
|
||||
|
||||
if !ConVarExists("VNT_Support_MineVehicle_PlaceDelay") then CreateConVar("VNT_Support_MineVehicle_PlaceDelay", 5 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "(INT) Delay between uses of the Anti-Vehicle Mine" , 1 , 30 ) end
|
||||
if !ConVarExists("VNT_Support_MineVehicle_Radius") then CreateConVar("VNT_Support_MineVehicle_Radius", 128 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "(INT) Radius of the Anti-Vehicle Mine" , 5 , 128 ) end
|
||||
|
||||
if !ConVarExists("VNT_Support_MinePersonnel_PlaceDelay") then CreateConVar("VNT_Support_MinePersonnel_PlaceDelay", 5 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "(INT) Delay between uses of the Anti-Personnel Mine" , 1 , 30 ) end
|
||||
if !ConVarExists("VNT_Support_MinePersonnel_Radius") then CreateConVar("VNT_Support_MinePersonnel_Radius", 128 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "(INT) Radius of the Anti-Personnel Mine" , 5 , 128 ) end
|
||||
|
||||
local function vntSupportSWepsOptions( Panel )
|
||||
|
||||
Panel:ClearControls()
|
||||
|
||||
Panel:AddControl( "Header", {
|
||||
Text = "Support Weapons" ,
|
||||
Description =[[Добро пожаловать на фт тим!
|
||||
]],
|
||||
} )
|
||||
|
||||
-----------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
-- Torch
|
||||
-----------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
|
||||
Panel:AddControl( "Checkbox", {
|
||||
["label"] = "Toggle Vanilla Flashlight",
|
||||
["Command"] = "VNT_Support_Torch_Toggle",
|
||||
["Type"] = "bool"
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Header", {
|
||||
["text"] = "M15 Anti-Vehicle Mines" ,
|
||||
["Description"] =[[M15 Options
|
||||
These control the M15 Anti-Vehicle mines.
|
||||
]],
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Slider", {
|
||||
["label"] = "Mine Place Delay",
|
||||
["Command"] = "VNT_Support_MineVehicle_PlaceDelay",
|
||||
["Type"] = "int",
|
||||
["min"] = "1",
|
||||
["max"] = "30"
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Slider", {
|
||||
["label"] = "Find Radius",
|
||||
["Command"] = "VNT_Support_MineVehicle_Radius",
|
||||
["Type"] = "int",
|
||||
["min"] = "5",
|
||||
["max"] = "128"
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Header", {
|
||||
["text"] = "M18 Anti-Personnel Mines" ,
|
||||
["Description"] =[[M18 Options
|
||||
These control the M18 Anti-Personnel mines.
|
||||
]],
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Slider", {
|
||||
["label"] = "Mine Place Delay",
|
||||
["Command"] = "VNT_Support_MinePersonnel_PlaceDelay",
|
||||
["Type"] = "int",
|
||||
["min"] = "1",
|
||||
["max"] = "30"
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Slider", {
|
||||
["label"] = "Find Radius",
|
||||
["Command"] = "VNT_Support_MinePersonnel_Radius",
|
||||
["Type"] = "int",
|
||||
["min"] = "5",
|
||||
["max"] = "128"
|
||||
} )
|
||||
|
||||
end
|
||||
|
||||
local function vntSupportSWepsIndex() spawnmenu.AddToolMenuOption( "Options", "V92", "Support Equipment", "Support Equipment", "", "", vntSupportSWepsOptions ) end
|
||||
hook.Add( "PopulateToolMenu", "vntSupportSWepsIndex", vntSupportSWepsIndex )
|
||||
|
||||
if SERVER then
|
||||
resource.AddWorkshop( "635210663" ) -- Support Equipment
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
@@ -0,0 +1,949 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
AddCSLuaFile()
|
||||
|
||||
//Sound,Impact
|
||||
// 1 2 3 4 5
|
||||
//Dirt, Concrete, Metal, Glass, Flesh
|
||||
// 1 2 3 4 5 6 7 8 9
|
||||
//Dust, Dirt, Sand, Metal, Smoke, Wood, Glass, Blood, YellowBlood
|
||||
local mats={
|
||||
[MAT_ALIENFLESH] ={5,9},
|
||||
[MAT_ANTLION] ={5,9},
|
||||
[MAT_BLOODYFLESH] ={5,8},
|
||||
[45] ={5,8}, // Metrocop heads are a source glitch, they have no enumeration
|
||||
[MAT_CLIP] ={3,5},
|
||||
[MAT_COMPUTER] ={4,5},
|
||||
[MAT_FLESH] ={5,8},
|
||||
[MAT_GRATE] ={3,4},
|
||||
[MAT_METAL] ={3,4},
|
||||
[MAT_PLASTIC] ={2,5},
|
||||
[MAT_SLOSH] ={5,5},
|
||||
[MAT_VENT] ={3,4},
|
||||
[MAT_FOLIAGE] ={1,5},
|
||||
[MAT_TILE] ={2,5},
|
||||
[MAT_CONCRETE] ={2,1},
|
||||
[MAT_DIRT] ={1,2},
|
||||
[MAT_SAND] ={1,3},
|
||||
[MAT_WOOD] ={2,6},
|
||||
[MAT_GLASS] ={4,7},
|
||||
}
|
||||
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.Entity = data:GetEntity() // Entity determines what is creating the dynamic light //
|
||||
|
||||
self.Pos = data:GetOrigin() // Origin determines the global position of the effect //
|
||||
|
||||
self.Scale = data:GetScale()*0.8 // Scale determines how large the effect is //
|
||||
self.Radius = data:GetRadius() or 1 // Radius determines what type of effect to create, default is Concrete //
|
||||
|
||||
self.DirVec = data:GetNormal() // Normal determines the direction of impact for the effect //
|
||||
self.PenVec = data:GetStart() // PenVec determines the direction of the round for penetrations //
|
||||
self.Particles = data:GetMagnitude() // Particles determines how many puffs to make, primarily for "trails" //
|
||||
self.Angle = self.DirVec:Angle() // Angle is the angle of impact from Normal //
|
||||
self.DebrizzlemyNizzle = 10+data:GetScale() // Debrizzle my Nizzle is how many "trails" to make //
|
||||
self.Size = 5*self.Scale // Size is exclusively for the explosion "trails" size //
|
||||
|
||||
self.Emitter = ParticleEmitter( self.Pos ) // Emitter must be there so you don't get an error //
|
||||
|
||||
|
||||
|
||||
if self.Scale<2.1 then
|
||||
sound.Play( "ambient/explosions/explode_" .. math.random(1, 4) .. ".wav", self.Pos, 100, 100 )
|
||||
else
|
||||
sound.Play( "Explosion.Boom", self.Pos)
|
||||
sound.Play( "ambient/explosions/explode_" .. math.random(1, 4) .. ".wav", self.Pos, 100, 100 )
|
||||
end
|
||||
|
||||
|
||||
self.Mat=math.ceil(self.Radius)
|
||||
|
||||
|
||||
|
||||
if mats[self.Mat][2]==1 then self:Dust()
|
||||
elseif mats[self.Mat][2]==2 then self:Dirt()
|
||||
elseif mats[self.Mat][2]==3 then self:Sand()
|
||||
elseif mats[self.Mat][2]==4 then self:Metal()
|
||||
elseif mats[self.Mat][2]==5 then self:Smoke()
|
||||
elseif mats[self.Mat][2]==6 then self:Wood()
|
||||
elseif mats[self.Mat][2]==7 then self:Glass()
|
||||
elseif mats[self.Mat][2]==8 then self:Blood()
|
||||
elseif mats[self.Mat][2]==9 then self:YellowBlood()
|
||||
else self:Smoke()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Dust()
|
||||
|
||||
for i=1,5 do
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.15 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*300 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=1, 20*self.Scale do
|
||||
local Dust = self.Emitter:Add( "particle/particle_composite", self.Pos )
|
||||
if (Dust) then
|
||||
Dust:SetVelocity( self.DirVec * math.random( 100,400)*self.Scale + ((VectorRand():GetNormalized()*300)*self.Scale) )
|
||||
Dust:SetDieTime( math.Rand( 2 , 3 ) )
|
||||
Dust:SetStartAlpha( 230 )
|
||||
Dust:SetEndAlpha( 0 )
|
||||
Dust:SetStartSize( (50*self.Scale) )
|
||||
Dust:SetEndSize( (100*self.Scale) )
|
||||
Dust:SetRoll( math.Rand(150, 360) )
|
||||
Dust:SetRollDelta( math.Rand(-1, 1) )
|
||||
Dust:SetAirResistance( 150 )
|
||||
Dust:SetGravity( Vector( 0, 0, math.Rand(-100, -400) ) )
|
||||
Dust:SetColor( 80,80,80 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 15*self.Scale do
|
||||
local Dust = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Dust) then
|
||||
Dust:SetVelocity( self.DirVec * math.random( 100,400)*self.Scale + ((VectorRand():GetNormalized()*400)*self.Scale) )
|
||||
Dust:SetDieTime( math.Rand( 1 , 5 )*self.Scale )
|
||||
Dust:SetStartAlpha( 50 )
|
||||
Dust:SetEndAlpha( 0 )
|
||||
Dust:SetStartSize( (80*self.Scale) )
|
||||
Dust:SetEndSize( (100*self.Scale) )
|
||||
Dust:SetRoll( math.Rand(150, 360) )
|
||||
Dust:SetRollDelta( math.Rand(-1, 1) )
|
||||
Dust:SetAirResistance( 250 )
|
||||
Dust:SetGravity( Vector( math.Rand( -200 , 200 ), math.Rand( -200 , 200 ), math.Rand( 10 , 100 ) ) )
|
||||
Dust:SetColor( 90,85,75 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 25*self.Scale do
|
||||
local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos )
|
||||
if (Debris) then
|
||||
Debris:SetVelocity ( self.DirVec * math.random(0,500)*self.Scale + VectorRand():GetNormalized() * math.random(0,400)*self.Scale )
|
||||
Debris:SetDieTime( math.random( 1, 2) * self.Scale )
|
||||
Debris:SetStartAlpha( 255 )
|
||||
Debris:SetEndAlpha( 0 )
|
||||
Debris:SetStartSize( math.random(5,10)*self.Scale)
|
||||
Debris:SetRoll( math.Rand(0, 360) )
|
||||
Debris:SetRollDelta( math.Rand(-5, 5) )
|
||||
Debris:SetAirResistance( 40 )
|
||||
Debris:SetColor( 60,60,60 )
|
||||
Debris:SetGravity( Vector( 0, 0, -600) )
|
||||
end
|
||||
end
|
||||
|
||||
local Angle = self.DirVec:Angle()
|
||||
|
||||
for i = 1, self.DebrizzlemyNizzle do /// This part makes the trailers ///
|
||||
Angle:RotateAroundAxis(Angle:Forward(), (360/self.DebrizzlemyNizzle))
|
||||
local DustRing = Angle:Up()
|
||||
local RanVec = self.DirVec*math.Rand(1, 5) + (DustRing*math.Rand(2, 5))
|
||||
|
||||
for k = 3, self.Particles do
|
||||
local Rcolor = math.random(-20,20)
|
||||
|
||||
local particle1 = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
particle1:SetVelocity((VectorRand():GetNormalized()*math.Rand(1, 2) * self.Size) + (RanVec*self.Size*k*3.5))
|
||||
particle1:SetDieTime( math.Rand( 0.5, 4 )*self.Scale )
|
||||
|
||||
particle1:SetStartAlpha( math.Rand( 90, 100 ) )
|
||||
particle1:SetEndAlpha(0)
|
||||
particle1:SetGravity((VectorRand():GetNormalized()*math.Rand(5, 10)* self.Size) + Vector(0,0,-50))
|
||||
particle1:SetAirResistance( 200+self.Scale*20 )
|
||||
particle1:SetStartSize( (5*self.Size)-((k/self.Particles)*self.Size*3) )
|
||||
particle1:SetEndSize( (20*self.Size)-((k/self.Particles)*self.Size) )
|
||||
particle1:SetRoll( math.random( -500, 500 )/100 )
|
||||
|
||||
particle1:SetRollDelta( math.random( -0.5, 0.5 ) )
|
||||
particle1:SetColor( 90+Rcolor,87+Rcolor,80+Rcolor )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Dirt()
|
||||
|
||||
for i=1,5 do
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.15 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*300 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=1, 20*self.Scale do
|
||||
local Dust = self.Emitter:Add( "particle/particle_composite", self.Pos )
|
||||
if (Dust) then
|
||||
Dust:SetVelocity( self.DirVec * math.random( 100,400)*self.Scale + ((VectorRand():GetNormalized()*300)*self.Scale) )
|
||||
Dust:SetDieTime( math.Rand( 2 , 3 ) )
|
||||
Dust:SetStartAlpha( 230 )
|
||||
Dust:SetEndAlpha( 0 )
|
||||
Dust:SetStartSize( (50*self.Scale) )
|
||||
Dust:SetEndSize( (100*self.Scale) )
|
||||
Dust:SetRoll( math.Rand(150, 360) )
|
||||
Dust:SetRollDelta( math.Rand(-1, 1) )
|
||||
Dust:SetAirResistance( 150 )
|
||||
Dust:SetGravity( Vector( 0, 0, math.Rand(-100, -400) ) )
|
||||
Dust:SetColor( 90,83,68 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 15*self.Scale do
|
||||
local Dust = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Dust) then
|
||||
Dust:SetVelocity( self.DirVec * math.random( 100,400)*self.Scale + ((VectorRand():GetNormalized()*400)*self.Scale) )
|
||||
Dust:SetDieTime( math.Rand( 1 , 5 )*self.Scale )
|
||||
Dust:SetStartAlpha( 50 )
|
||||
Dust:SetEndAlpha( 0 )
|
||||
Dust:SetStartSize( (80*self.Scale) )
|
||||
Dust:SetEndSize( (100*self.Scale) )
|
||||
Dust:SetRoll( math.Rand(150, 360) )
|
||||
Dust:SetRollDelta( math.Rand(-1, 1) )
|
||||
Dust:SetAirResistance( 250 )
|
||||
Dust:SetGravity( Vector( math.Rand( -200 , 200 ), math.Rand( -200 , 200 ), math.Rand( 10 , 100 ) ) )
|
||||
Dust:SetColor( 90,83,68 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 25*self.Scale do
|
||||
local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos )
|
||||
if (Debris) then
|
||||
Debris:SetVelocity ( self.DirVec * math.random(0,500)*self.Scale + VectorRand():GetNormalized() * math.random(0,400)*self.Scale )
|
||||
Debris:SetDieTime( math.random( 1, 2) * self.Scale )
|
||||
Debris:SetStartAlpha( 255 )
|
||||
Debris:SetEndAlpha( 0 )
|
||||
Debris:SetStartSize( math.random(5,10)*self.Scale)
|
||||
Debris:SetRoll( math.Rand(0, 360) )
|
||||
Debris:SetRollDelta( math.Rand(-5, 5) )
|
||||
Debris:SetAirResistance( 40 )
|
||||
Debris:SetColor( 50,53,45 )
|
||||
Debris:SetGravity( Vector( 0, 0, -600) )
|
||||
end
|
||||
end
|
||||
|
||||
local Angle = self.DirVec:Angle()
|
||||
|
||||
for i = 1, self.DebrizzlemyNizzle do /// This part makes the trailers ///
|
||||
Angle:RotateAroundAxis(Angle:Forward(), (360/self.DebrizzlemyNizzle))
|
||||
local DustRing = Angle:Up()
|
||||
local RanVec = self.DirVec*math.Rand(2, 6) + (DustRing*math.Rand(1, 4))
|
||||
|
||||
for k = 3, self.Particles do
|
||||
local Rcolor = math.random(-20,20)
|
||||
|
||||
local particle1 = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
particle1:SetVelocity((VectorRand():GetNormalized()*math.Rand(1, 2) * self.Size) + (RanVec*self.Size*k*3.5))
|
||||
particle1:SetDieTime( math.Rand( 0.5, 4 )*self.Scale )
|
||||
|
||||
particle1:SetStartAlpha( math.Rand( 90, 100 ) )
|
||||
particle1:SetEndAlpha(0)
|
||||
particle1:SetGravity((VectorRand():GetNormalized()*math.Rand(5, 10)* self.Size) + Vector(0,0,-50))
|
||||
particle1:SetAirResistance( 200+self.Scale*20 )
|
||||
particle1:SetStartSize( (5*self.Size)-((k/self.Particles)*self.Size*3) )
|
||||
particle1:SetEndSize( (20*self.Size)-((k/self.Particles)*self.Size) )
|
||||
particle1:SetRoll( math.random( -500, 500 )/100 )
|
||||
|
||||
particle1:SetRollDelta( math.random( -0.5, 0.5 ) )
|
||||
particle1:SetColor( 90+Rcolor,83+Rcolor,68+Rcolor )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Sand()
|
||||
|
||||
for i=0, 45*self.Scale do // This is the main plume
|
||||
local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Smoke) then
|
||||
Smoke:SetVelocity( self.DirVec * math.random( 50,1000*self.Scale) + VectorRand():GetNormalized()*300*self.Scale )
|
||||
Smoke:SetDieTime( math.Rand( 1 , 5 )*self.Scale )
|
||||
Smoke:SetStartAlpha( math.Rand( 100, 120 ) )
|
||||
Smoke:SetEndAlpha( 0 )
|
||||
Smoke:SetStartSize( 50*self.Scale )
|
||||
Smoke:SetEndSize( 120*self.Scale )
|
||||
Smoke:SetRoll( math.Rand(150, 360) )
|
||||
Smoke:SetRollDelta( math.Rand(-1, 1) )
|
||||
Smoke:SetAirResistance( 200 )
|
||||
Smoke:SetGravity( Vector( 0, 0, math.Rand(-100, -400) ) )
|
||||
Smoke:SetColor( 90,83,68 )
|
||||
end
|
||||
end
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=0, 20*self.Scale do // This is the dirt kickup
|
||||
local Dust = self.Emitter:Add( "particle/particle_composite", self.Pos )
|
||||
if (Dust) then
|
||||
Dust:SetVelocity( self.DirVec * math.random( 100,700)*self.Scale + VectorRand():GetNormalized()*250*self.Scale )
|
||||
Dust:SetDieTime( math.Rand( 0.5 , 1,5 ) )
|
||||
Dust:SetStartAlpha( 200 )
|
||||
Dust:SetEndAlpha( 0 )
|
||||
Dust:SetStartSize( 60*self.Scale )
|
||||
Dust:SetEndSize( 90*self.Scale )
|
||||
Dust:SetRoll( math.Rand(150, 360) )
|
||||
Dust:SetRollDelta( math.Rand(-1, 1) )
|
||||
Dust:SetAirResistance( 200 )
|
||||
Dust:SetGravity( Vector( 0, 0, math.Rand(-100, -400) ) )
|
||||
Dust:SetColor( 90,83,68 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=0, 25*self.Scale do // Chunkage
|
||||
local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos )
|
||||
if (Debris) then
|
||||
Debris:SetVelocity ( self.DirVec * math.random(50,700)*self.Scale + VectorRand():GetNormalized() * math.random(0,500)*self.Scale )
|
||||
Debris:SetDieTime( math.random( 1, 2) * self.Scale )
|
||||
Debris:SetStartAlpha( 255 )
|
||||
Debris:SetEndAlpha( 0 )
|
||||
Debris:SetStartSize( math.random(5,8)*self.Scale )
|
||||
Debris:SetRoll( math.Rand(0, 360) )
|
||||
Debris:SetRollDelta( math.Rand(-5, 5) )
|
||||
Debris:SetAirResistance( 40 )
|
||||
Debris:SetColor( 53,50,45 )
|
||||
Debris:SetGravity( Vector( 0, 0, -600) )
|
||||
end
|
||||
end
|
||||
|
||||
for i=0, 25*self.Scale do // Shrapnel
|
||||
local Shrapnel = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos+self.DirVec )
|
||||
if (Shrapnel) then
|
||||
Shrapnel:SetVelocity ( (self.DirVec*700*self.Scale) + (VectorRand():GetNormalized() * 1000*self.Scale) )
|
||||
Shrapnel:SetDieTime( math.random( 0.3, 0.5) * self.Scale )
|
||||
Shrapnel:SetStartAlpha( 255 )
|
||||
Shrapnel:SetEndAlpha( 0 )
|
||||
Shrapnel:SetStartSize( math.random(4,7)*self.Scale )
|
||||
Shrapnel:SetRoll( math.Rand(0, 360) )
|
||||
Shrapnel:SetRollDelta( math.Rand(-5, 5) )
|
||||
Shrapnel:SetAirResistance( 10 )
|
||||
Shrapnel:SetColor( 53,50,45 )
|
||||
Shrapnel:SetGravity( Vector( 0, 0, -600) )
|
||||
Shrapnel:SetCollide( true )
|
||||
Shrapnel:SetBounce( 0.8 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=1,5 do // Blast flash
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.10 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*200 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
for i=0, 10*self.Scale do
|
||||
local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Smoke) then
|
||||
Smoke:SetVelocity( self.DirVec * math.random( 30,120*self.Scale) + VectorRand():GetNormalized() * math.random( 50,100*self.Scale) )
|
||||
Smoke:SetDieTime( math.Rand( 0.5 , 1 )*self.Scale )
|
||||
Smoke:SetStartAlpha( math.Rand( 80, 100 ) )
|
||||
Smoke:SetEndAlpha( 0 )
|
||||
Smoke:SetStartSize( 10*self.Scale )
|
||||
Smoke:SetEndSize( 30*self.Scale )
|
||||
Smoke:SetRoll( math.Rand(150, 360) )
|
||||
Smoke:SetRollDelta( math.Rand(-2, 2) )
|
||||
Smoke:SetAirResistance( 100 )
|
||||
Smoke:SetGravity( Vector( math.random(-20,20)*self.Scale, math.random(-20,20)*self.Scale, 250 ) )
|
||||
Smoke:SetColor( 90,83,68 )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for i=0, 5*self.Scale do
|
||||
local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Whisp) then
|
||||
Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 300,600*self.Scale) )
|
||||
Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
|
||||
Whisp:SetStartAlpha( math.Rand( 30, 40 ) )
|
||||
Whisp:SetEndAlpha( 0 )
|
||||
Whisp:SetStartSize( 70*self.Scale )
|
||||
Whisp:SetEndSize( 100*self.Scale )
|
||||
Whisp:SetRoll( math.Rand(150, 360) )
|
||||
Whisp:SetRollDelta( math.Rand(-2, 2) )
|
||||
Whisp:SetAirResistance( 300 )
|
||||
Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
|
||||
Whisp:SetColor( 150,150,150 )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local Density = 40*self.Scale /// This part is for the dust ring ///
|
||||
local Angle = self.DirVec:Angle()
|
||||
for i=0, Density do
|
||||
Angle:RotateAroundAxis(Angle:Forward(), (360/Density))
|
||||
local ShootVector = Angle:Up()
|
||||
local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Smoke) then
|
||||
Smoke:SetVelocity( ShootVector * math.Rand(50,700*self.Scale) )
|
||||
Smoke:SetDieTime( math.Rand( 1 , 4 )*self.Scale )
|
||||
Smoke:SetStartAlpha( math.Rand( 90, 120 ) )
|
||||
Smoke:SetEndAlpha( 0 )
|
||||
Smoke:SetStartSize( 40*self.Scale )
|
||||
Smoke:SetEndSize( 70*self.Scale )
|
||||
Smoke:SetRoll( math.Rand(0, 360) )
|
||||
Smoke:SetRollDelta( math.Rand(-1, 1) )
|
||||
Smoke:SetAirResistance( 200 )
|
||||
Smoke:SetGravity( Vector( math.Rand( -200 , 200 ), math.Rand( -200 , 200 ), math.Rand( 10 , 100 ) ) )
|
||||
Smoke:SetColor( 90,83,68 )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Metal()
|
||||
|
||||
for i=1,3 do // Blast flash
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.15 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*200 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=0, 20*self.Scale do
|
||||
local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Whisp) then
|
||||
Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 200,1000*self.Scale) )
|
||||
Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
|
||||
Whisp:SetStartAlpha( math.Rand( 50, 70 ) )
|
||||
Whisp:SetEndAlpha( 0 )
|
||||
Whisp:SetStartSize( 70*self.Scale )
|
||||
Whisp:SetEndSize( 100*self.Scale )
|
||||
Whisp:SetRoll( math.Rand(150, 360) )
|
||||
Whisp:SetRollDelta( math.Rand(-2, 2) )
|
||||
Whisp:SetAirResistance( 300 )
|
||||
Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
|
||||
Whisp:SetColor( 120,120,120 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=0, 30*self.Scale do
|
||||
local Sparks = self.Emitter:Add( "effects/spark", self.Pos )
|
||||
if (Sparks) then
|
||||
Sparks:SetVelocity( ((self.DirVec*0.75)+VectorRand()) * math.Rand(200, 600)*self.Scale )
|
||||
Sparks:SetDieTime( math.Rand(0.3, 1) )
|
||||
Sparks:SetStartAlpha( 255 )
|
||||
Sparks:SetStartSize( math.Rand(7, 15)*self.Scale )
|
||||
Sparks:SetEndSize( 0 )
|
||||
Sparks:SetRoll( math.Rand(0, 360) )
|
||||
Sparks:SetRollDelta( math.Rand(-5, 5) )
|
||||
Sparks:SetAirResistance( 20 )
|
||||
Sparks:SetGravity( Vector( 0, 0, -600 ) )
|
||||
end
|
||||
end
|
||||
|
||||
for i=0, 10*self.Scale do
|
||||
local Sparks = self.Emitter:Add( "effects/yellowflare", self.Pos )
|
||||
if (Sparks) then
|
||||
Sparks:SetVelocity( VectorRand() * math.Rand(200, 600)*self.Scale )
|
||||
Sparks:SetDieTime( math.Rand(1, 1.7) )
|
||||
Sparks:SetStartAlpha( 200 )
|
||||
Sparks:SetStartSize( math.Rand(10, 13)*self.Scale )
|
||||
Sparks:SetEndSize( 0 )
|
||||
Sparks:SetRoll( math.Rand(0, 360) )
|
||||
Sparks:SetRollDelta( math.Rand(-5, 5) )
|
||||
Sparks:SetAirResistance( 100 )
|
||||
Sparks:SetGravity( Vector( 0, 0, -60 ) )
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function EFFECT:Smoke()
|
||||
|
||||
for i=1,5 do // Blast flash
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.15 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*200 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=0, 20*self.Scale do
|
||||
local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Whisp) then
|
||||
Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 200,1200*self.Scale) )
|
||||
Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
|
||||
Whisp:SetStartAlpha( math.Rand( 35, 50 ) )
|
||||
Whisp:SetEndAlpha( 0 )
|
||||
Whisp:SetStartSize( 70*self.Scale )
|
||||
Whisp:SetEndSize( 100*self.Scale )
|
||||
Whisp:SetRoll( math.Rand(150, 360) )
|
||||
Whisp:SetRollDelta( math.Rand(-2, 2) )
|
||||
Whisp:SetAirResistance( 300 )
|
||||
Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
|
||||
Whisp:SetColor( 120,120,120 )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for i=1, 25*self.Scale do
|
||||
local Debris = self.Emitter:Add( "effects/fleck_tile"..math.random(1,2), self.Pos )
|
||||
if (Debris) then
|
||||
Debris:SetVelocity ( self.DirVec * math.random(100,400)*self.Scale + VectorRand():GetNormalized() * math.random(100,700)*self.Scale )
|
||||
Debris:SetDieTime( math.random( 1, 3) * self.Scale )
|
||||
Debris:SetStartAlpha( 255 )
|
||||
Debris:SetEndAlpha( 0 )
|
||||
Debris:SetStartSize( math.random(5,10)*self.Scale)
|
||||
Debris:SetRoll( math.Rand(0, 360) )
|
||||
Debris:SetRollDelta( math.Rand(-5, 5) )
|
||||
Debris:SetAirResistance( 40 )
|
||||
Debris:SetColor( 70,70,70 )
|
||||
Debris:SetGravity( Vector( 0, 0, -600) )
|
||||
end
|
||||
end
|
||||
|
||||
local Angle = self.DirVec:Angle()
|
||||
|
||||
for i = 1, self.DebrizzlemyNizzle do /// This part makes the trailers ///
|
||||
Angle:RotateAroundAxis(Angle:Forward(), (360/self.DebrizzlemyNizzle))
|
||||
local DustRing = Angle:Up()
|
||||
local RanVec = self.DirVec*math.Rand(1, 4) + (DustRing*math.Rand(3, 4))
|
||||
|
||||
for k = 3, self.Particles do
|
||||
local Rcolor = math.random(-20,20)
|
||||
|
||||
local particle1 = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
particle1:SetVelocity((VectorRand():GetNormalized()*math.Rand(1, 2) * self.Size) + (RanVec*self.Size*k*3.5))
|
||||
particle1:SetDieTime( math.Rand( 0, 3 )*self.Scale )
|
||||
|
||||
particle1:SetStartAlpha( math.Rand( 90, 100 ) )
|
||||
particle1:SetEndAlpha(0)
|
||||
particle1:SetGravity((VectorRand():GetNormalized()*math.Rand(5, 10)* self.Size) + Vector(0,0,-50))
|
||||
particle1:SetAirResistance( 200+self.Scale*20 )
|
||||
particle1:SetStartSize( (5*self.Size)-((k/self.Particles)*self.Size*3) )
|
||||
particle1:SetEndSize( (20*self.Size)-((k/self.Particles)*self.Size) )
|
||||
particle1:SetRoll( math.random( -500, 500 )/100 )
|
||||
|
||||
particle1:SetRollDelta( math.random( -0.5, 0.5 ) )
|
||||
particle1:SetColor( 90+Rcolor,85+Rcolor,75+Rcolor )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Wood()
|
||||
|
||||
for i=1,5 do
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.15 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*200 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=0, 30*self.Scale do
|
||||
local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Whisp) then
|
||||
Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 200,1000)*self.Scale )
|
||||
Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
|
||||
Whisp:SetStartAlpha( math.Rand( 70, 90 ) )
|
||||
Whisp:SetEndAlpha( 0 )
|
||||
Whisp:SetStartSize( 70*self.Scale )
|
||||
Whisp:SetEndSize( 100*self.Scale )
|
||||
Whisp:SetRoll( math.Rand(150, 360) )
|
||||
Whisp:SetRollDelta( math.Rand(-2, 2) )
|
||||
Whisp:SetAirResistance( 300 )
|
||||
Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
|
||||
Whisp:SetColor( 90,85,75 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=0, 20*self.Scale do
|
||||
local Debris = self.Emitter:Add( "effects/fleck_wood"..math.random(1,2), self.Pos+self.DirVec )
|
||||
if (Debris) then
|
||||
Debris:SetVelocity( self.DirVec * math.random(50,300)*self.Scale + VectorRand():GetNormalized() * math.random(200,600)*self.Scale )
|
||||
Debris:SetDieTime( math.random( 0.75, 2) )
|
||||
Debris:SetStartAlpha( 255 )
|
||||
Debris:SetEndAlpha( 0 )
|
||||
Debris:SetStartSize( math.random(10,15)*self.Scale )
|
||||
Debris:SetRoll( math.Rand(0, 360) )
|
||||
Debris:SetRollDelta( math.Rand(-5, 5) )
|
||||
Debris:SetAirResistance( 70 )
|
||||
Debris:SetColor( 90,85,75 )
|
||||
Debris:SetGravity( Vector( 0, 0, -600) )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Glass()
|
||||
|
||||
for i=1,5 do // Blast flash
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.15 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*200 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=0, 30*self.Scale do
|
||||
local Debris = self.Emitter:Add( "effects/fleck_glass"..math.random(1,3), self.Pos )
|
||||
if (Debris) then
|
||||
Debris:SetVelocity ( VectorRand():GetNormalized() * math.random(100,600)*self.Scale )
|
||||
Debris:SetDieTime( math.random( 1, 2.5) )
|
||||
Debris:SetStartAlpha( 255 )
|
||||
Debris:SetEndAlpha( 0 )
|
||||
Debris:SetStartSize( math.random(3,7)*self.Scale )
|
||||
Debris:SetRoll( math.Rand(0, 360) )
|
||||
Debris:SetRollDelta( math.Rand(-15, 15) )
|
||||
Debris:SetAirResistance( 50 )
|
||||
Debris:SetColor( 200,200,200 )
|
||||
Debris:SetGravity( Vector( 0, 0, -600) )
|
||||
Debris:SetCollide( true )
|
||||
Debris:SetBounce( 0.5 )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for i=0, 30*self.Scale do
|
||||
local Whisp = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Whisp) then
|
||||
Whisp:SetVelocity(VectorRand():GetNormalized() * math.random( 200,800*self.Scale) )
|
||||
Whisp:SetDieTime( math.Rand( 4 , 10 )*self.Scale/2 )
|
||||
Whisp:SetStartAlpha( math.Rand( 35, 50 ) )
|
||||
Whisp:SetEndAlpha( 0 )
|
||||
Whisp:SetStartSize( 70*self.Scale )
|
||||
Whisp:SetEndSize( 100*self.Scale )
|
||||
Whisp:SetRoll( math.Rand(150, 360) )
|
||||
Whisp:SetRollDelta( math.Rand(-2, 2) )
|
||||
Whisp:SetAirResistance( 300 )
|
||||
Whisp:SetGravity( Vector( math.random(-40,40)*self.Scale, math.random(-40,40)*self.Scale, 0 ) )
|
||||
Whisp:SetColor( 150,150,150 )
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:Blood()
|
||||
|
||||
for i=0, 30*self.Scale do // If you recieve over 50,000 joules of energy, you become red mist.
|
||||
local Smoke = self.Emitter:Add( "particle/particle_composite", self.Pos )
|
||||
if (Smoke) then
|
||||
Smoke:SetVelocity( VectorRand():GetNormalized()*math.random(100,600)*self.Scale )
|
||||
Smoke:SetDieTime( math.Rand( 1 , 2 ) )
|
||||
Smoke:SetStartAlpha( 80 )
|
||||
Smoke:SetEndAlpha( 0 )
|
||||
Smoke:SetStartSize( 30*self.Scale )
|
||||
Smoke:SetEndSize( 100*self.Scale )
|
||||
Smoke:SetRoll( math.Rand(150, 360) )
|
||||
Smoke:SetRollDelta( math.Rand(-2, 2) )
|
||||
Smoke:SetAirResistance( 400 )
|
||||
Smoke:SetGravity( Vector( math.Rand(-50, 50) * self.Scale, math.Rand(-50, 50) * self.Scale, math.Rand(0, -200) ) )
|
||||
Smoke:SetColor( 70,35,35 )
|
||||
end
|
||||
end
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=0, 20*self.Scale do // Add some finer details....
|
||||
local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Smoke) then
|
||||
Smoke:SetVelocity( VectorRand():GetNormalized()*math.random(200,600)*self.Scale )
|
||||
Smoke:SetDieTime( math.Rand( 1 , 4 ) )
|
||||
Smoke:SetStartAlpha( 120 )
|
||||
Smoke:SetEndAlpha( 0 )
|
||||
Smoke:SetStartSize( 30*self.Scale )
|
||||
Smoke:SetEndSize( 100*self.Scale )
|
||||
Smoke:SetRoll( math.Rand(150, 360) )
|
||||
Smoke:SetRollDelta( math.Rand(-2, 2) )
|
||||
Smoke:SetAirResistance( 400 )
|
||||
Smoke:SetGravity( Vector( math.Rand(-50, 50) * self.Scale, math.Rand(-50, 50) * self.Scale, math.Rand(-50, -300) ) )
|
||||
Smoke:SetColor( 70,35,35 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=1,5 do // Into the flash!
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.15 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*300 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 20*self.Scale do // Chunkage NOT contained
|
||||
local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos-(self.DirVec*5) )
|
||||
if (Debris) then
|
||||
Debris:SetVelocity ( VectorRand():GetNormalized() * 400*self.Scale )
|
||||
Debris:SetDieTime( math.random( 0.3, 0.6) )
|
||||
Debris:SetStartAlpha( 255 )
|
||||
Debris:SetEndAlpha( 0 )
|
||||
Debris:SetStartSize( 8 )
|
||||
Debris:SetEndSize( 9 )
|
||||
Debris:SetRoll( math.Rand(0, 360) )
|
||||
Debris:SetRollDelta( math.Rand(-5, 5) )
|
||||
Debris:SetAirResistance( 30 )
|
||||
Debris:SetColor( 70,35,35 )
|
||||
Debris:SetGravity( Vector( 0, 0, -600) )
|
||||
Debris:SetCollide( true )
|
||||
Debris:SetBounce( 0.2 )
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function EFFECT:YellowBlood()
|
||||
for i=0, 30*self.Scale do // If you recieve over 50,000 joules of energy, you become red mist.
|
||||
local Smoke = self.Emitter:Add( "particle/particle_composite", self.Pos )
|
||||
if (Smoke) then
|
||||
Smoke:SetVelocity( VectorRand():GetNormalized()*math.random(100,600)*self.Scale )
|
||||
Smoke:SetDieTime( math.Rand( 1 , 2 ) )
|
||||
Smoke:SetStartAlpha( 80 )
|
||||
Smoke:SetEndAlpha( 0 )
|
||||
Smoke:SetStartSize( 30*self.Scale )
|
||||
Smoke:SetEndSize( 100*self.Scale )
|
||||
Smoke:SetRoll( math.Rand(150, 360) )
|
||||
Smoke:SetRollDelta( math.Rand(-2, 2) )
|
||||
Smoke:SetAirResistance( 400 )
|
||||
Smoke:SetGravity( Vector( math.Rand(-50, 50) * self.Scale, math.Rand(-50, 50) * self.Scale, math.Rand(0, -200) ) )
|
||||
Smoke:SetColor( 120,120,0 )
|
||||
end
|
||||
end
|
||||
|
||||
local Distort = self.Emitter:Add( "sprites/heatwave", self.Pos )
|
||||
if (Distort) then
|
||||
Distort:SetVelocity( self.DirVec )
|
||||
Distort:SetAirResistance( 200 )
|
||||
Distort:SetDieTime( 0.1 )
|
||||
Distort:SetStartAlpha( 255 )
|
||||
Distort:SetEndAlpha( 0 )
|
||||
Distort:SetStartSize( self.Scale*600 )
|
||||
Distort:SetEndSize( 0 )
|
||||
Distort:SetRoll( math.Rand(180,480) )
|
||||
Distort:SetRollDelta( math.Rand(-1,1) )
|
||||
Distort:SetColor(255,255,255)
|
||||
end
|
||||
|
||||
for i=0, 20*self.Scale do // Add some finer details....
|
||||
local Smoke = self.Emitter:Add( "particle/smokesprites_000"..math.random(1,9), self.Pos )
|
||||
if (Smoke) then
|
||||
Smoke:SetVelocity( VectorRand():GetNormalized()*math.random(200,600)*self.Scale )
|
||||
Smoke:SetDieTime( math.Rand( 1 , 4 ) )
|
||||
Smoke:SetStartAlpha( 120 )
|
||||
Smoke:SetEndAlpha( 0 )
|
||||
Smoke:SetStartSize( 30*self.Scale )
|
||||
Smoke:SetEndSize( 100*self.Scale )
|
||||
Smoke:SetRoll( math.Rand(150, 360) )
|
||||
Smoke:SetRollDelta( math.Rand(-2, 2) )
|
||||
Smoke:SetAirResistance( 400 )
|
||||
Smoke:SetGravity( Vector( math.Rand(-50, 50) * self.Scale, math.Rand(-50, 50) * self.Scale, math.Rand(-50, -300) ) )
|
||||
Smoke:SetColor( 120,120,0 )
|
||||
end
|
||||
end
|
||||
|
||||
for i=1,5 do // Into the flash!
|
||||
local Flash = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos )
|
||||
if (Flash) then
|
||||
Flash:SetVelocity( self.DirVec*100 )
|
||||
Flash:SetAirResistance( 200 )
|
||||
Flash:SetDieTime( 0.15 )
|
||||
Flash:SetStartAlpha( 255 )
|
||||
Flash:SetEndAlpha( 0 )
|
||||
Flash:SetStartSize( self.Scale*300 )
|
||||
Flash:SetEndSize( 0 )
|
||||
Flash:SetRoll( math.Rand(180,480) )
|
||||
Flash:SetRollDelta( math.Rand(-1,1) )
|
||||
Flash:SetColor(255,255,255)
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, 20*self.Scale do // Chunkage NOT contained
|
||||
local Debris = self.Emitter:Add( "effects/fleck_cement"..math.random(1,2), self.Pos-(self.DirVec*5) )
|
||||
if (Debris) then
|
||||
Debris:SetVelocity ( VectorRand():GetNormalized() * 400*self.Scale )
|
||||
Debris:SetDieTime( math.random( 0.3, 0.6) )
|
||||
Debris:SetStartAlpha( 255 )
|
||||
Debris:SetEndAlpha( 0 )
|
||||
Debris:SetStartSize( 8 )
|
||||
Debris:SetEndSize( 9 )
|
||||
Debris:SetRoll( math.Rand(0, 360) )
|
||||
Debris:SetRollDelta( math.Rand(-5, 5) )
|
||||
Debris:SetAirResistance( 30 )
|
||||
Debris:SetColor( 120,120,0 )
|
||||
Debris:SetGravity( Vector( 0, 0, -600) )
|
||||
Debris:SetCollide( true )
|
||||
Debris:SetBounce( 0.2 )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think( ) return false end
|
||||
|
||||
function EFFECT:Render() end
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
@@ -0,0 +1,111 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
ENT.Category = "Equipment"
|
||||
ENT.PrintName = "BF2 Ammokit"
|
||||
ENT.Author = "V92"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
|
||||
local DeployModel = Model("models/v92/bf2/weapons/handheld/ammokit_w.mdl")
|
||||
local SupplySound = Sound( "BF2.Weapon.Handheld.Ammokit.Pickup" )
|
||||
ENT.SupplyAmount = 5
|
||||
|
||||
------------------------------------------------------------
|
||||
-- None of the shit under this concerns the client,
|
||||
-- so we aren't even going to scope it to save resources.
|
||||
------------------------------------------------------------
|
||||
if CLIENT then
|
||||
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self:SetModel( DeployModel )
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetCollisionGroup( COLLISION_GROUP_NONE )
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
if phys and phys:IsValid() then phys:Wake() end
|
||||
|
||||
util.PrecacheModel( DeployModel )
|
||||
util.PrecacheSound( SupplySound )
|
||||
|
||||
-- This is sloppy - but it works - so kiss my ass.
|
||||
timer.Simple( 1.5 , function()
|
||||
|
||||
if IsValid( self ) then
|
||||
|
||||
-- Need to delay this or you eat it immediately on spawn,
|
||||
-- which is an issue if you're trying to throw it to someone.
|
||||
self:SetTrigger( true )
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
-- I understand people might want to spawn a bunch of these as set dressing,
|
||||
-- but honestly it becomes a clusterfuck very quickly.
|
||||
-- How do I track how many a player has thrown? Max of 2?
|
||||
timer.Simple( 300 , function()
|
||||
|
||||
if IsValid( self ) then
|
||||
|
||||
SafeRemoveEntity( self )
|
||||
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
------------------------------------------------------------
|
||||
-- TOUCH! Patrick, don't touch. TOUCH!
|
||||
------------------------------------------------------------
|
||||
function ENT:StartTouch( toucher )
|
||||
|
||||
-- The toucher isn't a player or NPC and the toucher is at/exceeding full health...
|
||||
if !IsValid( toucher ) or !toucher:IsPlayer() or toucher:GetActiveWeapon():GetPrimaryAmmoType() == -1 then
|
||||
|
||||
-- DE-NIED!
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
local cw = toucher:GetActiveWeapon()
|
||||
local need = cw:GetMaxClip1()
|
||||
|
||||
if cw:Clip1() > -1 then
|
||||
|
||||
toucher:GiveAmmo( need , cw:GetPrimaryAmmoType() , false )
|
||||
toucher:EmitSound( SupplySound )
|
||||
|
||||
self.SupplyAmount = self.SupplyAmount - 1
|
||||
|
||||
end
|
||||
|
||||
-- Is the charge empty?
|
||||
if self.SupplyAmount <= 0 then
|
||||
|
||||
-- Fuck off to dev/null with your ass
|
||||
self:Remove()
|
||||
|
||||
end
|
||||
|
||||
-- Don't let the function directly run again to prevent cascading use
|
||||
return
|
||||
|
||||
end
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
@@ -0,0 +1,250 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
ENT.Category = "Equipment"
|
||||
ENT.PrintName = "BF2 Medikit"
|
||||
ENT.Author = "V92"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
|
||||
local DeployModel = Model("models/v92/bf2/weapons/handheld/medikit_w.mdl")
|
||||
local HealSound = Sound("BF2.Weapon.Handheld.Medikit.Pickup")
|
||||
local AttachSound = Sound("items/ammo_pickup.wav")
|
||||
local DetachSound = Sound("items/medshotno1.wav")
|
||||
|
||||
ENT.MaxUses = 5
|
||||
ENT.HealPerUse = 25
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Draw()
|
||||
return
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel(DeployModel)
|
||||
self:SetNoDraw(false)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
if IsValid(phys) then
|
||||
phys:Wake()
|
||||
phys:SetMass(5)
|
||||
end
|
||||
|
||||
self.AttachedPlayer = nil
|
||||
self.AttachmentBone = "ValveBiped.Bip01_Spine2"
|
||||
self.IsAttached = false
|
||||
self.HasInfiniteCharge = false
|
||||
self.RemoveTimer = nil
|
||||
|
||||
self.CurrentUses = self.MaxUses
|
||||
|
||||
self:SetNWBool("V92_Medikit_IsAttached", false)
|
||||
self:SetNWEntity("V92_Medikit_AttachedPlayer", NULL)
|
||||
|
||||
util.PrecacheModel(DeployModel)
|
||||
util.PrecacheSound(HealSound)
|
||||
util.PrecacheSound(AttachSound)
|
||||
util.PrecacheSound(DetachSound)
|
||||
|
||||
self.RemoveTimer = timer.Simple(300, function()
|
||||
if IsValid(self) and not self.IsAttached then
|
||||
SafeRemoveEntity(self)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:AttachToPlayer(ply)
|
||||
if not IsValid(ply) or not ply:IsPlayer() then return false end
|
||||
|
||||
for _, ent in ipairs(ents.FindByClass("v92_bf2_medikit_ent")) do
|
||||
if ent ~= self and IsValid(ent) and ent.IsAttached
|
||||
and IsValid(ent.AttachedPlayer) and ent.AttachedPlayer == ply then
|
||||
ent:DetachFromPlayer()
|
||||
end
|
||||
end
|
||||
|
||||
self.AttachedPlayer = ply
|
||||
self.IsAttached = true
|
||||
self.HasInfiniteCharge = true
|
||||
|
||||
self:SetNWBool("V92_Medikit_IsAttached", true)
|
||||
self:SetNWEntity("V92_Medikit_AttachedPlayer", ply)
|
||||
|
||||
if self.RemoveTimer then
|
||||
timer.Remove(self.RemoveTimer)
|
||||
self.RemoveTimer = nil
|
||||
end
|
||||
self:SetModel("")
|
||||
self:SetMoveType(MOVETYPE_NONE)
|
||||
self:SetSolid(SOLID_NONE)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
|
||||
self:SetNoDraw(true)
|
||||
ply:EmitSound(AttachSound)
|
||||
self:SetOwner(ply)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:DetachFromPlayer()
|
||||
if not self.IsAttached then return end
|
||||
|
||||
self:SetNWBool("V92_Medikit_IsAttached", false)
|
||||
self:SetNWEntity("V92_Medikit_AttachedPlayer", NULL)
|
||||
|
||||
if IsValid(self.AttachedPlayer) then
|
||||
self.AttachedPlayer:EmitSound(DetachSound)
|
||||
end
|
||||
|
||||
self.HasInfiniteCharge = false
|
||||
|
||||
timer.Simple(0.05, function()
|
||||
if IsValid(self) then
|
||||
self:SetModel(DeployModel)
|
||||
self:SetNoDraw(false)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
|
||||
timer.Simple(0, function()
|
||||
if not IsValid(deployEnt) then return end
|
||||
|
||||
local phys = deployEnt:GetPhysicsObject()
|
||||
if IsValid(phys) then
|
||||
phys:Wake()
|
||||
phys:SetMass(5)
|
||||
phys:SetVelocity(owner:GetAimVector() * (owner:KeyDown(IN_USE) and 50 or 400))
|
||||
end
|
||||
end)
|
||||
|
||||
self.RemoveTimer = timer.Simple(300, function()
|
||||
if IsValid(self) then
|
||||
SafeRemoveEntity(self)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
self.IsAttached = false
|
||||
self.AttachedPlayer = nil
|
||||
end
|
||||
|
||||
function ENT:Use(activator, caller, useType, value)
|
||||
if not IsValid(self) then return end
|
||||
if not IsValid(activator) or not activator:IsPlayer() then return end
|
||||
|
||||
if self.IsAttached and IsValid(self.AttachedPlayer) then
|
||||
local need = math.min(activator:GetMaxHealth() - activator:Health(), self.HealPerUse)
|
||||
if need > 0 then
|
||||
activator:SetHealth(math.min(activator:GetMaxHealth(), activator:Health() + need))
|
||||
activator:EmitSound(HealSound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:StartTouch(toucher)
|
||||
if not IsValid(self) then return end
|
||||
if not (toucher:IsPlayer() or toucher:IsNPC()) or toucher:Health() >= toucher:GetMaxHealth() then
|
||||
return false
|
||||
end
|
||||
|
||||
if toucher:Health() < toucher:GetMaxHealth() then
|
||||
local need = math.min(toucher:GetMaxHealth() - toucher:Health(), self.HealPerUse)
|
||||
|
||||
if need > 0 then
|
||||
if not (self.IsAttached and self.HasInfiniteCharge) then
|
||||
self.CurrentUses = self.CurrentUses - 1
|
||||
end
|
||||
|
||||
toucher:SetHealth(math.min(toucher:GetMaxHealth(), toucher:Health() + need))
|
||||
toucher:EmitSound(HealSound)
|
||||
|
||||
if self.CurrentUses <= 0 and not (self.IsAttached and self.HasInfiniteCharge) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if self.RemoveTimer then
|
||||
timer.Remove(self.RemoveTimer)
|
||||
self.RemoveTimer = nil
|
||||
end
|
||||
|
||||
if self.IsAttached then
|
||||
self.IsAttached = false
|
||||
self.AttachedPlayer = nil
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if self.IsAttached and (not IsValid(self.AttachedPlayer) or not self.AttachedPlayer:Alive()) then
|
||||
self:DetachFromPlayer()
|
||||
end
|
||||
|
||||
self:NextThink(CurTime() + 0.5)
|
||||
return true
|
||||
end
|
||||
|
||||
hook.Add("PlayerDeath", "V92_Medikit_PlayerDeath", function(victim)
|
||||
for _, ent in ipairs(ents.FindByClass("v92_bf2_medikit_ent")) do
|
||||
if IsValid(ent) and ent.IsAttached and IsValid(ent.AttachedPlayer)
|
||||
and ent.AttachedPlayer == victim then
|
||||
ent:DetachFromPlayer()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("PlayerDisconnected", "V92_Medikit_PlayerDisconnected", function(ply)
|
||||
for _, ent in ipairs(ents.FindByClass("v92_bf2_medikit_ent")) do
|
||||
if IsValid(ent) and ent.IsAttached and IsValid(ent.AttachedPlayer)
|
||||
and ent.AttachedPlayer == ply then
|
||||
ent:DetachFromPlayer()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("KeyPress", "V92_Medikit_TreatFromPlayer", function(ply, key)
|
||||
if key ~= IN_USE then return end
|
||||
if not IsValid(ply) or not ply:Alive() then return end
|
||||
|
||||
local trace = ply:GetEyeTrace()
|
||||
if not IsValid(trace.Entity) then return end
|
||||
|
||||
local target = trace.Entity
|
||||
|
||||
if IsValid(target) and target:IsPlayer() and target:Alive() and target ~= ply then
|
||||
for _, medikit in ipairs(ents.FindByClass("v92_bf2_medikit_ent")) do
|
||||
if IsValid(medikit) and medikit.IsAttached
|
||||
and IsValid(medikit.AttachedPlayer) and medikit.AttachedPlayer == target then
|
||||
|
||||
local need = math.min(ply:GetMaxHealth() - ply:Health(), 25)
|
||||
|
||||
if need > 0 then
|
||||
ply:SetHealth(math.min(ply:GetMaxHealth(), ply:Health() + need))
|
||||
ply:EmitSound(HealSound)
|
||||
end
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
@@ -0,0 +1,306 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
AddCSLuaFile()
|
||||
|
||||
sound.Add({ ["name"] = "BF2.VO.English.Grunt.NoFilter.AmmoHere",
|
||||
["channel"] = CHAN_VOICE ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = 100 ,
|
||||
["sound"] = {
|
||||
"v92/bf2/vo/english/grunt/no_filter/auto_moodgp_tm_ammohere.ogg" ,
|
||||
"v92/bf2/vo/english/grunt/no_filter/auto_moodgp_tm_ammohere_alt.ogg"
|
||||
}
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.VO.English.Grunt.NoFilter.OutOfAmmo",
|
||||
["channel"] = CHAN_VOICE ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = 100 ,
|
||||
["sound"] = {
|
||||
"v92/bf2/vo/english/grunt/no_filter/auto_moodgp_tm_outofammo.ogg" ,
|
||||
"v92/bf2/vo/english/grunt/no_filter/auto_moodgp_tm_outofammo_alt.ogg"
|
||||
}
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.VO.English.Grunt.NoFilter.RequestAmmo",
|
||||
["channel"] = CHAN_VOICE ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = 100 ,
|
||||
["sound"] = {
|
||||
"v92/bf2/vo/english/grunt/no_filter/PLAYER_REQUEST_TM_requestammo.ogg" ,
|
||||
"v92/bf2/vo/english/grunt/no_filter/PLAYER_REQUEST_TM_requestammo_alt.ogg"
|
||||
}
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.Weapon.Handheld.Ammokit.Pickup",
|
||||
["channel"] = CHAN_ITEM ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = 100 ,
|
||||
["sound"] = "v92/bf2/common/pick_up_ammopack.mp3"
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.Weapon.Handheld.Ammokit.Deploy" ,
|
||||
["channel"] = CHAN_BODY ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = { 95 , 105 },
|
||||
["sound"] = "v92/bf2/weapons/handheld/ammokit/medikit_deploy.wav"
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.Weapon.Handheld.Ammokit.Holster" ,
|
||||
["channel"] = CHAN_BODY ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = { 95 , 105 } ,
|
||||
["sound"] = "v92/bf2/weapons/handheld/ammokit/medikit_deploy.wav"
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.Weapon.Handheld.Ammokit.Throw" ,
|
||||
["channel"] = CHAN_BODY ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = { 95 , 105 } ,
|
||||
["sound"] = "v92/bf2/weapons/handheld/ammokit/throw.wav"
|
||||
})
|
||||
|
||||
if CLIENT then
|
||||
|
||||
local strEntityName = "v92_bf2_ammokit"
|
||||
local strInfoName = "Ammo Kit"
|
||||
|
||||
SWEP.Category = "Utilities"
|
||||
SWEP.PrintName = strInfoName
|
||||
SWEP.Author = "V92"
|
||||
SWEP.Contact = "Steam"
|
||||
SWEP.Purpose = "Resupplying Nearby Units"
|
||||
SWEP.Instructions = "Primary: Supply Target\nSecondary: Throw Consumable Kit\nUSE+Secondary: Drop Consumable Kit"
|
||||
SWEP.Slot = 4
|
||||
SWEP.SlotPos = 32
|
||||
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/" .. strEntityName )
|
||||
SWEP.ViewModelFOV = 67
|
||||
SWEP.BounceWeaponIcon = false
|
||||
|
||||
language.Add( strEntityName, strInfoName )
|
||||
killicon.Add( strEntityName, "vgui/entities/".. strEntityName , Color( 255, 255, 255 ) )
|
||||
|
||||
end
|
||||
|
||||
SWEP.Weight = 1
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminOnly = false
|
||||
SWEP.UseHands = true
|
||||
SWEP.ViewModel = Model("models/v92/bf2/weapons/handheld/ammokit_c.mdl")
|
||||
SWEP.WorldModel = Model("models/v92/bf2/weapons/handheld/ammokit_w.mdl")
|
||||
|
||||
SWEP.Primary.ClipSize = 100
|
||||
SWEP.Primary.DefaultClip = 100
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.Ammo = "None"
|
||||
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.Ammo = "None"
|
||||
|
||||
SWEP.SupplyAmount = 25
|
||||
SWEP.MaxAmmo = 100 -- Maximum ammo
|
||||
|
||||
local ThrowSound = Sound( "BF2.Weapon.Handheld.Ammokit.Throw" )
|
||||
local SupplySound = Sound( "BF2.Weapon.Handheld.Ammokit.Pickup" )
|
||||
local AmmoSoundVO = Sound( "BF2.VO.English.Grunt.NoFilter.AmmoHere" )
|
||||
local EmptySoundVO = Sound( "BF2.VO.English.Grunt.NoFilter.OutOfAmmo" )
|
||||
local RequestSoundVO = Sound( "BF2.VO.English.Grunt.NoFilter.RequestAmmo" )
|
||||
local DeployEntity = "v92_bf2_ammokit_ent"
|
||||
|
||||
function SWEP:Initialize()
|
||||
|
||||
self:SetHoldType( "slam" )
|
||||
|
||||
self.SupplyAmount = self.SupplyAmount or 25
|
||||
|
||||
if CLIENT then
|
||||
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
timer.Create( "ammokit_ammo" .. self:EntIndex() , 5 , 0 , function()
|
||||
if ( self:Clip1() < self.MaxAmmo ) then self:SetClip1( math.min( self:Clip1() + 5 , self.MaxAmmo ) ) end
|
||||
end )
|
||||
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
|
||||
if CLIENT then
|
||||
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
if self.Owner:IsPlayer() then
|
||||
|
||||
self.Owner:LagCompensation( true )
|
||||
|
||||
end
|
||||
|
||||
local tr = util.TraceLine( {
|
||||
["start"] = self.Owner:GetShootPos(),
|
||||
["endpos"] = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 64,
|
||||
["filter"] = self.Owner
|
||||
} )
|
||||
|
||||
if self.Owner:IsPlayer() then
|
||||
|
||||
self.Owner:LagCompensation( false )
|
||||
|
||||
end
|
||||
|
||||
local ent = tr.Entity
|
||||
|
||||
local need = 25
|
||||
|
||||
if IsValid( ent ) and self:Clip1() >= need then
|
||||
|
||||
self:TakePrimaryAmmo( need )
|
||||
|
||||
local cw = ent:GetActiveWeapon()
|
||||
if not IsValid(cw) then
|
||||
self.Owner:EmitSound( EmptySoundVO )
|
||||
self:SetNextSecondaryFire( CurTime() + 3 )
|
||||
return
|
||||
end
|
||||
local ammoType = cw:GetPrimaryAmmoType()
|
||||
if ammoType == "rpg_round" or ammoType == "PanzerFaust3 Rocket" then
|
||||
-- Не давать патроны для ракетниц
|
||||
self.Owner:EmitSound( EmptySoundVO )
|
||||
self:SetNextSecondaryFire( CurTime() + 3 )
|
||||
return
|
||||
end
|
||||
ent:GiveAmmo( cw:GetMaxClip1() , ammoType , false )
|
||||
ent:EmitSound( SupplySound )
|
||||
|
||||
if ent == tr.Entity then
|
||||
|
||||
self.Owner:EmitSound( AmmoSoundVO )
|
||||
|
||||
end
|
||||
|
||||
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
|
||||
|
||||
self:SetNextPrimaryFire( CurTime() + self:SequenceDuration() + 1 )
|
||||
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||
|
||||
-- Even though the viewmodel has looping IDLE anim at all times, we need this to make fire animation work in multiplayer
|
||||
-- timer.Create( "weapon_idle" .. self:EntIndex(), self:SequenceDuration(), 1, function() if ( IsValid( self ) ) then self:SendWeaponAnim( ACT_VM_IDLE ) end end )
|
||||
|
||||
else
|
||||
|
||||
self.Owner:EmitSound( EmptySoundVO )
|
||||
|
||||
self:SetNextSecondaryFire( CurTime() + 3 )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
|
||||
if CLIENT then
|
||||
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
local ent = self.Owner
|
||||
|
||||
local need = 25
|
||||
|
||||
if IsValid( ent ) and self:Clip1() >= need then
|
||||
|
||||
self:TakePrimaryAmmo( need )
|
||||
|
||||
ent:EmitSound( AmmoSoundVO )
|
||||
|
||||
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
|
||||
|
||||
local deployEnt = ents.Create( DeployEntity )
|
||||
deployEnt:SetPos( ent:EyePos() + ent:GetAimVector() * 16 + ent:GetRight() * 2 + ent:GetUp() * -3 )
|
||||
deployEnt:SetAngles( ent:EyeAngles() - Angle( 45 , 0 , 0 ) )
|
||||
deployEnt:SetOwner( self.Owner )
|
||||
deployEnt:Spawn()
|
||||
|
||||
if deployEnt:GetPhysicsObject():IsValid() then
|
||||
|
||||
deployEnt:GetPhysicsObject():SetMass( 5 )
|
||||
|
||||
if self.Owner:KeyDown( IN_USE ) then
|
||||
deployEnt:GetPhysicsObject():SetVelocity( ent:GetAimVector() * 50 )
|
||||
else
|
||||
deployEnt:GetPhysicsObject():SetVelocity( ent:GetAimVector() * 400 )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self:SetNextSecondaryFire( CurTime() + self:SequenceDuration() + 1 )
|
||||
self.Owner:SetAnimation( PLAYER_ATTACK1 )
|
||||
|
||||
-- timer.Create( "weapon_idle" .. self:EntIndex(), self:SequenceDuration(), 1, function() if ( IsValid( self ) ) then self:SendWeaponAnim( ACT_VM_IDLE ) end end )
|
||||
|
||||
else
|
||||
|
||||
self.Owner:EmitSound( EmptySoundVO )
|
||||
|
||||
self:SetNextSecondaryFire( CurTime() + 3 )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function SWEP:OnRemove()
|
||||
|
||||
timer.Stop( "ammokit_ammo" .. self:EntIndex() )
|
||||
-- timer.Stop( "weapon_idle" .. self:EntIndex() )
|
||||
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
|
||||
-- timer.Stop( "weapon_idle" .. self:EntIndex() )
|
||||
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
function SWEP:CustomAmmoDisplay()
|
||||
|
||||
self.AmmoDisplay = self.AmmoDisplay or {}
|
||||
|
||||
self.AmmoDisplay.Draw = true -- draw the display?
|
||||
|
||||
if self.Primary.ClipSize > 0 then
|
||||
|
||||
self.AmmoDisplay.PrimaryClip = self:Clip1() -- amount in clip
|
||||
self.AmmoDisplay.PrimaryAmmo = self:Ammo1() -- amount in reserve
|
||||
|
||||
end
|
||||
|
||||
if self.Secondary.ClipSize > 0 then
|
||||
|
||||
self.AmmoDisplay.SecondaryAmmo = self:Ammo2() -- amount of secondary ammo
|
||||
|
||||
end
|
||||
|
||||
return self.AmmoDisplay -- return the table
|
||||
|
||||
end
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
@@ -0,0 +1,233 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
AddCSLuaFile()
|
||||
|
||||
sound.Add({ ["name"] = "BF2.VO.English.Grunt.NoFilter.HealHere",
|
||||
["channel"] = CHAN_VOICE ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = 100 ,
|
||||
["sound"] = {
|
||||
"v92/bf2/vo/english/grunt/no_filter/auto_moodgp_tm_healhere.ogg" ,
|
||||
"v92/bf2/vo/english/grunt/no_filter/auto_moodgp_tm_healhere_alt.ogg"
|
||||
}
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.VO.English.Grunt.NoFilter.OutOfMedic",
|
||||
["channel"] = CHAN_VOICE ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = 100 ,
|
||||
["sound"] = {
|
||||
"v92/bf2/vo/english/grunt/no_filter/auto_moodgp_tm_outofmedic.ogg" ,
|
||||
"v92/bf2/vo/english/grunt/no_filter/auto_moodgp_tm_outofmedic_alt.ogg"
|
||||
}
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.VO.English.Grunt.NoFilter.RequestMedic",
|
||||
["channel"] = CHAN_VOICE ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = 100 ,
|
||||
["sound"] = {
|
||||
"v92/bf2/vo/english/grunt/no_filter/PLAYER_REQUEST_TM_requestmedic.ogg" ,
|
||||
"v92/bf2/vo/english/grunt/no_filter/PLAYER_REQUEST_TM_requestmedic_alt.ogg"
|
||||
}
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.Weapon.Handheld.Medikit.Pickup",
|
||||
["channel"] = CHAN_ITEM ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = 100 ,
|
||||
["sound"] = "v92/bf2/common/pick_up_medipack.wav"
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.Weapon.Handheld.Medikit.Deploy" ,
|
||||
["channel"] = CHAN_BODY ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = { 95 , 105 },
|
||||
["sound"] = "v92/bf2/weapons/handheld/medikit/medikit_deploy.wav"
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.Weapon.Handheld.Medikit.Holster" ,
|
||||
["channel"] = CHAN_BODY ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = { 95 , 105 } ,
|
||||
["sound"] = "v92/bf2/weapons/handheld/medikit/medikit_deploy.wav"
|
||||
})
|
||||
|
||||
sound.Add({ ["name"] = "BF2.Weapon.Handheld.Medikit.Throw" ,
|
||||
["channel"] = CHAN_BODY ,
|
||||
["volume"] = 1.0 ,
|
||||
["level"] = 85 ,
|
||||
["pitch"] = { 95 , 105 } ,
|
||||
["sound"] = "v92/bf2/weapons/handheld/medikit/throw.wav"
|
||||
})
|
||||
|
||||
if CLIENT then
|
||||
|
||||
local strEntityName = "v92_bf2_medikit"
|
||||
local strInfoName = "Medical Kit"
|
||||
|
||||
SWEP.Category = "Utilities"
|
||||
SWEP.PrintName = strInfoName
|
||||
SWEP.Author = "V92"
|
||||
SWEP.Contact = "Steam"
|
||||
SWEP.Purpose = "Healing Nearby Units"
|
||||
SWEP.Instructions = "Primary: Надеть/снять аптечку на себя\nUse+Primary: Вылечить себя\n"
|
||||
SWEP.Slot = 4
|
||||
SWEP.SlotPos = 32
|
||||
SWEP.WepSelectIcon = surface.GetTextureID("vgui/hud/" .. strEntityName )
|
||||
SWEP.ViewModelFOV = 67
|
||||
SWEP.BounceWeaponIcon = false
|
||||
|
||||
language.Add( strEntityName, strInfoName )
|
||||
killicon.Add( strEntityName, "vgui/entities/".. strEntityName , Color( 255, 255, 255 ) )
|
||||
|
||||
end
|
||||
|
||||
SWEP.Weight = 1
|
||||
SWEP.Spawnable = true
|
||||
SWEP.AdminOnly = false
|
||||
SWEP.UseHands = true
|
||||
SWEP.ViewModel = Model("models/v92/bf2/weapons/handheld/medikit_c.mdl")
|
||||
SWEP.WorldModel = Model("models/v92/bf2/weapons/handheld/medikit_w.mdl")
|
||||
|
||||
SWEP.Primary.ClipSize = 100
|
||||
SWEP.Primary.DefaultClip = 100
|
||||
SWEP.Primary.Automatic = false
|
||||
SWEP.Primary.Ammo = "none"
|
||||
|
||||
SWEP.Secondary.ClipSize = -1
|
||||
SWEP.Secondary.DefaultClip = -1
|
||||
SWEP.Secondary.Automatic = false
|
||||
SWEP.Secondary.Ammo = "none"
|
||||
|
||||
SWEP.HealAmount = GetConVarNumber("sk_healthkit")
|
||||
SWEP.MaxAmmo = 100
|
||||
|
||||
local ThrowSound = Sound( "BF2.Weapon.Handheld.Medikit.Throw" )
|
||||
local HealSound = Sound( "BF2.Weapon.Handheld.Medikit.Pickup" )
|
||||
local HealSoundVO = Sound( "BF2.VO.English.Grunt.NoFilter.HealHere" )
|
||||
local EmptySoundVO = Sound( "BF2.VO.English.Grunt.NoFilter.OutOfMedic" )
|
||||
local RequestSoundVO = Sound( "BF2.VO.English.Grunt.NoFilter.RequestMedic" )
|
||||
|
||||
function SWEP:Initialize()
|
||||
self:SetHoldType( "slam" )
|
||||
self.HealAmount = GetConVarNumber("sk_healthkit")
|
||||
|
||||
if CLIENT then
|
||||
return
|
||||
end
|
||||
|
||||
timer.Create( "medkit_ammo" .. self:EntIndex() , 10 , 0 , function()
|
||||
if ( self:Clip1() < self.MaxAmmo ) then
|
||||
self:SetClip1( math.min( self:Clip1() + 5 , self.MaxAmmo ) )
|
||||
end
|
||||
end )
|
||||
end
|
||||
|
||||
function SWEP:PrimaryAttack()
|
||||
if CLIENT then return end
|
||||
|
||||
local owner = self.Owner
|
||||
if not IsValid(owner) then return end
|
||||
|
||||
local medikitOnBack = nil
|
||||
for _, ent in ipairs(ents.FindByClass("v92_bf2_medikit_ent")) do
|
||||
if IsValid(ent) and ent.IsAttached and ent.AttachedPlayer == owner then
|
||||
medikitOnBack = ent
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if medikitOnBack then
|
||||
|
||||
if owner:KeyDown(IN_USE) then
|
||||
owner:ChatPrint("[!] Нельзя лечить себя, пока аптечка на спине!")
|
||||
self:SetNextPrimaryFire(CurTime() + 0.5)
|
||||
return
|
||||
end
|
||||
|
||||
medikitOnBack:DetachFromPlayer()
|
||||
self:SetNextPrimaryFire(CurTime() + 1)
|
||||
return
|
||||
end
|
||||
|
||||
if owner:KeyDown(IN_USE) then
|
||||
local need = GetConVarNumber("sk_healthkit")
|
||||
need = math.min(owner:GetMaxHealth() - owner:Health(), self.HealAmount)
|
||||
|
||||
if self:Clip1() >= need and owner:Health() < owner:GetMaxHealth() then
|
||||
self:TakePrimaryAmmo(need)
|
||||
owner:SetHealth(math.min(owner:GetMaxHealth(), owner:Health() + need))
|
||||
|
||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||
self:SetNextPrimaryFire(CurTime() + self:SequenceDuration() + 0.5)
|
||||
owner:SetAnimation(PLAYER_ATTACK1)
|
||||
else
|
||||
if need > self.HealAmount then
|
||||
owner:EmitSound(EmptySoundVO)
|
||||
end
|
||||
self:SetNextPrimaryFire(CurTime() + 1)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local deployEnt = ents.Create("v92_bf2_medikit_ent")
|
||||
if not IsValid(deployEnt) then
|
||||
self:SetNextPrimaryFire(CurTime() + 0.5)
|
||||
return
|
||||
end
|
||||
|
||||
deployEnt:SetPos(owner:GetPos() + Vector(0, 0, 50))
|
||||
deployEnt:SetAngles(owner:GetAngles())
|
||||
deployEnt:SetOwner(owner)
|
||||
deployEnt:Spawn()
|
||||
|
||||
if deployEnt.AttachToPlayer and deployEnt:AttachToPlayer(owner) then
|
||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||
self:SetNextPrimaryFire(CurTime() + self:SequenceDuration() + 0.5)
|
||||
owner:SetAnimation(PLAYER_ATTACK1)
|
||||
else
|
||||
self:SetNextPrimaryFire(CurTime() + 0.5)
|
||||
end
|
||||
end
|
||||
|
||||
function SWEP:SecondaryAttack()
|
||||
return
|
||||
end
|
||||
|
||||
function SWEP:OnRemove()
|
||||
timer.Stop( "medkit_ammo" .. self:EntIndex() )
|
||||
end
|
||||
|
||||
function SWEP:Holster()
|
||||
return true
|
||||
end
|
||||
|
||||
function SWEP:CustomAmmoDisplay()
|
||||
self.AmmoDisplay = self.AmmoDisplay or {}
|
||||
self.AmmoDisplay.Draw = true
|
||||
|
||||
if self.Primary.ClipSize > 0 then
|
||||
self.AmmoDisplay.PrimaryClip = self:Clip1()
|
||||
self.AmmoDisplay.PrimaryAmmo = self:Ammo1()
|
||||
end
|
||||
|
||||
if self.Secondary.ClipSize > 0 then
|
||||
self.AmmoDisplay.SecondaryAmmo = self:Ammo2()
|
||||
end
|
||||
|
||||
return self.AmmoDisplay
|
||||
end
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
Reference in New Issue
Block a user