Залив

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,44 @@
include("shared.lua")
killicon.Add("mg_aoe_arrow_gas", "VGUI/entities/mg_crossbow", Color(255, 0, 0, 255))
local gasEntities = {}
function ENT:Initialize()
table.insert(gasEntities, self)
end
function ENT:OnRemove()
table.RemoveByValue(gasEntities, self)
end
function ENT:Draw(flags)
self:DrawShadow(false)
end
function ENT:DrawPukeVision()
if (!IsValid(GetViewEntity())) then
return
end
local dist = GetViewEntity():NearestPoint(self:GetPos()):DistToSqr(self:GetPos()) - (64 * 64)
if (dist > self.GasRadius * self.GasRadius) then
return
end
local delta = 1 - (dist / (self.GasRadius * self.GasRadius))
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(117, 143, 53, 200 * delta)
surface.DrawRect(0, 0, ScrW(), ScrH())
end
hook.Add("HUDPaintBackground", "HUDPaint_MW19_GasVision", function()
for _, e in pairs(gasEntities) do
e:DrawPukeVision()
end
end)

View File

@@ -0,0 +1,83 @@
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.smokeSound = nil
function ENT:Initialize()
self:SetModel("models/dav0r/hoverball.mdl")
--[[self:PhysicsInit(SOLID_VPHYSICS)
self:GetPhysicsObject():EnableMotion(false)
self:SetCollisionGroup(COLLISION_GROUP_DEBRIS)]]
self:AddFlags(FL_GRENADE)
self:AddFlags(FL_ONFIRE)
local repFil = RecipientFilter()
repFil:AddAllPlayers()
self.smokeSound = CreateSound(self, "MW19_Crossbow.GasOn", repFil)
self.smokeSound:Play()
self:EmitSound("MW19_Crossbow.GasExplode")
ParticleEffectAttach("arrow_gas_dust", PATTACH_ABSORIGIN_FOLLOW, self, 0)
ParticleEffect("arrow_gas_explode", self:GetPos(), self:GetAngles(), self, 0)
self:SetParent(NULL) --detaching from whatever we nailed on
sound.EmitHint(SOUND_DANGER, self:GetPos(), self.GasRadius * 2, self.LifeTime, nil) --make shit run away (nil owner so even rebels run)
end
local function doesEntityBreathe(ent)
return ent:GetBloodColor() != BLOOD_COLOR_MECH && ent:GetBloodColor() != DONT_BLEED
end
function ENT:Think()
if (CurTime() > self:GetCreationTime() + (self.LifeTime - 2)) then
self:StopGas()
end
if (CurTime() - self:GetCreationTime() > self.LifeTime) then
self:Remove()
return
end
for _, e in pairs(ents.FindInSphere(self:GetPos(), self.GasRadius)) do
if (e:IsPlayer() || e:IsNPC() || e:IsNextBot()) then
if (!doesEntityBreathe(e) || !e:IsLineOfSightClear(self:GetPos())) then
continue
end
local dmgInfo = DamageInfo()
dmgInfo:SetAttacker(self:GetOwner())
dmgInfo:SetDamage(8)
dmgInfo:SetDamageType(DMG_NERVEGAS)
dmgInfo:SetInflictor(self)
e:TakeDamageInfo(dmgInfo)
end
end
self:NextThink(CurTime() + 0.25)
return true
end
function ENT:OnRemove()
self:StopGas()
end
ENT.bStoppedGas = false
function ENT:StopGas()
if (self.bStoppedGas) then
return
end
self.bStoppedGas = true
if (self.smokeSound != nil) then
self.smokeSound:Stop()
end
self:StopParticles()
sound.Play("MW19_Crossbow.GasOff", self:GetPos())
end

View File

@@ -0,0 +1,36 @@
ENT.Base = "base_entity"
ENT.Type = "anim"
ENT.GasRadius = 164
ENT.LifeTime = 8
game.AddParticles("particles/mw19_attachments.pcf")
PrecacheParticleSystem("arrow_gas_dust")
PrecacheParticleSystem("arrow_gas_explode")
sound.Add({
name = "MW19_Crossbow.GasOn",
channel = CHAN_BODY,
volume = 0.25,
level = 75,
pitch = {95, 105},
sound = {"viper/shared/smoke_grenade_smoke_loop.ogg"}
})
sound.Add({
name = "MW19_Crossbow.GasOff",
channel = CHAN_BODY,
volume = 0.25,
level = 75,
pitch = {95, 105},
sound = {"viper/shared/smoke_grenade_smoke_loop_end.ogg"}
})
sound.Add({
name = "MW19_Crossbow.GasExplode",
channel = CHAN_ITEM,
volume = 1,
level = 100,
pitch = {95, 105},
sound = {"viper/shared/smoke_expl_body_01.ogg"}
})