mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
56
addons/tfa-base/lua/effects/tfa_bullet_impact/init.lua
Normal file
56
addons/tfa-base/lua/effects/tfa_bullet_impact/init.lua
Normal file
@@ -0,0 +1,56 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
function EFFECT:Init(data)
|
||||
local posoffset = data:GetOrigin()
|
||||
local emitter = ParticleEmitter(posoffset)
|
||||
|
||||
if TFA.GetGasEnabled() then
|
||||
local p = emitter:Add("sprites/heatwave", posoffset)
|
||||
p:SetVelocity(50 * data:GetNormal() + 0.5 * VectorRand())
|
||||
p:SetAirResistance(200)
|
||||
p:SetStartSize(math.random(12.5, 17.5))
|
||||
p:SetEndSize(2)
|
||||
p:SetDieTime(math.Rand(0.15, 0.225))
|
||||
p:SetRoll(math.Rand(-180, 180))
|
||||
p:SetRollDelta(math.Rand(-0.75, 0.75))
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
return false
|
||||
end
|
||||
72
addons/tfa-base/lua/effects/tfa_dust_impact/init.lua
Normal file
72
addons/tfa-base/lua/effects/tfa_dust_impact/init.lua
Normal file
@@ -0,0 +1,72 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
function EFFECT:Init(data)
|
||||
local ply = data:GetEntity()
|
||||
local ent
|
||||
|
||||
if IsValid(ply) and ply:IsPlayer() then
|
||||
ent = ply:GetActiveWeapon()
|
||||
end
|
||||
|
||||
local sfac = (IsValid(ent) and ent.Primary and ent.Primary.Damage) and math.sqrt(ent.Primary.Damage / 30) or 1
|
||||
local sfac_sqrt = math.sqrt(sfac)
|
||||
local posoffset = data:GetOrigin()
|
||||
local forward = data:GetNormal()
|
||||
local emitter = ParticleEmitter(posoffset)
|
||||
|
||||
for i = 0, math.Round(8 * sfac) do
|
||||
local p = emitter:Add("particle/particle_smokegrenade", posoffset)
|
||||
p:SetVelocity(90 * math.sqrt(i) * forward)
|
||||
p:SetAirResistance(400)
|
||||
p:SetStartAlpha(math.Rand(255, 255))
|
||||
p:SetEndAlpha(0)
|
||||
p:SetDieTime(math.Rand(0.75, 1) * (1 + math.sqrt(i) / 3))
|
||||
local iclamped = math.Clamp(i, 1, 8)
|
||||
local iclamped_sqrt = math.sqrt(iclamped / 8) * 8
|
||||
p:SetStartSize(math.Rand(1, 1) * sfac_sqrt * iclamped_sqrt)
|
||||
p:SetEndSize(math.Rand(1.5, 1.75) * sfac_sqrt * iclamped)
|
||||
p:SetRoll(math.Rand(-25, 25))
|
||||
p:SetRollDelta(math.Rand(-0.05, 0.05))
|
||||
p:SetColor(255, 255, 255)
|
||||
p:SetLighting(true)
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
return false
|
||||
end
|
||||
87
addons/tfa-base/lua/effects/tfa_metal_impact/init.lua
Normal file
87
addons/tfa-base/lua/effects/tfa_metal_impact/init.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local gravity_cv = GetConVar("sv_gravity")
|
||||
EFFECT.VelocityRandom = 0.25
|
||||
EFFECT.VelocityMin = 95
|
||||
EFFECT.VelocityMax = 125
|
||||
EFFECT.ParticleCountMin = 4
|
||||
EFFECT.ParticleCountMax = 7
|
||||
EFFECT.ParticleLife = 1.3
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.StartPos = data:GetOrigin()
|
||||
self.Dir = data:GetNormal()
|
||||
self.LifeTime = 0.1
|
||||
self.DieTime = CurTime() + self.LifeTime
|
||||
self.PartMult = 0.2
|
||||
self.Grav = Vector(0, 0, -gravity_cv:GetFloat())
|
||||
self.SparkLife = 1
|
||||
local emitter = ParticleEmitter(self.StartPos)
|
||||
local partcount = math.random(self.ParticleCountMin, self.ParticleCountMax)
|
||||
|
||||
--Sparks
|
||||
for _ = 1, partcount do
|
||||
local part = emitter:Add("effects/yellowflare", self.StartPos)
|
||||
part:SetVelocity(Lerp(self.VelocityRandom, self.Dir, VectorRand()) * math.Rand(self.VelocityMin, self.VelocityMax))
|
||||
part:SetDieTime(math.Rand(0.25, 1) * self.SparkLife)
|
||||
part:SetStartAlpha(255)
|
||||
part:SetStartSize(math.Rand(2, 4))
|
||||
part:SetEndSize(0)
|
||||
part:SetRoll(0)
|
||||
part:SetGravity(self.Grav)
|
||||
part:SetCollide(true)
|
||||
part:SetBounce(0.55)
|
||||
part:SetAirResistance(0.5)
|
||||
part:SetStartLength(0.2)
|
||||
part:SetEndLength(0)
|
||||
part:SetVelocityScale(true)
|
||||
part:SetCollide(true)
|
||||
end
|
||||
|
||||
--Impact
|
||||
local part = emitter:Add("effects/yellowflare", self.StartPos)
|
||||
part:SetStartAlpha(255)
|
||||
part:SetStartSize(15 * self.PartMult)
|
||||
part:SetDieTime(self.LifeTime * 1)
|
||||
part:SetEndSize(0)
|
||||
part:SetEndAlpha(0)
|
||||
part:SetRoll(math.Rand(0, 360))
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
return false
|
||||
end
|
||||
155
addons/tfa-base/lua/effects/tfa_muzzle_smoketrail/init.lua
Normal file
155
addons/tfa-base/lua/effects/tfa_muzzle_smoketrail/init.lua
Normal file
@@ -0,0 +1,155 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local vector_origin = Vector()
|
||||
|
||||
local smokecol = Color(225, 225, 225, 200)
|
||||
local smokemat = Material("trails/smoke")
|
||||
smokemat:SetInt("$nocull", 1)
|
||||
|
||||
function EFFECT:AddPart()
|
||||
local pos, rawdat, norm
|
||||
pos = self.startpos
|
||||
norm = self.startnormal
|
||||
|
||||
if self.targent and self.targatt then
|
||||
--pos = self:GetTracerShootPos(self.startpos, self.targent, self.targatt)
|
||||
rawdat = self.targent:GetAttachment(self.targatt)
|
||||
|
||||
if rawdat then
|
||||
pos = rawdat.Pos
|
||||
norm = rawdat.Ang:Forward()
|
||||
end
|
||||
end
|
||||
|
||||
local p = {}
|
||||
p.position = pos
|
||||
p.normal = norm
|
||||
p.velocity = p.normal * 5
|
||||
p.startlife = CurTime()
|
||||
p.lifetime = self.lifetime
|
||||
p.radius = self.radius
|
||||
|
||||
if self.vparticles then
|
||||
table.insert(self.vparticles, #self.vparticles + 1, p)
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:ProcessFakeParticles()
|
||||
self.stepcount = self.stepcount + 1
|
||||
|
||||
if self.vparticles then
|
||||
if CurTime() < self.emittime and self.stepcount % self.partinterval == 0 then
|
||||
self:AddPart()
|
||||
end
|
||||
|
||||
for k, v in ipairs(self.vparticles) do
|
||||
v.position = v.position + v.velocity * FrameTime()
|
||||
v.velocity = v.velocity + self.grav * FrameTime()
|
||||
|
||||
if CurTime() > v.startlife + v.lifetime then
|
||||
--print("Curtime:"..CurTime())
|
||||
--print("Lifetime:"..v.lifetime)
|
||||
--print("CTime:"..v.startlife)
|
||||
table.remove(self.vparticles, k)
|
||||
end
|
||||
end
|
||||
|
||||
if #self.vparticles <= 0 then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local cv_gr = GetConVar("sv_gravity")
|
||||
|
||||
function EFFECT:Init(ef)
|
||||
self.lifetime = 1
|
||||
self.stepcount = 0
|
||||
self.partinterval = 3
|
||||
self.emittime = CurTime() + 3
|
||||
self.targent = ef:GetEntity()
|
||||
self.targatt = ef:GetAttachment()
|
||||
self.startpos = ef:GetOrigin()
|
||||
self.startnormal = ef:GetNormal()
|
||||
self.radius = ef:GetRadius()
|
||||
self.grav = Vector(0, 0, cv_gr:GetFloat() * 0.2)
|
||||
self.randfac = 1
|
||||
|
||||
if not self.startpos then
|
||||
self.startpos = vector_origin
|
||||
|
||||
if LocalPlayer():IsValid() then
|
||||
self.startpos = LocalPlayer():GetShootPos()
|
||||
end
|
||||
end
|
||||
|
||||
if not self.startnormal then
|
||||
self.startnormal = vector_origin
|
||||
end
|
||||
|
||||
if not self.radius or self.radius == 0 then
|
||||
self.radius = 1
|
||||
end
|
||||
|
||||
self.vparticles = {}
|
||||
self:AddPart()
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if self.vparticles and #self.vparticles <= 0 then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function EFFECT:DrawBeam()
|
||||
render.StartBeam(#self.vparticles)
|
||||
|
||||
for k, v in ipairs(self.vparticles) do
|
||||
local alphac = ColorAlpha(smokecol, (1 - (CurTime() - v.startlife) / v.lifetime) * 64)
|
||||
render.AddBeam(v.position, v.radius * (1 - k / #self.vparticles), k / #self.vparticles, alphac)
|
||||
end
|
||||
|
||||
render.EndBeam()
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
self:ProcessFakeParticles()
|
||||
|
||||
if self.vparticles and #self.vparticles >= 2 then
|
||||
render.SetMaterial(smokemat)
|
||||
self:DrawBeam()
|
||||
end
|
||||
end
|
||||
41
addons/tfa-base/lua/effects/tfa_muzzleflash_cryo/init.lua
Normal file
41
addons/tfa-base/lua/effects/tfa_muzzleflash_cryo/init.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.1
|
||||
EFFECT.XFlashSize = 1
|
||||
EFFECT.FlashSize = 1
|
||||
EFFECT.SmokeSize = 0
|
||||
EFFECT.SparkSize = 1.5
|
||||
EFFECT.HeatSize = 1.5
|
||||
EFFECT.Color = Color(162,192,255)
|
||||
EFFECT.ColorSprites = true
|
||||
41
addons/tfa-base/lua/effects/tfa_muzzleflash_energy/init.lua
Normal file
41
addons/tfa-base/lua/effects/tfa_muzzleflash_energy/init.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.15
|
||||
EFFECT.XFlashSize = 1
|
||||
EFFECT.FlashSize = 1
|
||||
EFFECT.SmokeSize = 0
|
||||
EFFECT.SparkSize = 1.25
|
||||
EFFECT.HeatSize = 1
|
||||
EFFECT.Color = Color(128,192,255)
|
||||
EFFECT.ColorSprites = true
|
||||
133
addons/tfa-base/lua/effects/tfa_muzzleflash_gauss/init.lua
Normal file
133
addons/tfa-base/lua/effects/tfa_muzzleflash_gauss/init.lua
Normal file
@@ -0,0 +1,133 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local blankvec = Vector(0, 0, 0)
|
||||
|
||||
local vector_origin = Vector()
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.Position = blankvec
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
self.WeaponEntOG = self.WeaponEnt
|
||||
self.Attachment = data:GetAttachment()
|
||||
self.Dir = data:GetNormal()
|
||||
local owent
|
||||
|
||||
if IsValid(self.WeaponEnt) then
|
||||
owent = self.WeaponEnt:GetOwner()
|
||||
end
|
||||
|
||||
if not IsValid(owent) then
|
||||
owent = self.WeaponEnt:GetParent()
|
||||
end
|
||||
|
||||
if IsValid(owent) and owent:IsPlayer() then
|
||||
if owent ~= LocalPlayer() or owent:ShouldDrawLocalPlayer() then
|
||||
self.WeaponEnt = owent:GetActiveWeapon()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
else
|
||||
self.WeaponEnt = owent:GetViewModel()
|
||||
local theirweapon = owent:GetActiveWeapon()
|
||||
|
||||
if IsValid(theirweapon) and theirweapon.ViewModelFlip or theirweapon.ViewModelFlipped then
|
||||
self.Flipped = true
|
||||
end
|
||||
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(self.WeaponEntOG) and self.WeaponEntOG.MuzzleAttachment then
|
||||
self.Attachment = self.WeaponEnt:LookupAttachment(self.WeaponEntOG.MuzzleAttachment)
|
||||
|
||||
if not self.Attachment or self.Attachment <= 0 then
|
||||
self.Attachment = 1
|
||||
end
|
||||
|
||||
if self.WeaponEntOG:GetStatL("IsAkimbo") then
|
||||
self.Attachment = 2 - self.WeaponEntOG:GetAnimCycle()
|
||||
end
|
||||
end
|
||||
|
||||
local angpos = self.WeaponEnt:GetAttachment(self.Attachment)
|
||||
|
||||
if not angpos or not angpos.Pos then
|
||||
angpos = {
|
||||
Pos = vector_origin,
|
||||
Ang = angle_zero
|
||||
}
|
||||
end
|
||||
|
||||
if self.Flipped then
|
||||
local tmpang = (self.Dir or angpos.Ang:Forward()):Angle()
|
||||
local localang = self.WeaponEnt:WorldToLocalAngles(tmpang)
|
||||
localang.y = localang.y + 180
|
||||
localang = self.WeaponEnt:LocalToWorldAngles(localang)
|
||||
--localang:RotateAroundAxis(localang:Up(),180)
|
||||
--tmpang:RotateAroundAxis(tmpang:Up(),180)
|
||||
self.Dir = localang:Forward()
|
||||
end
|
||||
|
||||
-- Keep the start and end Pos - we're going to interpolate between them
|
||||
self.Position = self:GetTracerShootPos(angpos.Pos, self.WeaponEnt, self.Attachment)
|
||||
self.Norm = self.Dir
|
||||
self.vOffset = self.Position
|
||||
local dir = self.Norm
|
||||
local dlight
|
||||
|
||||
if IsValid(self.WeaponEnt) then
|
||||
dlight = DynamicLight(self.WeaponEnt:EntIndex())
|
||||
else
|
||||
dlight = DynamicLight(0)
|
||||
end
|
||||
|
||||
local fadeouttime = 0.2
|
||||
|
||||
if (dlight) then
|
||||
dlight.Pos = self.Position + dir * 1 - dir:Angle():Right() * 5
|
||||
dlight.r = 25
|
||||
dlight.g = 200
|
||||
dlight.b = 255
|
||||
dlight.Brightness = 4.0
|
||||
dlight.size = 96
|
||||
dlight.decay = 1000
|
||||
dlight.DieTime = CurTime() + fadeouttime
|
||||
end
|
||||
|
||||
ParticleEffectAttach("tfa_muzzle_gauss", PATTACH_POINT_FOLLOW, self.WeaponEnt, data:GetAttachment())
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
41
addons/tfa-base/lua/effects/tfa_muzzleflash_generic/init.lua
Normal file
41
addons/tfa-base/lua/effects/tfa_muzzleflash_generic/init.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.075
|
||||
EFFECT.XFlashSize = 0.5
|
||||
EFFECT.FlashSize = 0.8
|
||||
EFFECT.SmokeSize = 1
|
||||
EFFECT.SparkSize = 1
|
||||
EFFECT.HeatSize = 1
|
||||
EFFECT.Color = Color(255, 225, 128)
|
||||
EFFECT.ColorSprites = false
|
||||
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.125
|
||||
EFFECT.XFlashSize = 0
|
||||
EFFECT.FlashSize = 1
|
||||
EFFECT.SmokeSize = 2
|
||||
EFFECT.SparkSize = 2
|
||||
EFFECT.HeatSize = 2
|
||||
EFFECT.Color = Color(255, 128, 64)
|
||||
EFFECT.ColorSprites = false
|
||||
41
addons/tfa-base/lua/effects/tfa_muzzleflash_pistol/init.lua
Normal file
41
addons/tfa-base/lua/effects/tfa_muzzleflash_pistol/init.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.07
|
||||
EFFECT.XFlashSize = 0.5
|
||||
EFFECT.FlashSize = 0.8
|
||||
EFFECT.SmokeSize = 1
|
||||
EFFECT.SparkSize = 1
|
||||
EFFECT.HeatSize = 1
|
||||
EFFECT.Color = Color(255, 225, 128)
|
||||
EFFECT.ColorSprites = false
|
||||
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.1
|
||||
EFFECT.XFlashSize = 0
|
||||
EFFECT.FlashSize = 1
|
||||
EFFECT.SmokeSize = 2
|
||||
EFFECT.SparkSize = 1
|
||||
EFFECT.HeatSize = 1.25
|
||||
EFFECT.Color = Color(255, 225, 128)
|
||||
EFFECT.ColorSprites = false
|
||||
41
addons/tfa-base/lua/effects/tfa_muzzleflash_rifle/init.lua
Normal file
41
addons/tfa-base/lua/effects/tfa_muzzleflash_rifle/init.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.1
|
||||
EFFECT.XFlashSize = 1
|
||||
EFFECT.FlashSize = 1
|
||||
EFFECT.SmokeSize = 1
|
||||
EFFECT.SparkSize = 1
|
||||
EFFECT.HeatSize = 1
|
||||
EFFECT.Color = Color(255, 192, 64)
|
||||
EFFECT.ColorSprites = false
|
||||
41
addons/tfa-base/lua/effects/tfa_muzzleflash_shotgun/init.lua
Normal file
41
addons/tfa-base/lua/effects/tfa_muzzleflash_shotgun/init.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.125
|
||||
EFFECT.XFlashSize = 0
|
||||
EFFECT.FlashSize = 1.3
|
||||
EFFECT.SmokeSize = 2
|
||||
EFFECT.SparkSize = 1.5
|
||||
EFFECT.HeatSize = 2
|
||||
EFFECT.Color = Color(255, 225, 128)
|
||||
EFFECT.ColorSprites = false
|
||||
@@ -0,0 +1,42 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.1
|
||||
EFFECT.XFlashSize = 0
|
||||
EFFECT.FlashSize = 0.1
|
||||
EFFECT.SmokeSize = 2
|
||||
EFFECT.SparkSize = 1
|
||||
EFFECT.HeatSize = 1
|
||||
EFFECT.Color = Color(255, 225, 128)
|
||||
EFFECT.ColorSprites = false
|
||||
|
||||
41
addons/tfa-base/lua/effects/tfa_muzzleflash_smg/init.lua
Normal file
41
addons/tfa-base/lua/effects/tfa_muzzleflash_smg/init.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.075
|
||||
EFFECT.XFlashSize = 1
|
||||
EFFECT.FlashSize = 1
|
||||
EFFECT.SmokeSize = 1
|
||||
EFFECT.SparkSize = 1
|
||||
EFFECT.HeatSize = 1
|
||||
EFFECT.Color = Color(255, 225, 128)
|
||||
EFFECT.ColorSprites = false
|
||||
41
addons/tfa-base/lua/effects/tfa_muzzleflash_sniper/init.lua
Normal file
41
addons/tfa-base/lua/effects/tfa_muzzleflash_sniper/init.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.125
|
||||
EFFECT.XFlashSize = 1.5
|
||||
EFFECT.FlashSize = 1.2
|
||||
EFFECT.SmokeSize = 2
|
||||
EFFECT.SparkSize = 1.3
|
||||
EFFECT.HeatSize = 2
|
||||
EFFECT.Color = Color(255, 225, 128)
|
||||
EFFECT.ColorSprites = false
|
||||
@@ -0,0 +1,41 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
include("tfa/muzzleflash_base.lua")
|
||||
|
||||
EFFECT.Life = 0.125
|
||||
EFFECT.XFlashSize = 2
|
||||
EFFECT.FlashSize = 2
|
||||
EFFECT.SmokeSize = 0
|
||||
EFFECT.SparkSize = 1.45
|
||||
EFFECT.HeatSize = 2
|
||||
EFFECT.Color = Color(128,192,255)
|
||||
EFFECT.ColorSprites = true
|
||||
105
addons/tfa-base/lua/effects/tfa_muzzlesmoke/init.lua
Normal file
105
addons/tfa-base/lua/effects/tfa_muzzlesmoke/init.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local ang
|
||||
local limit_particle_cv = GetConVar("cl_tfa_fx_muzzlesmoke_limited")
|
||||
local SMOKEDELAY = 1.5
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
self.WeaponEntOG = self.WeaponEnt
|
||||
if limit_particle_cv:GetBool() and self.WeaponEnt:GetOwner() ~= LocalPlayer() then return end
|
||||
self.Attachment = data:GetAttachment()
|
||||
local smokepart = "smoke_trail_tfa"
|
||||
local delay = self.WeaponEnt.GetStatL and self.WeaponEnt:GetStatL("SmokeDelay") or self.WeaponEnt.SmokeDelay
|
||||
|
||||
if self.WeaponEnt.SmokeParticle then
|
||||
smokepart = self.WeaponEnt.SmokeParticle
|
||||
elseif self.WeaponEnt.SmokeParticles then
|
||||
smokepart = self.WeaponEnt.SmokeParticles[self.WeaponEnt.DefaultHoldType or self.WeaponEnt.HoldType] or smokepart
|
||||
end
|
||||
|
||||
self.Position = self:GetTracerShootPos(data:GetOrigin(), self.WeaponEnt, self.Attachment)
|
||||
|
||||
if IsValid(self.WeaponEnt:GetOwner()) then
|
||||
if self.WeaponEnt:GetOwner() == LocalPlayer() then
|
||||
if not self.WeaponEnt:IsFirstPerson() then
|
||||
ang = self.WeaponEnt:GetOwner():EyeAngles()
|
||||
ang:Normalize()
|
||||
--ang.p = math.max(math.min(ang.p,55),-55)
|
||||
self.Forward = ang:Forward()
|
||||
else
|
||||
self.WeaponEnt = self.WeaponEnt:GetOwner():GetViewModel()
|
||||
end
|
||||
--ang.p = math.max(math.min(ang.p,55),-55)
|
||||
else
|
||||
ang = self.WeaponEnt:GetOwner():EyeAngles()
|
||||
ang:Normalize()
|
||||
self.Forward = ang:Forward()
|
||||
end
|
||||
end
|
||||
|
||||
if TFA.GetMZSmokeEnabled == nil or TFA.GetMZSmokeEnabled() then
|
||||
local e = self.WeaponEnt
|
||||
local w = self.WeaponEntOG
|
||||
local a = self.Attachment
|
||||
local tn = "tfasmokedelay_" .. w:EntIndex() .. "_" .. a
|
||||
local sp = smokepart
|
||||
|
||||
if timer.Exists(tn) then
|
||||
timer.Remove(tn)
|
||||
end
|
||||
|
||||
e.SmokePCF = e.SmokePCF or {}
|
||||
local _a = w:GetStatL("IsAkimbo") and a or 1
|
||||
|
||||
if IsValid(e.SmokePCF[_a]) then
|
||||
e.SmokePCF[_a]:StopEmission()
|
||||
end
|
||||
|
||||
timer.Create(tn, delay or SMOKEDELAY, 1, function()
|
||||
if not IsValid(e) then return end
|
||||
e.SmokePCF[_a] = CreateParticleSystem(e, sp, PATTACH_POINT_FOLLOW, a)
|
||||
|
||||
if IsValid(e.SmokePCF[_a]) then
|
||||
e.SmokePCF[_a]:StartEmission()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
163
addons/tfa-base/lua/effects/tfa_penetrate/init.lua
Normal file
163
addons/tfa-base/lua/effects/tfa_penetrate/init.lua
Normal file
@@ -0,0 +1,163 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local PenetColor = Color(255, 255, 255, 255)
|
||||
local PenetMat = Material("trails/smoke")
|
||||
local PenetMat2 = Material("effects/yellowflare")
|
||||
local cv_gv = GetConVar("sv_gravity")
|
||||
local cv_sl = GetConVar("cl_tfa_fx_impact_ricochet_sparklife")
|
||||
|
||||
--local cv_sc = GetConVar("cl_tfa_fx_impact_ricochet_sparks")
|
||||
local DFX = {
|
||||
["AR2Tracer"] = true,
|
||||
["Tracer"] = true,
|
||||
["GunshipTracer"] = true,
|
||||
["GaussTracer"] = true,
|
||||
["AirboatGunTracer"] = true,
|
||||
["AirboatGunHeavyTracer"] = true
|
||||
}
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.StartPos = data:GetOrigin()
|
||||
self.Dir = data:GetNormal()
|
||||
self.Dir:Normalize()
|
||||
self.Len = 32
|
||||
self.EndPos = self.StartPos + self.Dir * self.Len
|
||||
self.LifeTime = 0.75
|
||||
self.DieTime = CurTime() + self.LifeTime
|
||||
self.Thickness = 1
|
||||
self.Grav = Vector(0, 0, -cv_gv:GetFloat())
|
||||
self.PartMult = data:GetRadius()
|
||||
self.SparkLife = cv_sl:GetFloat()
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
|
||||
if self.WeaponEnt.TracerPCF then
|
||||
local traceres = util.QuickTrace(self.StartPos, self.Dir * 9999999, Entity(math.Round(data:GetScale())))
|
||||
self.EndPos = traceres.HitPos or self.StartPos
|
||||
local efn = self.WeaponEnt.TracerName
|
||||
local spos = self.StartPos
|
||||
local cnt = math.min(math.Round(data:GetMagnitude()), 6000)
|
||||
|
||||
timer.Simple(cnt / 1000000, function()
|
||||
TFA.ParticleTracer(efn, spos, traceres.HitPos or spos, false)
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local tn = self.WeaponEnt.BulletTracerName
|
||||
|
||||
if tn and tn ~= "" and not DFX[tn] then
|
||||
local fx = EffectData()
|
||||
fx:SetStart(self.StartPos)
|
||||
local traceres = util.QuickTrace(self.StartPos, self.Dir * 9999999, Entity(math.Round(data:GetScale())))
|
||||
self.EndPos = traceres.HitPos or self.StartPos
|
||||
fx:SetOrigin(self.EndPos)
|
||||
fx:SetEntity(self.WeaponEnt)
|
||||
fx:SetMagnitude(1)
|
||||
util.Effect(tn, fx)
|
||||
SafeRemoveEntityDelayed(self, 0)
|
||||
--Sparks
|
||||
--Impact
|
||||
|
||||
return
|
||||
else
|
||||
local emitter = ParticleEmitter(self.StartPos)
|
||||
--[[
|
||||
for i = 1, cv_sc:GetFloat() * self.PartMult * 0.1 do
|
||||
local part = emitter:Add("effects/yellowflare", self.StartPos)
|
||||
part:SetVelocity((self.Dir + VectorRand() * 0.5) * math.Rand(75, 185))
|
||||
part:SetDieTime(math.Rand(0.25, 1) * self.SparkLife)
|
||||
part:SetStartAlpha(255)
|
||||
part:SetStartSize(math.Rand(2, 4))
|
||||
part:SetEndSize(0)
|
||||
part:SetRoll(0)
|
||||
part:SetGravity(self.Grav)
|
||||
part:SetCollide(true)
|
||||
part:SetBounce(0.55)
|
||||
part:SetAirResistance(0.5)
|
||||
part:SetStartLength(0.2)
|
||||
part:SetEndLength(0)
|
||||
part:SetVelocityScale(true)
|
||||
part:SetCollide(true)
|
||||
end
|
||||
]]
|
||||
--
|
||||
local part = emitter:Add("effects/select_ring", self.StartPos)
|
||||
part:SetStartAlpha(225)
|
||||
part:SetStartSize(1)
|
||||
part:SetDieTime(self.LifeTime / 5)
|
||||
part:SetEndSize(0)
|
||||
part:SetEndAlpha(0)
|
||||
part:SetRoll(math.Rand(0, 360))
|
||||
part:SetColor(200, 200, 200)
|
||||
part = emitter:Add("effects/select_ring", self.StartPos)
|
||||
part:SetStartAlpha(255)
|
||||
part:SetStartSize(1.5 * self.PartMult)
|
||||
part:SetDieTime(self.LifeTime / 6)
|
||||
part:SetEndSize(0)
|
||||
part:SetEndAlpha(0)
|
||||
part:SetRoll(math.Rand(0, 360))
|
||||
part:SetColor(200, 200, 200)
|
||||
emitter:Finish()
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if self.DieTime and (CurTime() > self.DieTime) then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
if self.DieTime then
|
||||
local fDelta = (self.DieTime - CurTime()) / self.LifeTime
|
||||
fDelta = math.Clamp(fDelta, 0, 1)
|
||||
render.SetMaterial(PenetMat)
|
||||
local color = ColorAlpha(PenetColor, 32 * fDelta)
|
||||
local precision = 16
|
||||
local i = 1
|
||||
|
||||
while i <= precision do
|
||||
render.DrawBeam(self.StartPos + self.Dir * self.Len * ((i - 1) / precision), self.StartPos + self.Dir * self.Len * (i / precision), self.Thickness * fDelta * (1 - i / precision), 0.5, 0.5, color)
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
render.SetMaterial(PenetMat2)
|
||||
i = 1
|
||||
|
||||
while i <= precision do
|
||||
render.DrawBeam(self.StartPos + self.Dir * self.Len * ((i - 1) / precision), self.StartPos + self.Dir * self.Len * (i / precision), self.Thickness / 3 * 2 * fDelta * (1 - i / precision), 0.5, 0.5, color)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
121
addons/tfa-base/lua/effects/tfa_ricochet/init.lua
Normal file
121
addons/tfa-base/lua/effects/tfa_ricochet/init.lua
Normal file
@@ -0,0 +1,121 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local RicochetColor = Color(255, 255, 255, 255)
|
||||
local RicochetIDOffset = 33
|
||||
local RicochetMat = Material("effects/yellowflare")
|
||||
local cv_gv = GetConVar("sv_gravity")
|
||||
local cv_sl = GetConVar("cl_tfa_fx_impact_ricochet_sparklife")
|
||||
local cv_sc = GetConVar("cl_tfa_fx_impact_ricochet_sparks")
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.StartPos = data:GetOrigin()
|
||||
self.Dir = data:GetNormal()
|
||||
self.Dir:Normalize()
|
||||
self.Len = 128
|
||||
self.EndPos = self.StartPos + self.Dir * self.Len
|
||||
self.LifeTime = 0.1
|
||||
self.DieTime = CurTime() + self.LifeTime
|
||||
self.Grav = Vector(0, 0, -cv_gv:GetFloat())
|
||||
self.PartMult = data:GetMagnitude()
|
||||
self.SparkLife = cv_sl:GetFloat()
|
||||
local emitter = ParticleEmitter(self.StartPos)
|
||||
|
||||
--Sparks
|
||||
for _ = 1, cv_sc:GetInt() * self.PartMult do
|
||||
local part = emitter:Add("effects/yellowflare", self.StartPos)
|
||||
part:SetVelocity((self.Dir + VectorRand() * 0.5) * math.Rand(75, 185))
|
||||
part:SetDieTime(math.Rand(0.25, 1) * self.SparkLife)
|
||||
part:SetStartAlpha(255)
|
||||
part:SetStartSize(math.Rand(2, 4))
|
||||
part:SetEndSize(0)
|
||||
part:SetRoll(0)
|
||||
part:SetGravity(self.Grav)
|
||||
part:SetCollide(true)
|
||||
part:SetBounce(0.55)
|
||||
part:SetAirResistance(0.5)
|
||||
part:SetStartLength(0.2)
|
||||
part:SetEndLength(0)
|
||||
part:SetVelocityScale(true)
|
||||
part:SetCollide(true)
|
||||
end
|
||||
|
||||
--Impact
|
||||
local part = emitter:Add("effects/yellowflare", self.StartPos)
|
||||
part:SetStartAlpha(225)
|
||||
part:SetStartSize(64)
|
||||
part:SetDieTime(self.LifeTime)
|
||||
part:SetEndSize(0)
|
||||
part:SetEndAlpha(0)
|
||||
part:SetRoll(math.Rand(0, 360))
|
||||
part = emitter:Add("effects/yellowflare", self.StartPos)
|
||||
part:SetStartAlpha(255)
|
||||
part:SetStartSize(30 * self.PartMult)
|
||||
part:SetDieTime(self.LifeTime * 1.5)
|
||||
part:SetEndSize(0)
|
||||
part:SetEndAlpha(0)
|
||||
part:SetRoll(math.Rand(0, 360))
|
||||
emitter:Finish()
|
||||
local dlight = DynamicLight(LocalPlayer():EntIndex() + RicochetIDOffset)
|
||||
|
||||
if (dlight) then
|
||||
dlight.Pos = self.StartPos
|
||||
dlight.r = 255
|
||||
dlight.g = 225
|
||||
dlight.b = 185
|
||||
dlight.Brightness = 2.75 * self.PartMult
|
||||
dlight.size = 48
|
||||
--dlight.DieTime = CurTime() + self.DieTime*0.7
|
||||
dlight.Decay = 1000 / math.max(0.01, math.min(self.SparkLife * 0.66, 1))
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if self.DieTime and (CurTime() > self.DieTime) then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
if self.DieTime then
|
||||
local fDelta = (self.DieTime - CurTime()) / self.LifeTime
|
||||
fDelta = math.Clamp(fDelta, 0, 1)
|
||||
render.SetMaterial(RicochetMat)
|
||||
local color = ColorAlpha(RicochetColor, 255 * fDelta)
|
||||
local precision = 16
|
||||
local i = 1
|
||||
|
||||
while i <= precision do
|
||||
render.DrawBeam(self.StartPos + self.Dir * self.Len * ((i - 1) / precision), self.StartPos + self.Dir * self.Len * (i / precision), 8 * fDelta * (1 - i / precision), 0.5, 0.5, color)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
261
addons/tfa-base/lua/effects/tfa_shell/init.lua
Normal file
261
addons/tfa-base/lua/effects/tfa_shell/init.lua
Normal file
@@ -0,0 +1,261 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
EFFECT.Velocity = {120, 160}
|
||||
EFFECT.VelocityRand = {-15, 40}
|
||||
EFFECT.VelocityAngle = Vector(1,1,10)
|
||||
EFFECT.VelocityRandAngle = Vector(10,10,5)
|
||||
|
||||
local modelReplaceLookup = {
|
||||
["models/hdweapons/rifleshell.mdl"] = "models/tfa/rifleshell.mdl",
|
||||
["models/hdweapons/rifleshell_hd.mdl"] = "models/tfa/rifleshell.mdl",
|
||||
["models/weapons/rifleshell_hd.mdl"] = "models/tfa/rifleshell.mdl",
|
||||
["models/hdweapons/shell.mdl"] = "models/tfa/pistolshell.mdl",
|
||||
["models/hdweapons/shell_hd.mdl"] = "models/tfa/pistolshell.mdl",
|
||||
["models/weapons/shell_hd.mdl"] = "models/tfa/pistolshell.mdl",
|
||||
["models/hdweapons/shotgun_shell.mdl"] = "models/tfa/shotgunshell.mdl",
|
||||
["models/hdweapons/shotgun_shell_hd.mdl"] = "models/tfa/shotgunshell.mdl",
|
||||
["models/weapons/shotgun_shell_hd.mdl"] = "models/tfa/shotgunshell.mdl",
|
||||
}
|
||||
|
||||
EFFECT.ShellPresets = {
|
||||
["sniper"] = {"models/tfa/rifleshell.mdl", math.pow(0.487 / 1.236636, 1 / 3), 90}, --1.236636 is shell diameter, then divide base diameter into that for 7.62x54mm
|
||||
["rifle"] = {"models/tfa/rifleshell.mdl", math.pow(0.4709 / 1.236636, 1 / 3), 90}, --1.236636 is shell diameter, then divide base diameter into that for standard nato rifle
|
||||
["pistol"] = {"models/tfa/pistolshell.mdl", math.pow(0.391 / 0.955581, 1 / 3), 90}, --0.955581 is shell diameter, then divide base diameter into that for 9mm luger
|
||||
["smg"] = {"models/tfa/pistolshell.mdl", math.pow(.476 / 0.955581, 1 / 3), 90}, --.45 acp
|
||||
["shotgun"] = {"models/tfa/shotgunshell.mdl", 1, 90}
|
||||
}
|
||||
|
||||
EFFECT.SoundFiles = {Sound(")player/pl_shell1.wav"), Sound(")player/pl_shell2.wav"), Sound(")player/pl_shell3.wav")}
|
||||
EFFECT.SoundFilesSG = {Sound(")weapons/fx/tink/shotgun_shell1.wav"), Sound(")weapons/fx/tink/shotgun_shell2.wav"), Sound(")weapons/fx/tink/shotgun_shell3.wav")}
|
||||
EFFECT.SoundLevel = {45, 55}
|
||||
EFFECT.SoundPitch = {80, 120}
|
||||
EFFECT.SoundVolume = {0.85, 0.95}
|
||||
EFFECT.LifeTime = 15
|
||||
EFFECT.FadeTime = 0.5
|
||||
EFFECT.SmokeTime = {3, 3}
|
||||
EFFECT.SmokeParticle = "tfa_ins2_weapon_shell_smoke"
|
||||
local cv_eject
|
||||
local cv_life
|
||||
local upVec = Vector(0,0,1)
|
||||
|
||||
function EFFECT:ComputeSmokeLighting()
|
||||
if not self.PCFSmoke then return end
|
||||
local licht = render.ComputeLighting(self:GetPos() + upVec * 2, upVec)
|
||||
local lichtFloat = math.Clamp((licht.r + licht.g + licht.b) / 3, 0, TFA.Particles.SmokeLightingClamp) / TFA.Particles.SmokeLightingClamp
|
||||
local lichtFinal = LerpVector(lichtFloat, TFA.Particles.SmokeLightingMin, TFA.Particles.SmokeLightingMax)
|
||||
self.PCFSmoke:SetControlPoint(1, lichtFinal)
|
||||
end
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.IsTFAShell = true
|
||||
|
||||
if not cv_eject then
|
||||
cv_eject = GetConVar("cl_tfa_fx_ejectionsmoke")
|
||||
end
|
||||
|
||||
if not cv_life then
|
||||
cv_life = GetConVar("cl_tfa_fx_ejectionlife")
|
||||
end
|
||||
|
||||
if cv_life then
|
||||
self.LifeTime = cv_life:GetFloat()
|
||||
end
|
||||
|
||||
self.StartTime = CurTime()
|
||||
self.Emitter = ParticleEmitter(self:GetPos())
|
||||
self.SmokeDelta = 0
|
||||
|
||||
if cv_eject:GetBool() then
|
||||
self.SmokeDeath = self.StartTime + math.Rand(self.SmokeTime[1], self.SmokeTime[2])
|
||||
else
|
||||
self.SmokeDeath = -1
|
||||
end
|
||||
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
self.WeaponEntOG = self.WeaponEnt
|
||||
if self.WeaponEntOG.LuaShellEffect and self.WeaponEntOG.LuaShellEffect == "" then return end
|
||||
self.Attachment = data:GetAttachment()
|
||||
self.Dir = data:GetNormal()
|
||||
self.DirAng = data:GetNormal():Angle()
|
||||
self.OriginalOrigin = data:GetOrigin()
|
||||
local owent = self.WeaponEnt:GetOwner()
|
||||
|
||||
if self.LifeTime <= 0 or not IsValid(owent) then
|
||||
self.StartTime = -1000
|
||||
self.SmokeDeath = -1000
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if owent:IsPlayer() and owent == GetViewEntity() and not owent:ShouldDrawLocalPlayer() then
|
||||
self.WeaponEnt = owent:GetViewModel()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
end
|
||||
|
||||
local model, scale, yaw = self:FindModel(self.WeaponEntOG)
|
||||
model = self.WeaponEntOG:GetStatL("ShellModel") or self.WeaponEntOG:GetStatL("LuaShellModel") or model
|
||||
model = modelReplaceLookup[model] or model
|
||||
scale = self.WeaponEntOG:GetStatL("ShellScale") or self.WeaponEntOG:GetStatL("LuaShellScale") or scale
|
||||
yaw = self.WeaponEntOG:GetStatL("ShellYaw") or self.WeaponEntOG:GetStatL("LuaShellYaw") or yaw
|
||||
|
||||
if model:lower():find("shotgun") then
|
||||
self.Shotgun = true
|
||||
end
|
||||
|
||||
self:SetModel(model)
|
||||
self:SetModelScale(scale, 0)
|
||||
self:SetPos(data:GetOrigin())
|
||||
local mdlang = self.DirAng * 1
|
||||
mdlang:RotateAroundAxis(mdlang:Up(), yaw)
|
||||
local owang = IsValid(owent) and owent:EyeAngles() or mdlang
|
||||
self:SetAngles(owang)
|
||||
self:SetRenderMode(RENDERMODE_TRANSALPHA)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
|
||||
self:SetCollisionBounds(self:OBBMins(), self:OBBMaxs())
|
||||
self:PhysicsInitBox(self:OBBMins(), self:OBBMaxs())
|
||||
local velocity = self.Dir * math.Rand(self.Velocity[1], self.Velocity[2]) + owang:Forward() * math.Rand(self.VelocityRand[1], self.VelocityRand[2])
|
||||
|
||||
if IsValid(owent) then
|
||||
velocity = velocity + owent:GetVelocity()
|
||||
end
|
||||
|
||||
local physObj = self:GetPhysicsObject()
|
||||
|
||||
if physObj:IsValid() then
|
||||
physObj:SetDamping(0.1, 1)
|
||||
physObj:SetMass(5)
|
||||
physObj:SetMaterial("gmod_silent")
|
||||
physObj:SetVelocity(velocity)
|
||||
local localVel = velocity:Length() * self.WeaponEnt:WorldToLocalAngles(velocity:Angle()):Forward()
|
||||
physObj:AddAngleVelocity(localVel.y * self.VelocityAngle)
|
||||
physObj:AddAngleVelocity(VectorRand() * velocity:Length() * self.VelocityRandAngle * 0.5)
|
||||
end
|
||||
|
||||
local ss = self.WeaponEntOG:GetStatL("ShellSound") or self.WeaponEntOG:GetStatL("LuaShellSound")
|
||||
|
||||
if ss then
|
||||
self.ImpactSound = ss
|
||||
else
|
||||
self.ImpactSound = self.Shotgun and self.SoundFilesSG[math.random(1, #self.SoundFiles)] or self.SoundFiles[math.random(1, #self.SoundFiles)]
|
||||
end
|
||||
|
||||
self.setup = true
|
||||
end
|
||||
|
||||
function EFFECT:FindModel(wep)
|
||||
if not IsValid(wep) then return unpack(self.ShellPresets["rifle"]) end
|
||||
local ammotype = (wep.Primary.Ammo or wep:GetPrimaryAmmoType()):lower()
|
||||
local guntype = (wep.Type or wep:GetHoldType()):lower()
|
||||
|
||||
if guntype:find("sniper") or ammotype:find("sniper") or guntype:find("dmr") then
|
||||
return unpack(self.ShellPresets["sniper"])
|
||||
elseif guntype:find("rifle") or ammotype:find("rifle") then
|
||||
return unpack(self.ShellPresets["rifle"])
|
||||
elseif ammotype:find("pist") or guntype:find("pist") then
|
||||
return unpack(self.ShellPresets["pistol"])
|
||||
elseif ammotype:find("smg") or guntype:find("smg") then
|
||||
return unpack(self.ShellPresets["smg"])
|
||||
elseif ammotype:find("buckshot") or ammotype:find("shotgun") or guntype:find("shot") then
|
||||
return unpack(self.ShellPresets["shotgun"])
|
||||
end
|
||||
|
||||
return unpack(self.ShellPresets["rifle"])
|
||||
end
|
||||
|
||||
function EFFECT:BounceSound()
|
||||
sound.Play(self.ImpactSound, self:GetPos(), math.Rand(self.SoundLevel[1], self.SoundLevel[2]), math.Rand(self.SoundPitch[1], self.SoundPitch[2]), math.Rand(self.SoundVolume[1], self.SoundVolume[2]))
|
||||
end
|
||||
|
||||
function EFFECT:PhysicsCollide(data)
|
||||
if self:WaterLevel() > 0 then return end
|
||||
|
||||
if TFA.GetEJSmokeEnabled() and not self.PCFSmoke and CurTime() < self.SmokeDeath then
|
||||
self.PCFSmoke = CreateParticleSystem(self, self.SmokeParticle, PATTACH_POINT_FOLLOW, 1)
|
||||
if IsValid(self.PCFSmoke) then
|
||||
self:ComputeSmokeLighting()
|
||||
self.PCFSmoke:StartEmission()
|
||||
else
|
||||
self.PCFSmoke = nil
|
||||
end
|
||||
end
|
||||
|
||||
if data.Speed > 60 then
|
||||
self:BounceSound()
|
||||
local impulse = (data.OurOldVelocity - 2 * data.OurOldVelocity:Dot(data.HitNormal) * data.HitNormal) * 0.33
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:ApplyForceCenter(impulse)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if CurTime() > self.SmokeDeath and self.PCFSmoke then
|
||||
self.PCFSmoke:StopEmission()
|
||||
self.PCFSmoke = nil
|
||||
else
|
||||
self:ComputeSmokeLighting()
|
||||
end
|
||||
|
||||
if self:WaterLevel() > 0 and not self.WaterSplashed then
|
||||
self.WaterSplashed = true
|
||||
local ef = EffectData()
|
||||
ef:SetOrigin(self:GetPos())
|
||||
ef:SetScale(1)
|
||||
util.Effect("watersplash", ef)
|
||||
end
|
||||
|
||||
if CurTime() > self.StartTime + self.LifeTime then
|
||||
if self.Emitter then
|
||||
self.Emitter:Finish()
|
||||
end
|
||||
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
if not self.setup then return end
|
||||
self:SetColor(ColorAlpha(color_white, (1 - math.Clamp(CurTime() - (self.StartTime + self.LifeTime - self.FadeTime), 0, self.FadeTime) / self.FadeTime) * 255))
|
||||
self:SetupBones()
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
hook.Add("EntityEmitSound", "TFA_BlockShellScrapeSound", function(sndData)
|
||||
if IsValid(sndData.Entity) and sndData.Entity.IsTFAShell and sndData.SoundName:find("scrape") then
|
||||
return false
|
||||
end
|
||||
end)
|
||||
121
addons/tfa-base/lua/effects/tfa_shell_legacy/init.lua
Normal file
121
addons/tfa-base/lua/effects/tfa_shell_legacy/init.lua
Normal file
@@ -0,0 +1,121 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local vector_origin = Vector()
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
self.WeaponEntOG = self.WeaponEnt
|
||||
self.Attachment = data:GetAttachment()
|
||||
self.Dir = data:GetNormal()
|
||||
local owent = self.WeaponEnt:GetOwner()
|
||||
|
||||
if not IsValid(owent) then
|
||||
owent = self.WeaponEnt:GetParent()
|
||||
end
|
||||
|
||||
if IsValid(owent) and owent:IsPlayer() then
|
||||
if owent ~= LocalPlayer() or owent:ShouldDrawLocalPlayer() then
|
||||
self.WeaponEnt = owent:GetActiveWeapon()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
else
|
||||
self.WeaponEnt = owent:GetViewModel()
|
||||
local theirweapon = owent:GetActiveWeapon()
|
||||
|
||||
if IsValid(theirweapon) and theirweapon.ViewModelFlip or theirweapon.ViewModelFlipped then
|
||||
self.Flipped = true
|
||||
end
|
||||
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(self.WeaponEntOG) and self.WeaponEntOG.ShellAttachment then
|
||||
self.Attachment = self.WeaponEnt:LookupAttachment(self.WeaponEntOG.ShellAttachment)
|
||||
|
||||
if not self.Attachment or self.Attachment <= 0 then
|
||||
self.Attachment = 2
|
||||
end
|
||||
|
||||
if self.WeaponEntOG:GetStatL("IsAkimbo") then
|
||||
self.Attachment = 4 - self.WeaponEntOG:GetAnimCycle()
|
||||
end
|
||||
|
||||
if self.WeaponEntOG.ShellAttachmentRaw then
|
||||
self.Attachment = self.WeaponEntOG.ShellAttachmentRaw
|
||||
end
|
||||
end
|
||||
|
||||
local angpos = self.WeaponEnt:GetAttachment(self.Attachment)
|
||||
|
||||
if not angpos or not angpos.Pos then
|
||||
angpos = {
|
||||
Pos = vector_origin,
|
||||
Ang = angle_zero
|
||||
}
|
||||
end
|
||||
|
||||
if self.Flipped then
|
||||
local tmpang = (self.Dir or angpos.Ang:Forward()):Angle()
|
||||
local localang = self.WeaponEnt:WorldToLocalAngles(tmpang)
|
||||
localang.y = localang.y + 180
|
||||
localang = self.WeaponEnt:LocalToWorldAngles(localang)
|
||||
--localang:RotateAroundAxis(localang:Up(),180)
|
||||
--tmpang:RotateAroundAxis(tmpang:Up(),180)
|
||||
self.Dir = localang:Forward()
|
||||
end
|
||||
|
||||
-- Keep the start and end Pos - we're going to interpolate between them
|
||||
self.Pos = self:GetTracerShootPos(angpos.Pos, self.WeaponEnt, self.Attachment)
|
||||
self.Norm = angpos.Ang:Forward() --angpos.Ang:Forward()
|
||||
--print(self.Norm)
|
||||
self.Magnitude = data:GetMagnitude()
|
||||
self.Scale = data:GetScale()
|
||||
local fx = EffectData()
|
||||
fx:SetOrigin(self.Pos)
|
||||
fx:SetStart(self.Pos)
|
||||
fx:SetEntity(self.WeaponEnt)
|
||||
fx:SetAttachment(self.Attachment)
|
||||
fx:SetNormal(self.Norm)
|
||||
fx:SetAngles(self.Norm:Angle())
|
||||
fx:SetScale(self.Scale)
|
||||
fx:SetMagnitude(self.Magnitude)
|
||||
local se = (self.WeaponEntOG.LuaShellEffect or self.WeaponEntOG.Blowback_Shell_Effect) or "ShellEject"
|
||||
util.Effect(se, fx)
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
120
addons/tfa-base/lua/effects/tfa_shelleject_smoke/init.lua
Normal file
120
addons/tfa-base/lua/effects/tfa_shelleject_smoke/init.lua
Normal file
@@ -0,0 +1,120 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local vector_origin = Vector()
|
||||
|
||||
EFFECT.SmokeParticle = "tfa_ins2_shell_eject"
|
||||
local upVec = Vector(0, 0, 1)
|
||||
|
||||
function EFFECT:ComputeSmokeLighting(part, pos)
|
||||
if not IsValid(part) then return end
|
||||
local licht = render.ComputeLighting(pos + upVec * 2, upVec)
|
||||
local lichtFloat = math.Clamp((licht.r + licht.g + licht.b) / 3, 0, TFA.Particles.SmokeLightingClamp) / TFA.Particles.SmokeLightingClamp
|
||||
local lichtFinal = LerpVector(lichtFloat, TFA.Particles.SmokeLightingMin, TFA.Particles.SmokeLightingMax)
|
||||
lichtFinal.x = math.sqrt(math.Clamp(lichtFinal.x-0.2,0,0.8)) / 0.8
|
||||
lichtFinal.y = math.sqrt(math.Clamp(lichtFinal.y-0.2,0,0.8)) / 0.8
|
||||
lichtFinal.z = math.sqrt(math.Clamp(lichtFinal.z-0.2,0,0.8)) / 0.8
|
||||
part:SetControlPoint(1, lichtFinal)
|
||||
end
|
||||
|
||||
function EFFECT:Init(data)
|
||||
if not TFA.GetEJSmokeEnabled() then return end
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
self.WeaponEntOG = self.WeaponEnt
|
||||
self.Attachment = data:GetAttachment()
|
||||
local owent = self.WeaponEnt:GetOwner()
|
||||
|
||||
if not IsValid(owent) then
|
||||
owent = self.WeaponEnt:GetParent()
|
||||
end
|
||||
|
||||
if IsValid(owent) and owent:IsPlayer() then
|
||||
if owent ~= LocalPlayer() or owent:ShouldDrawLocalPlayer() then
|
||||
self.WeaponEnt = owent:GetActiveWeapon()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
else
|
||||
self.WeaponEnt = owent:GetViewModel()
|
||||
local theirweapon = owent:GetActiveWeapon()
|
||||
|
||||
if IsValid(theirweapon) and theirweapon.ViewModelFlip or theirweapon.ViewModelFlipped then
|
||||
self.Flipped = true
|
||||
end
|
||||
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(self.WeaponEntOG) and self.WeaponEntOG.ShellAttachment then
|
||||
self.Attachment = self.WeaponEnt:LookupAttachment(self.WeaponEntOG.ShellAttachment)
|
||||
|
||||
if not self.Attachment or self.Attachment <= 0 then
|
||||
self.Attachment = 2
|
||||
end
|
||||
|
||||
if self.WeaponEntOG:GetStatL("IsAkimbo") then
|
||||
self.Attachment = 3 + self.WeaponEntOG:GetAnimCycle()
|
||||
end
|
||||
|
||||
if self.WeaponEntOG.ShellAttachmentRaw then
|
||||
self.Attachment = self.WeaponEntOG.ShellAttachmentRaw
|
||||
end
|
||||
end
|
||||
|
||||
local angpos = self.WeaponEnt:GetAttachment(self.Attachment)
|
||||
|
||||
if not angpos or not angpos.Pos then
|
||||
angpos = {
|
||||
Pos = vector_origin,
|
||||
Ang = angle_zero
|
||||
}
|
||||
end
|
||||
|
||||
local PCFSmoke = CreateParticleSystem(self.WeaponEnt, self.SmokeParticle, PATTACH_POINT_FOLLOW, self.Attachment)
|
||||
|
||||
if IsValid(PCFSmoke) then
|
||||
self:ComputeSmokeLighting(PCFSmoke, angpos.Pos)
|
||||
PCFSmoke:StartEmission()
|
||||
|
||||
timer.Simple(0.2, function()
|
||||
if IsValid(PCFSmoke) then
|
||||
PCFSmoke:StopEmission(false,true)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
return false
|
||||
end
|
||||
|
||||
function EFFECT:Render()
|
||||
end
|
||||
86
addons/tfa-base/lua/effects/tfa_tracer_cryo/init.lua
Normal file
86
addons/tfa-base/lua/effects/tfa_tracer_cryo/init.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
EFFECT.Mat = Material("effects/laser_tracer")
|
||||
EFFECT.Col1 = Color(255, 255, 255, 255) --Color(225,225,225,225)
|
||||
EFFECT.Col2 = Color(65, 128, 255, 200)
|
||||
EFFECT.Speed = 1024*3
|
||||
EFFECT.TracerLength = 128
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Init( data table )
|
||||
-----------------------------------------------------------]]
|
||||
function EFFECT:Init(data)
|
||||
self.Position = data:GetStart()
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
self.Attachment = data:GetAttachment()
|
||||
|
||||
if IsValid(self.WeaponEnt) and self.WeaponEnt.GetMuzzleAttachment then
|
||||
self.Attachment = self.WeaponEnt:GetMuzzleAttachment()
|
||||
end
|
||||
|
||||
-- Keep the start and end pos - we're going to interpolate between them
|
||||
self.StartPos = self:GetTracerShootPos(self.Position, self.WeaponEnt, self.Attachment)
|
||||
self.EndPos = data:GetOrigin()
|
||||
self.Normal = (self.EndPos - self.StartPos):GetNormalized()
|
||||
self.Length = (self.EndPos - self.StartPos):Length()
|
||||
--self.Alpha = 255
|
||||
self.Life = 0
|
||||
self.MaxLife = self.Length / self.Speed
|
||||
self:SetRenderBoundsWS(self.StartPos, self.EndPos, Vector(1000,1000,1000))
|
||||
self.CurPos = self.StartPos
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
THINK
|
||||
-----------------------------------------------------------]]
|
||||
function EFFECT:Think()
|
||||
self.Life = self.Life + FrameTime() * (1 / self.MaxLife)
|
||||
--self.Alpha = 255 * ( 1 - self.Life )
|
||||
|
||||
return self.Life < 1
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Draw the effect
|
||||
-----------------------------------------------------------]]
|
||||
local lerpedcol = Color(225, 225, 225, 225)
|
||||
|
||||
function EFFECT:Render()
|
||||
render.SetMaterial(self.Mat)
|
||||
lerpedcol.r = Lerp(self.Life, self.Col1.r, self.Col2.r)
|
||||
lerpedcol.g = Lerp(self.Life, self.Col1.g, self.Col2.g)
|
||||
lerpedcol.b = Lerp(self.Life, self.Col1.b, self.Col2.b)
|
||||
lerpedcol.a = Lerp(self.Life, self.Col1.a, self.Col2.a)
|
||||
local startbeampos = LerpVector(self.Life, self.StartPos, self.EndPos)
|
||||
local endbeampos = LerpVector(self.Life + self.TracerLength / self.Length, self.StartPos, self.EndPos)
|
||||
render.DrawBeam(startbeampos, endbeampos, 8, 0, 1, lerpedcol)
|
||||
end
|
||||
154
addons/tfa-base/lua/effects/tfa_tracer_gauss/init.lua
Normal file
154
addons/tfa-base/lua/effects/tfa_tracer_gauss/init.lua
Normal file
@@ -0,0 +1,154 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
local vector_origin = Vector()
|
||||
|
||||
EFFECT.Thickness = 16
|
||||
EFFECT.Life = 0.25
|
||||
EFFECT.RotVelocity = 30
|
||||
EFFECT.InValid = false
|
||||
local Mat_Impact = Material("effects/combinemuzzle2")
|
||||
local Mat_Beam = Material("effects/tool_tracer")
|
||||
local Mat_TracePart = Material("effects/select_ring")
|
||||
|
||||
function EFFECT:Init(data)
|
||||
self.Position = data:GetStart()
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
self.Attachment = data:GetAttachment()
|
||||
|
||||
if IsValid(self.WeaponEnt) and self.WeaponEnt.GetMuzzleAttachment then
|
||||
self.Attachment = self.WeaponEnt:GetMuzzleAttachment()
|
||||
end
|
||||
|
||||
local owent
|
||||
|
||||
if IsValid(self.WeaponEnt) then
|
||||
owent = self.WeaponEnt:GetOwner()
|
||||
|
||||
if not IsValid(owent) then
|
||||
owent = self.WeaponEnt:GetParent()
|
||||
end
|
||||
end
|
||||
|
||||
if IsValid(owent) and owent:IsPlayer() then
|
||||
if owent ~= LocalPlayer() or owent:ShouldDrawLocalPlayer() then
|
||||
self.WeaponEnt = owent:GetActiveWeapon()
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
else
|
||||
self.WeaponEnt = owent:GetViewModel()
|
||||
local theirweapon = owent:GetActiveWeapon()
|
||||
|
||||
if IsValid(theirweapon) and theirweapon.ViewModelFlip or theirweapon.ViewModelFlipped then
|
||||
self.Flipped = true
|
||||
end
|
||||
|
||||
if not IsValid(self.WeaponEnt) then return end
|
||||
end
|
||||
end
|
||||
|
||||
local angpos
|
||||
|
||||
if IsValid(self.WeaponEnt) then
|
||||
angpos = self.WeaponEnt:GetAttachment(self.Attachment)
|
||||
end
|
||||
|
||||
if not angpos or not angpos.Pos then
|
||||
angpos = {
|
||||
Pos = vector_origin,
|
||||
Ang = angle_zero
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
if self.Flipped then
|
||||
local tmpang = (self.Dir or angpos.Ang:Forward()):Angle()
|
||||
local localang = self.WeaponEnt:WorldToLocalAngles(tmpang)
|
||||
localang.y = localang.y + 180
|
||||
localang = self.WeaponEnt:LocalToWorldAngles(localang)
|
||||
--localang:RotateAroundAxis(localang:Up(),180)
|
||||
--tmpang:RotateAroundAxis(tmpang:Up(),180)
|
||||
self.Dir = localang:Forward()
|
||||
end
|
||||
|
||||
-- Keep the start and end Pos - we're going to interpolate between them
|
||||
if IsValid(owent) and self.Position:Distance(owent:EyePos()) > 72 then
|
||||
self.WeaponEnt = nil
|
||||
end
|
||||
|
||||
self.StartPos = self:GetTracerShootPos(self.WeaponEnt and angpos.Pos or self.Position, self.WeaponEnt, self.Attachment)
|
||||
self.EndPos = data:GetOrigin()
|
||||
self.Entity:SetRenderBoundsWS(self.StartPos, self.EndPos)
|
||||
self.Normal = (self.EndPos - self.StartPos):GetNormalized()
|
||||
self.StartTime = 0
|
||||
self.LifeTime = self.Life
|
||||
self.data = data
|
||||
self.rot = 0
|
||||
end
|
||||
|
||||
function EFFECT:Think()
|
||||
if self.InValid then return false end
|
||||
self.LifeTime = self.LifeTime - FrameTime()
|
||||
self.StartTime = self.StartTime + FrameTime()
|
||||
|
||||
return self.LifeTime > 0
|
||||
end
|
||||
|
||||
local beamcol = table.Copy(color_white)
|
||||
local beamcol2 = Color(0, 225, 255, 255)
|
||||
|
||||
function EFFECT:Render()
|
||||
if self.InValid then return false end
|
||||
self.StartPos = self:GetTracerShootPos(self.StartPos, self.WeaponEnt, self.Attachment)
|
||||
local startPos = self.StartPos
|
||||
local endPos = self.EndPos
|
||||
local tracerpos
|
||||
beamcol.a = self.LifeTime / self.Life * 255
|
||||
self.rot = self.rot + FrameTime() * self.RotVelocity
|
||||
render.SetMaterial(Mat_Impact)
|
||||
render.DrawSprite(endPos, 12, 12, ColorAlpha(color_white, beamcol.a))
|
||||
render.SetMaterial(Mat_TracePart)
|
||||
tracerpos = Lerp(math.Clamp(self.LifeTime / self.Life - 0.1, 0, 1), endPos, startPos)
|
||||
render.DrawQuadEasy(tracerpos, self.Normal, 12, 12, beamcol2, self.rot - 60)
|
||||
tracerpos = Lerp(math.Clamp(self.LifeTime / self.Life - 0.05, 0, 1), endPos, startPos)
|
||||
render.DrawQuadEasy(tracerpos, self.Normal, 12, 12, beamcol2, self.rot - 30)
|
||||
tracerpos = Lerp(math.Clamp(self.LifeTime / self.Life, 0, 1), endPos, startPos)
|
||||
render.DrawQuadEasy(tracerpos, self.Normal, 12, 12, beamcol2, self.rot)
|
||||
tracerpos = Lerp(math.Clamp(self.LifeTime / self.Life + 0.05, 0, 1), endPos, startPos)
|
||||
render.DrawQuadEasy(tracerpos, self.Normal, 12, 12, beamcol2, self.rot + 30)
|
||||
tracerpos = Lerp(math.Clamp(self.LifeTime / self.Life + 0.1, 0, 1), endPos, startPos)
|
||||
render.DrawQuadEasy(tracerpos, self.Normal, 12, 12, beamcol2, self.rot + 60)
|
||||
tracerpos = Lerp(math.Clamp(self.LifeTime / self.Life + 0.15, 0, 1), endPos, startPos)
|
||||
render.DrawQuadEasy(tracerpos, self.Normal, 12, 12, beamcol2, self.rot + 30)
|
||||
tracerpos = Lerp(math.Clamp(self.LifeTime / self.Life + 0.2, 0, 1), endPos, startPos)
|
||||
render.DrawQuadEasy(tracerpos, self.Normal, 12, 12, beamcol2, self.rot + 60)
|
||||
render.SetMaterial(Mat_Beam)
|
||||
render.DrawBeam(startPos, endPos, self.Thickness, 0 + beamcol.a / 128, endPos:Distance(startPos) / 64 + beamcol.a / 128, beamcol)
|
||||
end
|
||||
86
addons/tfa-base/lua/effects/tfa_tracer_incendiary/init.lua
Normal file
86
addons/tfa-base/lua/effects/tfa_tracer_incendiary/init.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
EFFECT.Mat = Material("effects/laser_tracer")
|
||||
EFFECT.Col1 = Color(255, 90, 25, 200) --Color(225,225,225,225)
|
||||
EFFECT.Col2 = Color(225, 25, 25, 200)
|
||||
EFFECT.Speed = 8192
|
||||
EFFECT.TracerLength = 128
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Init( data table )
|
||||
-----------------------------------------------------------]]
|
||||
function EFFECT:Init(data)
|
||||
self.Position = data:GetStart()
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
self.Attachment = data:GetAttachment()
|
||||
|
||||
if IsValid(self.WeaponEnt) and self.WeaponEnt.GetMuzzleAttachment then
|
||||
self.Attachment = self.WeaponEnt:GetMuzzleAttachment()
|
||||
end
|
||||
|
||||
-- Keep the start and end pos - we're going to interpolate between them
|
||||
self.StartPos = self:GetTracerShootPos(self.Position, self.WeaponEnt, self.Attachment)
|
||||
self.EndPos = data:GetOrigin()
|
||||
self.Normal = (self.EndPos - self.StartPos):GetNormalized()
|
||||
self.Length = (self.EndPos - self.StartPos):Length()
|
||||
--self.Alpha = 255
|
||||
self.Life = 0
|
||||
self.MaxLife = self.Length / self.Speed
|
||||
self:SetRenderBoundsWS(self.StartPos, self.EndPos)
|
||||
self.CurPos = self.StartPos
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
THINK
|
||||
-----------------------------------------------------------]]
|
||||
function EFFECT:Think()
|
||||
self.Life = self.Life + FrameTime() * (1 / self.MaxLife)
|
||||
--self.Alpha = 255 * ( 1 - self.Life )
|
||||
|
||||
return self.Life < 1
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Draw the effect
|
||||
-----------------------------------------------------------]]
|
||||
local lerpedcol = Color(225, 225, 225, 225)
|
||||
|
||||
function EFFECT:Render()
|
||||
render.SetMaterial(self.Mat)
|
||||
lerpedcol.r = Lerp(self.Life, self.Col1.r, self.Col2.r)
|
||||
lerpedcol.g = Lerp(self.Life, self.Col1.g, self.Col2.g)
|
||||
lerpedcol.b = Lerp(self.Life, self.Col1.b, self.Col2.b)
|
||||
lerpedcol.a = Lerp(self.Life, self.Col1.a, self.Col2.a)
|
||||
local startbeampos = Lerp(self.Life, self.StartPos, self.EndPos)
|
||||
local endbeampos = Lerp(self.Life + self.TracerLength / self.Length, self.StartPos, self.EndPos)
|
||||
render.DrawBeam(startbeampos, endbeampos, 8, 0, 1, lerpedcol)
|
||||
end
|
||||
86
addons/tfa-base/lua/effects/tfa_tracer_plasma/init.lua
Normal file
86
addons/tfa-base/lua/effects/tfa_tracer_plasma/init.lua
Normal file
@@ -0,0 +1,86 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Copyright (c) 2018-2020 TFA Base Devs
|
||||
|
||||
-- Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
-- of this software and associated documentation files (the "Software"), to deal
|
||||
-- in the Software without restriction, including without limitation the rights
|
||||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
-- copies of the Software, and to permit persons to whom the Software is
|
||||
-- furnished to do so, subject to the following conditions:
|
||||
|
||||
-- The above copyright notice and this permission notice shall be included in all
|
||||
-- copies or substantial portions of the Software.
|
||||
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
-- SOFTWARE.
|
||||
|
||||
EFFECT.Mat = Material("effects/laser_tracer")
|
||||
EFFECT.Col1 = Color(128, 255, 255) --Color(225,225,225,225)
|
||||
EFFECT.Col2 = Color(97, 218, 255)
|
||||
EFFECT.Speed = 4096
|
||||
EFFECT.TracerLength = 128
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Init( data table )
|
||||
-----------------------------------------------------------]]
|
||||
function EFFECT:Init(data)
|
||||
self.Position = data:GetStart()
|
||||
self.WeaponEnt = data:GetEntity()
|
||||
self.Attachment = data:GetAttachment()
|
||||
|
||||
if IsValid(self.WeaponEnt) and self.WeaponEnt.GetMuzzleAttachment then
|
||||
self.Attachment = self.WeaponEnt:GetMuzzleAttachment()
|
||||
end
|
||||
|
||||
-- Keep the start and end pos - we're going to interpolate between them
|
||||
self.StartPos = self:GetTracerShootPos(self.Position, self.WeaponEnt, self.Attachment)
|
||||
self.EndPos = data:GetOrigin()
|
||||
self.Normal = (self.EndPos - self.StartPos):GetNormalized()
|
||||
self.Length = (self.EndPos - self.StartPos):Length()
|
||||
--self.Alpha = 255
|
||||
self.Life = 0
|
||||
self.MaxLife = self.Length / self.Speed
|
||||
self:SetRenderBoundsWS(self.StartPos, self.EndPos)
|
||||
self.CurPos = self.StartPos
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
THINK
|
||||
-----------------------------------------------------------]]
|
||||
function EFFECT:Think()
|
||||
self.Life = self.Life + FrameTime() * (1 / self.MaxLife)
|
||||
--self.Alpha = 255 * ( 1 - self.Life )
|
||||
|
||||
return self.Life < 1
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
Draw the effect
|
||||
-----------------------------------------------------------]]
|
||||
local lerpedcol = Color(225, 225, 225, 225)
|
||||
|
||||
function EFFECT:Render()
|
||||
render.SetMaterial(self.Mat)
|
||||
lerpedcol.r = Lerp(self.Life, self.Col1.r, self.Col2.r)
|
||||
lerpedcol.g = Lerp(self.Life, self.Col1.g, self.Col2.g)
|
||||
lerpedcol.b = Lerp(self.Life, self.Col1.b, self.Col2.b)
|
||||
lerpedcol.a = Lerp(self.Life, self.Col1.a, self.Col2.a)
|
||||
local startbeampos = Lerp(self.Life, self.StartPos, self.EndPos)
|
||||
local endbeampos = Lerp(self.Life + self.TracerLength / self.Length, self.StartPos, self.EndPos)
|
||||
render.DrawBeam(startbeampos, endbeampos, 8, 0, 1, lerpedcol)
|
||||
end
|
||||
Reference in New Issue
Block a user