2018-05-02 06:32:59 +08:00
|
|
|
local messages = {
|
|
|
|
"MUNCH!",
|
|
|
|
"BRAIN GET!",
|
|
|
|
"+1!",
|
|
|
|
"JOIN US!",
|
|
|
|
"ONE OF US!",
|
|
|
|
"BUTT MANGLED!",
|
|
|
|
"CHOMP!"
|
2014-10-02 08:49:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
EFFECT.LifeTime = 3
|
|
|
|
|
|
|
|
function EFFECT:Init(data)
|
|
|
|
self:SetRenderBounds(Vector(-64, -64, -64), Vector(64, 64, 64))
|
|
|
|
|
|
|
|
self.Seed = math.Rand(0, 10)
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
self.Pos = data:GetOrigin()
|
2014-10-02 08:49:54 +08:00
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
local amount = math.Round(data:GetMagnitude())
|
2014-10-02 08:49:54 +08:00
|
|
|
if amount > 1 then
|
|
|
|
self.Message = amount.." BRAINS!"
|
|
|
|
else
|
|
|
|
self.Message = messages[math.random(#messages)]
|
|
|
|
end
|
|
|
|
|
|
|
|
self.DeathTime = CurTime() + self.LifeTime
|
|
|
|
end
|
|
|
|
|
|
|
|
function EFFECT:Think()
|
|
|
|
self.Pos.z = self.Pos.z + FrameTime() * 32
|
|
|
|
return CurTime() < self.DeathTime
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
local cam_IgnoreZ = cam.IgnoreZ
|
|
|
|
local cam_Start3D2D = cam.Start3D2D
|
|
|
|
local cam_End3D2D = cam.End3D2D
|
|
|
|
local draw_SimpleText = draw.SimpleText
|
|
|
|
local math_Clamp = math.Clamp
|
|
|
|
local math_sin = math.sin
|
|
|
|
local EyeAngles = EyeAngles
|
|
|
|
local TEXT_ALIGN_CENTER = TEXT_ALIGN_CENTER
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
local col = Color(40, 255, 40, 255)
|
|
|
|
local col2 = Color(0, 0, 0, 255)
|
|
|
|
function EFFECT:Render()
|
2018-05-02 06:32:59 +08:00
|
|
|
local delta = math_Clamp(self.DeathTime - CurTime(), 0, self.LifeTime) / self.LifeTime
|
2014-10-02 08:49:54 +08:00
|
|
|
col.a = delta * 240
|
|
|
|
col2.a = col.a
|
2018-05-02 06:32:59 +08:00
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
local ang = EyeAngles()
|
|
|
|
local right = ang:Right()
|
|
|
|
ang:RotateAroundAxis(ang:Up(), -90)
|
|
|
|
ang:RotateAroundAxis(ang:Forward(), 90)
|
2018-05-02 06:32:59 +08:00
|
|
|
|
|
|
|
cam_IgnoreZ(true)
|
|
|
|
cam_Start3D2D(self.Pos + math_sin(CurTime() + self.Seed) * 30 * delta * right, ang, (delta * 0.24 + 0.09) / 2)
|
|
|
|
draw_SimpleText(self.Message, "ZS3D2DFont2", 0, 0, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
|
|
|
cam_End3D2D()
|
|
|
|
cam_IgnoreZ(false)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|