mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
242
addons/tfa-base/lua/entities/tfa_ammo_base.lua
Normal file
242
addons/tfa-base/lua/entities/tfa_ammo_base.lua
Normal file
@@ -0,0 +1,242 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_anim"
|
||||
ENT.PrintName = "AmmoBase"
|
||||
ENT.Category = "TFA Ammunition"
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
ENT.Class = ""
|
||||
ENT.MyModel = "models/props_junk/popcan01a.mdl"
|
||||
ENT.ImpactSound = "Default.ImpactSoft"
|
||||
ENT.AmmoCount = 100
|
||||
ENT.AmmoType = "357"
|
||||
ENT.TextPosition = Vector(-2.5, -3.3, 4)
|
||||
ENT.TextAngles = Vector(48, -90, 0)
|
||||
ENT.TextColor = Color(240, 35, 35, 255)
|
||||
ENT.DrawText = false
|
||||
ENT.ShouldDrawShadow = true
|
||||
ENT.ImpactSound = "Default.ImpactSoft"
|
||||
ENT.DamageThreshold = 80
|
||||
ENT.ExplosionOffset = Vector(0, 0, 10)
|
||||
ENT.Damage = 30
|
||||
ENT.TextOffX = 30
|
||||
ENT.TextOffY = -20
|
||||
ENT.TextScale = 1
|
||||
|
||||
if SERVER then
|
||||
AddCSLuaFile()
|
||||
|
||||
function ENT:SpawnFunction(ply, tr, classname)
|
||||
if (not tr.Hit) then return end
|
||||
local pos = tr.HitPos + tr.HitNormal * 4
|
||||
local ent = ents.Create(classname)
|
||||
ent:SetPos(pos)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
ent.Class = classname
|
||||
ent.Spawner = ply
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
local model = self.MyModel
|
||||
self.Class = self:GetClass()
|
||||
self:SetModel(model)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:DrawShadow(self.ShouldDrawShadow)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self:SetHealth(self.DamageThreshold)
|
||||
self:SetNW2Bool("ShouldRemove", false)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(data, physobj)
|
||||
if (data.Speed > 60 and data.DeltaTime > 0.2) then
|
||||
self:EmitSound(self.ImpactSound)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator, caller)
|
||||
if IsValid(activator) and activator:IsPlayer() then
|
||||
activator:GiveAmmo(self.AmmoCount, self.AmmoType)
|
||||
self:SetNW2Bool("ShouldRemove", true)
|
||||
end
|
||||
end
|
||||
|
||||
local bul = {}
|
||||
local randvec = Vector(0, 0, 0)
|
||||
bul.Tracer = 3
|
||||
bul.Num = 1
|
||||
bul.TracerName = "Tracer"
|
||||
bul.Spread = Vector(0, 0, 0)
|
||||
|
||||
local cv_dc = GetConVar("sv_tfa_ammo_detonation_chain")
|
||||
local cv_dm = GetConVar("sv_tfa_ammo_detonation_mode")
|
||||
function ENT:OnTakeDamage(dmginfo)
|
||||
if not IsValid(self) then return end
|
||||
local at = dmginfo:GetInflictor()
|
||||
local shouldtakedamage = true
|
||||
|
||||
if IsValid(at) then
|
||||
local base = at.Base
|
||||
|
||||
if (base and string.find(base, "tfa_ammo_base")) or string.find(at:GetClass(), "tfa_ammo_") and not cv_dc:GetBool() then
|
||||
shouldtakedamage = false
|
||||
end
|
||||
end
|
||||
|
||||
if dmginfo:GetDamage() < 1 then
|
||||
shouldtakedamage = false
|
||||
end
|
||||
|
||||
self.Attacker = at
|
||||
|
||||
if shouldtakedamage then
|
||||
self:SetHealth(self:Health() - dmginfo:GetDamage())
|
||||
end
|
||||
|
||||
self:EmitSound(self.ImpactSound)
|
||||
local phy = self:GetPhysicsObject()
|
||||
|
||||
if IsValid(phy) then
|
||||
local f = dmginfo:GetDamageForce()
|
||||
local p = dmginfo:GetDamagePosition()
|
||||
|
||||
if f and p then
|
||||
phy:ApplyForceOffset(f / 4, p)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if self:GetNW2Bool("ShouldRemove", false) then
|
||||
self:Remove()
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if not cv_dc:GetBool() then return true end
|
||||
|
||||
if self:Health() <= 0 then
|
||||
self:EmitSound(self.ImpactSound)
|
||||
local adm = cv_dm:GetInt()
|
||||
bul.AmmoType = self.AmmoType
|
||||
bul.Damage = self.Damage
|
||||
bul.Force = math.Max(self.Damage / 25, 0.1)
|
||||
bul.Attacker = self
|
||||
|
||||
if IsValid(self.Attacker) then
|
||||
bul.Attacker = self.Attacker
|
||||
end
|
||||
|
||||
local upang = self:GetAngles():Up()
|
||||
bul.Dir = upang + randvec * 0.75
|
||||
local numbuls = math.random(math.Round(self.AmmoCount * 0.25), math.Round(self.AmmoCount * 0.75))
|
||||
local i = 1
|
||||
|
||||
if adm == 2 then
|
||||
bul.Damage = bul.Damage / 2
|
||||
end
|
||||
|
||||
bul.Dir = (upang + randvec * 0.75):GetNormalized()
|
||||
bul.Src = self:GetPos()
|
||||
self:FireBullets(bul)
|
||||
|
||||
if adm ~= 1 then
|
||||
while i <= math.Clamp(numbuls, 1, 35) do
|
||||
randvec.x = math.Rand(-1, 1)
|
||||
randvec.y = math.Rand(-1, 1)
|
||||
randvec.z = math.Rand(-1, 1)
|
||||
bul.Dir = (upang + randvec * 0.75):GetNormalized()
|
||||
bul.Src = self:GetPos()
|
||||
self:FireBullets(bul)
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
effectdata:SetMagnitude(0.1)
|
||||
effectdata:SetScale(0.5)
|
||||
|
||||
if adm == 1 then
|
||||
bul.Damage = bul.Damage * 3 / 4
|
||||
end
|
||||
|
||||
if adm > 0 then
|
||||
util.BlastDamage(bul.Attacker, bul.Attacker, bul.Src, (bul.Damage * 6 + 128) / 2, bul.Damage * 2)
|
||||
util.Effect("Explosion", effectdata)
|
||||
end
|
||||
|
||||
if adm ~= 1 then
|
||||
util.Effect("cball_explode", effectdata)
|
||||
end
|
||||
|
||||
self:SetNW2Bool("ShouldRemove", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Initialize()
|
||||
self.Class = self:GetClass()
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
if self.TextPosition and self.TextAngles and self.DrawText then
|
||||
local pos = self:GetPos() + (self:GetUp() * self.TextPosition.z) + (self:GetRight() * self.TextPosition.x) + (self:GetForward() * self.TextPosition.y)
|
||||
local ang = self:GetAngles()
|
||||
ang:RotateAroundAxis(ang:Right(), self.TextAngles.x)
|
||||
ang:RotateAroundAxis(ang:Up(), self.TextAngles.y)
|
||||
ang:RotateAroundAxis(ang:Forward(), self.TextAngles.z)
|
||||
|
||||
if not self.Text then
|
||||
self.Text = string.upper(self.AmmoType)
|
||||
end
|
||||
|
||||
cam.Start3D2D(pos, ang, .07 * self.TextScale)
|
||||
draw.SimpleText(self.Text, "DermaLarge", self.TextOffX, self.TextOffY, self.TextColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
end
|
||||
40
addons/tfa-base/lua/entities/tfa_exp_base/cl_init.lua
Normal file
40
addons/tfa-base/lua/entities/tfa_exp_base/cl_init.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
--[[
|
||||
| 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("shared.lua")
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
function ENT:IsTranslucent()
|
||||
return true
|
||||
end
|
||||
110
addons/tfa-base/lua/entities/tfa_exp_base/init.lua
Normal file
110
addons/tfa-base/lua/entities/tfa_exp_base/init.lua
Normal file
@@ -0,0 +1,110 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
|
||||
ENT.DefaultModel = Model("models/weapons/w_eq_fraggrenade.mdl")
|
||||
|
||||
ENT.Damage = 100
|
||||
ENT.Delay = 3
|
||||
|
||||
function ENT:Initialize()
|
||||
local mdl = self:GetModel()
|
||||
|
||||
if not mdl or mdl == "" or mdl == "models/error.mdl" then
|
||||
self:SetModel(self.DefaultModel)
|
||||
end
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
if IsValid(phys) then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
self:SetFriction(self.Delay)
|
||||
self.killtime = CurTime() + self.Delay
|
||||
self:DrawShadow(true)
|
||||
|
||||
if not self.Inflictor and self:GetOwner():IsValid() and self:GetOwner():GetActiveWeapon():IsValid() then
|
||||
self.Inflictor = self:GetOwner():GetActiveWeapon()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if self.killtime < CurTime() then
|
||||
self:Explode()
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
ENT.ExplosionSound = "BaseExplosionEffect.Sound"
|
||||
|
||||
function ENT:DoExplosionEffect()
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
|
||||
util.Effect("HelicopterMegaBomb", effectdata)
|
||||
util.Effect("Explosion", effectdata)
|
||||
|
||||
self:EmitSoundNet(self.ExplosionSound)
|
||||
end
|
||||
|
||||
function ENT:Explode()
|
||||
if not IsValid(self.Inflictor) then
|
||||
self.Inflictor = self
|
||||
end
|
||||
|
||||
self.Damage = self.mydamage or self.Damage
|
||||
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetInflictor(self.Inflictor)
|
||||
dmg:SetAttacker(IsValid(self:GetOwner()) and self:GetOwner() or self)
|
||||
dmg:SetDamage(self.Damage)
|
||||
dmg:SetDamageType(bit.bor(DMG_BLAST, DMG_AIRBOAT))
|
||||
|
||||
util.BlastDamageInfo(dmg, self:GetPos(), math.pow( self.Damage / 100, 0.75) * 200)
|
||||
|
||||
util.ScreenShake(self:GetPos(), self.Damage * 20, 255, self.Damage / 200, math.pow(self.Damage / 100, 0.75) * 400)
|
||||
|
||||
self:DoExplosionEffect()
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
62
addons/tfa-base/lua/entities/tfa_exp_base/shared.lua
Normal file
62
addons/tfa-base/lua/entities/tfa_exp_base/shared.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Base Explosive"
|
||||
ENT.Author = ""
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = ""
|
||||
ENT.DoNotDuplicate = true
|
||||
ENT.DisableDuplicator = true
|
||||
|
||||
local sp = game.SinglePlayer()
|
||||
|
||||
function ENT:EmitSoundNet(sound)
|
||||
if CLIENT or sp then
|
||||
if sp and not IsFirstTimePredicted() then return end
|
||||
|
||||
self:EmitSound(sound)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local filter = RecipientFilter()
|
||||
filter:AddPAS(self:GetPos())
|
||||
if IsValid(self:GetOwner()) then
|
||||
filter:RemovePlayer(self:GetOwner())
|
||||
end
|
||||
|
||||
net.Start("tfaSoundEvent", true)
|
||||
net.WriteEntity(self)
|
||||
net.WriteString(sound)
|
||||
net.Send(filter)
|
||||
end
|
||||
41
addons/tfa-base/lua/entities/tfa_exp_contact.lua
Normal file
41
addons/tfa-base/lua/entities/tfa_exp_contact.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.
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "tfa_exp_base"
|
||||
ENT.PrintName = "Contact Explosive"
|
||||
|
||||
function ENT:PhysicsCollide(data, phys)
|
||||
if data.Speed > 60 then
|
||||
self.killtime = -1
|
||||
end
|
||||
end
|
||||
127
addons/tfa-base/lua/entities/tfa_exp_rocket.lua
Normal file
127
addons/tfa-base/lua/entities/tfa_exp_rocket.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "tfa_exp_base"
|
||||
ENT.PrintName = "Rocket-Propelled Explosive"
|
||||
|
||||
-- EDITABLE PARAMETERS -- START
|
||||
|
||||
ENT.LaunchSound = "" -- none, replace to enable
|
||||
ENT.PropelSound = Sound("Missile.Accelerate") -- looped propel sound
|
||||
|
||||
ENT.BaseSpeed = 500 -- base rocket speed, in units
|
||||
|
||||
ENT.AccelerationTime = 0.25 -- time in seconds to accelerate to max speed
|
||||
ENT.MaxSpeed = 1500 -- maximum speed, works if AccelerationTime > 0
|
||||
|
||||
ENT.HasTrail = true -- create trail
|
||||
|
||||
-- EDITABLE PARAMETERS -- END
|
||||
|
||||
ENT.AccelProgress = 0
|
||||
|
||||
ENT.DefaultModel = Model("models/weapons/w_missile.mdl")
|
||||
ENT.Delay = 10
|
||||
|
||||
DEFINE_BASECLASS(ENT.Base)
|
||||
|
||||
-- Creates HL2 rocket trail by default, feel free to copy and edit to your needs
|
||||
function ENT:CreateRocketTrail()
|
||||
if not SERVER then return end
|
||||
|
||||
local rockettrail = ents.Create("env_rockettrail")
|
||||
rockettrail:DeleteOnRemove(self)
|
||||
|
||||
rockettrail:SetPos(self:GetPos())
|
||||
rockettrail:SetAngles(self:GetAngles())
|
||||
rockettrail:SetParent(self)
|
||||
rockettrail:SetMoveType(MOVETYPE_NONE)
|
||||
rockettrail:AddSolidFlags(FSOLID_NOT_SOLID)
|
||||
|
||||
rockettrail:SetSaveValue("m_Opacity", 0.2)
|
||||
rockettrail:SetSaveValue("m_SpawnRate", 100)
|
||||
rockettrail:SetSaveValue("m_ParticleLifetime", 0.5)
|
||||
rockettrail:SetSaveValue("m_StartColor", Vector(0.65, 0.65, 0.65))
|
||||
rockettrail:SetSaveValue("m_EndColor", Vector(0, 0, 0))
|
||||
rockettrail:SetSaveValue("m_StartSize", 8)
|
||||
rockettrail:SetSaveValue("m_EndSize", 32)
|
||||
rockettrail:SetSaveValue("m_SpawnRadius", 4)
|
||||
rockettrail:SetSaveValue("m_MinSpeed", 2)
|
||||
rockettrail:SetSaveValue("m_MaxSpeed", 16)
|
||||
rockettrail:SetSaveValue("m_nAttachment", 0)
|
||||
rockettrail:SetSaveValue("m_flDeathTime", CurTime() + 999)
|
||||
|
||||
rockettrail:Activate()
|
||||
rockettrail:Spawn()
|
||||
end
|
||||
|
||||
function ENT:Initialize(...)
|
||||
BaseClass.Initialize(self, ...)
|
||||
|
||||
self:EmitSoundNet(self.PropelSound)
|
||||
|
||||
if self.LaunchSound and self.LaunchSound ~= "" then
|
||||
self:EmitSoundNet(self.LaunchSound)
|
||||
end
|
||||
|
||||
self:SetFriction(0)
|
||||
self:SetLocalAngularVelocity(angle_zero)
|
||||
|
||||
self:SetMoveType(bit.bor(MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE))
|
||||
self:SetLocalVelocity(self:GetForward() * self.BaseSpeed)
|
||||
|
||||
if self.HasTrail then
|
||||
self:CreateRocketTrail()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think(...)
|
||||
if self.AccelerationTime > 0 and self.AccelProgress < 1 then
|
||||
self.LastAccelThink = self.LastAccelThink or CurTime()
|
||||
self.AccelProgress = Lerp((CurTime() - self.LastAccelThink) / self.AccelerationTime, self.AccelProgress, 1)
|
||||
end
|
||||
|
||||
self:SetLocalVelocity(self:GetForward() * Lerp(self.AccelProgress, self.BaseSpeed, self.MaxSpeed))
|
||||
|
||||
return BaseClass.Think(self, ...)
|
||||
end
|
||||
|
||||
function ENT:Explode(...)
|
||||
self:StopSound(self.PropelSound)
|
||||
|
||||
return BaseClass.Explode(self, ...)
|
||||
end
|
||||
|
||||
function ENT:Touch()
|
||||
self.killtime = -1
|
||||
end
|
||||
48
addons/tfa-base/lua/entities/tfa_exp_timed.lua
Normal file
48
addons/tfa-base/lua/entities/tfa_exp_timed.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "tfa_exp_base"
|
||||
ENT.PrintName = "Timed Explosive"
|
||||
|
||||
ENT.BounceSound = Sound("HEGrenade.Bounce")
|
||||
|
||||
function ENT:PhysicsCollide(data, phys)
|
||||
if data.Speed > 60 then
|
||||
if self.BounceSound then
|
||||
self:EmitSoundNet(self.BounceSound)
|
||||
end
|
||||
|
||||
local impulse = (data.OurOldVelocity - 2 * data.OurOldVelocity:Dot(data.HitNormal) * data.HitNormal) * 0.25
|
||||
phys:ApplyForceCenter(impulse)
|
||||
end
|
||||
end
|
||||
36
addons/tfa-base/lua/entities/tfa_thrown_blade/cl_init.lua
Normal file
36
addons/tfa-base/lua/entities/tfa_thrown_blade/cl_init.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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("shared.lua")
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
207
addons/tfa-base/lua/entities/tfa_thrown_blade/init.lua
Normal file
207
addons/tfa-base/lua/entities/tfa_thrown_blade/init.lua
Normal file
@@ -0,0 +1,207 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Initialize()
|
||||
local mdl = self:GetModel()
|
||||
|
||||
if not mdl or mdl == "" or string.find(mdl, "error") then
|
||||
self:SetModel("models/weapons/w_knife_t.mdl")
|
||||
end
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
self:NextThink(CurTime() + 1)
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
phys:SetMass(10)
|
||||
end
|
||||
|
||||
for _, v in pairs(self.HitSounds) do
|
||||
for _, o in pairs(v) do
|
||||
util.PrecacheSound(o)
|
||||
end
|
||||
end
|
||||
|
||||
local bounds = self:OBBMaxs() - self:OBBMins()
|
||||
|
||||
if bounds.z > bounds.x and bounds.z > bounds.y then
|
||||
self.up = true
|
||||
elseif bounds.y > bounds.x and bounds.y > bounds.z then
|
||||
self.right = true
|
||||
end
|
||||
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
|
||||
self.mydamage = self.mydamage or 40
|
||||
|
||||
self.DestroyTime = CurTime() + 30
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if CurTime() > self.DestroyTime then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Stick()
|
||||
self.DestroyTime = CurTime() + 60
|
||||
timer.Simple(0,function()
|
||||
if IsValid(self) then
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
self:GetPhysicsObject():EnableMotion(false)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(data, phys)
|
||||
timer.Simple(0,function()
|
||||
if not IsValid(self) then return end
|
||||
local owner = self:GetOwner()
|
||||
self:SetOwner(nil)
|
||||
local fwdang = self:GetAngles()
|
||||
local fwdvec
|
||||
|
||||
if self.up then
|
||||
fwdvec = fwdang:Up()
|
||||
elseif self.right then
|
||||
fwdvec = fwdang:Right()
|
||||
else
|
||||
fwdvec = fwdang:Forward()
|
||||
end
|
||||
|
||||
local ent = data.HitEntity
|
||||
if not IsValid(ent) and not (ent and ent:IsWorld()) then return end
|
||||
local dmg = self.mydamage * math.sqrt(data.Speed / 1500)
|
||||
|
||||
if dmg > 5 and ent and not ent:IsWorld() then
|
||||
local dmginfo = DamageInfo()
|
||||
dmginfo:SetDamage(dmg)
|
||||
dmginfo:SetDamagePosition(data.HitPos)
|
||||
dmginfo:SetDamageForce(data.OurOldVelocity)
|
||||
dmginfo:SetInflictor(self)
|
||||
dmginfo:SetDamageType(DMG_SLASH)
|
||||
local att = self:GetPhysicsAttacker()
|
||||
|
||||
if not IsValid(att) then
|
||||
att = owner
|
||||
end
|
||||
|
||||
if not IsValid(att) then
|
||||
att = self
|
||||
end
|
||||
|
||||
dmginfo:SetAttacker(att)
|
||||
ent:TakeDamageInfo(dmginfo)
|
||||
end
|
||||
|
||||
local traceres = util.QuickTrace(self:GetPos(), data.OurOldVelocity, self)
|
||||
if not traceres.HitPos then return end
|
||||
|
||||
if data.Speed > 50 then
|
||||
local soundtbl
|
||||
|
||||
if self.HitSounds[traceres.MatType] then
|
||||
soundtbl = self.HitSounds[traceres.MatType]
|
||||
else
|
||||
soundtbl = self.HitSounds[MAT_DIRT]
|
||||
end
|
||||
|
||||
local snd = soundtbl[math.random(1, #soundtbl)]
|
||||
self:EmitSound(snd)
|
||||
end
|
||||
|
||||
local dp = traceres.HitNormal:Dot(fwdvec)
|
||||
|
||||
if dp >= -0.3 then
|
||||
local fx = EffectData()
|
||||
fx:SetOrigin(data.HitPos)
|
||||
fx:SetMagnitude(1)
|
||||
fx:SetScale((data.Speed / 1500 * (dp + 0.6)) / 5)
|
||||
util.Effect("Sparks", fx)
|
||||
end
|
||||
|
||||
local canstick = data.Speed > 250 and dp < (-1 + data.Speed / 1000 * 0.3)
|
||||
|
||||
if ent:IsWorld() and canstick then
|
||||
util.Decal("ManhackCut", traceres.HitPos + traceres.HitNormal, traceres.HitPos - traceres.HitNormal)
|
||||
self:EmitSound(self.ImpactSound)
|
||||
self:SetPos(traceres.HitPos + traceres.HitNormal * 12)
|
||||
local tmpang = data.HitNormal:Angle()
|
||||
tmpang:RotateAroundAxis(tmpang:Right(), 270)
|
||||
--self:SetAngles(tmpang)
|
||||
local fx = EffectData()
|
||||
fx:SetOrigin(data.HitPos)
|
||||
fx:SetMagnitude(2)
|
||||
fx:SetScale(0.1)
|
||||
util.Effect("Sparks", fx)
|
||||
self:Stick()
|
||||
elseif IsValid(ent) then
|
||||
if not (ent:IsPlayer() or ent:IsNPC() or ent:GetClass() == "prop_ragdoll") then
|
||||
if canstick then
|
||||
util.Decal("ManhackCut", data.HitPos + data.HitNormal, data.HitPos - data.HitNormal)
|
||||
end
|
||||
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
else
|
||||
local fx = EffectData()
|
||||
fx:SetOrigin(data.HitPos)
|
||||
util.Effect("BloodImpact", fx)
|
||||
self:GetPhysicsObject():SetVelocity(-(data.OurOldVelocity / 8))
|
||||
end
|
||||
if IsValid(self) then
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
end
|
||||
end
|
||||
|
||||
if canstick then
|
||||
self:GetPhysicsObject():SetVelocity(-(data.OurOldVelocity / 16))
|
||||
end
|
||||
|
||||
self:GetPhysicsObject():AddAngleVelocity(-self:GetPhysicsObject():GetAngleVelocity() / 3)
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:Use(ply, caller)
|
||||
local classname = self:GetNW2String("ClassName")
|
||||
if not classname or classname == "" then return end
|
||||
|
||||
if ply:IsPlayer() and ply:GetWeapon(classname) == NULL then
|
||||
ply:Give(classname)
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
45
addons/tfa-base/lua/entities/tfa_thrown_blade/shared.lua
Normal file
45
addons/tfa-base/lua/entities/tfa_thrown_blade/shared.lua
Normal file
@@ -0,0 +1,45 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Thrown Blade"
|
||||
ENT.Author = ""
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = ""
|
||||
ENT.DoNotDuplicate = true
|
||||
|
||||
ENT.HitSounds = {
|
||||
[MAT_DIRT] = {Sound("physics/metal/metal_grenade_impact_hard1.wav"), Sound("physics/metal/metal_grenade_impact_hard2.wav"), Sound("physics/metal/metal_grenade_impact_hard3.wav")},
|
||||
[MAT_FLESH] = {Sound("physics/flesh/flesh_impact_bullet1.wav"), Sound("physics/flesh/flesh_impact_bullet2.wav"), Sound("physics/flesh/flesh_impact_bullet3.wav")}
|
||||
}
|
||||
|
||||
ENT.ImpactSound = Sound("weapons/blades/impact.mp3")
|
||||
54
addons/tfa-base/lua/entities/tfbow_arrow/cl_init.lua
Normal file
54
addons/tfa-base/lua/entities/tfbow_arrow/cl_init.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
--[[
|
||||
| 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("shared.lua")
|
||||
local cv_ht = GetConVar("host_timescale")
|
||||
|
||||
function ENT:Draw()
|
||||
local ang, tmpang
|
||||
tmpang = self:GetAngles()
|
||||
ang = tmpang
|
||||
|
||||
if not self.roll then
|
||||
self.roll = 0
|
||||
end
|
||||
|
||||
local phobj = self:GetPhysicsObject()
|
||||
|
||||
if IsValid(phobj) then
|
||||
self.roll = self.roll + phobj:GetVelocity():Length() / 3600 * cv_ht:GetFloat()
|
||||
end
|
||||
|
||||
ang:RotateAroundAxis(ang:Forward(), self.roll)
|
||||
self:SetAngles(ang)
|
||||
self:DrawModel() -- Draw the model.
|
||||
self:SetAngles(tmpang)
|
||||
end
|
||||
34
addons/tfa-base/lua/entities/tfbow_arrow/init.lua
Normal file
34
addons/tfa-base/lua/entities/tfbow_arrow/init.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
AddCSLuaFile("cl_init.lua") -- Make sure clientside
|
||||
AddCSLuaFile("shared.lua") -- and shared scripts are sent.
|
||||
include("shared.lua")
|
||||
278
addons/tfa-base/lua/entities/tfbow_arrow/shared.lua
Normal file
278
addons/tfa-base/lua/entities/tfbow_arrow/shared.lua
Normal file
@@ -0,0 +1,278 @@
|
||||
--[[
|
||||
| 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()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "TFBow Arrow"
|
||||
ENT.Author = "TheForgottenArchitect"
|
||||
ENT.Contact = "Don't"
|
||||
ENT.Purpose = "Arrow Entity"
|
||||
ENT.Instructions = "Spawn this with a velocity, get rich"
|
||||
|
||||
local function GetBoneCenter(ent, bone)
|
||||
local bonechildren = ent:GetChildBones(bone)
|
||||
|
||||
if #bonechildren <= 0 then
|
||||
return ent:GetBonePosition(bone)
|
||||
else
|
||||
local bonepos = ent:GetBonePosition(bone)
|
||||
local tmppos = bonepos
|
||||
|
||||
if tmppos then
|
||||
for i = 1, #bonechildren do
|
||||
local childpos = ent:GetBonePosition(bonechildren[i])
|
||||
|
||||
if childpos then
|
||||
tmppos = (tmppos + childpos) / 2
|
||||
end
|
||||
end
|
||||
else
|
||||
return ent:GetPos()
|
||||
end
|
||||
|
||||
return tmppos
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:GetClosestBonePos(ent, pos)
|
||||
local i, count, dist, ppos, cbone
|
||||
i = 1
|
||||
count = ent:GetBoneCount()
|
||||
cbone = 0
|
||||
dist = 99999999
|
||||
ppos = ent:GetPos()
|
||||
|
||||
while (i < count) do
|
||||
local bonepos = GetBoneCenter(ent, i)
|
||||
|
||||
if bonepos:Distance(pos) < dist then
|
||||
dist = bonepos:Distance(pos)
|
||||
cbone = i
|
||||
ppos = bonepos
|
||||
end
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
return ppos, cbone
|
||||
end
|
||||
|
||||
local cv_al = GetConVar("sv_tfa_arrow_lifetime")
|
||||
local cv_ht = GetConVar("host_timescale")
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
if not IsValid(self.myowner) then
|
||||
self.myowner = self:GetOwner()
|
||||
|
||||
if not IsValid(self.myowner) then
|
||||
self.myowner = self
|
||||
end
|
||||
end
|
||||
|
||||
timer.Simple(0, function()
|
||||
if self.model then
|
||||
self:SetModel(self.model)
|
||||
end
|
||||
end)
|
||||
|
||||
if cv_al:GetInt() ~= -1 then
|
||||
timer.Simple( cv_al:GetFloat() + 5, function()
|
||||
if IsValid(self) then
|
||||
self:Remove()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
|
||||
if self.velocity then
|
||||
phys:SetVelocityInstantaneous(self.velocity)
|
||||
end
|
||||
|
||||
phys:EnableCollisions(false)
|
||||
self:StartMotionController()
|
||||
self:PhysicsUpdate(phys, 0.1 * cv_ht:GetFloat() )
|
||||
end
|
||||
end
|
||||
|
||||
self:SetNW2Vector("lastpos", self:GetPos())
|
||||
|
||||
if not self.mydamage then
|
||||
self.mydamage = 60
|
||||
end
|
||||
|
||||
if not self.gun then
|
||||
if IsValid(self:GetOwner()) and self:GetOwner():IsPlayer() then
|
||||
self:UpdateGun()
|
||||
else
|
||||
timer.Simple(0, function()
|
||||
if IsValid(self) and IsValid(self:GetOwner()) and self:GetOwner():IsPlayer() then
|
||||
self:UpdateGun()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:UpdateGun()
|
||||
local wep = self:GetOwner():GetActiveWeapon()
|
||||
|
||||
if IsValid(wep) then
|
||||
self.gun = wep:GetClass()
|
||||
end
|
||||
end
|
||||
|
||||
local wl,tracedata,tr
|
||||
|
||||
local cv_fm = GetConVar("sv_tfa_force_multiplier")
|
||||
|
||||
function ENT:HitCB(a,b,c)
|
||||
c:SetDamageType(bit.bor(DMG_NEVERGIB, DMG_CLUB))
|
||||
|
||||
if IsValid(self) and IsValid(self:GetOwner()) then
|
||||
if b.HitWorld then
|
||||
local arrowstuck = ents.Create("tfbow_arrow_stuck")
|
||||
arrowstuck:SetModel(self:GetModel())
|
||||
arrowstuck.gun = self.gun
|
||||
arrowstuck:SetPos(tr.HitPos)
|
||||
local phys = self:GetPhysicsObject()
|
||||
arrowstuck:SetAngles((phys:GetVelocity()):Angle())
|
||||
arrowstuck:Spawn()
|
||||
else
|
||||
if IsValid(b.Entity) then
|
||||
if (not b.Entity:IsWorld()) then
|
||||
local arrowstuck = ents.Create("tfbow_arrow_stuck_clientside")
|
||||
arrowstuck:SetModel(self:GetModel())
|
||||
arrowstuck:SetPos(tr.HitPos)
|
||||
local ang = self:GetAngles()
|
||||
arrowstuck.gun = self.gun
|
||||
arrowstuck:SetAngles(ang)
|
||||
arrowstuck.targent = tr.Entity
|
||||
arrowstuck.targphysbone = tr.PhysicsBone
|
||||
arrowstuck:Spawn()
|
||||
else
|
||||
local arrowstuck = ents.Create("tfbow_arrow_stuck")
|
||||
arrowstuck:SetModel(self:GetModel())
|
||||
arrowstuck.gun = self.gun
|
||||
arrowstuck:SetPos(tr.HitPos)
|
||||
arrowstuck:SetAngles(self:GetAngles())
|
||||
arrowstuck:Spawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:Remove()
|
||||
elseif IsValid(self) then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
wl = self:WaterLevel()
|
||||
|
||||
if not self.prevwaterlevel then
|
||||
self.prevwaterlevel = wl
|
||||
end
|
||||
|
||||
if self.prevwaterlevel ~= wl and wl - self.prevwaterlevel >= 1 then
|
||||
--print(wl)
|
||||
local ef = EffectData()
|
||||
ef:SetOrigin(self:GetPos())
|
||||
util.Effect("watersplash", ef)
|
||||
end
|
||||
|
||||
self.prevwaterlevel = wl
|
||||
|
||||
if wl >= 2 then
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if IsValid(phys) then
|
||||
phys:SetVelocity(phys:GetVelocity() * math.sqrt(9 / 10))
|
||||
end
|
||||
end
|
||||
|
||||
tracedata = {}
|
||||
tracedata.start = self:GetNW2Vector("lastpos", self:GetPos())
|
||||
tracedata.endpos = self:GetPos()
|
||||
tracedata.mask = MASK_SOLID
|
||||
tracedata.filter = {self.myowner, self:GetOwner(), self}
|
||||
tr = util.TraceLine(tracedata)
|
||||
|
||||
--self:SetAngles((((tracedata.endpos-tracedata.start):GetNormalized()+self:GetAngles():Forward())/2):Angle())
|
||||
if (tr.Hit and tr.Fraction < 1 and tr.Fraction > 0) then
|
||||
debugoverlay.Line(tracedata.start, tr.HitPos, 10, Color(255, 0, 0, 255), true)
|
||||
debugoverlay.Cross(tr.HitPos, 5, 10, Color(255, 0, 0, 255), true)
|
||||
|
||||
if SERVER then
|
||||
--[[
|
||||
local bul ={}
|
||||
bul.Attacker=self:GetOwner() and self:GetOwner() or self:GetOwner()
|
||||
bul.Spread=vector_origin
|
||||
bul.Src=tracedata.start
|
||||
bul.Force=self.mydamage*0.25*GetConVarNumber("sv_tfbow_force_multiplier",1)
|
||||
bul.Damage=self.mydamage
|
||||
bul.Tracer = 0 -- Show a tracer on every x bullets
|
||||
bul.TracerName = "None"
|
||||
bul.Dir=((tr.HitPos-bul.Src):GetNormalized())
|
||||
|
||||
bul.Attacker:FireBullets( bul )
|
||||
]]
|
||||
--
|
||||
local bul = {}
|
||||
bul.Attacker = self:GetOwner() and self:GetOwner() or self:GetOwner()
|
||||
bul.Spread = vector_origin
|
||||
bul.Src = tracedata.start
|
||||
bul.Force = self.mydamage * 0.25 * cv_fm:GetFloat()
|
||||
bul.Damage = self.mydamage
|
||||
bul.Tracer = 0 -- Show a tracer on every x bullets
|
||||
bul.TracerName = "None"
|
||||
bul.Dir = (tr.HitPos - bul.Src):GetNormalized()
|
||||
|
||||
bul.Callback = function(a, b, c)
|
||||
self:HitCB(a,b,c)
|
||||
end
|
||||
|
||||
bul.Attacker:FireBullets(bul)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
self:SetNW2Vector("lastpos", self:GetPos())
|
||||
end
|
||||
36
addons/tfa-base/lua/entities/tfbow_arrow_stuck/cl_init.lua
Normal file
36
addons/tfa-base/lua/entities/tfbow_arrow_stuck/cl_init.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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("shared.lua")
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel() -- Draw the model.
|
||||
end
|
||||
34
addons/tfa-base/lua/entities/tfbow_arrow_stuck/init.lua
Normal file
34
addons/tfa-base/lua/entities/tfbow_arrow_stuck/init.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
AddCSLuaFile("cl_init.lua") -- Make sure clientside
|
||||
AddCSLuaFile("shared.lua") -- and shared scripts are sent.
|
||||
include("shared.lua")
|
||||
85
addons/tfa-base/lua/entities/tfbow_arrow_stuck/shared.lua
Normal file
85
addons/tfa-base/lua/entities/tfbow_arrow_stuck/shared.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "TFBow Arrow Stuck"
|
||||
ENT.Author = "TheForgottenArchitect"
|
||||
ENT.Contact = "Don't"
|
||||
ENT.Purpose = "Arrow Entity"
|
||||
ENT.Instructions = "Arrow that's stuck in ground"
|
||||
|
||||
local cv_al = GetConVar("sv_tfa_arrow_lifetime")
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
if cv_al:GetInt() ~= -1 then
|
||||
timer.Simple( cv_al:GetFloat(), function()
|
||||
if IsValid(self) then
|
||||
self:Remove()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
phys:SetMass(2)
|
||||
end
|
||||
|
||||
if IsValid(self) and self.SetUseType then
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
end
|
||||
end
|
||||
|
||||
if (self:GetModel() and self:GetModel() == "") then
|
||||
self:SetModel("models/weapons/w_tfa_arrow.mdl")
|
||||
end
|
||||
|
||||
self:SetOwner(nil)
|
||||
self.PhysicsCollide = function() end
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Sleep()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator, caller)
|
||||
if activator:IsPlayer() and activator:GetWeapon(self.gun) then
|
||||
activator:GiveAmmo(1, activator:GetWeapon(self.gun):GetPrimaryAmmoType(), false)
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
--[[
|
||||
| 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("shared.lua")
|
||||
|
||||
function ENT:Draw()
|
||||
if IsValid( self:GetParent() ) then
|
||||
self:GetParent():SetupBones()
|
||||
end
|
||||
self:SetupBones()
|
||||
self:DrawModel()
|
||||
end
|
||||
@@ -0,0 +1,44 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
AddCSLuaFile("cl_init.lua")
|
||||
AddCSLuaFile("shared.lua")
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Use( activator, caller, usetype, val )
|
||||
if activator:IsPlayer() and activator:GetWeapon(self.gun) ~= nil then
|
||||
activator:GiveAmmo(1, activator:GetWeapon(self.gun):GetPrimaryAmmoType(), false)
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(data, phys)
|
||||
end
|
||||
@@ -0,0 +1,228 @@
|
||||
--[[
|
||||
| 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.
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Sawblade"
|
||||
ENT.Author = ""
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = ""
|
||||
ENT.DoNotDuplicate = true
|
||||
ENT.DisableDuplicator = true
|
||||
|
||||
ENT.glitchthreshold = 24 --threshold distance from bone to reset pos
|
||||
ENT.glitchthresholds = {}
|
||||
ENT.glitchthresholds["ValveBiped.Bip01_Head1"] = 8
|
||||
ENT.glitchthresholds["ValveBiped.Bip01_Head"] = 8
|
||||
ENT.glitchthresholds["ValveBiped.Bip01_R_Hand"] = 1
|
||||
ENT.glitchthresholds["ValveBiped.Bip01_L_Hand"] = 1
|
||||
ENT.glitchthresholds["ValveBiped.Bip01_Spine2"] = 40
|
||||
|
||||
ENT.Hull = 1.5 --Expand hull to make it easier to grab
|
||||
ENT.PredictCL = false
|
||||
ENT.UseMod = false --Experimentally modify the parent's Use func
|
||||
|
||||
local cv_al = GetConVar("sv_tfa_arrow_lifetime")
|
||||
local nzombies
|
||||
|
||||
local function GetBoneCenter(ent, bone)
|
||||
local bonechildren = ent:GetChildBones(bone)
|
||||
|
||||
if #bonechildren <= 0 then
|
||||
return ent:GetBonePosition(bone)
|
||||
else
|
||||
local bonepos = ent:GetBonePosition(bone)
|
||||
local tmppos = bonepos
|
||||
|
||||
if tmppos then
|
||||
for i = 1, #bonechildren do
|
||||
local childpos = ent:GetBonePosition(bonechildren[i])
|
||||
|
||||
if childpos then
|
||||
tmppos = (tmppos + childpos) / 2
|
||||
end
|
||||
end
|
||||
else
|
||||
return ent:GetPos()
|
||||
end
|
||||
|
||||
return tmppos
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
if nzombies == nil then
|
||||
nzombies = nZombies or NZ or NZombies or engine.ActiveGamemode() == "nzombies"
|
||||
end
|
||||
|
||||
local mdl = self:GetModel()
|
||||
|
||||
if not mdl or mdl == "" or mdl == "models/error.mdl" then
|
||||
self:SetModel("models/weapons/w_tfa_arrow.mdl")
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
|
||||
local mins = (self:OBBMins() and self:OBBMins() or Vector(0, 0, 0)) - Vector(1, 1, 1)
|
||||
local maxs = (self:OBBMaxs() and self:OBBMaxs() or Vector(0, 0, 0)) + Vector(1, 1, 1)
|
||||
self:PhysicsInitBox(mins * self.Hull, maxs * self.Hull)
|
||||
--self:PhysicsInit( SOLID_VPHYSICS )
|
||||
--self:SetSolid( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
phys:SetMass(2)
|
||||
phys:EnableGravity(false)
|
||||
phys:EnableCollisions(false)
|
||||
end
|
||||
|
||||
if self.SetUseType then
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
end
|
||||
|
||||
if cv_al:GetInt() ~= -1 then
|
||||
timer.Simple( cv_al:GetFloat(), function()
|
||||
if IsValid(self) then
|
||||
self:Remove()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
self:SetUseType( SIMPLE_USE )
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
self:TargetEnt( true )
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
self:SetPredictable(false)
|
||||
end
|
||||
|
||||
if (self:GetModel() and self:GetModel() == "") then
|
||||
self:SetModel("models/weapons/w_tfa_arrow.mdl")
|
||||
end
|
||||
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
|
||||
self:DrawShadow(true)
|
||||
end
|
||||
|
||||
function ENT:TargetEnt( init )
|
||||
if self.targent and IsValid(self.targent) then
|
||||
if init then
|
||||
local ent, bone, bonepos, bonerot
|
||||
ent = self.targent
|
||||
bone = self.targent:TranslatePhysBoneToBone(self.targphysbone)
|
||||
self.targbone = bone
|
||||
|
||||
if not ent:GetBoneCount() or ent:GetBoneCount() <= 1 or string.find(ent:GetModel(), "door") then
|
||||
bonepos = ent:GetPos()
|
||||
bonerot = ent:GetAngles()
|
||||
self.enthasbones = false
|
||||
else
|
||||
if ent.SetupBones then
|
||||
ent:SetupBones()
|
||||
end
|
||||
|
||||
bonepos, bonerot = ent:GetBonePosition(bone)
|
||||
self.enthasbones = true
|
||||
end
|
||||
|
||||
if self.enthasbones == true then
|
||||
local gpos = self:GetPos()
|
||||
local bonepos2 = GetBoneCenter(ent, bone)
|
||||
local tmpgts = self.glitchthresholds[ent:LookupBone(bone)] or self.glitchthreshold
|
||||
|
||||
while gpos:Distance(bonepos2) > tmpgts do
|
||||
self:SetPos((gpos + bonepos2) / 2)
|
||||
gpos = (gpos + bonepos2) / 2
|
||||
end
|
||||
end
|
||||
|
||||
if not bonepos then
|
||||
bonepos = ent:GetPos()
|
||||
bonerot = ent:GetAngles()
|
||||
end
|
||||
|
||||
self.posoff, self.angoff = WorldToLocal(self:GetPos(), self:GetAngles(), bonepos, bonerot)
|
||||
end
|
||||
self:FollowBone( self.targent, self.targbone or -1 )
|
||||
self:SetOwner( self.targent )
|
||||
self:SetLocalPos( self.posoff )
|
||||
self:SetLocalAngles( self.angoff )
|
||||
self.HTE = true
|
||||
if SERVER and self.PredictCL then
|
||||
timer.Simple(0.05,function()
|
||||
if IsValid(self) then
|
||||
net.Start("tfaArrowFollow")
|
||||
net.WriteEntity( self )
|
||||
net.WriteEntity( self.targent )
|
||||
net.WriteInt( self.targbone, 8 )
|
||||
net.WriteVector( self.posoff )
|
||||
net.WriteAngle( self.angoff )
|
||||
net.Broadcast()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if CLIENT and not self.PredictCL then return end
|
||||
if IsValid(self.targent) and self.targent.Health and self.targent:Health() <= 0 and self.targent.GetRagdollEntity then
|
||||
local rag = self.targent:GetRagdollEntity()
|
||||
if IsValid(rag) then
|
||||
self.targent = rag
|
||||
self:TargetEnt( false )
|
||||
end
|
||||
end
|
||||
local par = self:GetParent()
|
||||
if IsValid(par) and self.UseMod and not par.HasUseMod then
|
||||
par.HasUseMod = true
|
||||
par.ArrowUseOld = par.ArrowUseOld or par.Use
|
||||
par.Use = function( parent, ... )
|
||||
for _,v in pairs( par:GetChildren() ) do
|
||||
if v.Use then v:Use(...) end
|
||||
end
|
||||
parent:Use( ... )
|
||||
end
|
||||
par:SetUseType( SIMPLE_USE )
|
||||
end
|
||||
if SERVER and not self.HTE then
|
||||
self:TargetEnt( true )
|
||||
end
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
Reference in New Issue
Block a user