Залив

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,45 @@
include("shared.lua")
killicon.Add("mg_aoe_arrow_gas", "VGUI/entities/mg_crossbow", Color(255, 0, 0, 255))
local smokeEntities = {}
function ENT:Initialize()
table.insert(smokeEntities, self)
self:SetCollisionGroup(self.CollisionGroup)
end
function ENT:OnRemove()
table.RemoveByValue(smokeEntities, self)
end
function ENT:Draw(flags)
self:DrawShadow(false)
end
function ENT:DrawSmokeVision()
if (!IsValid(GetViewEntity())) then
return
end
local dist = GetViewEntity():NearestPoint(self:GetPos()):DistToSqr(self:GetPos()) - (64 * 64)
if (dist > self.SmokeRadius * self.SmokeRadius) then
return
end
local delta = 1 - (dist / (self.SmokeRadius * self.SmokeRadius))
local time = self:GetCreationTime() + self.LifeTime
local fadeout = math.Clamp(time - CurTime(), 0, 0.5) * 2
local fadein = math.Clamp(math.abs(CurTime() - self:GetCreationTime()), 0, 1)
delta = delta * fadein
delta = delta * fadeout
surface.SetDrawColor(150, 150, 150, 255 * delta)
surface.DrawRect(0, 0, ScrW(), ScrH())
end
hook.Add("HUDPaintBackground", "HUDPaint_MW19_SmokeVision", function()
for _, e in pairs(smokeEntities) do
e:DrawSmokeVision()
end
end)

View File

@@ -0,0 +1,69 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.smokeSound = nil
function ENT:Initialize()
self:SetParent(NULL) --detaching from whatever we nailed on
self:SetModel("models/dav0r/hoverball.mdl")
self:SetOwner(NULL)
self:EnableCustomCollisions(true)
local p = self:GetPos() --+ self:GetAngles():Up() * -self.SmokeRadius
local b = Vector(0.66, 0.66, 0.66) * self.SmokeRadius
self:PhysicsInitBox(-b, b)
self:SetCollisionBoundsWS(p - b, p + b)
self:GetPhysicsObject():EnableMotion(false)
self:SetCollisionGroup(self.CollisionGroup)
local repFil = RecipientFilter()
repFil:AddAllPlayers()
self.smokeSound = CreateSound(self, "MW19_Crossbow.SmokeOn", repFil)
self.smokeSound:Play()
self.smokeSound:ChangePitch(75)
self:EmitSound("MW19_Crossbow.SmokeExplode")
ParticleEffectAttach("arrow_smoke", PATTACH_ABSORIGIN_FOLLOW, self, 0)
ParticleEffect("arrow_smoke_explode", self:GetPos(), self:GetAngles(), self, 0)
end
function ENT:GetRelationship(e)
return self:GetOwner()
end
function ENT:Think()
if (CurTime() > self:GetCreationTime() + (self.LifeTime - 2)) then
self:StopSmoke()
end
if (CurTime() - self:GetCreationTime() > self.LifeTime) then
self:Remove()
return
end
end
function ENT:OnRemove()
self:StopSmoke()
end
ENT.bStoppedSmoke = false
function ENT:StopSmoke()
if (self.bStoppedSmoke) then
return
end
self.bStoppedSmoke = true
if (self.smokeSound != nil) then
self.smokeSound:Stop()
end
self:StopParticles()
sound.Play("MW19_Crossbow.SmokeOff", self:GetPos())
end

View File

@@ -0,0 +1,57 @@
ENT.Base = "base_entity"
ENT.Type = "anim"
ENT.SmokeRadius = 256
ENT.LifeTime = 11
ENT.CollisionGroup = COLLISION_GROUP_DEBRIS_TRIGGER
function ENT:TestCollision(startpos, delta, isbox, extents, mask)
--[[if (bit.band(mask, MASK_SHOT) == MASK_SHOT && SERVER) then
--workaround for strider
local tr = util.TraceLine({
start = self:GetPos(),
endpos = startpos,
filter = self,
mask = MASK_SHOT
})
if (IsValid(tr.Entity)) then
tr.Entity:Fire("SetCannonTarget", "") --strider
tr.Entity:Fire("SetMinigunTarget", "") --strider
--can't do shit to helicopter _shrug_
end
end]] --causes an infinite loop when shooting more arrows into the smoke
return bit.band(mask, MASK_BLOCKLOS) == MASK_BLOCKLOS
end
game.AddParticles("particles/mw19_attachments.pcf")
PrecacheParticleSystem("arrow_smoke")
PrecacheParticleSystem("arrow_smoke_explode")
sound.Add({
name = "MW19_Crossbow.SmokeOn",
channel = CHAN_BODY,
volume = 0.25,
level = 75,
pitch = {75, 85},
sound = {"viper/shared/smoke_grenade_smoke_loop.ogg"}
})
sound.Add({
name = "MW19_Crossbow.SmokeOff",
channel = CHAN_BODY,
volume = 0.25,
level = 75,
pitch = {75, 85},
sound = {"viper/shared/smoke_grenade_smoke_loop_end.ogg"}
})
sound.Add({
name = "MW19_Crossbow.SmokeExplode",
channel = CHAN_ITEM,
volume = 1,
level = 100,
pitch = {95, 105},
sound = {"viper/shared/smoke_expl_body_01.ogg"}
})