Залив
This commit is contained in:
52
lua/entities/mg_aoe_arrow_explosion/cl_init.lua
Normal file
52
lua/entities/mg_aoe_arrow_explosion/cl_init.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
include("shared.lua")
|
||||
|
||||
killicon.Add("mg_aoe_arrow_explosion", "VGUI/entities/mg_crossbow", Color(255, 0, 0, 255))
|
||||
|
||||
local BaseClass = baseclass.Get(ENT.Base)
|
||||
|
||||
function ENT:Beep()
|
||||
local dlight = DynamicLight(self:EntIndex())
|
||||
dlight.pos = self:GetPos()
|
||||
dlight.r = 15
|
||||
dlight.g = 255
|
||||
dlight.b = 15
|
||||
dlight.brightness = -1
|
||||
dlight.Decay = 1000
|
||||
dlight.Size = 256
|
||||
dlight.DieTime = CurTime() + 0.1
|
||||
|
||||
sound.Play("MW19_Crossbow.ExploBeep", self:GetPos())
|
||||
ParticleEffectAttach("arrow_beep_flare", PATTACH_ABSORIGIN_FOLLOW, self, 0)
|
||||
end
|
||||
|
||||
function ENT:Draw(flags)
|
||||
self:DrawShadow(false)
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
ParticleEffect("Generic_explo_high", self:GetPos(), self:GetAngles())
|
||||
self:EmitSound("^viper/shared/frag_expl.ogg", 0, 100, 1, CHAN_BODY) --snd scripts dont work lol!
|
||||
|
||||
local dlight = DynamicLight(self:EntIndex())
|
||||
if (dlight) then
|
||||
dlight.pos = self:GetPos()
|
||||
dlight.r = 255
|
||||
dlight.g = 75
|
||||
dlight.b = 0
|
||||
dlight.brightness = 5
|
||||
dlight.Decay = 500
|
||||
dlight.Size = 512
|
||||
dlight.DieTime = CurTime() + 6
|
||||
end
|
||||
|
||||
util.Decal("Scorch", self:GetPos(), self:GetPos() + self:GetUp() * -100, {self, self.arrow})
|
||||
|
||||
local ed = EffectData()
|
||||
ed:SetScale(5000)
|
||||
ed:SetOrigin(self:GetPos())
|
||||
ed:SetRadius(512)
|
||||
ed:SetMagnitude(1000)
|
||||
ed:SetScale(1000)
|
||||
ed:SetEntity(self)
|
||||
util.Effect("ShakeRopes", ed)
|
||||
end
|
||||
59
lua/entities/mg_aoe_arrow_explosion/init.lua
Normal file
59
lua/entities/mg_aoe_arrow_explosion/init.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
ENT.ExplosionRadius = 256
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/dav0r/hoverball.mdl")
|
||||
--[[self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:GetPhysicsObject():EnableMotion(false)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_DEBRIS)]]
|
||||
self:SetLifeTime(1.5)
|
||||
self:AddFlags(FL_GRENADE)
|
||||
self:AddFlags(FL_ONFIRE)
|
||||
self.nextBeep = self:GetLifeTime()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if (IsValid(self:GetParent()) && self:GetParent():Health() <= 0 && self:GetParent():GetMaxHealth() > 1) then
|
||||
self:Explode()
|
||||
self:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
self:SetLifeTime(self:GetLifeTime() - FrameTime())
|
||||
|
||||
if (self:GetLifeTime() > 0.1 && self:GetLifeTime() <= self.nextBeep) then
|
||||
sound.EmitHint(SOUND_DANGER, self:GetPos(), self.ExplosionRadius * 2, 1, nil) --make shit run away (nil owner so even rebels run)
|
||||
self.nextBeep = self:GetLifeTime() * 0.75
|
||||
BroadcastLua("Entity("..self:EntIndex().."):Beep()")
|
||||
end
|
||||
|
||||
if (self:GetLifeTime() <= 0) then
|
||||
self:Explode()
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:Explode()
|
||||
local dmgInfo = DamageInfo()
|
||||
dmgInfo:SetAttacker(self:GetOwner())
|
||||
dmgInfo:SetDamage(150)
|
||||
dmgInfo:SetDamageType(DMG_BLAST + DMG_AIRBOAT)
|
||||
dmgInfo:SetInflictor(self)
|
||||
util.BlastDamageInfo(dmgInfo, self:GetPos(), self.ExplosionRadius)
|
||||
util.ScreenShake(self:GetPos(), 3500, 1111, 1, self.ExplosionRadius * 4)
|
||||
|
||||
if (IsValid(self.arrow)) then
|
||||
self.arrow:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:Explode()
|
||||
end
|
||||
23
lua/entities/mg_aoe_arrow_explosion/shared.lua
Normal file
23
lua/entities/mg_aoe_arrow_explosion/shared.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
ENT.Base = "base_entity"
|
||||
ENT.Type = "anim"
|
||||
|
||||
game.AddParticles("particles/mw19_attachments.pcf")
|
||||
PrecacheParticleSystem("arrow_beep_flare")
|
||||
|
||||
game.AddParticles("particles/generic_explosions_pak.pcf")
|
||||
PrecacheParticleSystem("Generic_explo_high")
|
||||
PrecacheParticleSystem("Generic_explo_mid")
|
||||
PrecacheParticleSystem("Generic_explo_tiny")
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Float", 0, "LifeTime")
|
||||
end
|
||||
|
||||
sound.Add({
|
||||
name = "MW19_Crossbow.ExploBeep",
|
||||
channel = CHAN_ITEM,
|
||||
volume = 1,
|
||||
level = 85,
|
||||
pitch = 100,
|
||||
sound = "viper/shared/weap_semtex_beep.ogg"
|
||||
})
|
||||
Reference in New Issue
Block a user