mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 21:33:46 +03:00
Upload
This commit is contained in:
50
lua/entities/applejuice/init.lua
Normal file
50
lua/entities/applejuice/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "AppleJuice" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/juicesmall.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/drinking.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/applejuice/shared.lua
Normal file
28
lua/entities/applejuice/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Apple Juice"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A small carton of apple juice"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/juicesmall.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/applejuice2/init.lua
Normal file
50
lua/entities/applejuice2/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "appleJuice2" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/juice2.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/drinking.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/applejuice2/shared.lua
Normal file
28
lua/entities/applejuice2/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Apple Juice"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/juice2.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/applejuice3/init.lua
Normal file
50
lua/entities/applejuice3/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "appleJuice3" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/juice3.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/drinking.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/applejuice3/shared.lua
Normal file
28
lua/entities/applejuice3/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Apple Juice"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/juice3.mdl")
|
||||
|
||||
end
|
||||
331
lua/entities/arccw_ammo.lua
Normal file
331
lua/entities/arccw_ammo.lua
Normal file
@@ -0,0 +1,331 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_entity"
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
ENT.PrintName = "Base Ammo"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
ENT.ArcCW_Ammo = true
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.Model = "models/items/sniper_round_box.mdl"
|
||||
ENT.MaxHealth = 40
|
||||
ENT.Scale = 1
|
||||
|
||||
ENT.AmmoType = "SniperPenetratedRound"
|
||||
ENT.AmmoCount = 5
|
||||
ENT.DetonationDamage = 10 -- Per-round damage
|
||||
ENT.DetonationRadius = 256
|
||||
ENT.DetonationSound = "weapons/arccw/glock18/glock18-1.wav" -- string or table
|
||||
|
||||
ENT.ShellModel = "models/shells/shell_9mm.mdl"
|
||||
ENT.ShellScale = 1.5
|
||||
|
||||
ENT.ResistanceMult = {
|
||||
[DMG_BURN] = 3,
|
||||
[DMG_DIRECT] = 3, -- This is also fire
|
||||
[DMG_BLAST] = 2,
|
||||
[DMG_BULLET] = 0.5,
|
||||
[DMG_BUCKSHOT] = 0.5,
|
||||
[DMG_CLUB] = 0.25,
|
||||
[DMG_SLASH] = 0.25,
|
||||
[DMG_CRUSH] = 0.25,
|
||||
[DMG_NERVEGAS] = 0,
|
||||
[DMG_POISON] = 0
|
||||
}
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel(self.Model)
|
||||
self:SetHealth(math.max(math.ceil(self.MaxHealth * ArcCW.ConVars["mult_ammohealth"]:GetFloat()), 1))
|
||||
self.AmmoCount = math.max(math.ceil(self.AmmoCount * ArcCW.ConVars["mult_ammoamount"]:GetFloat(), 1))
|
||||
self.MaxAmmoCount = self.AmmoCount
|
||||
|
||||
if engine.ActiveGamemode() == "terrortown" and ArcCW.TTTReplaceTable then
|
||||
self.AmmoType = ArcCW.TTTReplaceTable[self.AmmoType] or self.AmmoType
|
||||
end
|
||||
|
||||
if self.Scale != 1 then
|
||||
self:SetModelScale(self.Scale)
|
||||
end
|
||||
|
||||
if self:SkinCount() > 1 and math.random() <= ArcCW.ConVars["ammo_rareskin"]:GetFloat() then
|
||||
self:SetSkin(math.random(1, self:SkinCount() - 1))
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self:PhysWake()
|
||||
|
||||
self:SetTrigger(true) -- Enables Touch() to be called even when not colliding
|
||||
if ArcCW.ConVars["ammo_largetrigger"]:GetBool() then
|
||||
self:UseTriggerBounds(true, 24)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Adapted from TTT's ammo - we don't use it otherwise
|
||||
function ENT:TTT_PlayerCanPickup(ply)
|
||||
if ply == self:GetOwner() then return false end
|
||||
|
||||
local result = hook.Call("TTTCanPickupAmmo", nil, ply, self)
|
||||
if result then
|
||||
return result
|
||||
end
|
||||
|
||||
local ent = self
|
||||
local phys = ent:GetPhysicsObject()
|
||||
local spos = phys:IsValid() and phys:GetPos() or ent:OBBCenter()
|
||||
local epos = ply:GetShootPos()
|
||||
|
||||
local tr = util.TraceLine({start = spos, endpos = epos, filter = {ply, ent}, mask = MASK_SOLID})
|
||||
|
||||
-- can pickup if trace was not stopped
|
||||
return tr.Fraction == 1.0
|
||||
end
|
||||
|
||||
-- Ditto - unused outside of TTT
|
||||
function ENT:TTT_CheckForWeapon(ply)
|
||||
--[[]
|
||||
if !self.CachedWeapons then
|
||||
local tbl = {}
|
||||
for k,v in pairs(weapons.GetList()) do
|
||||
if v and v.Primary.Ammo == self.AmmoType then
|
||||
tbl[v.ClassName] = true -- WEPS.GetClass(v)
|
||||
end
|
||||
end
|
||||
self.CachedWeapons = tbl
|
||||
end
|
||||
]]
|
||||
|
||||
-- Why does TTT not iterate over the player's weapons? This is obviously faster
|
||||
for _, wep in ipairs(ply:GetWeapons()) do
|
||||
--if self.CachedWeapons[wep:GetClass()] then return true end
|
||||
-- Perform check for overwritten ammo types (attachments) and UBGLs
|
||||
if wep.ArcCW and
|
||||
(wep:GetBuff_Override("UBGL_Ammo") == self.AmmoType
|
||||
or wep:GetBuff_Override("Override_Ammo", wep.Primary.Ammo) == self.AmmoType
|
||||
or wep:GetBuff_Override("Akimbo_Ammo") == self.AmmoType) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:ApplyAmmo(ply)
|
||||
if self.USED then return end
|
||||
if engine.ActiveGamemode() == "terrortown" then
|
||||
-- Stupid checks mate... but we'll play along unless an override exists
|
||||
if !self.IgnoreTTTChecks and !self:TTT_PlayerCanPickup(ply) or !self:TTT_CheckForWeapon(ply) then return end
|
||||
|
||||
local giveCount = math.min(self.AmmoCount, ArcCW.TTTAmmoToClipMax[string.lower(self.AmmoType)] - ply:GetAmmoCount(self.AmmoType))
|
||||
if giveCount <= 0 then return end
|
||||
|
||||
self.AmmoCount = self.AmmoCount - giveCount
|
||||
ply:GiveAmmo(giveCount, self.AmmoType)
|
||||
|
||||
-- Ugly hack to let client update ammo count
|
||||
-- Why not just use NWInts or NetworkVars to begin with? Good question!
|
||||
self:SetNWInt("truecount", self.AmmoCount)
|
||||
|
||||
if self.AmmoCount <= 0 then
|
||||
self.USED = true
|
||||
self:Remove()
|
||||
end
|
||||
else
|
||||
self.USED = true -- Prevent multiple uses
|
||||
ply:GiveAmmo(self.AmmoCount, self.AmmoType)
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:DetonateRound()
|
||||
local count = math.Clamp(math.random(1, self.MaxAmmoCount / 5), 1, self.AmmoCount)
|
||||
-- Default function
|
||||
self:FireBullets({
|
||||
Attacker = self.Burner,
|
||||
Damage = self.DetonationDamage,
|
||||
Force = self.DetonationDamage / 5,
|
||||
Num = count,
|
||||
AmmoType = self.AmmoType,
|
||||
Src = self:WorldSpaceCenter(),
|
||||
Dir = self:GetUp(),
|
||||
Spread = Vector(math.pi * 2, math.pi * 2, 0),
|
||||
IgnoreEntity = self
|
||||
})
|
||||
self.AmmoCount = self.AmmoCount - count
|
||||
|
||||
self:GetPhysicsObject():AddVelocity(VectorRand() * math.random(30, 50) * self:GetPhysicsObject():GetMass())
|
||||
self:GetPhysicsObject():AddAngleVelocity(VectorRand() * math.random(60, 300))
|
||||
|
||||
if self.DetonationSound then
|
||||
self:EmitSound(istable(self.DetonationSound) and table.Random(self.DetonationSound) or self.DetonationSound)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Detonate(wet, attacker)
|
||||
if wet then
|
||||
self:FireBullets({
|
||||
Attacker = attacker,
|
||||
Damage = self.DetonationDamage,
|
||||
Force = self.DetonationDamage / 5,
|
||||
Num = math.max(self.AmmoCount, 50),
|
||||
AmmoType = self.AmmoType,
|
||||
Src = self:WorldSpaceCenter(),
|
||||
Dir = self:GetUp(),
|
||||
Spread = Vector(math.pi * 2, math.pi * 2, 0),
|
||||
IgnoreEntity = self
|
||||
})
|
||||
end
|
||||
|
||||
local e = EffectData()
|
||||
e:SetOrigin(self:GetPos())
|
||||
util.Effect("Explosion", e)
|
||||
|
||||
util.BlastDamage(self, attacker, self:GetPos(), self.DetonationRadius, self.DetonationDamage * (wet and 0.5 or 1))
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
|
||||
function ENT:Use(ply)
|
||||
if !ply:IsPlayer() then return end
|
||||
self:ApplyAmmo(ply)
|
||||
end
|
||||
|
||||
|
||||
function ENT:Touch(ply)
|
||||
if !ply:IsPlayer() or !ArcCW.ConVars["ammo_autopickup"]:GetBool() then return end
|
||||
self:ApplyAmmo(ply)
|
||||
end
|
||||
|
||||
function ENT:Burn(attacker)
|
||||
self.Burning = true
|
||||
self.Burner = attacker
|
||||
self:Ignite(30)
|
||||
self:SetHealth(-1)
|
||||
end
|
||||
|
||||
function ENT:OnTakeDamage(dmginfo)
|
||||
|
||||
if self:Health() <= 0 or self.USED then return end
|
||||
|
||||
--self:TakePhysicsDamage(dmginfo)
|
||||
self:SetHealth(self:Health() - dmginfo:GetDamage())
|
||||
|
||||
if self:Health() <= 0 then
|
||||
|
||||
self.USED = true
|
||||
|
||||
local cvar = ArcCW.ConVars["ammo_detonationmode"]:GetInt()
|
||||
|
||||
if cvar == -1 or (!ArcCW.ConVars["ammo_chaindet"]:GetBool() and dmginfo:GetInflictor().ArcCW_Ammo) or self.DetonationDamage <= 0 then
|
||||
-- Go quietly
|
||||
local e = EffectData()
|
||||
e:SetOrigin(self:GetPos())
|
||||
e:SetMagnitude(8)
|
||||
e:SetScale(2)
|
||||
util.Effect("Sparks", e)
|
||||
self:EmitSound("physics/cardboard/cardboard_box_break2.wav", 80, 120)
|
||||
self:Remove()
|
||||
elseif cvar == 2 and (math.random() <= 0.25 or dmginfo:IsDamageType(DMG_BURN)) then
|
||||
-- Fancy ammobox burning
|
||||
self:Burn(dmginfo:GetAttacker())
|
||||
else
|
||||
-- Plain old explosion
|
||||
self:Detonate(cvar >= 1, dmginfo:GetAttacker())
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if self.Burning then
|
||||
|
||||
if self.AmmoCount <= 0 then
|
||||
self:Detonate(false, IsValid(self.Burner) and self.Burner or self)
|
||||
else
|
||||
self:DetonateRound()
|
||||
end
|
||||
|
||||
self:NextThink(CurTime() + math.random() * 0.3 + 0.2)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- Do it during the hook so that hit damage numbers show up properly (yes, I am _that_ pedantic)
|
||||
hook.Add("EntityTakeDamage", "ArcCW_Ammo", function(ent, dmginfo)
|
||||
if ent.ArcCW_Ammo then
|
||||
if ArcCW.ConVars["mult_ammohealth"]:GetFloat() < 0 then
|
||||
dmginfo:ScaleDamage(0)
|
||||
elseif ent.ResistanceMult then
|
||||
-- Only apply one multiplier, and prioritize larger ones
|
||||
for k, v in SortedPairsByValue(ent.ResistanceMult, true) do if dmginfo:IsDamageType(k) then dmginfo:ScaleDamage(v) break end end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
elseif CLIENT then
|
||||
|
||||
function ENT:DrawTranslucent()
|
||||
self:Draw()
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
local cvar2d3d = ArcCW.ConVars["2d3d"]:GetInt()
|
||||
if cvar2d3d == 0 or (cvar2d3d == 1 and LocalPlayer():GetEyeTrace().Entity != self) then return end
|
||||
|
||||
if (EyePos() - self:GetPos()):LengthSqr() <= 262144 then -- 512^2
|
||||
local ang = LocalPlayer():EyeAngles()
|
||||
|
||||
ang:RotateAroundAxis(ang:Forward(), 180)
|
||||
ang:RotateAroundAxis(ang:Right(), 90)
|
||||
ang:RotateAroundAxis(ang:Up(), 90)
|
||||
|
||||
cam.Start3D2D(self:WorldSpaceCenter() + Vector(0, 0, (self:OBBMaxs().z - self:OBBMins().z) * 0.5 + 8) , ang, 0.1)
|
||||
surface.SetFont("ArcCW_32_Unscaled")
|
||||
|
||||
local w = surface.GetTextSize(self.PrintName)
|
||||
|
||||
surface.SetTextPos(-w / 2 + 2, 2)
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.DrawText(self.PrintName)
|
||||
|
||||
surface.SetTextPos(-w / 2, 0)
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.DrawText(self.PrintName)
|
||||
|
||||
local ammo = self:GetNWInt("truecount", -1) != -1 and self:GetNWInt("truecount", -1) or self.AmmoCount
|
||||
if ammo then
|
||||
w = surface.GetTextSize("×" .. ammo)
|
||||
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.SetTextPos(-w / 2 + 2, 27)
|
||||
surface.DrawText("×" .. ammo)
|
||||
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.SetTextPos(-w / 2, 25)
|
||||
surface.DrawText("×" .. ammo)
|
||||
end
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
32
lua/entities/arccw_ammo_357.lua
Normal file
32
lua/entities/arccw_ammo_357.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
ENT.PrintName = "Magnum Ammo"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/magnum_ammo.mdl"
|
||||
|
||||
ENT.AmmoType = "357"
|
||||
ENT.AmmoCount = 12
|
||||
if engine.ActiveGamemode() == "terrortown" then
|
||||
ENT.AmmoType = "AlyxGun"
|
||||
ENT.AmmoCount = 18
|
||||
end
|
||||
|
||||
|
||||
ENT.DetonationDamage = 50
|
||||
ENT.DetonationRadius = 128
|
||||
ENT.DetonationSound = "weapons/357_fire2.wav"
|
||||
28
lua/entities/arccw_ammo_357_large.lua
Normal file
28
lua/entities/arccw_ammo_357_large.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
ENT.PrintName = "Magnum Ammo (Large)"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/magnum_ammo_closed.mdl"
|
||||
|
||||
ENT.AmmoType = "357"
|
||||
ENT.AmmoCount = 60
|
||||
ENT.Scale = 1.5
|
||||
|
||||
ENT.DetonationDamage = 50
|
||||
ENT.DetonationRadius = 128
|
||||
ENT.DetonationSound = "weapons/357_fire2.wav"
|
||||
27
lua/entities/arccw_ammo_ar2.lua
Normal file
27
lua/entities/arccw_ammo_ar2.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
ENT.PrintName = "Rifle Ammo"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/rifle_ammo.mdl"
|
||||
|
||||
ENT.AmmoType = "ar2"
|
||||
ENT.AmmoCount = 30
|
||||
|
||||
ENT.DetonationDamage = 50
|
||||
ENT.DetonationRadius = 256
|
||||
ENT.DetonationSound = "weapons/ar1/ar1_dist2.wav"
|
||||
28
lua/entities/arccw_ammo_ar2_large.lua
Normal file
28
lua/entities/arccw_ammo_ar2_large.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
ENT.PrintName = "Rifle Ammo (Large)"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/rifle_ammo.mdl"
|
||||
ENT.Scale = 1.5
|
||||
|
||||
ENT.AmmoType = "ar2"
|
||||
ENT.AmmoCount = 150
|
||||
|
||||
ENT.DetonationDamage = 50
|
||||
ENT.DetonationRadius = 256
|
||||
ENT.DetonationSound = "weapons/ar1/ar1_dist2.wav"
|
||||
29
lua/entities/arccw_ammo_buckshot.lua
Normal file
29
lua/entities/arccw_ammo_buckshot.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Shotgun Ammo"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/shotgun_ammo.mdl"
|
||||
|
||||
ENT.AmmoType = "buckshot"
|
||||
ENT.AmmoCount = 20
|
||||
if engine.ActiveGamemode() == "terrortown" then
|
||||
ENT.AmmoCount = 12
|
||||
end
|
||||
|
||||
ENT.DetonationDamage = 80
|
||||
ENT.DetonationRadius = 128
|
||||
ENT.DetonationSound = "weapons/shotgun/shotgun_fire6.wav"
|
||||
27
lua/entities/arccw_ammo_buckshot_large.lua
Normal file
27
lua/entities/arccw_ammo_buckshot_large.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Shotgun Ammo (Large)"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/shotgun_ammo_closed.mdl"
|
||||
ENT.Scale = 1.5
|
||||
|
||||
ENT.AmmoType = "buckshot"
|
||||
ENT.AmmoCount = 100
|
||||
|
||||
ENT.DetonationDamage = 80
|
||||
ENT.DetonationRadius = 128
|
||||
ENT.DetonationSound = "weapons/shotgun/shotgun_fire6.wav"
|
||||
26
lua/entities/arccw_ammo_pistol.lua
Normal file
26
lua/entities/arccw_ammo_pistol.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Pistol Ammo"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/pistol_ammo.mdl"
|
||||
|
||||
ENT.AmmoType = "pistol"
|
||||
ENT.AmmoCount = 40
|
||||
|
||||
ENT.DetonationDamage = 10
|
||||
ENT.DetonationRadius = 256
|
||||
ENT.DetonationSound = "weapons/pistol/pistol_fire3.wav"
|
||||
27
lua/entities/arccw_ammo_pistol_large.lua
Normal file
27
lua/entities/arccw_ammo_pistol_large.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Pistol Ammo (Large)"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/pistol_ammo.mdl"
|
||||
ENT.Scale = 1.5
|
||||
|
||||
ENT.AmmoType = "pistol"
|
||||
ENT.AmmoCount = 200
|
||||
|
||||
ENT.DetonationDamage = 10
|
||||
ENT.DetonationRadius = 256
|
||||
ENT.DetonationSound = "weapons/pistol/pistol_fire3.wav"
|
||||
33
lua/entities/arccw_ammo_plinking.lua
Normal file
33
lua/entities/arccw_ammo_plinking.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
ENT.PrintName = "Plinking Ammo"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/plinking_ammo.mdl"
|
||||
|
||||
ENT.AmmoType = "plinking"
|
||||
ENT.AmmoCount = 100
|
||||
|
||||
ENT.DetonationDamage = 10
|
||||
ENT.DetonationRadius = 128
|
||||
ENT.DetonationSound = nil
|
||||
|
||||
DEFINE_BASECLASS(ENT.Base)
|
||||
function ENT:DetonateRound()
|
||||
BaseClass.DetonateRound(self)
|
||||
self:EmitSound("weapons/pistol/pistol_fire2.wav", 70, 175, 0.8)
|
||||
end
|
||||
34
lua/entities/arccw_ammo_plinking_large.lua
Normal file
34
lua/entities/arccw_ammo_plinking_large.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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
ENT.PrintName = "Plinking Ammo (Large)"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/plinking_ammo.mdl"
|
||||
ENT.Scale = 1.5
|
||||
|
||||
ENT.AmmoType = "plinking"
|
||||
ENT.AmmoCount = 500
|
||||
|
||||
ENT.DetonationDamage = 10
|
||||
ENT.DetonationRadius = 128
|
||||
ENT.DetonationSound = nil
|
||||
|
||||
DEFINE_BASECLASS(ENT.Base)
|
||||
function ENT:DetonateRound()
|
||||
BaseClass.DetonateRound(self)
|
||||
self:EmitSound("weapons/pistol/pistol_fire2.wav", 70, 175, 0.8)
|
||||
end
|
||||
29
lua/entities/arccw_ammo_smg1.lua
Normal file
29
lua/entities/arccw_ammo_smg1.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Carbine Ammo"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/smg_ammo.mdl"
|
||||
|
||||
ENT.AmmoType = "smg1"
|
||||
ENT.AmmoCount = 60
|
||||
if engine.ActiveGamemode() == "terrortown" then
|
||||
ENT.AmmoCount = 30
|
||||
end
|
||||
|
||||
ENT.DetonationDamage = 30
|
||||
ENT.DetonationRadius = 256
|
||||
ENT.DetonationSound = "weapons/smg1/npc_smg1_fire1.wav"
|
||||
49
lua/entities/arccw_ammo_smg1_grenade.lua
Normal file
49
lua/entities/arccw_ammo_smg1_grenade.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Rifle Grenade"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/Items/AR2_Grenade.mdl"
|
||||
ENT.Health = 15
|
||||
|
||||
ENT.AmmoType = "smg1_grenade"
|
||||
ENT.AmmoCount = 1
|
||||
|
||||
ENT.DetonationDamage = 50 -- Per-round damage
|
||||
ENT.DetonationRadius = 300
|
||||
|
||||
function ENT:DetonateRound(attacker)
|
||||
local nade = ents.Create("arccw_gl_ammodet")
|
||||
nade:SetPos(self:GetPos())
|
||||
nade:SetAngles(self:GetAngles() + AngleRand(-10, 10))
|
||||
nade:Spawn()
|
||||
nade:GetPhysicsObject():AddVelocity(self:GetVelocity() + self:GetForward() * math.random(500, 2000))
|
||||
nade:SetOwner(attacker or self.Burner)
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
function ENT:Detonate(wet, attacker)
|
||||
if wet then
|
||||
self:DetonateRound(attacker)
|
||||
else
|
||||
local e = EffectData()
|
||||
e:SetOrigin(self:GetPos())
|
||||
util.Effect("Explosion", e)
|
||||
|
||||
util.BlastDamage(self, attacker, self:GetPos(), self.DetonationRadius, self.DetonationDamage)
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
58
lua/entities/arccw_ammo_smg1_grenade_large.lua
Normal file
58
lua/entities/arccw_ammo_smg1_grenade_large.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Rifle Grenade Box"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/riflegrenade_ammo.mdl"
|
||||
ENT.Health = 70
|
||||
|
||||
ENT.AmmoType = "smg1_grenade"
|
||||
ENT.AmmoCount = 5
|
||||
|
||||
ENT.DetonationDamage = 100 -- Per-round damage
|
||||
ENT.DetonationRadius = 300
|
||||
|
||||
function ENT:DetonateRound(attacker)
|
||||
local nade = ents.Create("arccw_gl_ammodet")
|
||||
nade:SetPos(self:GetPos())
|
||||
local v = self:GetUp():Angle() + AngleRand(-60, 60)
|
||||
nade:SetAngles(v)
|
||||
nade:Spawn()
|
||||
nade:GetPhysicsObject():AddVelocity(self:GetVelocity() + self:GetForward() * math.random(2000, 3000))
|
||||
nade:SetOwner(attacker or self.Burner)
|
||||
|
||||
self.AmmoCount = self.AmmoCount - 1
|
||||
|
||||
self:GetPhysicsObject():AddVelocity(VectorRand() * math.random(5, 10) * self:GetPhysicsObject():GetMass())
|
||||
self:GetPhysicsObject():AddAngleVelocity(VectorRand() * math.random(60, 300))
|
||||
|
||||
self:EmitSound("weapons/ar2/ar2_altfire.wav", 80, 150)
|
||||
end
|
||||
|
||||
function ENT:Detonate(wet, attacker)
|
||||
if wet then
|
||||
for i = 1, math.random(1, 3) do
|
||||
self:DetonateRound(attacker)
|
||||
end
|
||||
end
|
||||
|
||||
local e = EffectData()
|
||||
e:SetOrigin(self:GetPos())
|
||||
util.Effect("Explosion", e)
|
||||
|
||||
util.BlastDamage(self, attacker, self:GetPos(), self.DetonationRadius, self.DetonationDamage * (wet and 1 or 2))
|
||||
self:Remove()
|
||||
end
|
||||
27
lua/entities/arccw_ammo_smg1_large.lua
Normal file
27
lua/entities/arccw_ammo_smg1_large.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Carbine Ammo (Large)"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/smg_ammo.mdl"
|
||||
ENT.Scale = 1.5
|
||||
|
||||
ENT.AmmoType = "smg1"
|
||||
ENT.AmmoCount = 300
|
||||
|
||||
ENT.DetonationDamage = 30
|
||||
ENT.DetonationRadius = 256
|
||||
ENT.DetonationSound = "weapons/smg1/npc_smg1_fire1.wav"
|
||||
30
lua/entities/arccw_ammo_sniper.lua
Normal file
30
lua/entities/arccw_ammo_sniper.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Sniper Ammo"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/sniper_ammo.mdl"
|
||||
|
||||
ENT.AmmoType = "SniperPenetratedRound"
|
||||
ENT.AmmoCount = 10
|
||||
ENT.MaxHealth = 20
|
||||
if engine.ActiveGamemode() == "terrortown" then
|
||||
ENT.AmmoType = "357"
|
||||
end
|
||||
|
||||
ENT.DetonationDamage = 80
|
||||
ENT.DetonationRadius = 128
|
||||
ENT.DetonationSound = "npc/sniper/echo1.wav"
|
||||
28
lua/entities/arccw_ammo_sniper_large.lua
Normal file
28
lua/entities/arccw_ammo_sniper_large.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_ammo"
|
||||
|
||||
ENT.PrintName = "Sniper Ammo (Large)"
|
||||
ENT.Category = "ArcCW - Ammo"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/items/arccw/sniper_ammo.mdl"
|
||||
ENT.Scale = 1.5
|
||||
|
||||
ENT.AmmoType = "SniperPenetratedRound"
|
||||
ENT.AmmoCount = 50
|
||||
ENT.MaxHealth = 20
|
||||
|
||||
ENT.DetonationDamage = 80
|
||||
ENT.DetonationRadius = 128
|
||||
ENT.DetonationSound = "npc/sniper/echo1.wav"
|
||||
142
lua/entities/arccw_att_base/shared.lua
Normal file
142
lua/entities/arccw_att_base/shared.lua
Normal file
@@ -0,0 +1,142 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_entity"
|
||||
ENT.PrintName = "Base Dropped Attachment"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
|
||||
ENT.Spawnable = false
|
||||
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
ENT.Category = "ArcCW - Attachments"
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.GiveAttachments = nil -- table of all the attachments to give, and in what quantity. {{["id"] = int quantity}}
|
||||
|
||||
ENT.SoundImpact = "weapon.ImpactSoft"
|
||||
ENT.Model = ""
|
||||
|
||||
if SERVER then
|
||||
|
||||
function ENT:Initialize()
|
||||
if !self.Model then
|
||||
self:Remove()
|
||||
return
|
||||
end
|
||||
|
||||
self:SetModel(self.Model)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
self:SetTrigger( true )
|
||||
self:SetPos(self:GetPos() + Vector(0, 0, 4))
|
||||
local phys = self:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
phys:SetBuoyancyRatio(0)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(colData, collider)
|
||||
if colData.DeltaTime < 0.25 then return end
|
||||
|
||||
self:EmitSound(self.SoundImpact)
|
||||
end
|
||||
|
||||
function ENT:Use(activator, caller)
|
||||
if !caller:IsPlayer() then return end
|
||||
|
||||
if ArcCW.ConVars["attinv_free"]:GetBool() then return end
|
||||
|
||||
local take = false
|
||||
|
||||
for i, k in pairs(self.GiveAttachments) do
|
||||
if i == "BaseClass" then continue end
|
||||
|
||||
if ArcCW.ConVars["attinv_lockmode"]:GetBool() then
|
||||
if ArcCW:PlayerGetAtts(caller, i) > 0 then
|
||||
continue
|
||||
end
|
||||
end
|
||||
|
||||
if hook.Run("ArcCW_PickupAttEnt", caller, i, k) then continue end
|
||||
|
||||
ArcCW:PlayerGiveAtt(caller, i, k)
|
||||
|
||||
take = true
|
||||
end
|
||||
|
||||
if take then
|
||||
ArcCW:PlayerSendAttInv(caller)
|
||||
|
||||
self:EmitSound("weapons/arccw/useatt.wav")
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
local defaulticon = Material("arccw/hud/atts/default.png")
|
||||
local iw = 64
|
||||
|
||||
function ENT:DrawTranslucent()
|
||||
self:Draw()
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
local cvar2d3d = ArcCW.ConVars["2d3d"]:GetInt()
|
||||
if cvar2d3d == 0 or (cvar2d3d == 1 and LocalPlayer():GetEyeTrace().Entity != self) then return end
|
||||
|
||||
if self.PrintName == "Base Dropped Attachment" and self:GetNWInt("attid", -1) != -1 then
|
||||
local att = ArcCW.AttachmentIDTable[self:GetNWInt("attid", -1)]
|
||||
|
||||
if !att then return end
|
||||
|
||||
local atttbl = ArcCW.AttachmentTable[att]
|
||||
|
||||
if !atttbl then return end
|
||||
|
||||
self.PrintName = atttbl.PrintName or att
|
||||
self.Icon = atttbl.Icon or defaulticon
|
||||
end
|
||||
|
||||
if (EyePos() - self:WorldSpaceCenter()):LengthSqr() <= 262144 then -- 512^2
|
||||
local ang = LocalPlayer():EyeAngles()
|
||||
|
||||
ang:RotateAroundAxis(ang:Forward(), 180)
|
||||
ang:RotateAroundAxis(ang:Right(), 90)
|
||||
ang:RotateAroundAxis(ang:Up(), 90)
|
||||
|
||||
cam.Start3D2D(self:WorldSpaceCenter() + Vector(0, 0, 16), ang, 0.1)
|
||||
surface.SetFont("ArcCW_32_Unscaled")
|
||||
|
||||
local w = surface.GetTextSize(self.PrintName)
|
||||
surface.SetTextPos(-w / 2 + 2, 2)
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.DrawText(self.PrintName)
|
||||
surface.SetTextPos(-w / 2, 0)
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.DrawText(self.PrintName)
|
||||
|
||||
surface.SetDrawColor(255, 255, 255)
|
||||
surface.SetMaterial(self.Icon or defaulticon)
|
||||
surface.DrawTexturedRect(-iw / 2, iw / 2, iw, iw)
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
59
lua/entities/arccw_att_dropped.lua
Normal file
59
lua/entities/arccw_att_dropped.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_att_base"
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
ENT.Category = "ArcCW - Attachments"
|
||||
ENT.PrintName = "Attachment Box"
|
||||
ENT.Spawnable = false
|
||||
|
||||
ENT.Model = "models/Items/BoxMRounds.mdl"
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
local cvar2d3d = ArcCW.ConVars["2d3d"]:GetInt()
|
||||
if cvar2d3d == 0 or (cvar2d3d == 1 and LocalPlayer():GetEyeTrace().Entity != self) then return end
|
||||
|
||||
if (EyePos() - self:WorldSpaceCenter()):LengthSqr() <= 262144 then -- 512^2
|
||||
local ang = LocalPlayer():EyeAngles()
|
||||
local name = self:GetNWString("boxname", nil) or self.PrintName
|
||||
|
||||
ang:RotateAroundAxis(ang:Forward(), 180)
|
||||
ang:RotateAroundAxis(ang:Right(), 90)
|
||||
ang:RotateAroundAxis(ang:Up(), 90)
|
||||
|
||||
cam.Start3D2D(self:WorldSpaceCenter() + Vector(0, 0, 14), ang, 0.1)
|
||||
surface.SetFont("ArcCW_32_Unscaled")
|
||||
local w = surface.GetTextSize(name)
|
||||
|
||||
surface.SetTextPos(-w / 2 + 2, 2)
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.DrawText(name)
|
||||
|
||||
surface.SetTextPos(-w / 2, 0)
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.DrawText(name)
|
||||
|
||||
local count = self:GetNWInt("boxcount", 0)
|
||||
local str = count .. " Attachment" .. (count != 1 and "s" or "")
|
||||
local w2 = surface.GetTextSize(str)
|
||||
|
||||
surface.SetTextPos(-w2 / 2 + 2, 26)
|
||||
surface.SetTextColor(0, 0, 0, 150)
|
||||
surface.DrawText(str)
|
||||
surface.SetTextPos(-w2 / 2, 24)
|
||||
surface.SetTextColor(255, 255, 255, 255)
|
||||
surface.DrawText(str)
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
126
lua/entities/arccw_gl_ammodet.lua
Normal file
126
lua/entities/arccw_gl_ammodet.lua
Normal file
@@ -0,0 +1,126 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_entity"
|
||||
ENT.PrintName = "HE Round"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
|
||||
ENT.Spawnable = false
|
||||
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Model = "models/items/ar2_grenade.mdl"
|
||||
ENT.Ticks = 0
|
||||
ENT.FuseTime = 10
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
ENT.Ticks = 0
|
||||
|
||||
function ENT:Detonate()
|
||||
if !self:IsValid() then return end
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin( self:GetPos() )
|
||||
|
||||
if self:WaterLevel() >= 1 then
|
||||
util.Effect( "WaterSurfaceExplosion", effectdata )
|
||||
self:EmitSound("weapons/underwater_explode3.wav", 125, 100, 1, CHAN_AUTO)
|
||||
else
|
||||
util.Effect( "Explosion", effectdata)
|
||||
self:EmitSound("phx/kaboom.wav", 125, 100, 1, CHAN_AUTO)
|
||||
end
|
||||
|
||||
local attacker = self
|
||||
|
||||
if self:GetOwner():IsValid() then
|
||||
attacker = self:GetOwner()
|
||||
end
|
||||
|
||||
util.BlastDamage(self, attacker, self:GetPos(), 300, 50)
|
||||
|
||||
self:FireBullets({
|
||||
Attacker = attacker,
|
||||
Damage = 0,
|
||||
Tracer = 0,
|
||||
Distance = 20000,
|
||||
Dir = self:GetVelocity(),
|
||||
Src = self:GetPos(),
|
||||
Callback = function(att, tr, dmg)
|
||||
util.Decal("Scorch", tr.StartPos, tr.HitPos - (tr.HitNormal * 16), self)
|
||||
end
|
||||
})
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Think()
|
||||
if self.Ticks % 2 == 0 then
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
|
||||
if !self:IsValid() or self:WaterLevel() > 2 then return end
|
||||
if !IsValid(emitter) then return end
|
||||
|
||||
local smoke = emitter:Add("particle/particle_smokegrenade", self:GetPos())
|
||||
smoke:SetVelocity( VectorRand() * 25 )
|
||||
smoke:SetGravity( Vector(math.Rand(-5, 5), math.Rand(-5, 5), math.Rand(-20, -25)) )
|
||||
smoke:SetDieTime( math.Rand(1.5, 2.0) )
|
||||
smoke:SetStartAlpha( 255 )
|
||||
smoke:SetEndAlpha( 0 )
|
||||
smoke:SetStartSize( 0 )
|
||||
smoke:SetEndSize( 100 )
|
||||
smoke:SetRoll( math.Rand(-180, 180) )
|
||||
smoke:SetRollDelta( math.Rand(-0.2,0.2) )
|
||||
smoke:SetColor( 20, 20, 20 )
|
||||
smoke:SetAirResistance( 5 )
|
||||
smoke:SetPos( self:GetPos() )
|
||||
smoke:SetLighting( false )
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
self.Ticks = self.Ticks + 1
|
||||
end
|
||||
else
|
||||
|
||||
function ENT:Initialize()
|
||||
local pb_vert = 1
|
||||
local pb_hor = 1
|
||||
self:SetModel(self.Model)
|
||||
self:PhysicsInitBox( Vector(-pb_vert,-pb_hor,-pb_hor), Vector(pb_vert,pb_hor,pb_hor) )
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
self.SpawnTime = CurTime()
|
||||
|
||||
timer.Simple(0.1, function()
|
||||
if !IsValid(self) then return end
|
||||
self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE)
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if SERVER and CurTime() - self.SpawnTime >= self.FuseTime then
|
||||
self:Detonate()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(colData, collider)
|
||||
self:Detonate()
|
||||
end
|
||||
|
||||
end
|
||||
131
lua/entities/arccw_smoke/shared.lua
Normal file
131
lua/entities/arccw_smoke/shared.lua
Normal file
@@ -0,0 +1,131 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_entity"
|
||||
ENT.PrintName = "Smoke Cloud"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
local smokeimages = {"particle/smokesprites_0002", "particle/smokesprites_0003", "particle/smokesprites_0004", "particle/smokesprites_0005", "particle/smokesprites_0006", "particle/smokesprites_0007", "particle/smokesprites_0008", "particle/smokesprites_0009", "particle/smokesprites_0010", "particle/smokesprites_0011", "particle/smokesprites_0012", "particle/smokesprites_0013", "particle/smokesprites_0014", "particle/smokesprites_0015", "particle/smokesprites_0016"}
|
||||
|
||||
local function GetSmokeImage()
|
||||
return smokeimages[math.random(#smokeimages)]
|
||||
end
|
||||
|
||||
ENT.Particles = nil
|
||||
ENT.SmokeRadius = 256
|
||||
ENT.SmokeColor = Color(150, 150, 150)
|
||||
ENT.BillowTime = 1
|
||||
ENT.Life = 15
|
||||
|
||||
ENT.ArcCWSmoke = true
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
self:SetModel( "models/weapons/w_eq_smokegrenade_thrown.mdl" )
|
||||
self:SetMoveType( MOVETYPE_NONE )
|
||||
self:SetSolid( SOLID_NONE )
|
||||
self:DrawShadow( false )
|
||||
else
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
|
||||
self.Particles = {}
|
||||
|
||||
local amt = 20
|
||||
|
||||
for i = 1, amt do
|
||||
local smoke = emitter:Add(GetSmokeImage(), self:GetPos())
|
||||
smoke:SetVelocity( VectorRand() * 8 + (Angle(0, i * (360 / amt), 0):Forward() * 400) )
|
||||
smoke:SetStartAlpha( 0 )
|
||||
smoke:SetEndAlpha( 255 )
|
||||
smoke:SetStartSize( 0 )
|
||||
smoke:SetEndSize( self.SmokeRadius )
|
||||
smoke:SetRoll( math.Rand(-180, 180) )
|
||||
smoke:SetRollDelta( math.Rand(-0.2,0.2) )
|
||||
smoke:SetColor( self.SmokeColor.r, self.SmokeColor.g, self.SmokeColor.b )
|
||||
smoke:SetAirResistance( 75 )
|
||||
smoke:SetPos( self:GetPos() )
|
||||
smoke:SetCollide( true )
|
||||
smoke:SetBounce( 0.2 )
|
||||
smoke:SetLighting( false )
|
||||
smoke:SetNextThink( CurTime() + FrameTime() )
|
||||
smoke.bt = CurTime() + self.BillowTime
|
||||
smoke.dt = CurTime() + self.BillowTime + self.Life
|
||||
smoke.ft = CurTime() + self.BillowTime + self.Life + math.Rand(2.5, 5)
|
||||
smoke:SetDieTime(smoke.ft)
|
||||
smoke.life = self.Life
|
||||
smoke.billowed = false
|
||||
smoke.radius = self.SmokeRadius
|
||||
smoke:SetThinkFunction( function(pa)
|
||||
if !pa then return end
|
||||
|
||||
local prog = 1
|
||||
local alph = 0
|
||||
|
||||
if pa.ft < CurTime() then
|
||||
return
|
||||
elseif pa.dt < CurTime() then
|
||||
local d = (CurTime() - pa.dt) / (pa.ft - pa.dt)
|
||||
|
||||
alph = 1 - d
|
||||
elseif pa.bt < CurTime() then
|
||||
alph = 1
|
||||
else
|
||||
local d = math.Clamp(pa:GetLifeTime() / (pa.bt - CurTime()), 0, 1)
|
||||
|
||||
prog = (-d ^ 2) + (2 * d)
|
||||
|
||||
alph = d
|
||||
end
|
||||
|
||||
pa:SetEndSize( pa.radius * prog )
|
||||
pa:SetStartSize( pa.radius * prog )
|
||||
|
||||
pa:SetStartAlpha(255 * alph)
|
||||
pa:SetEndAlpha(255 * alph)
|
||||
|
||||
pa:SetNextThink( CurTime() + FrameTime() )
|
||||
end )
|
||||
|
||||
table.insert(self.Particles, smoke)
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
end
|
||||
|
||||
self.dt = CurTime() + self.Life + self.BillowTime
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
|
||||
if SERVER then
|
||||
local targets = ents.FindInSphere(self:GetPos(), 256)
|
||||
for _, k in pairs(targets) do
|
||||
if k:IsNPC() then
|
||||
k:SetSchedule(SCHED_STANDOFF)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.dt < CurTime() then
|
||||
if SERVER then
|
||||
SafeRemoveEntity(self)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
return false
|
||||
end
|
||||
143
lua/entities/arccw_uc_40mm_airburst.lua
Normal file
143
lua/entities/arccw_uc_40mm_airburst.lua
Normal file
@@ -0,0 +1,143 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_40mm_he"
|
||||
ENT.PrintName = "40mm Airburst"
|
||||
|
||||
ENT.GrenadeDamage = 75
|
||||
ENT.GrenadeRadius = 300
|
||||
ENT.ExplosionEffect = false
|
||||
ENT.Scorch = false
|
||||
ENT.DragCoefficient = 0.75
|
||||
ENT.DetonateOnImpact = false
|
||||
|
||||
ENT.NextTraceTime = 0
|
||||
|
||||
if SERVER then
|
||||
function ENT:Think()
|
||||
if SERVER and CurTime() - self.SpawnTime >= self.FuseTime then
|
||||
self:Detonate()
|
||||
end
|
||||
|
||||
if self.SpawnTime + 0.2 < CurTime() and self.NextTraceTime < CurTime() then
|
||||
self.NextTraceTime = CurTime() + 0.1
|
||||
|
||||
local dir = self:GetVelocity():GetNormalized()
|
||||
local deg = math.Clamp(1.5 - dir:Cross(Vector(0, 0, -1)):Length(), 0.5, 1)
|
||||
|
||||
local tr = util.TraceHull({
|
||||
start = self:GetPos(),
|
||||
endpos = self:GetPos() + dir * (1024 * deg),
|
||||
filter = self,
|
||||
mins = Vector(-16, -16, -8),
|
||||
maxs = Vector(16, 16, 8)
|
||||
})
|
||||
if tr.Hit then
|
||||
self:Detonate()
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:DoDetonation()
|
||||
local attacker = IsValid(self:GetOwner()) and self:GetOwner() or self
|
||||
local dir = self:GetVelocity():GetNormalized()
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
|
||||
if self:WaterLevel() >= 1 then
|
||||
util.Effect("WaterSurfaceExplosion", effectdata)
|
||||
self:EmitSound("weapons/underwater_explode3.wav", 125, 100, 1, CHAN_AUTO)
|
||||
else
|
||||
effectdata:SetMagnitude(4)
|
||||
effectdata:SetScale(1)
|
||||
effectdata:SetRadius(4)
|
||||
effectdata:SetNormal(dir)
|
||||
util.Effect("Sparks", effectdata)
|
||||
self:EmitSound("physics/metal/metal_box_break1.wav", 100, 200)
|
||||
end
|
||||
|
||||
-- The steeper the vertical angle, the higher the damage
|
||||
local deg = math.Clamp(1.5 - dir:Cross(Vector(0, 0, -1)):Length(), 0.5, 1)
|
||||
|
||||
self:FireBullets({
|
||||
Attacker = attacker,
|
||||
Damage = 25,
|
||||
Force = 5,
|
||||
Distance = 2048,
|
||||
HullSize = 16,
|
||||
Num = 64,
|
||||
Tracer = 1,
|
||||
Src = self:GetPos(),
|
||||
Dir = dir,
|
||||
Spread = Vector(1, 1, 0),
|
||||
IgnoreEntity = self,
|
||||
})
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetAttacker(IsValid(self:GetOwner()) and self:GetOwner() or self)
|
||||
dmg:SetDamageType(DMG_BULLET)
|
||||
dmg:SetInflictor(self)
|
||||
dmg:SetDamageForce(self:GetVelocity() * 100)
|
||||
for _, ent in pairs(ents.FindInCone(self:GetPos(), dir, 1024, 0.707)) do
|
||||
local tr = util.QuickTrace(self:GetPos(), ent:WorldSpaceCenter() - self:GetPos(), self)
|
||||
if tr.Entity == ent then
|
||||
dmg:SetDamage(math.Rand(75, 150) * deg * math.Clamp(tr.Fraction, 0.5, 1))
|
||||
ent:TakeDamageInfo(dmg)
|
||||
end
|
||||
end
|
||||
|
||||
util.BlastDamage(self, attacker, self:GetPos(), self.GrenadeRadius, self.GrenadeDamage or self.Damage or 0)
|
||||
end
|
||||
|
||||
--[[]
|
||||
function ENT:BurstEffect()
|
||||
local dir = self:GetVelocity():GetNormalized()
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
if !self:IsValid() or self:WaterLevel() > 2 then return end
|
||||
if !IsValid(emitter) then return end
|
||||
for i = 1, 64 do
|
||||
local fire = emitter:Add("particles/smokey", self:GetPos())
|
||||
fire:SetVelocity( VectorRand() * 500 + dir * 1000 )
|
||||
fire:SetGravity( Vector(0, 0, -90) )
|
||||
fire:SetDieTime( math.Rand(0.25, 0.5) )
|
||||
fire:SetStartAlpha( 200 )
|
||||
fire:SetEndAlpha( 0 )
|
||||
fire:SetStartSize( 10 )
|
||||
fire:SetEndSize( 128 )
|
||||
fire:SetRoll( math.Rand(-180, 180) )
|
||||
fire:SetRollDelta( math.Rand(-0.2,0.2) )
|
||||
fire:SetColor( 255, 255, 255 )
|
||||
fire:SetAirResistance( 150 )
|
||||
fire:SetPos( self:GetPos() )
|
||||
fire:SetLighting( false )
|
||||
fire:SetCollide(true)
|
||||
fire:SetBounce(0.75)
|
||||
fire:SetNextThink( CurTime() + FrameTime() )
|
||||
fire:SetThinkFunction( function(pa)
|
||||
if !pa then return end
|
||||
local col1 = Color(150, 150, 150)
|
||||
local col2 = Color(200, 200, 200)
|
||||
|
||||
local col3 = col1
|
||||
local d = pa:GetLifeTime() / pa:GetDieTime()
|
||||
col3.r = Lerp(d, col1.r, col2.r)
|
||||
col3.g = Lerp(d, col1.g, col2.g)
|
||||
col3.b = Lerp(d, col1.b, col2.b)
|
||||
|
||||
pa:SetColor(col3.r, col3.g, col3.b)
|
||||
pa:SetNextThink( CurTime() + FrameTime() )
|
||||
end )
|
||||
end
|
||||
emitter:Finish()
|
||||
end
|
||||
]]
|
||||
85
lua/entities/arccw_uc_40mm_dp.lua
Normal file
85
lua/entities/arccw_uc_40mm_dp.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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_40mm_he"
|
||||
ENT.PrintName = "40mm HE Dual Purpose Grenade"
|
||||
|
||||
ENT.GrenadeDamage = false
|
||||
ENT.GrenadeRadius = 300
|
||||
ENT.ExplosionEffect = false
|
||||
ENT.Scorch = false
|
||||
|
||||
function ENT:DoDetonation()
|
||||
local dir = self.GrenadeDir or self:GetVelocity():GetNormalized()
|
||||
local attacker = IsValid(self:GetOwner()) and self:GetOwner() or self
|
||||
local damage = self.GrenadeDamage or self.Damage or 0
|
||||
local blastpos = self:GetPos()
|
||||
local tr = util.TraceLine({
|
||||
start = self:GetPos(),
|
||||
endpos = self:GetPos() + dir * 64,
|
||||
filter = self
|
||||
})
|
||||
if IsValid(tr.Entity) then
|
||||
-- do impact damage
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetAttacker(attacker)
|
||||
dmg:SetInflictor(self)
|
||||
dmg:SetDamage(damage * 10)
|
||||
dmg:SetDamageForce(dir * 3000)
|
||||
dmg:SetDamagePosition(tr.HitPos)
|
||||
tr.Entity:TakeDamageInfo(dmg)
|
||||
end
|
||||
-- attempt to penetrate entity/world and place explosion behind
|
||||
local tr2 = util.TraceLine({
|
||||
start = tr.HitPos + dir * 69,
|
||||
endpos = tr.HitPos,
|
||||
filter = self,
|
||||
})
|
||||
|
||||
if tr2.Hit and !tr2.StartSolid then
|
||||
-- Produce a weaker blast on the pre-penetration side
|
||||
util.BlastDamage(self, attacker, blastpos, self.GrenadeRadius, damage * 0.5)
|
||||
|
||||
blastpos = tr2.HitPos + dir * 16
|
||||
self:EmitSound("physics/concrete/concrete_break2.wav", 100, 110)
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
effectdata:SetMagnitude(2)
|
||||
effectdata:SetScale(1)
|
||||
effectdata:SetRadius(2)
|
||||
effectdata:SetNormal(-dir)
|
||||
util.Effect("Sparks", effectdata)
|
||||
effectdata:SetOrigin(blastpos)
|
||||
effectdata:SetNormal(dir)
|
||||
util.Effect("Sparks", effectdata)
|
||||
end
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(blastpos)
|
||||
|
||||
if self:WaterLevel() >= 1 then
|
||||
util.Effect("WaterSurfaceExplosion", effectdata)
|
||||
self:EmitSound("weapons/underwater_explode3.wav", 125, 100, 1, CHAN_AUTO)
|
||||
else
|
||||
self:EmitSound(self.ExplosionSounds[math.random(1,#self.ExplosionSounds)], 125, 100, 1, CHAN_AUTO)
|
||||
ParticleEffect("explosion_grenade_fas2", self:GetPos(), tr.HitNormal:Angle())
|
||||
if tr2.Hit and !tr2.StartSolid then
|
||||
ParticleEffect("explosion_he_m79_fas2", tr2.StartPos, tr.HitNormal:Angle() * -1)
|
||||
end
|
||||
if self.DebrisSounds then
|
||||
self:EmitSound(self.DebrisSounds[math.random(1,#self.DebrisSounds)], 85, 100, 1, CHAN_AUTO)
|
||||
end
|
||||
end
|
||||
|
||||
util.ScreenShake(self:GetPos(),25,4,.75,self.GrenadeRadius * 4)
|
||||
util.BlastDamage(self, attacker, blastpos, self.GrenadeRadius, damage)
|
||||
end
|
||||
87
lua/entities/arccw_uc_40mm_dummy.lua
Normal file
87
lua/entities/arccw_uc_40mm_dummy.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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_40mm_he"
|
||||
ENT.PrintName = "40mm Dummy Grenade"
|
||||
|
||||
ENT.GrenadeDamage = 50
|
||||
ENT.GrenadeRadius = 150
|
||||
ENT.ExplosionEffect = false
|
||||
ENT.Scorch = "PaintSplatBlue"
|
||||
|
||||
function ENT:DoDetonation()
|
||||
--[[]
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
effectdata:SetMagnitude(4)
|
||||
effectdata:SetScale(1)
|
||||
effectdata:SetRadius(4)
|
||||
effectdata:SetNormal(self:GetVelocity():GetNormalized())
|
||||
util.Effect("Sparks", effectdata)
|
||||
]]
|
||||
self:EmitSound("physics/cardboard/cardboard_box_break2.wav", 80, 110)
|
||||
end
|
||||
|
||||
function ENT:DoImpact(ent)
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Think()
|
||||
self.NextSmoke = self.NextSmoke or CurTime()
|
||||
if self.SmokeTrail and self.NextSmoke < CurTime() then
|
||||
self.NextSmoke = CurTime() + 0.025 / math.Clamp(self:GetVelocity():Length() / 1000, 1, 5)
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
if not self:IsValid() or self:WaterLevel() > 2 then return end
|
||||
if not IsValid(emitter) then return end
|
||||
local smoke = emitter:Add("particle/smokestack", self:GetPos())
|
||||
smoke:SetVelocity(VectorRand() * 2)
|
||||
smoke:SetGravity(Vector(0, 0, -3))
|
||||
smoke:SetDieTime(math.Rand(2, 3))
|
||||
smoke:SetStartAlpha(150)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(math.Rand(3, 5))
|
||||
smoke:SetEndSize(20)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.1, 0.1))
|
||||
smoke:SetColor(150, 150, math.Rand(220, 255))
|
||||
smoke:SetAirResistance(5)
|
||||
smoke:SetPos(self:GetPos())
|
||||
smoke:SetLighting(false)
|
||||
emitter:Finish()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
if not self:IsValid() or self:WaterLevel() > 2 then return end
|
||||
if not IsValid(emitter) then return end
|
||||
for i = 1, 10 do
|
||||
local smoke = emitter:Add("particle/smokestack", self:GetPos())
|
||||
smoke:SetVelocity(VectorRand() * 100)
|
||||
smoke:SetGravity(Vector(math.Rand(-5, 5), math.Rand(-5, 5), -25))
|
||||
smoke:SetDieTime(math.Rand(5, 7))
|
||||
smoke:SetStartAlpha(100)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(math.Rand(10, 15))
|
||||
smoke:SetEndSize(75)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.5, 0.5))
|
||||
smoke:SetColor(150, 150, math.Rand(220, 255))
|
||||
smoke:SetAirResistance(150)
|
||||
smoke:SetPos(self:GetPos())
|
||||
smoke:SetLighting(false)
|
||||
smoke:SetBounce(0.5)
|
||||
smoke:SetCollide(true)
|
||||
end
|
||||
emitter:Finish()
|
||||
end
|
||||
end
|
||||
80
lua/entities/arccw_uc_40mm_flash.lua
Normal file
80
lua/entities/arccw_uc_40mm_flash.lua
Normal file
@@ -0,0 +1,80 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_40mm_he"
|
||||
ENT.PrintName = "40mm Flash Grenade"
|
||||
|
||||
ENT.GrenadeDamage = 50
|
||||
ENT.GrenadeRadius = 150
|
||||
ENT.ExplosionEffect = false
|
||||
ENT.Scorch = false
|
||||
|
||||
function ENT:DoDetonation()
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
|
||||
if self:WaterLevel() >= 1 then
|
||||
util.Effect("WaterSurfaceExplosion", effectdata)
|
||||
self:EmitSound("weapons/underwater_explode3.wav", 125, 100, 1, CHAN_AUTO)
|
||||
else
|
||||
effectdata:SetMagnitude(4)
|
||||
effectdata:SetScale(1)
|
||||
effectdata:SetRadius(4)
|
||||
effectdata:SetNormal(self:GetVelocity():GetNormalized())
|
||||
util.Effect("Sparks", effectdata)
|
||||
self:EmitSound("physics/metal/metal_box_break1.wav", 100, 200, 0.5)
|
||||
end
|
||||
|
||||
-- TODO: these sounds need to be replaced (dependency)!
|
||||
self:EmitSound("weapons/arccw/flashbang/flashbang_explode1.wav", 100, 100, 1, CHAN_AUTO)
|
||||
self:EmitSound("weapons/arccw/flashbang/flashbang_explode1_distant.wav", 140, 100, 1, CHAN_AUTO)
|
||||
|
||||
util.Effect( "arccw_flashexplosion", effectdata)
|
||||
|
||||
local flashorigin = self:GetPos()
|
||||
|
||||
local flashpower = 512
|
||||
local targets = ents.FindInSphere(flashorigin, flashpower)
|
||||
|
||||
for _, k in pairs(targets) do
|
||||
if k:IsPlayer() then
|
||||
local dist = k:EyePos():Distance(flashorigin)
|
||||
local dp = (k:EyePos() - flashorigin):Dot(k:EyeAngles():Forward())
|
||||
|
||||
local time = Lerp( dp, 2.5, 0.25 )
|
||||
|
||||
time = Lerp( dist / flashpower, time, 0 )
|
||||
|
||||
if k:VisibleVec( flashorigin ) then
|
||||
k:ScreenFade( SCREENFADE.IN, Color( 255, 255, 255, 255 ), 2.5, time )
|
||||
end
|
||||
|
||||
k:SetDSP(37, false)
|
||||
|
||||
elseif k:IsNPC() then
|
||||
|
||||
k:SetNPCState(NPC_STATE_PLAYDEAD)
|
||||
|
||||
if timer.Exists( k:EntIndex() .. "_arccw_flashtimer" ) then
|
||||
timer.Remove( k:EntIndex() .. "_arccw_flashtimer" )
|
||||
end
|
||||
|
||||
timer.Create( k:EntIndex() .. "_arccw_flashtimer", 10, 1, function()
|
||||
if !k:IsValid() then return end
|
||||
k:SetNPCState(NPC_STATE_ALERT)
|
||||
end)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
20
lua/entities/arccw_uc_40mm_he.lua
Normal file
20
lua/entities/arccw_uc_40mm_he.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_riflegrenade"
|
||||
ENT.PrintName = "40mm HE"
|
||||
|
||||
ENT.GrenadeDamage = false
|
||||
ENT.GrenadeRadius = 300
|
||||
ENT.DragCoefficient = 0.25
|
||||
|
||||
ENT.Model = "models/items/ar2_grenade.mdl"
|
||||
47
lua/entities/arccw_uc_40mm_hv.lua
Normal file
47
lua/entities/arccw_uc_40mm_hv.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_40mm_he"
|
||||
ENT.PrintName = "40mm High Velocity"
|
||||
|
||||
ENT.GrenadeDamage = false
|
||||
ENT.GrenadeRadius = 200
|
||||
ENT.DragCoefficient = 0
|
||||
|
||||
ENT.Model = "models/weapons/shell.mdl"
|
||||
|
||||
if CLIENT then
|
||||
function ENT:Think()
|
||||
if self.Ticks % 3 == 0 then
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
if not self:IsValid() or self:WaterLevel() > 2 then return end
|
||||
if not IsValid(emitter) then return end
|
||||
|
||||
local smoke = emitter:Add("particle/particle_smokegrenade", self:GetPos())
|
||||
smoke:SetVelocity(VectorRand() * 25)
|
||||
smoke:SetGravity(Vector(math.Rand(-5, 5), math.Rand(-5, 5), math.Rand(-20, -25)))
|
||||
smoke:SetDieTime(math.Rand(1.5, 2.0))
|
||||
smoke:SetStartAlpha(255)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(0)
|
||||
smoke:SetEndSize(60)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(100, 100, 100)
|
||||
smoke:SetAirResistance(5)
|
||||
smoke:SetPos(self:GetPos())
|
||||
smoke:SetLighting(false)
|
||||
emitter:Finish()
|
||||
end
|
||||
self.Ticks = self.Ticks + 1
|
||||
end
|
||||
end
|
||||
42
lua/entities/arccw_uc_40mm_incendiary.lua
Normal file
42
lua/entities/arccw_uc_40mm_incendiary.lua
Normal file
@@ -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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_40mm_he"
|
||||
ENT.PrintName = "40mm Incendiary"
|
||||
|
||||
ENT.GrenadeDamage = 50
|
||||
ENT.GrenadeRadius = 150
|
||||
|
||||
function ENT:DoDetonation()
|
||||
local attacker = IsValid(self:GetOwner()) and self:GetOwner() or self
|
||||
util.BlastDamage(self, attacker, self:GetPos(), self.GrenadeRadius, self.GrenadeDamage)
|
||||
self:EmitSound("ambient/fire/gascan_ignite1.wav", 100, 100, 1)
|
||||
|
||||
for i = 1, 5 do
|
||||
local cloud = ents.Create("arccw_uc_fire")
|
||||
cloud.FireTime = 20
|
||||
|
||||
if !IsValid(cloud) then return end
|
||||
|
||||
local vel = Vector(math.Rand(-1, 1), math.Rand(-1, 1), math.Rand(-1, 1)) * 1500
|
||||
|
||||
cloud.Order = i
|
||||
cloud:SetPos(self:GetPos() - (self:GetVelocity() * FrameTime()) * 3 + VectorRand())
|
||||
cloud:SetAbsVelocity(vel + self:GetVelocity())
|
||||
cloud:SetOwner(self:GetOwner())
|
||||
cloud:Spawn()
|
||||
end
|
||||
end
|
||||
|
||||
--[[att.Hook_FireBullets = function(wep, data) this thing doesn't actually call firebullets lol
|
||||
wep:EmitSound("DB_ADD") -- lua/arccw/shared/sh_0_uc.lua
|
||||
end]]
|
||||
82
lua/entities/arccw_uc_40mm_napalm.lua
Normal file
82
lua/entities/arccw_uc_40mm_napalm.lua
Normal file
@@ -0,0 +1,82 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_40mm_he"
|
||||
ENT.PrintName = "40mm Napalm"
|
||||
|
||||
ENT.GrenadeDamage = 50
|
||||
ENT.GrenadeRadius = 150
|
||||
ENT.ExplosionEffect = false
|
||||
ENT.Scorch = false
|
||||
ENT.DragCoefficient = 0.75
|
||||
ENT.DetonateOnImpact = false
|
||||
|
||||
ENT.NextTraceTime = 0
|
||||
|
||||
if SERVER then
|
||||
function ENT:Think()
|
||||
if SERVER and CurTime() - self.SpawnTime >= self.FuseTime then
|
||||
self:Detonate()
|
||||
end
|
||||
|
||||
if self.SpawnTime + 0.2 < CurTime() and self.NextTraceTime < CurTime() then
|
||||
self.NextTraceTime = CurTime() + 0.1
|
||||
local dir = self:GetVelocity():GetNormalized()
|
||||
local tr = util.TraceHull({
|
||||
start = self:GetPos(),
|
||||
endpos = self:GetPos() + dir * 512,
|
||||
filter = self,
|
||||
mins = Vector(-16, -16, -8),
|
||||
maxs = Vector(16, 16, 8)
|
||||
})
|
||||
if tr.Hit then
|
||||
self:Detonate()
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:DoDetonation()
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
|
||||
if self:WaterLevel() >= 1 then
|
||||
util.Effect("WaterSurfaceExplosion", effectdata)
|
||||
self:EmitSound("weapons/underwater_explode3.wav", 125, 100, 1, CHAN_AUTO)
|
||||
else
|
||||
effectdata:SetMagnitude(4)
|
||||
effectdata:SetScale(1)
|
||||
effectdata:SetRadius(4)
|
||||
effectdata:SetNormal(self:GetVelocity():GetNormalized())
|
||||
util.Effect("Sparks", effectdata)
|
||||
self:EmitSound("physics/metal/metal_box_break1.wav", 100, 200)
|
||||
self:EmitSound("ambient/fire/gascan_ignite1.wav", 100, 100, 0.75)
|
||||
end
|
||||
|
||||
for i = 1, math.random(5, 7) do
|
||||
local cloud = ents.Create("arccw_uc_napalm")
|
||||
cloud.FireTime = math.Rand(20, 40)
|
||||
|
||||
if !IsValid(cloud) then return end
|
||||
|
||||
local vel = VectorRand() * 500
|
||||
|
||||
cloud.Order = i
|
||||
cloud:SetPos(self:GetPos() - (self:GetVelocity() * FrameTime()) + VectorRand())
|
||||
--cloud:SetAbsVelocity(vel + self:GetVelocity())
|
||||
cloud:SetOwner(self:GetOwner())
|
||||
cloud:Spawn()
|
||||
cloud:GetPhysicsObject():SetVelocityInstantaneous(self:GetVelocity() + vel)
|
||||
|
||||
end
|
||||
end
|
||||
48
lua/entities/arccw_uc_40mm_smoke.lua
Normal file
48
lua/entities/arccw_uc_40mm_smoke.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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Base = "arccw_uc_40mm_he"
|
||||
ENT.PrintName = "40mm Smoke Grenade"
|
||||
|
||||
ENT.GrenadeDamage = 50
|
||||
ENT.GrenadeRadius = 150
|
||||
ENT.ExplosionEffect = false
|
||||
ENT.Scorch = false
|
||||
|
||||
function ENT:DoDetonation()
|
||||
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
|
||||
if self:WaterLevel() >= 1 then
|
||||
util.Effect("WaterSurfaceExplosion", effectdata)
|
||||
self:EmitSound("weapons/underwater_explode3.wav", 125, 100, 1, CHAN_AUTO)
|
||||
else
|
||||
effectdata:SetMagnitude(4)
|
||||
effectdata:SetScale(1)
|
||||
effectdata:SetRadius(4)
|
||||
effectdata:SetNormal(self:GetVelocity():GetNormalized())
|
||||
util.Effect("Sparks", effectdata)
|
||||
self:EmitSound("physics/metal/metal_box_break1.wav", 100, 200, 0.5)
|
||||
end
|
||||
|
||||
-- TODO: these sounds need to be replaced (dependency)!
|
||||
self:EmitSound("weapons/arccw/smokegrenade/smoke_emit.wav", 90, 100, 1, CHAN_AUTO)
|
||||
|
||||
local cloud = ents.Create( "arccw_smoke" )
|
||||
|
||||
if !IsValid(cloud) then return end
|
||||
|
||||
cloud:SetPos(self:GetPos())
|
||||
cloud:Spawn()
|
||||
|
||||
end
|
||||
205
lua/entities/arccw_uc_fire.lua
Normal file
205
lua/entities/arccw_uc_fire.lua
Normal file
@@ -0,0 +1,205 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_entity"
|
||||
ENT.PrintName = "Fire Particle"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
ENT.Model = "models/Items/AR2_Grenade.mdl"
|
||||
|
||||
ENT.FireTime = 20
|
||||
|
||||
ENT.Armed = false
|
||||
|
||||
ENT.NextDamageTick = 0
|
||||
|
||||
ENT.Ticks = 0
|
||||
|
||||
ENT.ArcCW_Killable = false
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
self:SetModel( self.Model )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
local maxs = Vector(1, 1, 1)
|
||||
local mins = -maxs
|
||||
self:PhysicsInitBox(mins, maxs)
|
||||
self:DrawShadow( false )
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
phys:SetBuoyancyRatio(0)
|
||||
end
|
||||
|
||||
self.SpawnTime = CurTime()
|
||||
self:Detonate()
|
||||
|
||||
self.FireTime = math.Rand(self.FireTime - 1, self.FireTime + 1)
|
||||
end
|
||||
end
|
||||
|
||||
local fired = {
|
||||
"sprites/flamelet1",
|
||||
"sprites/flamelet2",
|
||||
"sprites/flamelet3",
|
||||
"sprites/flamelet4",
|
||||
"sprites/flamelet5",
|
||||
}
|
||||
local function GetFireParticle()
|
||||
return fired[math.random(#fired)]
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if !self.SpawnTime then self.SpawnTime = CurTime() end
|
||||
|
||||
if CLIENT then
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
|
||||
if !self:IsValid() or self:WaterLevel() > 2 then return end
|
||||
if !IsValid(emitter) then return end
|
||||
|
||||
if math.random(1, 100) < 10 then
|
||||
local fire = emitter:Add(GetFireParticle(), self:GetPos() + (VectorRand() * 16))
|
||||
fire:SetVelocity( VectorRand() * 500 * VectorRand() )
|
||||
fire:SetGravity( Vector(0, 0, 100) )
|
||||
fire:SetDieTime( math.Rand(0.5, 0.75) )
|
||||
fire:SetStartAlpha( 255 )
|
||||
fire:SetEndAlpha( 0 )
|
||||
fire:SetStartSize( 25 )
|
||||
fire:SetEndSize( 100 )
|
||||
fire:SetRoll( math.Rand(-180, 180) )
|
||||
fire:SetRollDelta( math.Rand(-0.2,0.2) )
|
||||
fire:SetColor( 255, 255, 255 )
|
||||
fire:SetAirResistance( 150 )
|
||||
fire:SetPos( self:GetPos() )
|
||||
fire:SetLighting( false )
|
||||
fire:SetCollide(true)
|
||||
fire:SetBounce(0.75)
|
||||
fire:SetNextThink( CurTime() + FrameTime() )
|
||||
fire:SetThinkFunction( function(pa)
|
||||
if !pa then return end
|
||||
local col1 = Color(255, 255, 255)
|
||||
local col2 = Color(0, 0, 0)
|
||||
|
||||
local col3 = col1
|
||||
local d = pa:GetLifeTime() / pa:GetDieTime()
|
||||
col3.r = Lerp(d, col1.r, col2.r)
|
||||
col3.g = Lerp(d, col1.g, col2.g)
|
||||
col3.b = Lerp(d, col1.b, col2.b)
|
||||
|
||||
pa:SetColor(col3.r, col3.g, col3.b)
|
||||
pa:SetNextThink( CurTime() + FrameTime() )
|
||||
end )
|
||||
end
|
||||
|
||||
if math.random(1, 100) < 5 then
|
||||
local fire = emitter:Add("particles/smokey", self:GetPos())
|
||||
fire:SetVelocity( VectorRand() * 25 )
|
||||
fire:SetGravity( Vector(0, 0, 1500) )
|
||||
fire:SetDieTime( math.Rand(0.25, 1) )
|
||||
fire:SetStartAlpha( 255 )
|
||||
fire:SetEndAlpha( 0 )
|
||||
fire:SetStartSize( 10 )
|
||||
fire:SetEndSize( 150 )
|
||||
fire:SetRoll( math.Rand(-180, 180) )
|
||||
fire:SetRollDelta( math.Rand(-0.2,0.2) )
|
||||
fire:SetColor( 255, 255, 255 )
|
||||
fire:SetAirResistance( 150 )
|
||||
fire:SetPos( self:GetPos() )
|
||||
fire:SetLighting( false )
|
||||
fire:SetCollide(true)
|
||||
fire:SetBounce(0.75)
|
||||
fire:SetNextThink( CurTime() + FrameTime() )
|
||||
fire:SetThinkFunction( function(pa)
|
||||
if !pa then return end
|
||||
local col1 = Color(255, 135, 0)
|
||||
local col2 = Color(150, 150, 150)
|
||||
|
||||
local col3 = col1
|
||||
local d = pa:GetLifeTime() / pa:GetDieTime()
|
||||
col3.r = Lerp(d, col1.r, col2.r)
|
||||
col3.g = Lerp(d, col1.g, col2.g)
|
||||
col3.b = Lerp(d, col1.b, col2.b)
|
||||
|
||||
pa:SetColor(col3.r, col3.g, col3.b)
|
||||
pa:SetNextThink( CurTime() + FrameTime() )
|
||||
end )
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
|
||||
self.Ticks = self.Ticks + 1
|
||||
else
|
||||
|
||||
if self:GetVelocity():LengthSqr() <= 32 then
|
||||
self:SetMoveType( MOVETYPE_NONE )
|
||||
end
|
||||
|
||||
if self.NextDamageTick > CurTime() then return end
|
||||
|
||||
if self:WaterLevel() > 2 then self:Remove() return end
|
||||
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetDamageType(DMG_BURN)
|
||||
dmg:SetDamage(math.Round(math.random() * 2 + 3))
|
||||
dmg:SetInflictor(self)
|
||||
dmg:SetAttacker(self:GetOwner())
|
||||
util.BlastDamageInfo(dmg, self:GetPos(), 200)
|
||||
|
||||
self.NextDamageTick = CurTime() + 0.15
|
||||
|
||||
if self.SpawnTime + self.FireTime <= CurTime() then self:Remove() return end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if !self.FireSound then return end
|
||||
self.FireSound:Stop()
|
||||
end
|
||||
|
||||
function ENT:Detonate()
|
||||
if !self:IsValid() then return end
|
||||
|
||||
self.Armed = true
|
||||
|
||||
if self.Order and self.Order != 1 then return end
|
||||
|
||||
self.FireSound = CreateSound(self, "arccw_go/molotov/fire_loop_1.wav")
|
||||
self.FireSound:Play()
|
||||
|
||||
self.FireSound:ChangePitch(80, self.FireTime)
|
||||
|
||||
timer.Simple(self.FireTime - 1, function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
self.FireSound:ChangeVolume(0, 1)
|
||||
end)
|
||||
|
||||
timer.Simple(self.FireTime, function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
self:Remove()
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
-- cam.Start3D() -- Start the 3D function so we can draw onto the screen.
|
||||
-- render.SetMaterial( GetFireParticle() ) -- Tell render what material we want, in this case the flash from the gravgun
|
||||
-- render.DrawSprite( self:GetPos(), math.random(200, 250), math.random(200, 250), Color(255, 255, 255) ) -- Draw the sprite in the middle of the map, at 16x16 in it's original colour with full alpha.
|
||||
-- cam.End3D()
|
||||
end
|
||||
263
lua/entities/arccw_uc_napalm.lua
Normal file
263
lua/entities/arccw_uc_napalm.lua
Normal file
@@ -0,0 +1,263 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_entity"
|
||||
ENT.PrintName = "Fire Particle"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminSpawnable = false
|
||||
|
||||
ENT.Model = "models/Items/AR2_Grenade.mdl"
|
||||
|
||||
ENT.FireTime = 30
|
||||
ENT.CollisionGroup = COLLISION_GROUP_PROJECTILE
|
||||
ENT.Armed = false
|
||||
|
||||
ENT.NextDamageTick = 0
|
||||
ENT.NextStickTick = 0
|
||||
|
||||
ENT.Ticks = 0
|
||||
|
||||
ENT.ArcCW_Killable = false
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
self:SetModel( self.Model )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
local maxs = Vector(1, 1, 1)
|
||||
local mins = -maxs
|
||||
self:PhysicsInitBox(mins, maxs)
|
||||
self:DrawShadow( false )
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
phys:SetBuoyancyRatio(0)
|
||||
end
|
||||
|
||||
self.SpawnTime = CurTime()
|
||||
self:Detonate()
|
||||
|
||||
self.FireTime = math.Rand(self.FireTime - 1, self.FireTime + 1)
|
||||
end
|
||||
end
|
||||
|
||||
local fired = {
|
||||
"sprites/flamelet1",
|
||||
"sprites/flamelet2",
|
||||
"sprites/flamelet3",
|
||||
"sprites/flamelet4",
|
||||
"sprites/flamelet5",
|
||||
}
|
||||
local function GetFireParticle()
|
||||
return fired[math.random(#fired)]
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if !self.SpawnTime then self.SpawnTime = CurTime() end
|
||||
|
||||
if CLIENT then
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
|
||||
if !self:IsValid() or self:WaterLevel() > 2 then return end
|
||||
if !IsValid(emitter) then return end
|
||||
|
||||
if math.random(1, 100) < 10 then
|
||||
local fire = emitter:Add(GetFireParticle(), self:GetPos() + (VectorRand() * 16))
|
||||
fire:SetVelocity( VectorRand() * 500 * VectorRand() )
|
||||
fire:SetGravity( Vector(0, 0, 100) )
|
||||
fire:SetDieTime( math.Rand(0.5, 0.75) )
|
||||
fire:SetStartAlpha( 255 )
|
||||
fire:SetEndAlpha( 0 )
|
||||
fire:SetStartSize( 15 )
|
||||
fire:SetEndSize( 100 )
|
||||
fire:SetRoll( math.Rand(-180, 180) )
|
||||
fire:SetRollDelta( math.Rand(-0.2,0.2) )
|
||||
fire:SetColor( 255, 255, 255 )
|
||||
fire:SetAirResistance( 150 )
|
||||
fire:SetPos( self:GetPos() )
|
||||
fire:SetLighting( false )
|
||||
fire:SetCollide(true)
|
||||
fire:SetBounce(0.75)
|
||||
fire:SetNextThink( CurTime() + FrameTime() )
|
||||
fire:SetThinkFunction( function(pa)
|
||||
if !pa then return end
|
||||
local col1 = Color(255, 255, 175)
|
||||
local col2 = Color(0, 0, 0)
|
||||
|
||||
local col3 = col1
|
||||
local d = pa:GetLifeTime() / pa:GetDieTime()
|
||||
col3.r = Lerp(d, col1.r, col2.r)
|
||||
col3.g = Lerp(d, col1.g, col2.g)
|
||||
col3.b = Lerp(d, col1.b, col2.b)
|
||||
|
||||
pa:SetColor(col3.r, col3.g, col3.b)
|
||||
pa:SetNextThink( CurTime() + FrameTime() )
|
||||
end )
|
||||
end
|
||||
|
||||
if math.random(1, 100) < 15 then
|
||||
local fire = emitter:Add("particles/smokey", self:GetPos())
|
||||
fire:SetVelocity( VectorRand() * 100 )
|
||||
fire:SetGravity( Vector(0, 0, 1000) )
|
||||
fire:SetDieTime( math.Rand(0.5, 2) )
|
||||
fire:SetStartAlpha( 200 )
|
||||
fire:SetEndAlpha( 0 )
|
||||
fire:SetStartSize( 10 )
|
||||
fire:SetEndSize( 128 )
|
||||
fire:SetRoll( math.Rand(-180, 180) )
|
||||
fire:SetRollDelta( math.Rand(-0.2,0.2) )
|
||||
fire:SetColor( 255, 255, 255 )
|
||||
fire:SetAirResistance( 150 )
|
||||
fire:SetPos( self:GetPos() )
|
||||
fire:SetLighting( false )
|
||||
fire:SetCollide(true)
|
||||
fire:SetBounce(0.75)
|
||||
fire:SetNextThink( CurTime() + FrameTime() )
|
||||
fire:SetThinkFunction( function(pa)
|
||||
if !pa then return end
|
||||
local col1 = Color(150, 75, 0)
|
||||
local col2 = Color(50, 50, 50)
|
||||
|
||||
local col3 = col1
|
||||
local d = pa:GetLifeTime() / pa:GetDieTime()
|
||||
col3.r = Lerp(d, col1.r, col2.r)
|
||||
col3.g = Lerp(d, col1.g, col2.g)
|
||||
col3.b = Lerp(d, col1.b, col2.b)
|
||||
|
||||
pa:SetColor(col3.r, col3.g, col3.b)
|
||||
pa:SetNextThink( CurTime() + FrameTime() )
|
||||
end )
|
||||
end
|
||||
|
||||
emitter:Finish()
|
||||
|
||||
self.Ticks = self.Ticks + 1
|
||||
else
|
||||
|
||||
if self.NextDamageTick > CurTime() then return end
|
||||
|
||||
if self.Stuck and (!IsValid(self:GetParent()) or (self:GetParent():IsPlayer() and !self:GetParent():Alive())) then
|
||||
self:SetParent(NULL)
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
self.Stuck = false
|
||||
local maxs = Vector(1, 1, 1)
|
||||
local mins = -maxs
|
||||
self:PhysicsInitBox(mins, maxs)
|
||||
local phys = self:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetDamageType(DMG_BURN)
|
||||
dmg:SetDamage(math.random() * 2 + 1)
|
||||
dmg:SetInflictor(self)
|
||||
dmg:SetAttacker(self:GetOwner())
|
||||
|
||||
if self:WaterLevel() > 2 then
|
||||
if math.random() <= 0.075 then self:Remove() return end
|
||||
dmg:SetDamage(1)
|
||||
end
|
||||
|
||||
util.BlastDamageInfo(dmg, self:GetPos(), 150)
|
||||
|
||||
self.NextDamageTick = CurTime() + 0.15
|
||||
if !self.Stuck and self.NextStickTick < CurTime() then
|
||||
self.NextStickTick = CurTime() + 0.5
|
||||
if math.random() <= 0.25 then
|
||||
for _, e in pairs(ents.FindInSphere(self:GetPos(), 96)) do
|
||||
if e:IsNPC() or e:IsNextBot() or e:IsVehicle() or (e:IsPlayer() and e:Alive()) or (simfphys and simfphys.IsCar(e)) then
|
||||
self.Stuck = true
|
||||
timer.Simple(0, function()
|
||||
-- we commit a mild amount of war crimes
|
||||
self:SetSolid(SOLID_NONE)
|
||||
self:SetMoveType(MOVETYPE_NONE)
|
||||
self:SetParent(e)
|
||||
local min, max = e:WorldSpaceAABB()
|
||||
self:SetPos(min + (max - min) * math.random())
|
||||
end)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if self.SpawnTime + self.FireTime <= CurTime() then self:Remove() return end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if !self.FireSound then return end
|
||||
self.FireSound:Stop()
|
||||
end
|
||||
|
||||
function ENT:Detonate()
|
||||
if !self:IsValid() then return end
|
||||
|
||||
self.Armed = true
|
||||
|
||||
if self.Order and self.Order != 1 then return end
|
||||
|
||||
self.FireSound = CreateSound(self, "arccw_go/molotov/fire_loop_1.wav")
|
||||
self.FireSound:Play()
|
||||
|
||||
self.FireSound:ChangePitch(80, self.FireTime)
|
||||
|
||||
timer.Simple(self.FireTime - 1, function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
self.FireSound:ChangeVolume(0, 1)
|
||||
end)
|
||||
|
||||
timer.Simple(self.FireTime, function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
self:Remove()
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function ENT:PhysicsCollide(data, physobj)
|
||||
if self.Stuck then return end
|
||||
|
||||
local tgt = data.HitEntity
|
||||
if !tgt:IsWorld() then
|
||||
timer.Simple(0, function()
|
||||
-- we commit a mild amount of war crimes
|
||||
self:SetSolid(SOLID_NONE)
|
||||
self:SetMoveType(MOVETYPE_NONE)
|
||||
self:SetParent(tgt)
|
||||
end)
|
||||
self.Stuck = true
|
||||
else
|
||||
timer.Simple(0, function()
|
||||
-- we commit a mild amount of war crimes
|
||||
self:SetSolid(SOLID_NONE)
|
||||
self:SetMoveType(MOVETYPE_NONE)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
-- cam.Start3D() -- Start the 3D function so we can draw onto the screen.
|
||||
-- render.SetMaterial( GetFireParticle() ) -- Tell render what material we want, in this case the flash from the gravgun
|
||||
-- render.DrawSprite( self:GetPos(), math.random(200, 250), math.random(200, 250), Color(255, 255, 255) ) -- Draw the sprite in the middle of the map, at 16x16 in it's original colour with full alpha.
|
||||
-- cam.End3D()
|
||||
end
|
||||
188
lua/entities/arccw_uc_riflegrenade.lua
Normal file
188
lua/entities/arccw_uc_riflegrenade.lua
Normal file
@@ -0,0 +1,188 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_entity"
|
||||
ENT.PrintName = "Base Rifle Grenade"
|
||||
ENT.Author = ""
|
||||
ENT.Information = ""
|
||||
ENT.Spawnable = false
|
||||
|
||||
ENT.Ticks = 0
|
||||
ENT.CollisionGroup = COLLISION_GROUP_PROJECTILE
|
||||
|
||||
|
||||
-- Intentionally not ENT.Damage since ArcCW base overwrites it with weapon damage (for some reason)
|
||||
ENT.GrenadeDamage = false
|
||||
ENT.GrenadeRadius = 0
|
||||
ENT.FuseTime = 10
|
||||
ENT.DragCoefficient = 1
|
||||
ENT.DetonateOnImpact = true
|
||||
|
||||
ENT.Model = "models/items/ar2_grenade.mdl"
|
||||
ENT.ExplosionEffect = true
|
||||
ENT.Scorch = "Scorch"
|
||||
ENT.SmokeTrail = true
|
||||
|
||||
local path = "arccw_uc/common/"
|
||||
local path1 = "arccw_uc/common/"
|
||||
ENT.ExplosionSounds = {path .. "explosion-close-01.ogg", path .. "explosion-close-02.ogg"}
|
||||
ENT.DebrisSounds = {path1 .. "debris-01.ogg", path1 .. "debris-02.ogg", path1 .. "debris-03.ogg", path1 .. "debris-04.ogg", path1 .. "debris-05.ogg"}
|
||||
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
local pb_vert = 1
|
||||
local pb_hor = 1
|
||||
self:SetModel(self.Model)
|
||||
self:PhysicsInitBox(Vector(-pb_vert, -pb_hor, -pb_hor), Vector(pb_vert, pb_hor, pb_hor))
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
phys:SetDragCoefficient(self.DragCoefficient)
|
||||
phys:SetBuoyancyRatio(0.1)
|
||||
end
|
||||
|
||||
self.SpawnTime = CurTime()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if SERVER and CurTime() - self.SpawnTime >= self.FuseTime then
|
||||
self:Detonate()
|
||||
end
|
||||
end
|
||||
else
|
||||
function ENT:Think()
|
||||
if self.SmokeTrail then
|
||||
if self.Ticks % 5 == 0 then
|
||||
local emitter = ParticleEmitter(self:GetPos())
|
||||
if not self:IsValid() or self:WaterLevel() > 2 then return end
|
||||
if not IsValid(emitter) then return end
|
||||
local smoke = emitter:Add("particle/particle_smokegrenade", self:GetPos())
|
||||
smoke:SetVelocity(VectorRand() * 25)
|
||||
smoke:SetGravity(Vector(math.Rand(-5, 5), math.Rand(-5, 5), math.Rand(-20, -25)))
|
||||
smoke:SetDieTime(math.Rand(1.5, 2.0))
|
||||
smoke:SetStartAlpha(255)
|
||||
smoke:SetEndAlpha(0)
|
||||
smoke:SetStartSize(0)
|
||||
smoke:SetEndSize(100)
|
||||
smoke:SetRoll(math.Rand(-180, 180))
|
||||
smoke:SetRollDelta(math.Rand(-0.2, 0.2))
|
||||
smoke:SetColor(20, 20, 20)
|
||||
smoke:SetAirResistance(5)
|
||||
smoke:SetPos(self:GetPos())
|
||||
smoke:SetLighting(false)
|
||||
emitter:Finish()
|
||||
end
|
||||
self.Ticks = self.Ticks + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- overwrite to do special explosion things
|
||||
function ENT:DoDetonation()
|
||||
local attacker = IsValid(self:GetOwner()) and self:GetOwner() or self
|
||||
util.BlastDamage(self, attacker, self:GetPos(), self.GrenadeRadius, self.GrenadeDamage or self.Damage or 0)
|
||||
end
|
||||
|
||||
function ENT:DoImpact(ent)
|
||||
local attacker = IsValid(self:GetOwner()) and self:GetOwner() or self
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetAttacker(attacker)
|
||||
dmg:SetInflictor(self)
|
||||
dmg:SetDamage(100)
|
||||
dmg:SetDamageType(DMG_CRUSH)
|
||||
dmg:SetDamageForce(self.GrenadeDir * 5000)
|
||||
dmg:SetDamagePosition(self:GetPos())
|
||||
ent:TakeDamageInfo(dmg)
|
||||
end
|
||||
|
||||
function ENT:Detonate()
|
||||
if not self:IsValid() or self.BOOM then return end
|
||||
self.BOOM = true
|
||||
|
||||
if self.ExplosionEffect then
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
|
||||
if self:WaterLevel() >= 1 then
|
||||
util.Effect("WaterSurfaceExplosion", effectdata)
|
||||
self:EmitSound("weapons/underwater_explode3.wav", 125, 100, 1, CHAN_AUTO)
|
||||
else
|
||||
-- util.Effect("Explosion", effectdata)
|
||||
|
||||
-- explosion_HE_m79_fas2
|
||||
-- explosion_he_grenade_fas2
|
||||
-- explosion_HE_claymore_fas2
|
||||
-- explosion_grenade_fas2
|
||||
|
||||
self:EmitSound(self.ExplosionSounds[math.random(1,#self.ExplosionSounds)], 125, 100, 1, CHAN_AUTO)
|
||||
ParticleEffect("explosion_HE_m79_fas2", self:GetPos(), Angle(-90, 0, 0))
|
||||
|
||||
--self:EmitSound("phx/kaboom.wav", 125, 100, 1, CHAN_AUTO)
|
||||
|
||||
-- Where is the sound zenith ? ???
|
||||
end
|
||||
|
||||
util.ScreenShake(self:GetPos(), 25, 4, 0.75, self.GrenadeRadius * 4)
|
||||
|
||||
if self.GrenadePos == nil then
|
||||
self.GrenadePos = self:GetPos()
|
||||
end
|
||||
if self.GrenadeDir == nil then
|
||||
self.GrenadeDir = self:GetVelocity():GetNormalized()
|
||||
end
|
||||
|
||||
local trace = util.TraceLine({
|
||||
start = self.GrenadePos,
|
||||
endpos = self.GrenadePos + self.GrenadeDir * 4,
|
||||
mask = MASK_SOLID_BRUSHONLY
|
||||
})
|
||||
if trace.Hit then
|
||||
self:EmitSound(self.DebrisSounds[math.random(1,#self.DebrisSounds)], 85, 100, 1, CHAN_AUTO)
|
||||
end
|
||||
end
|
||||
|
||||
self:DoDetonation()
|
||||
|
||||
if self.Scorch then
|
||||
util.Decal(self.Scorch, self.GrenadePos, self.GrenadePos + self.GrenadeDir * 4, self)
|
||||
end
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(colData, collider)
|
||||
self.GrenadeDir = colData.OurOldVelocity:GetNormalized()
|
||||
self.GrenadePos = colData.HitPos
|
||||
|
||||
self:DoImpact(colData.HitEntity)
|
||||
|
||||
if self.DetonateOnImpact then
|
||||
self:Detonate()
|
||||
else
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetOrigin(self:GetPos())
|
||||
effectdata:SetMagnitude(2)
|
||||
effectdata:SetScale(1)
|
||||
effectdata:SetRadius(2)
|
||||
effectdata:SetNormal(self.GrenadeDir)
|
||||
util.Effect("Sparks", effectdata)
|
||||
self:EmitSound("weapons/rpg/shotdown.wav", 100, 150)
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
611
lua/entities/aw2_dropship.lua
Normal file
611
lua/entities/aw2_dropship.lua
Normal file
@@ -0,0 +1,611 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Combine Dropship"
|
||||
ENT.Category = "Airwatch 2"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
|
||||
ENT.AutomaticFrameAdvance = true
|
||||
|
||||
ENT.useGunner = false
|
||||
|
||||
ENT.firstPersonOffset = Vector(110, 50, 40)
|
||||
ENT.thirdPersonOffset = Vector(-800, 0, 100)
|
||||
|
||||
ENT.baseAttach = 1
|
||||
ENT.barrelAttach = 2
|
||||
|
||||
ENT.pitchIndex = 0
|
||||
ENT.yawIndex = 1
|
||||
|
||||
ENT.accuracy = 0.02
|
||||
ENT.damage = 15
|
||||
ENT.delay = 0.1
|
||||
|
||||
util.PrecacheSound("NPC_CombineDropship.NearRotorLoop")
|
||||
util.PrecacheSound("NPC_CombineDropship.OnGroundRotorLoop")
|
||||
util.PrecacheSound("NPC_CombineDropship.DescendingWarningLoop")
|
||||
util.PrecacheSound("NPC_CombineDropship.FireLoop")
|
||||
|
||||
function ENT:SpawnFunction(ply, tr, className)
|
||||
if not tr.Hit then
|
||||
return
|
||||
end
|
||||
|
||||
local spawnPos = tr.HitPos + tr.HitNormal * 120
|
||||
|
||||
local ent = ents.Create(className)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent:SetPos(spawnPos)
|
||||
|
||||
ent.Owner = ply
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Entity", 0, "GunOperator")
|
||||
self:NetworkVar("Entity", 1, "Pod")
|
||||
|
||||
self:NetworkVar("Int", 0, "SpeedMult")
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
self:aimGun()
|
||||
self:weaponThink()
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if ply and ply:IsValid() or GetConVar("aw2_alwayson"):GetBool() then
|
||||
if not self.isActive then
|
||||
self:enableEffects()
|
||||
self.isActive = true
|
||||
end
|
||||
else
|
||||
if self.isActive then
|
||||
self:disableEffects()
|
||||
self.isActive = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:hasLOS()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
local hitpos = self:getHitpos(ply)
|
||||
|
||||
local barrel = self:GetPod():GetAttachment(self.barrelAttach)
|
||||
|
||||
local dot = barrel.Ang:Forward():Dot((hitpos - barrel.Pos):GetNormalized())
|
||||
|
||||
if dot >= 0.95 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:getViewData(ply)
|
||||
if not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
local eyeAng = ply:EyeAngles()
|
||||
|
||||
-- Hours wasted on trying to find what the issue was: 4.5
|
||||
-- Hours wasted on trying to fix the issue before finding out the fix was the issue: Too many
|
||||
if SERVER then
|
||||
eyeAng = self:WorldToLocalAngles(eyeAng) -- Note to self: NEVER subtract angles when you can WorldToLocal/LocalToWorld
|
||||
end
|
||||
|
||||
local thirdperson = ply:GetVehicle():GetThirdPersonMode()
|
||||
|
||||
local pos, ang
|
||||
|
||||
if thirdperson then
|
||||
local trace = util.TraceLine({
|
||||
start = self:GetPos(),
|
||||
endpos = self:GetPos() + eyeAng:Up() * self.thirdPersonOffset.z + eyeAng:Forward() * self.thirdPersonOffset.x,
|
||||
filter = {self, self:GetPod()},
|
||||
mask = MASK_SOLID_BRUSHONLY
|
||||
})
|
||||
|
||||
pos = trace.HitPos + trace.HitNormal * 5
|
||||
ang = eyeAng
|
||||
else
|
||||
local entAng = self:GetAngles()
|
||||
|
||||
entAng.p = 0
|
||||
entAng.r = 0
|
||||
|
||||
local offset = self.firstPersonOffset
|
||||
|
||||
pos = self:LocalToWorld(offset)
|
||||
ang = eyeAng
|
||||
end
|
||||
|
||||
return pos, ang
|
||||
end
|
||||
|
||||
function ENT:getHitpos(ply)
|
||||
local pos, ang = self:getViewData(ply)
|
||||
|
||||
return util.QuickTrace(pos, ang:Forward() * 10000, {self, self:GetPod()}).HitPos
|
||||
end
|
||||
|
||||
function ENT:CanPhysgun(ply)
|
||||
if ply and ply:IsValid() then
|
||||
return ply:IsAdmin()
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/Combine_dropship.mdl")
|
||||
self:ResetSequence("cargo_hover")
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:SetMass(500000)
|
||||
end
|
||||
|
||||
local pod = ents.Create("prop_dynamic")
|
||||
pod:SetModel("models/combine_dropship_container.mdl")
|
||||
pod:SetPos(self:GetPos())
|
||||
pod:SetAngles(self:GetAngles())
|
||||
pod:SetParent(self)
|
||||
pod:Spawn()
|
||||
pod:Activate()
|
||||
|
||||
self:DeleteOnRemove(pod)
|
||||
|
||||
self:SetPod(pod)
|
||||
|
||||
self.seatDriver = ents.Create("prop_vehicle_prisoner_pod")
|
||||
self.seatDriver:SetModel("models/props_lab/cactus.mdl")
|
||||
self.seatDriver:SetPos(self:GetPos())
|
||||
self.seatDriver:SetAngles(self:GetAngles())
|
||||
self.seatDriver:SetSolid(SOLID_NONE)
|
||||
self.seatDriver:SetKeyValue("limitview", 0, 0)
|
||||
self.seatDriver:SetNoDraw(true)
|
||||
self.seatDriver:Spawn()
|
||||
self.seatDriver:SetParent(self)
|
||||
self.seatDriver:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(self.seatDriver)
|
||||
|
||||
self.seatDriver.aw2Ent = self
|
||||
|
||||
if self.useGunner then
|
||||
self.seatGunner = ents.Create("prop_vehicle_prisoner_pod")
|
||||
self.seatGunner:SetModel("models/props_lab/cactus.mdl")
|
||||
self.seatGunner:SetPos(self:GetPos())
|
||||
self.seatGunner:SetAngles(self:GetAngles())
|
||||
self.seatGunner:SetSolid(SOLID_NONE)
|
||||
self.seatGunner:SetKeyValue("limitview", 0, 0)
|
||||
self.seatGunner:SetNoDraw(true)
|
||||
self.seatGunner:Spawn()
|
||||
self.seatGunner:SetParent(self)
|
||||
self.seatGunner:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(self.seatGunner)
|
||||
|
||||
self.seatGunner.aw2Ent = self
|
||||
end
|
||||
|
||||
self:StartMotionController()
|
||||
|
||||
self:SetPlaybackRate(0)
|
||||
|
||||
self:SetBodygroup(1, 1)
|
||||
|
||||
self.driver, self.gunner = nil
|
||||
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
self.storedVel = Vector(0, 0, 0)
|
||||
|
||||
self.storedPitch = 0
|
||||
self.storedYaw = 0
|
||||
|
||||
self.isActive = false
|
||||
self.isFiring = false
|
||||
|
||||
self.nextShot = 0
|
||||
|
||||
self.passengers = {}
|
||||
|
||||
self:SetSpeedMult(GetConVar("aw2_dropship_speedmult"):GetInt())
|
||||
end
|
||||
|
||||
function ENT:Use(ply)
|
||||
local sequence = self:GetPod():GetSequenceName(self:GetPod():GetSequence())
|
||||
|
||||
if not self.driver then
|
||||
ply:EnterVehicle(self.seatDriver)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
self.driver = ply
|
||||
|
||||
if not self.useGunner then
|
||||
self:SetGunOperator(ply)
|
||||
end
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
elseif self.useGunner and not self.gunner then
|
||||
ply:EnterVehicle(self.seatGunner)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
self.gunner = ply
|
||||
self:SetGunOperator(ply)
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
elseif sequence == "open_idle" then
|
||||
local seat = ents.Create("prop_vehicle_prisoner_pod")
|
||||
seat:SetModel("models/props_lab/cactus.mdl")
|
||||
seat:SetPos(self:GetPos())
|
||||
seat:SetAngles(self:GetAngles())
|
||||
seat:SetSolid(SOLID_NONE)
|
||||
seat:SetKeyValue("limitview", 0, 0)
|
||||
seat:SetNoDraw(true)
|
||||
seat:Spawn()
|
||||
seat:SetParent(self)
|
||||
seat:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(seat)
|
||||
|
||||
seat.aw2Ent = self
|
||||
|
||||
table.insert(self.passengers, seat)
|
||||
|
||||
ply:EnterVehicle(seat)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:StopSound("NPC_CombineDropship.NearRotorLoop")
|
||||
self:StopSound("NPC_CombineDropship.OnGroundRotorLoop")
|
||||
self:StopSound("NPC_CombineDropship.DescendingWarningLoop")
|
||||
self:StopSound("NPC_CombineDropship.FireLoop")
|
||||
end
|
||||
|
||||
function ENT:enableEffects()
|
||||
self.wash = ents.Create("env_rotorwash_emitter")
|
||||
self.wash:SetPos(self:GetPos())
|
||||
self.wash:SetAngles(self:GetAngles())
|
||||
self.wash:SetParent(self)
|
||||
self.wash:Spawn()
|
||||
|
||||
self:EmitSound("NPC_CombineDropship.OnGroundRotorLoop")
|
||||
self:EmitSound("NPC_CombineDropship.NearRotorLoop")
|
||||
|
||||
self:ResetSequence("cargo_idle")
|
||||
self:SetPlaybackRate(1)
|
||||
|
||||
self:SetBodygroup(1, 0)
|
||||
end
|
||||
|
||||
function ENT:disableEffects()
|
||||
if self.wash and self.wash:IsValid() then
|
||||
self.wash:Remove()
|
||||
end
|
||||
|
||||
self:GetPod():ResetSequence("idle")
|
||||
self:StopSound("NPC_CombineDropship.DescendingWarningLoop")
|
||||
|
||||
self:StopSound("NPC_CombineDropship.OnGroundRotorLoop")
|
||||
self:StopSound("NPC_CombineDropship.NearRotorLoop")
|
||||
|
||||
self:ResetSequence("cargo_hover")
|
||||
self:SetPlaybackRate(0)
|
||||
|
||||
self:SetBodygroup(1, 1)
|
||||
end
|
||||
|
||||
function ENT:weaponThink()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
if not ply or not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
local fire = ply:KeyDown(IN_ATTACK) and not ply:KeyDown(IN_RELOAD) and self:hasLOS()
|
||||
|
||||
if fire then
|
||||
if self.nextShot <= CurTime() then
|
||||
self.nextShot = CurTime() + self.delay
|
||||
|
||||
local bullet = {}
|
||||
bullet.Num = 1
|
||||
bullet.Src = self:GetPod():GetAttachment(self.barrelAttach).Pos
|
||||
bullet.Dir = (self:getHitpos(ply) - self:GetPod():GetAttachment(self.barrelAttach).Pos):GetNormalized():Angle():Forward()
|
||||
bullet.Spread = Vector(self.accuracy, self.accuracy, 0)
|
||||
bullet.Tracer = 1
|
||||
bullet.TracerName = "HelicopterTracer"
|
||||
bullet.Force = 20
|
||||
bullet.Damage = self.damage
|
||||
bullet.Attacker = ply
|
||||
bullet.Callback = function(attacker, trace, dmginfo)
|
||||
if not trace.HitPos or not trace.HitNormal then
|
||||
return
|
||||
end
|
||||
|
||||
dmginfo:SetDamageType(DMG_AIRBOAT)
|
||||
|
||||
local e = EffectData()
|
||||
e:SetOrigin(trace.HitPos)
|
||||
e:SetNormal(trace.HitNormal)
|
||||
util.Effect("AR2Impact", e)
|
||||
end
|
||||
|
||||
self:GetPod():FireBullets(bullet)
|
||||
|
||||
local effectData = EffectData()
|
||||
effectData:SetOrigin(self:GetPod():GetAttachment(self.barrelAttach).Pos)
|
||||
effectData:SetAngles(self:GetPod():GetAttachment(self.barrelAttach).Ang)
|
||||
effectData:SetEntity(self:GetPod())
|
||||
|
||||
util.Effect("ChopperMuzzleFlash", effectData)
|
||||
|
||||
if not self.isFiring then
|
||||
self:EmitSound("NPC_CombineDropship.FireLoop")
|
||||
|
||||
self.isFiring = true
|
||||
end
|
||||
end
|
||||
elseif self.isFiring then
|
||||
self:StopSound("NPC_CombineDropship.FireLoop")
|
||||
|
||||
self.isFiring = false
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:keyPress(ply, key)
|
||||
if ply == self.driver and key == IN_RELOAD then
|
||||
local pod = self:GetPod()
|
||||
|
||||
local sequence = pod:GetSequenceName(pod:GetSequence())
|
||||
|
||||
if sequence == "idle" then
|
||||
pod:ResetSequence("open_idle")
|
||||
self:EmitSound("NPC_CombineDropship.DescendingWarningLoop")
|
||||
else
|
||||
pod:ResetSequence("idle")
|
||||
self:StopSound("NPC_CombineDropship.DescendingWarningLoop")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:aimGun()
|
||||
local ply = self:GetGunOperator()
|
||||
local pod = self:GetPod()
|
||||
|
||||
local pitch = 0
|
||||
local yaw = 0
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
-- Thanks wiremod
|
||||
local rad2deg = 180 / math.pi
|
||||
|
||||
local pos, _ = WorldToLocal(self:getHitpos(ply), self:GetAngles(), pod:GetAttachment(self.baseAttach).Pos, self:GetAngles())
|
||||
local len = pos:Length()
|
||||
|
||||
if len < 0.0000001000000 then
|
||||
pitch = 0
|
||||
else
|
||||
pitch = rad2deg * math.asin(pos.z / len)
|
||||
end
|
||||
|
||||
yaw = rad2deg * math.atan2(pos.y, pos.x)
|
||||
end
|
||||
|
||||
local pitchMin, pitchMax = pod:GetPoseParameterRange(self.pitchIndex)
|
||||
local yawMin, yawMax = pod:GetPoseParameterRange(self.yawIndex)
|
||||
|
||||
pitch = math.Clamp(pitch, pitchMin, pitchMax)
|
||||
yaw = math.Clamp(yaw, yawMin, yawMax)
|
||||
|
||||
pod:SetPoseParameter("weapon_pitch", pitch)
|
||||
pod:SetPoseParameter("weapon_yaw", yaw)
|
||||
end
|
||||
|
||||
function ENT:ejectPlayer(ply, vehicle)
|
||||
ply:SetNoDraw(false)
|
||||
|
||||
ply.aw2Ent = nil
|
||||
|
||||
net.Start("aw2Eject")
|
||||
net.Send(ply)
|
||||
|
||||
if self.driver == ply then
|
||||
self.driver = nil
|
||||
|
||||
if not self.useGunner then
|
||||
self:SetGunOperator(nil)
|
||||
end
|
||||
elseif self.gunner == ply then
|
||||
self.gunner = nil
|
||||
|
||||
self:SetGunOperator(nil)
|
||||
else
|
||||
for k, v in pairs(self.passengers) do
|
||||
if v == vehicle then
|
||||
table.remove(self.passengers, k)
|
||||
vehicle:Remove()
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local ang = Angle(0, self:GetAngles().y, 0)
|
||||
|
||||
ply:SetEyeAngles(ang)
|
||||
ply:SetPos(self:LocalToWorld(Vector(170, 0, -50)))
|
||||
ply:SetVelocity(self:GetVelocity())
|
||||
end
|
||||
|
||||
function ENT:PhysicsSimulate(phys, delta)
|
||||
local vel = phys:GetVelocity()
|
||||
|
||||
local localVel = WorldToLocal(phys:GetVelocity(), Angle(), Vector(), phys:GetAngles())
|
||||
|
||||
if self.isActive then
|
||||
local accel = self:GetPoseParameter("cargo_body_accel")
|
||||
accel = math.Approach(accel, math.Remap(localVel.x, 0, 1600, -0.7, 1), 0.04)
|
||||
|
||||
self:SetPoseParameter("cargo_body_accel", accel)
|
||||
|
||||
local sway = math.Remap(localVel.y, -800, 800, -1, 1)
|
||||
|
||||
self:SetPoseParameter("cargo_body_sway", -sway)
|
||||
else
|
||||
self:SetPoseParameter("cargo_body_accel", 0)
|
||||
self:SetPoseParameter("cargo_body_sway", 0)
|
||||
end
|
||||
|
||||
local desiredPitch = -(self.storedVel:Dot(self:GetForward()) - vel:Dot(self:GetForward())) * 3
|
||||
local desiredRoll = -(self.storedVel:Dot(self:GetRight()) - vel:Dot(self:GetRight())) * 3
|
||||
|
||||
local pLerp = 1 - math.sin(delta * math.pi * 0.5)
|
||||
|
||||
desiredPitch = Lerp(pLerp * delta + delta, self.storedPitch, desiredPitch)
|
||||
|
||||
self.storedPitch = desiredPitch
|
||||
self.storedVel = vel
|
||||
|
||||
local desiredPos = self:GetPos()
|
||||
local desiredYaw = self:GetAngles().y
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
local addPos = Vector(0, 0, 0)
|
||||
|
||||
if ply:KeyDown(IN_FORWARD) then
|
||||
addPos.x = 0.7
|
||||
elseif ply:KeyDown(IN_BACK) then
|
||||
addPos.x = -0.2
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_MOVELEFT) then
|
||||
addPos.y = 0.2
|
||||
elseif ply:KeyDown(IN_MOVERIGHT) then
|
||||
addPos.y = -0.2
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_JUMP) then
|
||||
addPos.z = 0.3
|
||||
elseif ply:KeyDown(IN_SPEED) then
|
||||
addPos.z = -0.3
|
||||
end
|
||||
|
||||
local ang = self:GetAngles()
|
||||
ang.r = 0
|
||||
ang.p = 0
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
desiredYaw = self.storedYaw
|
||||
else
|
||||
desiredYaw = self:WorldToLocalAngles(ply:EyeAngles()).y
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
addPos:Rotate(Angle(0, self.storedYaw, 0))
|
||||
else
|
||||
addPos:Rotate(Angle(0, desiredYaw, 0))
|
||||
self.storedYaw = desiredYaw
|
||||
end
|
||||
|
||||
local mult = self:GetSpeedMult()
|
||||
|
||||
addPos:Mul(mult)
|
||||
|
||||
local dist = math.Clamp(self.storedPos:Distance(addPos), 0, mult)
|
||||
local time = math.Remap(dist, 0, mult, 0, 1)
|
||||
|
||||
local lerp = 1 - math.sin(time * math.pi * 0.5)
|
||||
|
||||
addPos = LerpVector(lerp * delta + (delta * 0.4), self.storedPos, addPos)
|
||||
|
||||
self.storedPos = addPos
|
||||
|
||||
desiredPos = desiredPos + addPos
|
||||
end
|
||||
|
||||
local randPos = Vector(math.sin(math.cos(CurTime())) * 10, math.sin(math.sin(CurTime())) * 10, 0)
|
||||
randPos:Rotate(self:GetAngles())
|
||||
|
||||
desiredPos = desiredPos + randPos
|
||||
|
||||
local move = {}
|
||||
move.secondstoarrive = 0.5
|
||||
move.pos = desiredPos
|
||||
move.angle = Angle(desiredPitch, desiredYaw, desiredRoll)
|
||||
move.maxangular = 12000
|
||||
move.maxangulardamp = 10000
|
||||
move.maxspeed = 12000
|
||||
move.maxspeeddamp = 10000
|
||||
move.dampfactor = 0.8
|
||||
move.teleportdistance = 0
|
||||
move.deltatime = delta
|
||||
|
||||
if ply and ply:IsValid() or GetConVar("aw2_alwayson"):GetBool() then
|
||||
phys:ComputeShadowControl(move)
|
||||
else
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
22
lua/entities/aw2_dropship2.lua
Normal file
22
lua/entities/aw2_dropship2.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "aw2_dropship"
|
||||
|
||||
ENT.PrintName = "Combine Dropship (2 seater)"
|
||||
ENT.Category = "Airwatch 2"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
|
||||
ENT.useGunner = true
|
||||
605
lua/entities/aw2_gunship.lua
Normal file
605
lua/entities/aw2_gunship.lua
Normal file
@@ -0,0 +1,605 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Gunship"
|
||||
ENT.Category = "Airwatch 2"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
|
||||
ENT.AutomaticFrameAdvance = true
|
||||
|
||||
ENT.firstPersonOffset = Vector(100, 0, -50)
|
||||
ENT.thirdPersonOffset = Vector(-600, 0, 0)
|
||||
|
||||
ENT.baseAttach = 1
|
||||
|
||||
ENT.pitchIndex = 0
|
||||
ENT.yawIndex = 1
|
||||
|
||||
ENT.accuracy = 0.01
|
||||
ENT.damage = 25
|
||||
ENT.delay = 0.05
|
||||
|
||||
util.PrecacheSound("NPC_CombineGunship.RotorSound")
|
||||
util.PrecacheSound("NPC_CombineGunship.ExhaustSound")
|
||||
util.PrecacheSound("NPC_CombineGunship.RotorBlastSound")
|
||||
util.PrecacheSound("NPC_CombineGunship.CannonSound")
|
||||
util.PrecacheSound("NPC_CombineGunship.CannonStopSound")
|
||||
|
||||
function ENT:SpawnFunction(ply, tr, className)
|
||||
if not tr.Hit then
|
||||
return
|
||||
end
|
||||
|
||||
local spawnPos = tr.HitPos + tr.HitNormal * 120
|
||||
|
||||
local ent = ents.Create(className)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent:SetPos(spawnPos)
|
||||
|
||||
ent.Owner = ply
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Entity", 0, "GunOperator")
|
||||
|
||||
self:NetworkVar("Int", 0, "SpeedMult")
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
self:aimGun()
|
||||
self:weaponThink()
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if ply and ply:IsValid() or self.healthStatus == AW2_CRASHING or GetConVar("aw2_alwayson"):GetBool() then
|
||||
if not self.isActive then
|
||||
self:enableEffects()
|
||||
self.isActive = true
|
||||
end
|
||||
else
|
||||
if self.isActive then
|
||||
self:disableEffects()
|
||||
self.isActive = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:hasLOS()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
local hitpos = self:getHitpos(ply)
|
||||
|
||||
local barrel = self:GetAttachment(self.baseAttach)
|
||||
|
||||
local dot = barrel.Ang:Forward():Dot((hitpos - barrel.Pos):GetNormalized())
|
||||
|
||||
if dot >= 0.95 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:getViewData(ply)
|
||||
if not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
local eyeAng = ply:EyeAngles()
|
||||
|
||||
-- Hours wasted on trying to find what the issue was: 4.5
|
||||
-- Hours wasted on trying to fix the issue before finding out the fix was the issue: Too many
|
||||
if SERVER then
|
||||
eyeAng = self:WorldToLocalAngles(eyeAng) -- Note to self: NEVER subtract angles when you can WorldToLocal/LocalToWorld
|
||||
end
|
||||
|
||||
local thirdperson = ply:GetVehicle():GetThirdPersonMode()
|
||||
|
||||
local pos, ang
|
||||
|
||||
if thirdperson then
|
||||
local trace = util.TraceLine({
|
||||
start = self:GetPos(),
|
||||
endpos = self:GetPos() + eyeAng:Up() * self.thirdPersonOffset.z + eyeAng:Forward() * self.thirdPersonOffset.x,
|
||||
filter = {self},
|
||||
mask = MASK_SOLID_BRUSHONLY
|
||||
})
|
||||
|
||||
pos = trace.HitPos + trace.HitNormal * 5
|
||||
ang = eyeAng
|
||||
else
|
||||
local entAng = self:GetAngles()
|
||||
|
||||
entAng.p = 0
|
||||
entAng.r = 0
|
||||
|
||||
local offset = self.firstPersonOffset
|
||||
|
||||
pos = self:LocalToWorld(offset)
|
||||
ang = eyeAng
|
||||
end
|
||||
|
||||
return pos, ang
|
||||
end
|
||||
|
||||
function ENT:getHitpos(ply)
|
||||
local pos, ang = self:getViewData(ply)
|
||||
|
||||
return util.QuickTrace(pos, ang:Forward() * 10000, {self}).HitPos
|
||||
end
|
||||
|
||||
function ENT:CanPhysgun(ply)
|
||||
if ply and ply:IsValid() then
|
||||
return ply:IsAdmin()
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/gunship.mdl")
|
||||
self:ResetSequence("idle")
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:SetMass(500000)
|
||||
end
|
||||
|
||||
self.seatDriver = ents.Create("prop_vehicle_prisoner_pod")
|
||||
self.seatDriver:SetModel("models/props_lab/cactus.mdl")
|
||||
self.seatDriver:SetPos(self:GetPos())
|
||||
self.seatDriver:SetAngles(self:GetAngles())
|
||||
self.seatDriver:SetSolid(SOLID_NONE)
|
||||
self.seatDriver:SetKeyValue("limitview", 0, 0)
|
||||
self.seatDriver:SetNoDraw(true)
|
||||
self.seatDriver:Spawn()
|
||||
self.seatDriver:SetParent(self)
|
||||
self.seatDriver:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(self.seatDriver)
|
||||
|
||||
self.seatDriver.aw2Ent = self
|
||||
|
||||
self:StartMotionController()
|
||||
|
||||
self:SetPlaybackRate(0)
|
||||
|
||||
self:SetMaxHealth(GetConVar("aw2_gunship_health"):GetInt())
|
||||
self:SetHealth(self:GetMaxHealth())
|
||||
|
||||
self.healthStatus = AW2_HEALTHY
|
||||
self.lastPercentage = 100
|
||||
|
||||
self.driver = nil
|
||||
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
self.storedVel = Vector(0, 0, 0)
|
||||
|
||||
self.storedPitch = 0
|
||||
self.storedYaw = 0
|
||||
|
||||
self.isActive = false
|
||||
self.isFiring = false
|
||||
|
||||
self.nextShot = 0
|
||||
|
||||
self.nextPing = 0
|
||||
|
||||
self:SetSpeedMult(GetConVar("aw2_gunship_speedmult"):GetInt())
|
||||
end
|
||||
|
||||
function ENT:Use(ply)
|
||||
if not self.driver then
|
||||
ply:EnterVehicle(self.seatDriver)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
self.driver = ply
|
||||
self:SetGunOperator(ply)
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:StopSound("NPC_CombineGunship.RotorSound")
|
||||
self:StopSound("NPC_CombineGunship.ExhaustSound")
|
||||
self:StopSound("NPC_CombineGunship.RotorBlastSound")
|
||||
self:StopSound("NPC_CombineGunship.CannonSound")
|
||||
self:StopSound("NPC_CombineGunship.DyingSound")
|
||||
end
|
||||
|
||||
function ENT:enableEffects()
|
||||
self:SetPlaybackRate(1)
|
||||
self:ResetSequence("prop_turn")
|
||||
|
||||
self.wash = ents.Create("env_rotorwash_emitter")
|
||||
self.wash:SetPos(self:GetPos())
|
||||
self.wash:SetAngles(self:GetAngles())
|
||||
self.wash:SetParent(self)
|
||||
self.wash:Spawn()
|
||||
|
||||
self:EmitSound("NPC_CombineGunship.RotorSound")
|
||||
self:EmitSound("NPC_CombineGunship.ExhaustSound")
|
||||
self:EmitSound("NPC_CombineGunship.RotorBlastSound")
|
||||
end
|
||||
|
||||
function ENT:disableEffects()
|
||||
self:SetPlaybackRate(0)
|
||||
self:ResetSequence("idle")
|
||||
|
||||
if self.wash and self.wash:IsValid() then
|
||||
self.wash:Remove()
|
||||
end
|
||||
|
||||
self:StopSound("NPC_CombineGunship.RotorSound")
|
||||
self:StopSound("NPC_CombineGunship.ExhaustSound")
|
||||
self:StopSound("NPC_CombineGunship.RotorBlastSound")
|
||||
end
|
||||
|
||||
function ENT:weaponThink()
|
||||
if self.healthStatus ~= AW2_HEALTHY then
|
||||
return
|
||||
end
|
||||
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
if not ply or not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
local fire = ply:KeyDown(IN_ATTACK) and not ply:KeyDown(IN_RELOAD) and self:hasLOS()
|
||||
|
||||
if fire then
|
||||
if self.nextShot <= CurTime() then
|
||||
self.nextShot = CurTime() + self.delay
|
||||
|
||||
local bullet = {}
|
||||
bullet.Num = 1
|
||||
bullet.Src = self:GetAttachment(self.baseAttach).Pos
|
||||
bullet.Dir = (self:getHitpos(ply) - self:GetAttachment(self.baseAttach).Pos):GetNormalized():Angle():Forward()
|
||||
bullet.Spread = Vector(self.accuracy, self.accuracy, 0)
|
||||
bullet.Tracer = 1
|
||||
bullet.TracerName = "HelicopterTracer"
|
||||
bullet.Force = 20
|
||||
bullet.Damage = self.damage
|
||||
bullet.Attacker = ply
|
||||
bullet.Callback = function(attacker, trace, dmginfo)
|
||||
if not trace.HitPos or not trace.HitNormal then
|
||||
return
|
||||
end
|
||||
|
||||
dmginfo:SetDamageType(DMG_AIRBOAT)
|
||||
|
||||
local e = EffectData()
|
||||
e:SetOrigin(trace.HitPos)
|
||||
e:SetNormal(trace.HitNormal)
|
||||
util.Effect("AR2Impact", e)
|
||||
end
|
||||
|
||||
self:FireBullets(bullet)
|
||||
|
||||
if not self.isFiring then
|
||||
self:EmitSound("NPC_CombineGunship.CannonSound")
|
||||
|
||||
self.isFiring = true
|
||||
end
|
||||
end
|
||||
elseif self.isFiring then
|
||||
self:StopSound("NPC_CombineGunship.CannonSound")
|
||||
self:EmitSound("NPC_CombineGunship.CannonStopSound")
|
||||
|
||||
self.isFiring = false
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:keyPress(ply, key)
|
||||
if key == IN_ATTACK2 and self.nextPing <= CurTime() then
|
||||
self:EmitSound("NPC_CombineGunship.SeeEnemy")
|
||||
|
||||
self.nextPing = CurTime() + 4
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:aimGun()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
local pitch = 0
|
||||
local yaw = 0
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
-- Thanks wiremod
|
||||
local rad2deg = 180 / math.pi
|
||||
|
||||
local pos, _ = WorldToLocal(self:getHitpos(ply), self:GetAngles(), self:GetAttachment(self.baseAttach).Pos, self:GetAngles())
|
||||
local len = pos:Length()
|
||||
|
||||
if len < 0.0000001000000 then
|
||||
pitch = 0
|
||||
else
|
||||
pitch = rad2deg * math.asin(pos.z / len)
|
||||
end
|
||||
|
||||
yaw = rad2deg * math.atan2(pos.y, pos.x)
|
||||
end
|
||||
|
||||
local pitchMin, pitchMax = self:GetPoseParameterRange(self.pitchIndex)
|
||||
local yawMin, yawMax = self:GetPoseParameterRange(self.yawIndex)
|
||||
|
||||
pitch = math.Clamp(pitch, pitchMin, pitchMax)
|
||||
yaw = math.Clamp(yaw, yawMin, yawMax)
|
||||
|
||||
self:SetPoseParameter("flex_vert", -pitch)
|
||||
self:SetPoseParameter("flex_horz", yaw)
|
||||
end
|
||||
|
||||
function ENT:ejectPlayer(ply, vehicle)
|
||||
ply:SetNoDraw(false)
|
||||
|
||||
ply.aw2Ent = nil
|
||||
|
||||
net.Start("aw2Eject")
|
||||
net.Send(ply)
|
||||
|
||||
if self.driver == ply then
|
||||
self.driver = nil
|
||||
|
||||
self:SetGunOperator(nil)
|
||||
end
|
||||
|
||||
ply:SetVelocity(self:GetVelocity())
|
||||
end
|
||||
|
||||
function ENT:OnTakeDamage(dmgInfo)
|
||||
local ply = self.driver
|
||||
|
||||
if not ply or not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
if self.healthStatus ~= AW2_HEALTHY then
|
||||
return
|
||||
end
|
||||
|
||||
if GetConVar("aw2_gunship_rocketonly"):GetBool() and not dmgInfo:IsDamageType(DMG_BLAST) and not dmgInfo:IsDamageType(DMG_AIRBOAT) then
|
||||
return
|
||||
end
|
||||
|
||||
local health = self:Health()
|
||||
|
||||
if health <= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
self:SetHealth(health - dmgInfo:GetDamage())
|
||||
|
||||
health = self:Health()
|
||||
|
||||
local percentage = (health / self:GetMaxHealth()) * 100
|
||||
local doSound = ""
|
||||
|
||||
if percentage <= 75 and self.lastPercentage > 75 then
|
||||
doSound = "NPC_CombineGunship.Pain"
|
||||
elseif percentage <= 50 and self.lastPercentage > 50 then
|
||||
doSound = "NPC_CombineGunship.Pain"
|
||||
elseif percentage <= 25 and self.lastPercentage > 25 then
|
||||
doSound = "NPC_CombineGunship.Pain"
|
||||
elseif percentage <= 15 and self.lastPercentage > 15 then
|
||||
doSound = "NPC_CombineGunship.Pain"
|
||||
end
|
||||
|
||||
if health <= 0 then
|
||||
self.healthStatus = AW2_CRASHING
|
||||
|
||||
self.crashAng = self:GetAngles()
|
||||
|
||||
self:StopSound("NPC_CombineGunship.RotorSound")
|
||||
self:StopSound("NPC_CombineGunship.ExhaustSound")
|
||||
self:StopSound("NPC_CombineGunship.RotorBlastSound")
|
||||
|
||||
self:EmitSound("NPC_CombineGunship.DyingSound")
|
||||
end
|
||||
|
||||
if #doSound > 0 then
|
||||
local attachment = math.random(2, 5)
|
||||
|
||||
local explosion = ents.Create("env_explosion")
|
||||
explosion:SetPos(self:GetAttachment(attachment).Pos)
|
||||
explosion:SetKeyValue("iMagnitude", 100)
|
||||
explosion:SetKeyValue("iRadiusOverride", 128)
|
||||
explosion:SetKeyValue("spawnflags", 1)
|
||||
explosion:SetParent(self)
|
||||
explosion:Spawn()
|
||||
explosion:Activate()
|
||||
explosion:Fire("explode")
|
||||
|
||||
self:EmitSound(doSound)
|
||||
end
|
||||
|
||||
self.lastPercentage = percentage
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(colData, phys)
|
||||
if self.healthStatus == AW2_CRASHING then
|
||||
self:StopSound("NPC_CombineGunship.DyingSound")
|
||||
self:EmitSound("NPC_CombineGunship.Explode")
|
||||
|
||||
local effect = ents.Create("env_ar2explosion")
|
||||
effect:SetPos(colData.HitPos)
|
||||
effect:Spawn()
|
||||
effect:Activate()
|
||||
effect:Fire("explode")
|
||||
|
||||
local ragdoll = ents.Create("prop_ragdoll")
|
||||
ragdoll:SetModel(self:GetModel())
|
||||
ragdoll:SetPos(self:GetPos())
|
||||
ragdoll:SetAngles(self:GetAngles())
|
||||
ragdoll:Spawn()
|
||||
ragdoll:Activate()
|
||||
ragdoll:GetPhysicsObject():SetVelocity(colData.OurOldVelocity)
|
||||
|
||||
ragdoll:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsSimulate(phys, delta)
|
||||
local vel = phys:GetVelocity()
|
||||
|
||||
local desiredPitch = -(self.storedVel:Dot(self:GetForward()) - vel:Dot(self:GetForward())) * 3
|
||||
local desiredRoll = -(self.storedVel:Dot(self:GetRight()) - vel:Dot(self:GetRight())) * 3
|
||||
|
||||
if self.isActive then
|
||||
local accel = self:GetPoseParameter("fin_accel")
|
||||
accel = math.Approach(accel, math.Remap(desiredPitch, -60, 60, -1, 1), delta)
|
||||
self:SetPoseParameter("fin_accel", accel)
|
||||
self:SetPoseParameter("antenna_accel", accel)
|
||||
|
||||
local sway = self:GetPoseParameter("fin_sway")
|
||||
sway = math.Approach(sway, math.Remap(desiredRoll, -60, 60, -1, 1), delta)
|
||||
self:SetPoseParameter("fin_sway", sway)
|
||||
self:SetPoseParameter("antenna_sway", sway)
|
||||
else
|
||||
self:SetPoseParameter("fin_accel", -1)
|
||||
self:SetPoseParameter("fin_sway", 0)
|
||||
self:SetPoseParameter("antenna_accel", 1)
|
||||
self:SetPoseParameter("antenna_sway", 0)
|
||||
end
|
||||
|
||||
local pLerp = 1 - math.sin(delta * math.pi * 0.5)
|
||||
|
||||
desiredPitch = Lerp(pLerp * delta + delta, self.storedPitch, desiredPitch)
|
||||
|
||||
self.storedPitch = desiredPitch
|
||||
self.storedVel = vel
|
||||
|
||||
local desiredPos = self:GetPos()
|
||||
local desiredYaw = self:GetAngles().y
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
local addPos = Vector(0, 0, 0)
|
||||
|
||||
if ply:KeyDown(IN_FORWARD) then
|
||||
addPos.x = 0.7
|
||||
elseif ply:KeyDown(IN_BACK) then
|
||||
addPos.x = -0.7
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_MOVELEFT) then
|
||||
addPos.y = 0.7
|
||||
elseif ply:KeyDown(IN_MOVERIGHT) then
|
||||
addPos.y = -0.7
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_JUMP) then
|
||||
addPos.z = 0.3
|
||||
elseif ply:KeyDown(IN_SPEED) then
|
||||
addPos.z = -0.3
|
||||
end
|
||||
|
||||
local ang = self:GetAngles()
|
||||
ang.r = 0
|
||||
ang.p = 0
|
||||
|
||||
desiredYaw = self:WorldToLocalAngles(ply:EyeAngles()).y
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
addPos:Rotate(Angle(0, self.storedYaw, 0))
|
||||
else
|
||||
addPos:Rotate(Angle(0, desiredYaw, 0))
|
||||
self.storedYaw = desiredYaw
|
||||
end
|
||||
|
||||
local mult = self:GetSpeedMult()
|
||||
|
||||
addPos:Mul(mult)
|
||||
|
||||
local dist = math.Clamp(self.storedPos:Distance(addPos), 0, mult)
|
||||
local time = math.Remap(dist, 0, mult, 0, 1)
|
||||
|
||||
local lerp = 1 - math.sin(time * math.pi * 0.5)
|
||||
|
||||
addPos = LerpVector(lerp * delta + (delta * 0.4), self.storedPos, addPos)
|
||||
|
||||
self.storedPos = addPos
|
||||
|
||||
desiredPos = desiredPos + addPos
|
||||
end
|
||||
|
||||
local randPos = Vector(math.sin(math.cos(CurTime())) * 10, math.sin(math.sin(CurTime())) * 10, 0)
|
||||
randPos:Rotate(self:GetAngles())
|
||||
|
||||
desiredPos = desiredPos + randPos
|
||||
|
||||
if self.healthStatus == AW2_CRASHING then
|
||||
local vec = Vector(300, 0, 0)
|
||||
vec:Rotate(self.crashAng)
|
||||
vec.z = -400
|
||||
|
||||
desiredPos = desiredPos + vec
|
||||
end
|
||||
|
||||
local move = {}
|
||||
move.secondstoarrive = 0.5
|
||||
move.pos = desiredPos
|
||||
move.angle = Angle(desiredPitch, desiredYaw, desiredRoll)
|
||||
move.maxangular = 12000
|
||||
move.maxangulardamp = 10000
|
||||
move.maxspeed = 12000
|
||||
move.maxspeeddamp = 10000
|
||||
move.dampfactor = 0.8
|
||||
move.teleportdistance = 0
|
||||
move.deltatime = delta
|
||||
|
||||
if ply and ply:IsValid() or self.healthStatus == AW2_CRASHING or GetConVar("aw2_alwayson"):GetBool() then
|
||||
phys:ComputeShadowControl(move)
|
||||
else
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
926
lua/entities/aw2_hk.lua
Normal file
926
lua/entities/aw2_hk.lua
Normal file
@@ -0,0 +1,926 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Hunter Killer"
|
||||
ENT.Category = "Airwatch 2"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
|
||||
ENT.AutomaticFrameAdvance = true
|
||||
|
||||
ENT.firstPersonOffset = Vector(155, 0, -65)
|
||||
ENT.thirdPersonOffset = Vector(-600, 0, 0)
|
||||
|
||||
ENT.pitchMultiplier = 1
|
||||
ENT.rollMultiplier = 1.5
|
||||
|
||||
ENT.cannonMuzzle = 4
|
||||
ENT.cannonPitch = 5
|
||||
ENT.cannonYaw = 4
|
||||
|
||||
ENT.turretMuzzle1 = 5
|
||||
ENT.turretMuzzle2 = 6
|
||||
ENT.turretPitch = 7
|
||||
ENT.turretYaw = 6
|
||||
|
||||
ENT.spotlightAttach1 = 7
|
||||
ENT.spotlightAttach2 = 8
|
||||
ENT.lightPitch = 9
|
||||
ENT.lightYaw = 8
|
||||
|
||||
ENT.pitchIndex = 5
|
||||
ENT.yawIndex = 4
|
||||
|
||||
ENT.accuracy = 1
|
||||
ENT.damage = 20
|
||||
ENT.delay = 0.12
|
||||
|
||||
ENT.cannonDelay = 1.5
|
||||
|
||||
util.PrecacheSound("NPC_AttackHelicopter.Rotors")
|
||||
util.PrecacheSound("NPC_AttackHelicopter.BadlyDamagedAlert")
|
||||
util.PrecacheSound("NPC_AttackHelicopter.MegabombAlert")
|
||||
util.PrecacheSound("NPC_AttackHelicopter.Crash")
|
||||
util.PrecacheSound("NPC_Strider.Shoot")
|
||||
util.PrecacheSound("hk/plasma.wav")
|
||||
|
||||
function ENT:SpawnFunction(ply, tr, className)
|
||||
if not tr.Hit then
|
||||
return
|
||||
end
|
||||
|
||||
local spawnPos = tr.HitPos + tr.HitNormal * 120
|
||||
|
||||
local ent = ents.Create(className)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent:SetPos(spawnPos)
|
||||
|
||||
ent.Owner = ply
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Entity", 0, "GunOperator")
|
||||
|
||||
self:NetworkVar("Int", 0, "SpeedMult")
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
self:aimCannon()
|
||||
self:aimTurrets()
|
||||
self:aimLights()
|
||||
self:weaponThink()
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if ply and ply:IsValid() or self.healthStatus == AW2_CRASHING or (GetConVar("aw2_alwayson"):GetBool() and self.healthStatus ~= AW2_DEAD) then
|
||||
if not self.isActive then
|
||||
self:enableEffects()
|
||||
self.isActive = true
|
||||
end
|
||||
else
|
||||
if self.isActive then
|
||||
self:disableEffects()
|
||||
self.isActive = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:hasLOS(origin)
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
local barrel
|
||||
|
||||
if not origin then
|
||||
barrel = self:GetAttachment(self.turretMuzzle1)
|
||||
else
|
||||
barrel = self:GetAttachment(origin)
|
||||
end
|
||||
|
||||
local hitpos = self:getHitpos(ply)
|
||||
local dot = barrel.Ang:Forward():Dot((hitpos - barrel.Pos):GetNormalized())
|
||||
|
||||
if dot >= 0.95 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:getViewData(ply)
|
||||
if not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
local eyeAng = ply:EyeAngles()
|
||||
|
||||
-- Hours wasted on trying to find what the issue was: 4.5
|
||||
-- Hours wasted on trying to fix the issue before finding out the fix was the issue: Too many
|
||||
if SERVER then
|
||||
eyeAng = self:WorldToLocalAngles(eyeAng) -- Note to self: NEVER subtract angles when you can WorldToLocal/LocalToWorld
|
||||
end
|
||||
|
||||
local thirdperson = ply:GetVehicle():GetThirdPersonMode()
|
||||
|
||||
local pos, ang
|
||||
|
||||
if thirdperson then
|
||||
local trace = util.TraceLine({
|
||||
start = self:GetPos(),
|
||||
endpos = self:GetPos() + eyeAng:Up() * self.thirdPersonOffset.z + eyeAng:Forward() * self.thirdPersonOffset.x,
|
||||
filter = {self},
|
||||
mask = MASK_SOLID_BRUSHONLY
|
||||
})
|
||||
|
||||
pos = trace.HitPos + trace.HitNormal * 5
|
||||
ang = eyeAng
|
||||
else
|
||||
local entAng = self:GetAngles()
|
||||
|
||||
entAng.p = 0
|
||||
entAng.r = 0
|
||||
|
||||
local offset = self.firstPersonOffset
|
||||
|
||||
if self.useGunner and self:GetGunOperator() == ply then
|
||||
offset = self.gunnerOffset
|
||||
end
|
||||
|
||||
pos = self:LocalToWorld(offset)
|
||||
ang = eyeAng
|
||||
end
|
||||
|
||||
return pos, ang
|
||||
end
|
||||
|
||||
function ENT:getHitpos(ply)
|
||||
local pos, ang = self:getViewData(ply)
|
||||
|
||||
return util.QuickTrace(pos, ang:Forward() * 10000, {self}).HitPos
|
||||
end
|
||||
|
||||
function ENT:CanPhysgun(ply)
|
||||
if ply and ply:IsValid() then
|
||||
return ply:IsAdmin()
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/inaki/props_vehicles/terminator_aerialhk.mdl")
|
||||
self:SetBodyGroups("1")
|
||||
self:ResetSequence("idle")
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:SetMass(500000)
|
||||
end
|
||||
|
||||
self.seatDriver = ents.Create("prop_vehicle_prisoner_pod")
|
||||
self.seatDriver:SetModel("models/props_lab/cactus.mdl")
|
||||
self.seatDriver:SetPos(self:GetPos())
|
||||
self.seatDriver:SetAngles(self:GetAngles())
|
||||
self.seatDriver:SetSolid(SOLID_NONE)
|
||||
self.seatDriver:SetKeyValue("limitview", 0, 0)
|
||||
self.seatDriver:SetNoDraw(true)
|
||||
self.seatDriver:Spawn()
|
||||
self.seatDriver:SetParent(self)
|
||||
self.seatDriver:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(self.seatDriver)
|
||||
|
||||
self.seatDriver.aw2Ent = self
|
||||
|
||||
if self.useGunner then
|
||||
self.seatGunner = ents.Create("prop_vehicle_prisoner_pod")
|
||||
self.seatGunner:SetModel("models/props_lab/cactus.mdl")
|
||||
self.seatGunner:SetPos(self:GetPos())
|
||||
self.seatGunner:SetAngles(self:GetAngles())
|
||||
self.seatGunner:SetSolid(SOLID_NONE)
|
||||
self.seatGunner:SetKeyValue("limitview", 0, 0)
|
||||
self.seatGunner:SetNoDraw(true)
|
||||
self.seatGunner:Spawn()
|
||||
self.seatGunner:SetParent(self)
|
||||
self.seatGunner:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(self.seatGunner)
|
||||
|
||||
self.seatGunner.aw2Ent = self
|
||||
end
|
||||
|
||||
self:initLights()
|
||||
|
||||
self:StartMotionController()
|
||||
|
||||
self:SetSubMaterial(1, "phoenix_storms/glass")
|
||||
self:SetPlaybackRate(0)
|
||||
|
||||
self:SetMaxHealth(GetConVar("aw2_hk_health"):GetInt())
|
||||
self:SetHealth(self:GetMaxHealth())
|
||||
|
||||
self.healthStatus = AW2_HEALTHY
|
||||
self.lastPercentage = 100
|
||||
|
||||
self.driver, self.gunner = nil
|
||||
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
self.storedVel = Vector(0, 0, 0)
|
||||
self.storedLocalVel = Vector(0, 0, 0)
|
||||
|
||||
self.storedPitch = 0
|
||||
self.storedYaw = 0
|
||||
|
||||
self.isActive = false
|
||||
|
||||
self.bulletSide = false
|
||||
|
||||
self.spotlightActive = false
|
||||
|
||||
self.nextShot = 0
|
||||
self.nextCannon = 0
|
||||
|
||||
self.passengers = {}
|
||||
|
||||
self:SetSpeedMult(GetConVar("aw2_hk_speedmult"):GetInt())
|
||||
end
|
||||
|
||||
function ENT:Use(ply)
|
||||
if self.healthStatus ~= AW2_HEALTHY then
|
||||
return
|
||||
end
|
||||
|
||||
if not self.driver then
|
||||
ply:EnterVehicle(self.seatDriver)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
self.driver = ply
|
||||
|
||||
if not self.useGunner then
|
||||
self:SetGunOperator(ply)
|
||||
end
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
elseif self.useGunner and not self.gunner then
|
||||
ply:EnterVehicle(self.seatGunner)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
self.gunner = ply
|
||||
self:SetGunOperator(ply)
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
else
|
||||
local seat = ents.Create("prop_vehicle_prisoner_pod")
|
||||
seat:SetModel("models/props_lab/cactus.mdl")
|
||||
seat:SetPos(self:GetPos())
|
||||
seat:SetAngles(self:GetAngles())
|
||||
seat:SetSolid(SOLID_NONE)
|
||||
seat:SetKeyValue("limitview", 0, 0)
|
||||
seat:SetNoDraw(true)
|
||||
seat:Spawn()
|
||||
seat:SetParent(self)
|
||||
seat:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(seat)
|
||||
|
||||
seat.aw2Ent = self
|
||||
|
||||
table.insert(self.passengers, seat)
|
||||
|
||||
ply:EnterVehicle(seat)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:StopSound("NPC_AttackHelicopter.Rotors")
|
||||
self:StopSound("NPC_AttackHelicopter.Crash")
|
||||
self:StopSound("NPC_CombineDropship.FireLoop")
|
||||
|
||||
self.spotlight1:SetParent()
|
||||
self.spotlight1:Fire("lightoff")
|
||||
self.spotlight1:Fire("kill",self.spotlight1, 0.5)
|
||||
|
||||
self.spotlight2:SetParent()
|
||||
self.spotlight2:Fire("lightoff")
|
||||
self.spotlight2:Fire("kill",self.spotlight2, 0.5)
|
||||
end
|
||||
|
||||
function ENT:enableEffects()
|
||||
self:SetPlaybackRate(1)
|
||||
|
||||
self.wash = ents.Create("env_rotorwash_emitter")
|
||||
self.wash:SetPos(self:GetPos())
|
||||
self.wash:SetAngles(self:GetAngles())
|
||||
self.wash:SetParent(self)
|
||||
self.wash:Spawn()
|
||||
|
||||
self:EmitSound("NPC_AttackHelicopter.Rotors")
|
||||
end
|
||||
|
||||
function ENT:disableEffects()
|
||||
self:SetPlaybackRate(0)
|
||||
|
||||
if self.wash and self.wash:IsValid() then
|
||||
self.wash:Remove()
|
||||
end
|
||||
|
||||
self:StopSound("NPC_AttackHelicopter.Rotors")
|
||||
end
|
||||
|
||||
function ENT:initLights()
|
||||
local spotlight1 = ents.Create("point_spotlight")
|
||||
|
||||
spotlight1:SetPos(self:GetAttachment(self.spotlightAttach1).Pos)
|
||||
spotlight1:SetKeyValue("spotlightlength", "500")
|
||||
spotlight1:SetKeyValue("spotlightwidth", "45")
|
||||
spotlight1:SetKeyValue("spawnflags", 3)
|
||||
spotlight1:SetParent(self)
|
||||
spotlight1:Spawn()
|
||||
spotlight1:Activate()
|
||||
|
||||
self.spotlight1 = spotlight1
|
||||
|
||||
local spotlight2 = ents.Create("point_spotlight")
|
||||
|
||||
spotlight2:SetPos(self:GetAttachment(self.spotlightAttach2).Pos)
|
||||
spotlight2:SetKeyValue("spotlightlength", "500")
|
||||
spotlight2:SetKeyValue("spotlightwidth", "45")
|
||||
spotlight2:SetKeyValue("spawnflags", 3)
|
||||
spotlight2:SetParent(self)
|
||||
spotlight2:Spawn()
|
||||
spotlight2:Activate()
|
||||
|
||||
self.spotlight2 = spotlight2
|
||||
|
||||
spotlight1:Fire("lightoff")
|
||||
spotlight2:Fire("lightoff")
|
||||
end
|
||||
|
||||
function ENT:createBomb(vel)
|
||||
local bomb = ents.Create("grenade_helicopter")
|
||||
bomb:SetPos(self:GetAttachment(self.bombAttach).Pos)
|
||||
bomb:SetOwner(self)
|
||||
bomb:Spawn()
|
||||
|
||||
bomb:GetPhysicsObject():SetVelocity(vel)
|
||||
bomb:GetPhysicsObject():SetBuoyancyRatio(1)
|
||||
|
||||
return bomb
|
||||
end
|
||||
|
||||
function ENT:weaponThink()
|
||||
if self.healthStatus ~= AW2_HEALTHY then
|
||||
return
|
||||
end
|
||||
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
if not IsValid(ply) then
|
||||
return
|
||||
end
|
||||
|
||||
local fire = ply:KeyDown(IN_ATTACK) and not ply:KeyDown(IN_RELOAD)
|
||||
|
||||
if fire and self:hasLOS() and self.nextShot <= CurTime() then
|
||||
self.nextShot = CurTime() + self.delay
|
||||
|
||||
local attach = self.bulletSide and self.turretMuzzle1 or self.turretMuzzle2
|
||||
|
||||
self.bulletSide = not self.bulletSide
|
||||
|
||||
local spread = math.sin(self.accuracy * 0.5 * (math.pi / 180))
|
||||
local pos = self:GetAttachment(attach).Pos
|
||||
local bullet = {}
|
||||
|
||||
bullet.Num = 1
|
||||
bullet.Src = pos
|
||||
bullet.Dir = (self:getHitpos(ply) - pos):Angle():Forward()
|
||||
bullet.Spread = Vector(spread, spread, 0)
|
||||
bullet.Tracer = 0
|
||||
bullet.Force = 20
|
||||
bullet.Damage = self.damage
|
||||
bullet.Attacker = ply
|
||||
bullet.Callback = function(attacker, trace, dmginfo)
|
||||
if not trace.HitPos or not trace.HitNormal then
|
||||
return
|
||||
end
|
||||
|
||||
dmginfo:SetDamageType(DMG_AIRBOAT)
|
||||
|
||||
local e = EffectData()
|
||||
e:SetOrigin(trace.HitPos)
|
||||
e:SetEntity(self)
|
||||
e:SetAttachment(attach)
|
||||
e:SetNormal(trace.HitNormal)
|
||||
e:SetScale(32)
|
||||
util.Effect("hk_laser", e)
|
||||
end
|
||||
|
||||
self:FireBullets(bullet)
|
||||
|
||||
self:EmitSound("hk/plasma.wav", 140)
|
||||
end
|
||||
|
||||
local altFire = ply:KeyDown(IN_ATTACK2) and not ply:KeyDown(IN_RELOAD)
|
||||
|
||||
if altFire and self.nextCannon <= CurTime() and self:hasLOS(self.cannonMuzzle) then
|
||||
self.nextCannon = CurTime() + self.cannonDelay
|
||||
|
||||
local pos = self:GetAttachment(self.cannonMuzzle).Pos
|
||||
|
||||
local bullet = {}
|
||||
bullet.Num = 1
|
||||
bullet.Src = pos
|
||||
bullet.Dir = (self:getHitpos(ply) - pos):GetNormalized():Angle():Forward()
|
||||
bullet.Spread = Vector(0, 0, 0)
|
||||
bullet.Tracer = 0
|
||||
bullet.Force = 20
|
||||
bullet.Damage = 1000
|
||||
bullet.Attacker = ply
|
||||
bullet.Callback = function(attacker, trace, dmginfo)
|
||||
if not trace.HitPos or not trace.HitNormal then
|
||||
return
|
||||
end
|
||||
|
||||
util.ParticleTracerEx("Weapon_Combine_Ion_Cannon", pos, trace.HitPos, true, self:EntIndex(), self.cannonMuzzle)
|
||||
|
||||
local explosion = ents.Create("env_explosion")
|
||||
explosion:SetPos(trace.HitPos)
|
||||
explosion:SetKeyValue("iMagnitude", 120)
|
||||
explosion:Spawn()
|
||||
explosion:Activate()
|
||||
explosion:Fire("explode")
|
||||
end
|
||||
|
||||
self:FireBullets(bullet)
|
||||
|
||||
self:EmitSound("NPC_Strider.Shoot")
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:keyPress(ply, key)
|
||||
if ply:KeyDown(IN_RELOAD) and key == IN_ATTACK then
|
||||
if ply == self:GetGunOperator() then
|
||||
if self.spotlightActive then
|
||||
self.spotlight1:Fire("lightoff")
|
||||
self.spotlight2:Fire("lightoff")
|
||||
self.spotlightActive = false
|
||||
else
|
||||
self.spotlight1:Fire("lighton")
|
||||
self.spotlight2:Fire("lighton")
|
||||
self.spotlightActive = true
|
||||
end
|
||||
end
|
||||
|
||||
ply:EmitSound("buttons/lightswitch2.wav")
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:aimTurrets()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
local pitch = 0
|
||||
local yaw = 0
|
||||
|
||||
if IsValid(ply) and self.healthStatus == AW2_HEALTHY then
|
||||
local rad2deg = 180 / math.pi
|
||||
|
||||
local turretMiddle = self:LocalToWorld(self:WorldToLocal(self:GetAttachment(self.turretMuzzle1).Pos) - self:WorldToLocal(self:GetAttachment(self.turretMuzzle2).Pos))
|
||||
|
||||
local pos, _ = WorldToLocal(self:getHitpos(ply), self:GetAngles(), turretMiddle, self:GetAngles())
|
||||
local len = pos:Length()
|
||||
|
||||
if len < 0.0000001000000 then
|
||||
pitch = 0
|
||||
else
|
||||
pitch = rad2deg * math.asin(pos.z / len)
|
||||
end
|
||||
|
||||
yaw = rad2deg * math.atan2(pos.y, pos.x)
|
||||
end
|
||||
|
||||
local pitchMin, pitchMax = self:GetPoseParameterRange(self.turretPitch)
|
||||
local yawMin, yawMax = self:GetPoseParameterRange(self.turretYaw)
|
||||
|
||||
pitch = math.Clamp(pitch, pitchMin, pitchMax)
|
||||
yaw = math.Clamp(yaw, yawMin, yawMax)
|
||||
|
||||
self:SetPoseParameter(self:GetPoseParameterName(self.turretPitch), -pitch)
|
||||
self:SetPoseParameter(self:GetPoseParameterName(self.turretYaw), -yaw)
|
||||
end
|
||||
|
||||
function ENT:aimCannon()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
local pitch = 0
|
||||
local yaw = 0
|
||||
|
||||
if IsValid(ply) and self.healthStatus == AW2_HEALTHY then
|
||||
local rad2deg = 180 / math.pi
|
||||
|
||||
local pos, _ = WorldToLocal(self:getHitpos(ply), self:GetAngles(), self:GetAttachment(self.cannonMuzzle).Pos, self:GetAngles())
|
||||
local len = pos:Length()
|
||||
|
||||
if len < 0.0000001000000 then
|
||||
pitch = 0
|
||||
else
|
||||
pitch = rad2deg * math.asin(pos.z / len)
|
||||
end
|
||||
|
||||
yaw = rad2deg * math.atan2(pos.y, pos.x)
|
||||
end
|
||||
|
||||
local pitchMin, pitchMax = self:GetPoseParameterRange(self.cannonPitch)
|
||||
local yawMin, yawMax = self:GetPoseParameterRange(self.cannonYaw)
|
||||
|
||||
pitch = math.Clamp(pitch, pitchMin, pitchMax)
|
||||
yaw = math.Clamp(yaw, yawMin, yawMax)
|
||||
|
||||
self:SetPoseParameter(self:GetPoseParameterName(self.cannonPitch), pitch)
|
||||
self:SetPoseParameter(self:GetPoseParameterName(self.cannonYaw), -yaw)
|
||||
end
|
||||
|
||||
function ENT:aimLights()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
local pitch = 0
|
||||
local yaw = 0
|
||||
|
||||
if IsValid(ply) and self.healthStatus == AW2_HEALTHY then
|
||||
local rad2deg = 180 / math.pi
|
||||
|
||||
local lightMiddle = self:LocalToWorld(self:WorldToLocal(self:GetAttachment(self.spotlightAttach1).Pos) - self:WorldToLocal(self:GetAttachment(self.spotlightAttach2).Pos))
|
||||
|
||||
local pos, _ = WorldToLocal(self:getHitpos(ply), self:GetAngles(), lightMiddle, self:GetAngles())
|
||||
local len = pos:Length()
|
||||
|
||||
if len < 0.0000001000000 then
|
||||
pitch = 0
|
||||
else
|
||||
pitch = rad2deg * math.asin(pos.z / len)
|
||||
end
|
||||
|
||||
yaw = rad2deg * math.atan2(pos.y, pos.x)
|
||||
end
|
||||
|
||||
local pitchMin, pitchMax = self:GetPoseParameterRange(self.lightPitch)
|
||||
local yawMin, yawMax = self:GetPoseParameterRange(self.lightYaw)
|
||||
|
||||
pitch = math.Clamp(pitch + 90, pitchMin, pitchMax + 35)
|
||||
|
||||
yaw = math.Clamp(yaw, yawMin, yawMax)
|
||||
|
||||
self:SetPoseParameter(self:GetPoseParameterName(self.lightPitch), -pitch)
|
||||
self:SetPoseParameter(self:GetPoseParameterName(self.lightYaw), -yaw)
|
||||
|
||||
self.spotlight1:SetAngles(self:GetAngles() + Angle(-pitch + 90, yaw, 0))
|
||||
self.spotlight2:SetAngles(self:GetAngles() + Angle(-pitch + 90, yaw, 0))
|
||||
end
|
||||
|
||||
function ENT:ejectPlayer(ply, vehicle)
|
||||
ply:SetNoDraw(false)
|
||||
|
||||
ply.aw2Ent = nil
|
||||
|
||||
net.Start("aw2Eject")
|
||||
net.Send(ply)
|
||||
|
||||
if self.driver == ply then
|
||||
self.driver = nil
|
||||
|
||||
if not self.useGunner then
|
||||
self:SetGunOperator(nil)
|
||||
end
|
||||
elseif self.gunner == ply then
|
||||
self.gunner = nil
|
||||
|
||||
self:SetGunOperator(nil)
|
||||
else
|
||||
for k, v in pairs(self.passengers) do
|
||||
if v == vehicle then
|
||||
table.remove(self.passengers, k)
|
||||
vehicle:Remove()
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ply:SetVelocity(self:GetVelocity())
|
||||
end
|
||||
|
||||
function ENT:OnTakeDamage(dmgInfo)
|
||||
local ply = self.driver
|
||||
|
||||
if not ply or not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
if self.healthStatus ~= AW2_HEALTHY then
|
||||
return
|
||||
end
|
||||
|
||||
if GetConVar("aw2_hk_rocketonly"):GetBool() and not dmgInfo:IsDamageType(DMG_BLAST) and not dmgInfo:IsDamageType(DMG_AIRBOAT) then
|
||||
return
|
||||
end
|
||||
|
||||
local health = self:Health()
|
||||
|
||||
if health <= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
self:SetHealth(health - dmgInfo:GetDamage())
|
||||
|
||||
health = self:Health()
|
||||
|
||||
local percentage = (health / self:GetMaxHealth()) * 100
|
||||
local addSmoke = false
|
||||
local attachPoint = 0
|
||||
local doSound = ""
|
||||
|
||||
if percentage <= 75 and self.lastPercentage > 75 then
|
||||
addSmoke = true
|
||||
attachPoint = 11
|
||||
doSound = "NPC_AttackHelicopter.BadlyDamagedAlert"
|
||||
elseif percentage <= 50 and self.lastPercentage > 50 then
|
||||
addSmoke = true
|
||||
attachPoint = 12
|
||||
doSound = "NPC_AttackHelicopter.BadlyDamagedAlert"
|
||||
elseif percentage <= 25 and self.lastPercentage > 25 then
|
||||
addSmoke = true
|
||||
attachPoint = 13
|
||||
doSound = "NPC_AttackHelicopter.BadlyDamagedAlert"
|
||||
elseif percentage <= 15 and self.lastPercentage > 15 then
|
||||
addSmoke = true
|
||||
attachPoint = 14
|
||||
doSound = "NPC_AttackHelicopter.MegabombAlert"
|
||||
end
|
||||
|
||||
if health <= 0 then
|
||||
addSmoke = true
|
||||
attachPoint = 15
|
||||
|
||||
self.healthStatus = AW2_CRASHING
|
||||
self:EmitSound("NPC_AttackHelicopter.CrashingAlarm1")
|
||||
self:StopSound("NPC_CombineDropship.FireLoop")
|
||||
end
|
||||
|
||||
if addSmoke then
|
||||
local explosion = ents.Create("env_explosion")
|
||||
explosion:SetPos(self:GetAttachment(attachPoint).Pos)
|
||||
explosion:SetKeyValue("iMagnitude", 100)
|
||||
explosion:SetKeyValue("iRadiusOverride", 128)
|
||||
explosion:SetKeyValue("spawnflags", 1)
|
||||
explosion:SetParent(self)
|
||||
explosion:Spawn()
|
||||
explosion:Activate()
|
||||
explosion:Fire("explode")
|
||||
|
||||
local smoke = ents.Create("env_smoketrail")
|
||||
smoke:SetPos(self:GetAttachment(attachPoint).Pos)
|
||||
smoke:SetKeyValue("opacity", 0.2)
|
||||
smoke:SetKeyValue("spawnrate", 48)
|
||||
smoke:SetKeyValue("lifetime", 0.5)
|
||||
smoke:SetKeyValue("minspeed", 16)
|
||||
smoke:SetKeyValue("maxspeed", 64)
|
||||
smoke:SetKeyValue("startcolor", "0.15 0.15 0.15")
|
||||
smoke:SetKeyValue("endcolor", "0 0 0")
|
||||
smoke:SetKeyValue("startsize", 16)
|
||||
smoke:SetKeyValue("endsize", 64)
|
||||
smoke:SetKeyValue("spawnradius", 8)
|
||||
smoke:SetParent(self)
|
||||
smoke:Spawn()
|
||||
smoke:Activate()
|
||||
|
||||
local fire = ents.Create("env_fire_trail")
|
||||
fire:SetPos(self:GetAttachment(attachPoint).Pos)
|
||||
fire:SetParent(self)
|
||||
fire:Spawn()
|
||||
fire:Activate()
|
||||
|
||||
self:EmitSound(doSound)
|
||||
end
|
||||
|
||||
self.lastPercentage = percentage
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(colData, phys)
|
||||
if self.healthStatus == AW2_CRASHING then
|
||||
self.healthStatus = AW2_DEAD
|
||||
|
||||
self:disableEffects()
|
||||
|
||||
self:StopMotionController()
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_PUSH)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
|
||||
self:SetPos(colData.HitPos - (colData.HitPos - self:GetPos()) * 0.25)
|
||||
|
||||
self:StopSound("NPC_AttackHelicopter.CrashingAlarm1")
|
||||
|
||||
self:EmitSound("NPC_AttackHelicopter.Crash")
|
||||
|
||||
local effect = ents.Create("env_ar2explosion")
|
||||
effect:SetPos(colData.HitPos)
|
||||
effect:Spawn()
|
||||
effect:Activate()
|
||||
effect:Fire("explode")
|
||||
|
||||
self.spotlight1:Fire("lightoff")
|
||||
self.spotlight2:Fire("lightoff")
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsSimulate(phys, delta)
|
||||
local avel = phys:GetAngleVelocity()
|
||||
local lvel = WorldToLocal(phys:GetVelocity(), Angle(), Vector(), phys:GetAngles())
|
||||
local gvel = phys:GetVelocity()
|
||||
|
||||
local desiredPitch = -(self.storedVel:Dot(self:GetForward()) - gvel:Dot(self:GetForward())) * self.pitchMultiplier
|
||||
local desiredRoll = -(self.storedVel:Dot(self:GetRight()) - gvel:Dot(self:GetRight())) * self.rollMultiplier
|
||||
|
||||
local pLerp = 1 - math.sin(delta * math.pi * 0.5)
|
||||
|
||||
desiredPitch = Lerp(pLerp * delta + delta, self.storedPitch, desiredPitch)
|
||||
|
||||
self.storedPitch = desiredPitch
|
||||
self.storedVel = gvel
|
||||
|
||||
if self.isActive then
|
||||
local paramL = self:GetPoseParameter("rotor_left")
|
||||
local paramR = self:GetPoseParameter("rotor_right")
|
||||
|
||||
local accel = math.Remap(lvel.x - self.storedLocalVel.x, -15, 15, 90, -90)
|
||||
local vel = math.Remap(lvel.x, -2200, 2200, 90, -90)
|
||||
|
||||
local rot = math.Clamp(avel:Dot(Vector(0, 0, 1)), -90, 90)
|
||||
|
||||
local targetL = accel + vel + rot
|
||||
local targetR = accel + vel - rot
|
||||
|
||||
paramL = math.Approach(paramL, targetL, (paramL - targetL) * FrameTime() * math.pi)
|
||||
paramR = math.Approach(paramR, targetR, (paramR - targetR) * FrameTime() * math.pi)
|
||||
|
||||
self:SetPoseParameter("rotor_left", paramL)
|
||||
self:SetPoseParameter("rotor_right", paramR)
|
||||
|
||||
local sway = math.Remap(lvel.y, -1600, 1600, -45, 45)
|
||||
|
||||
self:SetPoseParameter("move_yaw", -sway)
|
||||
else
|
||||
self:SetPoseParameter("rotor_left", 0)
|
||||
self:SetPoseParameter("rotor_right", 0)
|
||||
|
||||
self:SetPoseParameter("move_yaw", 0)
|
||||
end
|
||||
|
||||
self.storedLocalVel = lvel
|
||||
|
||||
local desiredPos = self:GetPos()
|
||||
local desiredYaw = self:GetAngles().y
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
local addPos = Vector(0, 0, 0)
|
||||
|
||||
if ply:KeyDown(IN_FORWARD) then
|
||||
addPos.x = 0.7
|
||||
elseif ply:KeyDown(IN_BACK) then
|
||||
addPos.x = -0.7
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_MOVELEFT) then
|
||||
addPos.y = 0.5
|
||||
elseif ply:KeyDown(IN_MOVERIGHT) then
|
||||
addPos.y = -0.5
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_JUMP) then
|
||||
addPos.z = 0.3
|
||||
elseif ply:KeyDown(IN_SPEED) then
|
||||
addPos.z = -0.3
|
||||
end
|
||||
|
||||
local ang = self:GetAngles()
|
||||
ang.r = 0
|
||||
ang.p = 0
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
desiredYaw = self.storedYaw
|
||||
else
|
||||
desiredYaw = self:WorldToLocalAngles(ply:EyeAngles()).y
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
addPos:Rotate(Angle(0, self.storedYaw, 0))
|
||||
else
|
||||
addPos:Rotate(Angle(0, desiredYaw, 0))
|
||||
self.storedYaw = desiredYaw
|
||||
end
|
||||
|
||||
local mult = self:GetSpeedMult()
|
||||
|
||||
addPos:Mul(mult)
|
||||
|
||||
local dist = math.Clamp(self.storedPos:Distance(addPos), 0, mult)
|
||||
local time = math.Remap(dist, 0, mult, 0, 1)
|
||||
|
||||
local lerp = 1 - math.sin(time * math.pi * 0.5)
|
||||
|
||||
addPos = LerpVector(lerp * delta + (delta * 0.4), self.storedPos, addPos)
|
||||
|
||||
self.storedPos = addPos
|
||||
|
||||
desiredPos = desiredPos + addPos
|
||||
end
|
||||
|
||||
local randPos = Vector(math.sin(math.cos(CurTime())) * 10, math.sin(math.sin(CurTime())) * 10, 0)
|
||||
randPos:Rotate(self:GetAngles())
|
||||
|
||||
desiredPos = desiredPos + randPos
|
||||
|
||||
if self.healthStatus == AW2_CRASHING then
|
||||
desiredYaw = self:GetAngles().y + 90
|
||||
|
||||
local vec = Vector(100, 0, 0)
|
||||
vec:Rotate(self:GetAngles())
|
||||
vec.z = -300
|
||||
|
||||
desiredPos = desiredPos + vec
|
||||
end
|
||||
|
||||
local move = {}
|
||||
move.secondstoarrive = 0.5
|
||||
move.pos = desiredPos
|
||||
move.angle = Angle(desiredPitch, desiredYaw, desiredRoll)
|
||||
move.maxangular = 12000
|
||||
move.maxangulardamp = 10000
|
||||
move.maxspeed = 12000
|
||||
move.maxspeeddamp = 10000
|
||||
move.dampfactor = 0.6
|
||||
move.teleportdistance = 0
|
||||
move.deltatime = delta
|
||||
|
||||
if ply and ply:IsValid() or self.healthStatus == AW2_CRASHING or (GetConVar("aw2_alwayson"):GetBool() and self.healthStatus ~= AW2_DEAD) then
|
||||
phys:ComputeShadowControl(move)
|
||||
else
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
1030
lua/entities/aw2_hunterchopper.lua
Normal file
1030
lua/entities/aw2_hunterchopper.lua
Normal file
File diff suppressed because it is too large
Load Diff
22
lua/entities/aw2_hunterchopper2.lua
Normal file
22
lua/entities/aw2_hunterchopper2.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "aw2_hunterchopper"
|
||||
|
||||
ENT.PrintName = "Hunter Chopper (2 seater)"
|
||||
ENT.Category = "Airwatch 2"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
|
||||
ENT.useGunner = true
|
||||
797
lua/entities/aw2_manhack.lua
Normal file
797
lua/entities/aw2_manhack.lua
Normal file
@@ -0,0 +1,797 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
EYES_OFF = 0
|
||||
EYES_ON1 = 1
|
||||
EYES_ON2 = 2
|
||||
EYES_STUNNED = 3
|
||||
EYES_DEAD = 4
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Manhack"
|
||||
ENT.Category = "Airwatch 2"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
|
||||
ENT.AutomaticFrameAdvance = true
|
||||
|
||||
ENT.firstPersonOffset = Vector()
|
||||
ENT.thirdPersonOffset = Vector(-50, 0, 10)
|
||||
|
||||
ENT.pitchMultiplier = 0.05
|
||||
ENT.rollMultiplier = 0.05
|
||||
|
||||
ENT.EventStartEngine = 50
|
||||
ENT.EventDoneUnpacking = 51
|
||||
ENT.EventOpenBlade = 52
|
||||
|
||||
ENT.PoseParameters = {
|
||||
"Panel1",
|
||||
"Panel2",
|
||||
"Panel3",
|
||||
"Panel4"
|
||||
}
|
||||
|
||||
ENT.EyeSprite = "sprites/glow1.vmt"
|
||||
|
||||
util.PrecacheSound("NPC_Manhack.EngineSound1")
|
||||
util.PrecacheSound("NPC_Manhack.BladeSound")
|
||||
|
||||
util.PrecacheSound("NPC_Manhack.ChargeAnnounce")
|
||||
util.PrecacheSound("NPC_Manhack.ChargeEnd")
|
||||
|
||||
util.PrecacheSound("NPC_Manhack.Unpack")
|
||||
util.PrecacheSound("NPC_Manhack.Grind")
|
||||
util.PrecacheSound("NPC_Manhack.Slice")
|
||||
|
||||
util.PrecacheSound("NPC_Manhack.Stunned")
|
||||
util.PrecacheSound("NPC_RollerMine.Reprogram")
|
||||
|
||||
function ENT:SpawnFunction(ply, tr, className)
|
||||
if not tr.Hit then
|
||||
return
|
||||
end
|
||||
|
||||
local spawnPos = tr.HitPos + tr.HitNormal * 20
|
||||
|
||||
local ent = ents.Create(className)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent:SetPos(spawnPos)
|
||||
|
||||
ent.Owner = ply
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Int", 0, "SpeedMult")
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if IsValid(phys) then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
if not self.Dead then
|
||||
if not IsValid(self.driver) and self.Active then
|
||||
self:TurnOff()
|
||||
end
|
||||
|
||||
self:UpdatePoseParameters()
|
||||
self:UpdateMotor()
|
||||
self:UpdateSound()
|
||||
self:UpdateEyes()
|
||||
else
|
||||
self:DoSparks()
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:getViewData(ply)
|
||||
if not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
local eyeAng = ply:EyeAngles()
|
||||
|
||||
-- Hours wasted on trying to find what the issue was: 4.5
|
||||
-- Hours wasted on trying to fix the issue before finding out the fix was the issue: Too many
|
||||
if SERVER then
|
||||
eyeAng = self:WorldToLocalAngles(eyeAng) -- Note to self: NEVER subtract angles when you can WorldToLocal/LocalToWorld
|
||||
end
|
||||
|
||||
local trace = util.TraceLine({
|
||||
start = self:GetPos(),
|
||||
endpos = self:GetPos() + eyeAng:Up() * self.thirdPersonOffset.z + eyeAng:Forward() * self.thirdPersonOffset.x,
|
||||
filter = {self},
|
||||
mask = MASK_SOLID_BRUSHONLY
|
||||
})
|
||||
|
||||
local pos = trace.HitPos + trace.HitNormal * 5
|
||||
local ang = eyeAng
|
||||
|
||||
return pos, ang
|
||||
end
|
||||
|
||||
function ENT:CanPhysgun(ply)
|
||||
if ply and ply:IsValid() then
|
||||
return ply:IsAdmin()
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/manhack.mdl")
|
||||
self:ResetSequence("idle")
|
||||
|
||||
self:SetBodyGroups("000")
|
||||
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:SetMass(30)
|
||||
end
|
||||
|
||||
self.seatDriver = ents.Create("prop_vehicle_prisoner_pod")
|
||||
self.seatDriver:SetModel("models/props_lab/cactus.mdl")
|
||||
self.seatDriver:SetPos(self:GetPos())
|
||||
self.seatDriver:SetAngles(self:GetAngles())
|
||||
self.seatDriver:SetSolid(SOLID_NONE)
|
||||
self.seatDriver:SetKeyValue("limitview", 0, 0)
|
||||
self.seatDriver:SetNoDraw(true)
|
||||
self.seatDriver:Spawn()
|
||||
self.seatDriver:SetParent(self)
|
||||
self.seatDriver:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(self.seatDriver)
|
||||
|
||||
self.seatDriver.aw2Ent = self
|
||||
|
||||
self:StartMotionController()
|
||||
|
||||
self:SetMaxHealth(GetConVar("aw2_manhack_health"):GetInt())
|
||||
self:SetHealth(self:GetMaxHealth())
|
||||
|
||||
self.driver = nil
|
||||
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
self.storedVel = Vector(0, 0, 0)
|
||||
|
||||
self.storedPitch = 0
|
||||
self.storedYaw = 0
|
||||
|
||||
self.Active = false
|
||||
self.Dead = false
|
||||
self.EyeState = EYES_OFF
|
||||
self.IdleState = false
|
||||
self.Friendly = false
|
||||
|
||||
self.EnginePower = 0
|
||||
self.BladeSpeed = 0
|
||||
self.StallTime = 0
|
||||
self.SparkTime = 0
|
||||
|
||||
local filter = RecipientFilter()
|
||||
filter:AddAllPlayers()
|
||||
|
||||
self.EngineSound1 = CreateSound(self, "NPC_Manhack.EngineSound1", filter)
|
||||
self.EngineSound1:ChangeVolume(0.55)
|
||||
|
||||
self:SetSpeedMult(GetConVar("aw2_manhack_speedmult"):GetInt())
|
||||
end
|
||||
|
||||
function ENT:Stalled()
|
||||
return self.StallTime > CurTime()
|
||||
end
|
||||
|
||||
function ENT:DoSparks()
|
||||
if self.SparkTime > CurTime() then
|
||||
return
|
||||
end
|
||||
|
||||
local data = EffectData()
|
||||
|
||||
data:SetOrigin(self:GetPos())
|
||||
data:SetAngles(self:GetAngles())
|
||||
data:SetNormal(VectorRand())
|
||||
|
||||
util.Effect("ManhackSparks", data)
|
||||
|
||||
self.SparkTime = CurTime() + math.Rand(0.5, 3)
|
||||
end
|
||||
|
||||
function ENT:HandleAnimEvent(event)
|
||||
if event == self.EventStartEngine then
|
||||
self.Active = true
|
||||
|
||||
self:EmitSound("NPC_Manhack.Unpack")
|
||||
elseif event == self.EventDoneUnpacking then
|
||||
self.EngineSound1:Play()
|
||||
self:ResetSequence("fly")
|
||||
elseif event == self.EventOpenBlade then
|
||||
self:SetBodyGroups("010")
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:FullyActive()
|
||||
return self.Active and self:GetSequenceName(self:GetSequence()) == "fly"
|
||||
end
|
||||
|
||||
function ENT:TurnOff()
|
||||
self.Active = false
|
||||
self.IsHostile = false
|
||||
|
||||
self:ResetSequence("idle")
|
||||
|
||||
self.EngineSound1:Stop()
|
||||
|
||||
self:StopSound("NPC_Manhack.BladeSound")
|
||||
end
|
||||
|
||||
function ENT:IsIdle()
|
||||
return not self.Active or self:GetSequenceName(self:GetSequence()) == "idle"
|
||||
end
|
||||
|
||||
function ENT:SetEyes(state)
|
||||
if self.EyeState == state and self.IdleState == self:IsIdle() then
|
||||
return
|
||||
end
|
||||
|
||||
if state == EYES_OFF and not IsValid(self.EyeGlow) and not IsValid(self.LightGlow) then
|
||||
return
|
||||
end
|
||||
|
||||
if not self.EyeGlow then
|
||||
local attach = self:LookupAttachment("Eye")
|
||||
|
||||
self.EyeGlow = ents.Create("env_sprite")
|
||||
self.EyeGlow:SetPos(self:GetAttachment(attach).Pos)
|
||||
self.EyeGlow:SetKeyValue("rendermode", 9)
|
||||
self.EyeGlow:SetKeyValue("model", self.EyeSprite)
|
||||
self.EyeGlow:SetKeyValue("scale", 0.15)
|
||||
self.EyeGlow:SetParent(self, attach)
|
||||
|
||||
self.EyeGlow:Spawn()
|
||||
self.EyeGlow:Activate()
|
||||
|
||||
self:DeleteOnRemove(self.EyeGlow)
|
||||
end
|
||||
|
||||
if not self.LightGlow then
|
||||
local attach = self:LookupAttachment("Light")
|
||||
|
||||
self.LightGlow = ents.Create("env_sprite")
|
||||
self.LightGlow:SetPos(self:GetAttachment(attach).Pos)
|
||||
self.LightGlow:SetKeyValue("rendermode", 9)
|
||||
self.LightGlow:SetKeyValue("model", self.EyeSprite)
|
||||
self.LightGlow:SetKeyValue("scale", 0.15)
|
||||
self.LightGlow:SetParent(self, attach)
|
||||
|
||||
self.LightGlow:Spawn()
|
||||
self.LightGlow:Activate()
|
||||
|
||||
self:DeleteOnRemove(self.LightGlow)
|
||||
end
|
||||
|
||||
self.EyeState = state
|
||||
self.IdleState = self:IsIdle()
|
||||
|
||||
if state == EYES_OFF then
|
||||
self.EyeGlow:SetNoDraw(true)
|
||||
self.LightGlow:SetNoDraw(true)
|
||||
elseif state == EYES_ON1 then
|
||||
self.EyeGlow:SetNoDraw(false)
|
||||
self.EyeGlow:Fire("Color", "255 0 0")
|
||||
self.EyeGlow:SetKeyValue("renderfx", 0)
|
||||
|
||||
self.LightGlow:SetNoDraw(false)
|
||||
self.LightGlow:Fire("Color", "255 0 0")
|
||||
self.LightGlow:SetKeyValue("renderfx", 0)
|
||||
elseif state == EYES_ON2 then
|
||||
self.EyeGlow:SetNoDraw(false)
|
||||
self.EyeGlow:Fire("Color", "0 255 0")
|
||||
self.EyeGlow:SetKeyValue("renderfx", 0)
|
||||
|
||||
self.LightGlow:SetNoDraw(false)
|
||||
self.LightGlow:Fire("Color", "0 255 0")
|
||||
self.LightGlow:SetKeyValue("renderfx", 0)
|
||||
elseif state == EYES_STUNNED then
|
||||
self.EyeGlow:SetNoDraw(false)
|
||||
self.EyeGlow:Fire("Color", "255 128 0")
|
||||
self.EyeGlow:SetKeyValue("renderfx", 10)
|
||||
|
||||
self.LightGlow:SetNoDraw(false)
|
||||
self.LightGlow:Fire("Color", "255 128 0")
|
||||
self.LightGlow:SetKeyValue("renderfx", 10)
|
||||
elseif state == EYES_DEAD then
|
||||
self.EyeGlow:SetNoDraw(false)
|
||||
self.EyeGlow:Fire("Color", "255 128 0")
|
||||
self.EyeGlow:SetKeyValue("renderfx", 9)
|
||||
|
||||
self.LightGlow:SetNoDraw(false)
|
||||
self.LightGlow:Fire("Color", "255 128 0")
|
||||
self.LightGlow:SetKeyValue("renderfx", 9)
|
||||
end
|
||||
|
||||
if self:IsIdle() then
|
||||
self.LightGlow:SetNoDraw(true)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:UpdateEyes()
|
||||
if self:Stalled() then
|
||||
self:SetEyes(EYES_STUNNED)
|
||||
else
|
||||
self:SetEyes(self.Friendly and EYES_ON2 or EYES_ON1)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(ply)
|
||||
if not self.driver and not self.Dead then
|
||||
ply:EnterVehicle(self.seatDriver)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
self.driver = ply
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:UpdatePoseParameters()
|
||||
local param = self:GetPoseParameter(self.PoseParameters[1])
|
||||
|
||||
if not self.Active then
|
||||
param = 0
|
||||
elseif self.IsHostile then
|
||||
param = math.Approach(param, 90, 700 * FrameTime())
|
||||
else
|
||||
param = math.Approach(param, 0, 700 * FrameTime())
|
||||
end
|
||||
|
||||
for _, v in pairs(self.PoseParameters) do
|
||||
self:SetPoseParameter(v, param)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:UpdateSound()
|
||||
if not self.Active then
|
||||
return
|
||||
end
|
||||
|
||||
local vel = math.abs(self:GetVelocity():Length())
|
||||
local pitch1 = math.Remap(vel, 0, 400, 100, 160)
|
||||
|
||||
self.EngineSound1:ChangePitch(pitch1, 0.5)
|
||||
end
|
||||
|
||||
function ENT:UpdateMotor()
|
||||
if not self.Active then
|
||||
self.EnginePower = 0
|
||||
self.BladeSpeed = 0
|
||||
|
||||
self:SetBodyGroups("000")
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if self:WaterLevel() > 1 then
|
||||
self.EnginePower = 0.75
|
||||
elseif self.EnginePower < 1 and not self:Stalled() then
|
||||
self.EnginePower = math.Min(self.EnginePower + (1 * FrameTime()), 1)
|
||||
end
|
||||
|
||||
if self:FullyActive() then
|
||||
if not self:Stalled() then
|
||||
if self.BladeSpeed < 10 then
|
||||
self.BladeSpeed = self.BladeSpeed * 2 + 1
|
||||
else
|
||||
self.BladeSpeed = math.Min(self.BladeSpeed + (80 * FrameTime()), 100)
|
||||
end
|
||||
end
|
||||
|
||||
self:SetPlaybackRate(self.BladeSpeed * 0.01)
|
||||
else
|
||||
self:SetPlaybackRate(1)
|
||||
end
|
||||
|
||||
if self.BladeSpeed < 20 then
|
||||
self:SetBodyGroups("010")
|
||||
elseif self.BladeSpeed < 40 then
|
||||
self:SetBodyGroups("011")
|
||||
else
|
||||
self:SetBodyGroups("001")
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:ShowHostile(state)
|
||||
if self.IsHostile == state then
|
||||
return
|
||||
end
|
||||
|
||||
self.IsHostile = state
|
||||
|
||||
if state then
|
||||
self:EmitSound("NPC_Manhack.ChargeAnnounce")
|
||||
self:EmitSound("NPC_Manhack.BladeSound")
|
||||
else
|
||||
self:EmitSound("NPC_Manhack.ChargeEnd")
|
||||
self:StopSound("NPC_Manhack.BladeSound")
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:TurnOff()
|
||||
end
|
||||
|
||||
function ENT:keyPress(ply, key)
|
||||
if self.Dead then
|
||||
return
|
||||
end
|
||||
|
||||
if key == IN_ATTACK then
|
||||
if not self.Active then
|
||||
self:ResetSequence("deploy")
|
||||
self:SetCycle(0)
|
||||
else
|
||||
self:ShowHostile(not self.IsHostile)
|
||||
end
|
||||
end
|
||||
|
||||
if key == IN_ATTACK2 then
|
||||
self:Stall(true)
|
||||
end
|
||||
|
||||
if key == IN_RELOAD then
|
||||
self.Friendly = not self.Friendly
|
||||
|
||||
self:EmitSound("NPC_RollerMine.Reprogram")
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:ejectPlayer(ply, vehicle)
|
||||
ply:SetNoDraw(false)
|
||||
|
||||
ply.aw2Ent = nil
|
||||
|
||||
net.Start("aw2Eject")
|
||||
net.Send(ply)
|
||||
|
||||
if self.driver == ply then
|
||||
self.driver = nil
|
||||
end
|
||||
|
||||
ply:SetVelocity(self:GetVelocity())
|
||||
|
||||
self.storedPos = Vector()
|
||||
end
|
||||
|
||||
function ENT:OnTakeDamage(dmgInfo)
|
||||
local ply = self.driver
|
||||
|
||||
if not IsValid(ply) then
|
||||
return
|
||||
end
|
||||
|
||||
local scale = 1
|
||||
local dmg = dmgInfo:GetDamage()
|
||||
|
||||
if dmgInfo:IsDamageType(DMG_CLUB) then
|
||||
scale = 1.5
|
||||
|
||||
local dir = dmgInfo:GetDamageForce():GetNormalized()
|
||||
local force = dir * (dmg * scale) * 100
|
||||
|
||||
self.storedPos = force
|
||||
self:Stall()
|
||||
end
|
||||
|
||||
self:SetHealth(self:Health() - (dmg * scale))
|
||||
|
||||
if self:Health() <= 0 then
|
||||
self:StopSound("NPC_Manhack.Stunned")
|
||||
self:Die()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Stall(force)
|
||||
if force then
|
||||
self.storedPos = VectorRand() * 100
|
||||
self:EmitSound("NPC_Manhack.Bat")
|
||||
end
|
||||
|
||||
self.BladeSpeed = 10
|
||||
self.EnginePower = 0
|
||||
|
||||
self.StallTime = CurTime() + 2
|
||||
|
||||
self:ShowHostile(false)
|
||||
self:EmitSound("NPC_Manhack.Stunned")
|
||||
end
|
||||
|
||||
function ENT:Die()
|
||||
self.Dead = true
|
||||
|
||||
self:EmitSound("NPC_Manhack.Die")
|
||||
|
||||
self:TurnOff()
|
||||
self:SetEyes(EYES_DEAD)
|
||||
|
||||
self:SetBodyGroups("000")
|
||||
|
||||
for _, v in pairs(self.PoseParameters) do
|
||||
self:SetPoseParameter(v, 0)
|
||||
end
|
||||
|
||||
self:SetLocalAngularVelocity(AngleRand() * 100)
|
||||
|
||||
self.Smoke = ents.Create("env_smoketrail")
|
||||
self.Smoke:SetPos(self:GetPos())
|
||||
self.Smoke:SetKeyValue("opacity", 0.2)
|
||||
self.Smoke:SetKeyValue("spawnrate", 20)
|
||||
self.Smoke:SetKeyValue("lifetime", 0.5)
|
||||
self.Smoke:SetKeyValue("minspeed", 15)
|
||||
self.Smoke:SetKeyValue("maxspeed", 12)
|
||||
self.Smoke:SetKeyValue("startcolor", "0.4 0.4 0.4")
|
||||
self.Smoke:SetKeyValue("endcolor", "0 0 0")
|
||||
self.Smoke:SetKeyValue("startsize", 8)
|
||||
self.Smoke:SetKeyValue("endsize", 32)
|
||||
self.Smoke:SetKeyValue("spawnradius", 5)
|
||||
self.Smoke:SetParent(self)
|
||||
self.Smoke:Spawn()
|
||||
self.Smoke:Activate()
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(colData, phys)
|
||||
if not self:FullyActive() then
|
||||
return
|
||||
end
|
||||
|
||||
local ent = colData.HitEntity
|
||||
|
||||
if ent:Health() > 0 then
|
||||
self:Slice(colData, phys)
|
||||
else
|
||||
self:Bump(colData, phys)
|
||||
end
|
||||
|
||||
self.BladeSpeed = 20
|
||||
end
|
||||
|
||||
function ENT:Slice(colData, phys)
|
||||
local ent = colData.HitEntity
|
||||
local damage = self.IsHostile and 30 or 5
|
||||
|
||||
if ent:IsNPC() then
|
||||
damage = damage * 0.5
|
||||
elseif string.find(ent:GetClass(), "prop_*") and ent:Health() > 0 then
|
||||
damage = ent:Health() * 2
|
||||
end
|
||||
|
||||
if ent:GetClass() != self:GetClass() then
|
||||
local info = DamageInfo()
|
||||
|
||||
info:SetAttacker(self.driver or self)
|
||||
info:SetDamage(damage)
|
||||
info:SetDamageForce(colData.OurOldVelocity)
|
||||
info:SetDamagePosition(colData.HitPos)
|
||||
info:SetDamageType(DMG_SLASH)
|
||||
info:SetInflictor(self)
|
||||
info:SetReportedPosition(colData.HitPos)
|
||||
|
||||
ent:TakeDamageInfo(info)
|
||||
end
|
||||
|
||||
local blood = ent:GetBloodColor()
|
||||
|
||||
if blood == DONT_BLEED or blood == nil then
|
||||
local vel = -self.storedPos:GetNormalized()
|
||||
local data = EffectData()
|
||||
|
||||
data:SetOrigin(colData.HitPos)
|
||||
data:SetAngles(self:GetAngles())
|
||||
data:SetNormal((colData.HitNormal + vel) * 0.5)
|
||||
|
||||
util.Effect("ManhackSparks", data)
|
||||
|
||||
self:EmitSound("NPC_Manhack.Grind")
|
||||
else
|
||||
local env = ents.Create("env_blood")
|
||||
|
||||
env:SetPos(colData.HitPos)
|
||||
env:SetKeyValue("spawnflags", 8)
|
||||
env:SetKeyValue("amount", 250)
|
||||
env:SetCollisionGroup(COLLISION_GROUP_WORLD)
|
||||
env:Spawn()
|
||||
env:Activate()
|
||||
env:Fire("EmitBlood")
|
||||
|
||||
self:EmitSound("NPC_Manhack.Slice")
|
||||
end
|
||||
|
||||
self:Rebound(ent)
|
||||
self:ShowHostile(false)
|
||||
end
|
||||
|
||||
function ENT:Bump(colData, phys)
|
||||
local ent = colData.HitEntity
|
||||
|
||||
if ent:GetMoveType() == MOVETYPE_VPHYSICS then
|
||||
self:HitPhysicsObject(phys, colData.HitObject)
|
||||
end
|
||||
|
||||
if math.abs(self:GetUp():Dot(colData.HitNormal)) < 0.55 then
|
||||
local vel = -self.storedPos:GetNormalized()
|
||||
local data = EffectData()
|
||||
|
||||
data:SetOrigin(colData.HitPos)
|
||||
data:SetAngles(self:GetAngles())
|
||||
data:SetNormal((colData.HitNormal + vel) * 0.5)
|
||||
|
||||
util.Effect("ManhackSparks", data)
|
||||
|
||||
self:EmitSound("NPC_Manhack.Grind")
|
||||
|
||||
self:ShowHostile(false)
|
||||
end
|
||||
|
||||
local dot = self.storedPos:Dot(colData.HitNormal) * colData.HitNormal
|
||||
local reflect = -2 * dot + self.storedPos
|
||||
|
||||
self.storedPos = reflect * 0.5
|
||||
end
|
||||
|
||||
function ENT:Rebound(ent)
|
||||
if ent:Health() > 0 and ent:GetClass() == "func_breakable_surf" then
|
||||
return
|
||||
end
|
||||
|
||||
local dir = (self:WorldSpaceCenter() - ent:WorldSpaceCenter()):GetNormalized()
|
||||
|
||||
dir = dir * 100
|
||||
dir.y = 0
|
||||
|
||||
local phys = ent:GetPhysicsObject()
|
||||
|
||||
if IsValid(phys) then
|
||||
phys:ApplyForceOffset(dir * 4, self:GetPos())
|
||||
end
|
||||
|
||||
self.storedPos = dir
|
||||
end
|
||||
|
||||
function ENT:HitPhysicsObject(phys, other)
|
||||
local pos = other:GetPos()
|
||||
local pos2 = phys:GetPos()
|
||||
|
||||
local dir = (pos - pos2):GetNormalized()
|
||||
local cross = dir:Cross(Vector(0, 0, 1)):GetNormalized()
|
||||
|
||||
other:ApplyForceOffset(cross * 30 * 100, pos)
|
||||
end
|
||||
|
||||
function ENT:PhysicsSimulate(phys, delta)
|
||||
if not self.Active then
|
||||
return
|
||||
end
|
||||
|
||||
local gvel = phys:GetVelocity()
|
||||
|
||||
local desiredPitch = gvel:Dot(self:GetForward()) * self.pitchMultiplier
|
||||
local desiredRoll = gvel:Dot(self:GetRight()) * self.rollMultiplier
|
||||
|
||||
local desiredPos = self:GetPos()
|
||||
local desiredYaw = self:GetAngles().y
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if IsValid(ply) and self:FullyActive() then
|
||||
local addPos = Vector(0, 0, 0)
|
||||
|
||||
if ply:KeyDown(IN_FORWARD) then
|
||||
addPos.x = 0.7
|
||||
elseif ply:KeyDown(IN_BACK) then
|
||||
addPos.x = -0.7
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_MOVELEFT) then
|
||||
addPos.y = 0.5
|
||||
elseif ply:KeyDown(IN_MOVERIGHT) then
|
||||
addPos.y = -0.5
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_JUMP) then
|
||||
addPos.z = 0.3
|
||||
elseif ply:KeyDown(IN_SPEED) then
|
||||
addPos.z = -0.3
|
||||
end
|
||||
|
||||
local ang = self:GetAngles()
|
||||
ang.r = 0
|
||||
ang.p = 0
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
desiredYaw = self.storedYaw
|
||||
else
|
||||
desiredYaw = self:WorldToLocalAngles(ply:EyeAngles()).y
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
addPos:Rotate(Angle(0, self.storedYaw, 0))
|
||||
else
|
||||
addPos:Rotate(Angle(0, desiredYaw, 0))
|
||||
self.storedYaw = desiredYaw
|
||||
end
|
||||
|
||||
local mult = self:GetSpeedMult() * math.max(0.01, self.EnginePower)
|
||||
|
||||
addPos:Mul(mult)
|
||||
|
||||
local dist = math.Clamp(self.storedPos:Distance(addPos), 0, mult)
|
||||
local time = math.Remap(dist, 0, mult, 0, 1)
|
||||
|
||||
local lerp = 1 - math.sin(time * math.pi * 0.5)
|
||||
|
||||
addPos = LerpVector(lerp * delta + (delta * 0.4), self.storedPos, addPos)
|
||||
|
||||
self.storedPos = addPos
|
||||
|
||||
desiredPos = desiredPos + addPos
|
||||
end
|
||||
|
||||
local randPos = Vector(math.sin(math.cos(CurTime())) * 1, math.sin(math.sin(CurTime())) * 1, 0)
|
||||
randPos:Rotate(self:GetAngles())
|
||||
|
||||
desiredPos = desiredPos + randPos
|
||||
|
||||
local move = {}
|
||||
move.secondstoarrive = 0.5
|
||||
move.pos = desiredPos
|
||||
move.angle = Angle(desiredPitch, desiredYaw, desiredRoll)
|
||||
move.maxangular = 12000
|
||||
move.maxangulardamp = 10000
|
||||
move.maxspeed = 12000
|
||||
move.maxspeeddamp = 10000
|
||||
move.dampfactor = 0.6
|
||||
move.teleportdistance = 0
|
||||
move.deltatime = delta
|
||||
|
||||
if IsValid(ply) then
|
||||
phys:ComputeShadowControl(move)
|
||||
else
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
485
lua/entities/aw2_stormtalon.lua
Normal file
485
lua/entities/aw2_stormtalon.lua
Normal file
@@ -0,0 +1,485 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Storm Talon"
|
||||
ENT.Category = "Airwatch 2"
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.AdminOnly = false
|
||||
|
||||
ENT.AutomaticFrameAdvance = true
|
||||
|
||||
ENT.firstPersonOffset = Vector(155, 0, 50)
|
||||
ENT.thirdPersonOffset = Vector(-600, 0, 100)
|
||||
|
||||
ENT.pitchMultiplier = 1
|
||||
ENT.rollMultiplier = 1.5
|
||||
|
||||
ENT.cannonMuzzle = 4
|
||||
ENT.cannonPitch = 5
|
||||
ENT.cannonYaw = 4
|
||||
|
||||
ENT.turretMuzzle1 = 5
|
||||
ENT.turretMuzzle2 = 6
|
||||
ENT.turretPitch = 7
|
||||
ENT.turretYaw = 6
|
||||
|
||||
ENT.spotlightAttach1 = 7
|
||||
ENT.spotlightAttach2 = 8
|
||||
ENT.lightPitch = 9
|
||||
ENT.lightYaw = 8
|
||||
|
||||
ENT.pitchIndex = 5
|
||||
ENT.yawIndex = 4
|
||||
|
||||
ENT.accuracy = 1
|
||||
ENT.damage = 20
|
||||
ENT.delay = 0.12
|
||||
|
||||
ENT.cannonDelay = 1.5
|
||||
|
||||
util.PrecacheSound("NPC_AttackHelicopter.Rotors")
|
||||
util.PrecacheSound("NPC_AttackHelicopter.BadlyDamagedAlert")
|
||||
util.PrecacheSound("NPC_AttackHelicopter.MegabombAlert")
|
||||
util.PrecacheSound("NPC_AttackHelicopter.Crash")
|
||||
util.PrecacheSound("NPC_Strider.Shoot")
|
||||
util.PrecacheSound("hk/plasma.wav")
|
||||
|
||||
function ENT:SpawnFunction(ply, tr, className)
|
||||
if not tr.Hit then
|
||||
return
|
||||
end
|
||||
|
||||
local spawnPos = tr.HitPos + tr.HitNormal * 120
|
||||
|
||||
local ent = ents.Create(className)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ent:SetPos(spawnPos)
|
||||
|
||||
ent.Owner = ply
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Entity", 0, "GunOperator")
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
self:aimTurrets()
|
||||
self:weaponThink()
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if ply and ply:IsValid() or self.healthStatus == AW2_CRASHING or (GetConVar("aw2_alwayson"):GetBool() and self.healthStatus ~= AW2_DEAD) then
|
||||
if not self.isActive then
|
||||
self:enableEffects()
|
||||
self.isActive = true
|
||||
end
|
||||
else
|
||||
if self.isActive then
|
||||
self:disableEffects()
|
||||
self.isActive = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:hasLOS(origin)
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
if IsValid(ply) then
|
||||
local pos, ang = self:GetBonePosition(7)
|
||||
|
||||
ang = ang + Angle(0, self:GetManipulateBoneAngles(4).p, 0) + Angle(self:GetManipulateBoneAngles(7).r, 0, 0)
|
||||
|
||||
local hitpos = self:getHitpos(ply)
|
||||
local dot = ang:Forward():Dot((hitpos - pos):GetNormalized())
|
||||
|
||||
if dot >= 0.95 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:getViewData(ply)
|
||||
if not ply:IsValid() then
|
||||
return
|
||||
end
|
||||
|
||||
local eyeAng = ply:EyeAngles()
|
||||
|
||||
-- Hours wasted on trying to find what the issue was: 4.5
|
||||
-- Hours wasted on trying to fix the issue before finding out the fix was the issue: Too many
|
||||
if SERVER then
|
||||
eyeAng = self:WorldToLocalAngles(eyeAng) -- Note to self: NEVER subtract angles when you can WorldToLocal/LocalToWorld
|
||||
end
|
||||
|
||||
local thirdperson = ply:GetVehicle():GetThirdPersonMode()
|
||||
|
||||
local pos, ang
|
||||
|
||||
if thirdperson then
|
||||
local trace = util.TraceLine({
|
||||
start = self:GetPos(),
|
||||
endpos = self:GetPos() + eyeAng:Up() * self.thirdPersonOffset.z + eyeAng:Forward() * self.thirdPersonOffset.x,
|
||||
filter = {self},
|
||||
mask = MASK_SOLID_BRUSHONLY
|
||||
})
|
||||
|
||||
pos = trace.HitPos + trace.HitNormal * 5
|
||||
ang = eyeAng
|
||||
else
|
||||
local entAng = self:GetAngles()
|
||||
|
||||
entAng.p = 0
|
||||
entAng.r = 0
|
||||
|
||||
local offset = self.firstPersonOffset
|
||||
|
||||
if self.useGunner and self:GetGunOperator() == ply then
|
||||
offset = self.gunnerOffset
|
||||
end
|
||||
|
||||
pos = self:LocalToWorld(offset)
|
||||
ang = eyeAng
|
||||
end
|
||||
|
||||
return pos, ang
|
||||
end
|
||||
|
||||
function ENT:getHitpos(ply)
|
||||
local pos, ang = self:getViewData(ply)
|
||||
|
||||
return util.QuickTrace(pos, ang:Forward() * 10000, {self}).HitPos
|
||||
end
|
||||
|
||||
function ENT:CanPhysgun(ply)
|
||||
if ply and ply:IsValid() then
|
||||
return ply:IsAdmin()
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/Joazzz/Warhammer40k/Spacemarines/Ultramarines/veh_stormtalon.mdl")
|
||||
self:SetBodyGroups("001")
|
||||
self:ResetSequence("idle")
|
||||
|
||||
if SERVER then
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
phys:SetMass(500000)
|
||||
end
|
||||
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
|
||||
self.seatDriver = ents.Create("prop_vehicle_prisoner_pod")
|
||||
self.seatDriver:SetModel("models/props_lab/cactus.mdl")
|
||||
self.seatDriver:SetPos(self:GetPos())
|
||||
self.seatDriver:SetAngles(self:GetAngles())
|
||||
self.seatDriver:SetSolid(SOLID_NONE)
|
||||
self.seatDriver:SetKeyValue("limitview", 0, 0)
|
||||
self.seatDriver:SetNoDraw(true)
|
||||
self.seatDriver:Spawn()
|
||||
self.seatDriver:SetParent(self)
|
||||
self.seatDriver:SetNotSolid(true)
|
||||
|
||||
self:DeleteOnRemove(self.seatDriver)
|
||||
|
||||
self.seatDriver.aw2Ent = self
|
||||
|
||||
self:StartMotionController()
|
||||
|
||||
self.driver = nil
|
||||
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
self.storedVel = Vector(0, 0, 0)
|
||||
self.storedLocalVel = Vector(0, 0, 0)
|
||||
|
||||
self.storedPitch = 0
|
||||
self.storedYaw = 0
|
||||
|
||||
self.isActive = false
|
||||
|
||||
self.nextShot = 0
|
||||
|
||||
self.passengers = {}
|
||||
end
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Use(ply)
|
||||
if not self.driver then
|
||||
ply:EnterVehicle(self.seatDriver)
|
||||
ply:SetNoDraw(true)
|
||||
|
||||
self.driver = ply
|
||||
self:SetGunOperator(ply)
|
||||
|
||||
ply.aw2Ent = self
|
||||
|
||||
net.Start("aw2Enter")
|
||||
net.WriteEntity(self)
|
||||
net.Send(ply)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:StopSound("NPC_AttackHelicopter.Rotors")
|
||||
self:StopSound("NPC_AttackHelicopter.Crash")
|
||||
self:StopSound("NPC_CombineDropship.FireLoop")
|
||||
end
|
||||
|
||||
function ENT:enableEffects()
|
||||
self.wash = ents.Create("env_rotorwash_emitter")
|
||||
self.wash:SetPos(self:GetPos())
|
||||
self.wash:SetAngles(self:GetAngles())
|
||||
self.wash:SetParent(self)
|
||||
self.wash:Spawn()
|
||||
|
||||
self:EmitSound("NPC_AttackHelicopter.Rotors")
|
||||
end
|
||||
|
||||
function ENT:disableEffects()
|
||||
if IsValid(self.wash) then
|
||||
self.wash:Remove()
|
||||
end
|
||||
|
||||
self:StopSound("NPC_AttackHelicopter.Rotors")
|
||||
end
|
||||
|
||||
function ENT:weaponThink()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
if not IsValid(ply) then
|
||||
return
|
||||
end
|
||||
|
||||
local fire = ply:KeyDown(IN_ATTACK) and not ply:KeyDown(IN_RELOAD)
|
||||
|
||||
if fire and self:hasLOS() and self.nextShot <= CurTime() then
|
||||
self.nextShot = CurTime() + self.delay
|
||||
|
||||
local spread = math.sin(self.accuracy * 0.5 * (math.pi / 180))
|
||||
local pos, ang = self:GetBonePosition(7)
|
||||
local bullet = {}
|
||||
|
||||
ang = ang + Angle(0, self:GetManipulateBoneAngles(4).p, 0) + Angle(self:GetManipulateBoneAngles(7).r, 0, 0)
|
||||
|
||||
bullet.Num = 1
|
||||
bullet.Src = pos
|
||||
bullet.Dir = ang:Forward()
|
||||
bullet.Spread = Vector(spread, spread, 0)
|
||||
bullet.Tracer = 1
|
||||
bullet.Force = 20
|
||||
bullet.Damage = self.damage
|
||||
bullet.Attacker = ply
|
||||
|
||||
self:FireBullets(bullet)
|
||||
|
||||
self:EmitSound("hk/plasma.wav", 140)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:keyPress(ply, key)
|
||||
end
|
||||
|
||||
function ENT:aimTurrets()
|
||||
local ply = self:GetGunOperator()
|
||||
|
||||
local pitch = 0
|
||||
local yaw = 0
|
||||
|
||||
if IsValid(ply) then
|
||||
local rad2deg = 180 / math.pi
|
||||
|
||||
local turret = self:GetBonePosition(7)
|
||||
|
||||
local pos, _ = WorldToLocal(self:getHitpos(ply), self:GetAngles(), turret, self:GetAngles())
|
||||
local len = pos:Length()
|
||||
|
||||
if len < 0.0000001000000 then
|
||||
pitch = 0
|
||||
else
|
||||
pitch = rad2deg * math.asin(pos.z / len)
|
||||
end
|
||||
|
||||
yaw = rad2deg * math.atan2(pos.y, pos.x)
|
||||
end
|
||||
|
||||
pitch = math.Clamp(pitch, -50, 10)
|
||||
|
||||
self:ManipulateBoneAngles(4, Angle(yaw, 0, 0))
|
||||
self:ManipulateBoneAngles(7, Angle(0, 0, -pitch))
|
||||
end
|
||||
|
||||
function ENT:ejectPlayer(ply, vehicle)
|
||||
ply:SetNoDraw(false)
|
||||
|
||||
ply.aw2Ent = nil
|
||||
|
||||
net.Start("aw2Eject")
|
||||
net.Send(ply)
|
||||
|
||||
if self.driver == ply then
|
||||
self.driver = nil
|
||||
self:SetGunOperator(nil)
|
||||
end
|
||||
|
||||
ply:SetVelocity(self:GetVelocity())
|
||||
end
|
||||
|
||||
function ENT:PhysicsSimulate(phys, delta)
|
||||
local avel = phys:GetAngleVelocity()
|
||||
local lvel = WorldToLocal(phys:GetVelocity(), Angle(), Vector(), phys:GetAngles())
|
||||
local gvel = phys:GetVelocity()
|
||||
|
||||
local desiredPitch = -(self.storedVel:Dot(self:GetForward()) - gvel:Dot(self:GetForward())) * self.pitchMultiplier
|
||||
local desiredRoll = -(self.storedVel:Dot(self:GetRight()) - gvel:Dot(self:GetRight())) * self.rollMultiplier
|
||||
|
||||
local pLerp = 1 - math.sin(delta * math.pi * 0.5)
|
||||
|
||||
desiredPitch = Lerp(pLerp * delta + delta, self.storedPitch, desiredPitch)
|
||||
|
||||
self.storedPitch = desiredPitch
|
||||
self.storedVel = gvel
|
||||
|
||||
if self.isActive then
|
||||
local paramL = self:GetManipulateBoneAngles(2).r
|
||||
local paramR = self:GetManipulateBoneAngles(3).r
|
||||
|
||||
local vel = math.Remap(lvel.x, -2200, 2200, -180, 0)
|
||||
local rot = math.Clamp(avel:Dot(Vector(0, 0, 1)), -45, 45) * math.Remap(math.abs(lvel.x), 0, 2200, -1, 1)
|
||||
local vert = math.Remap(lvel.z, -1000, 1000, 45, -45) * math.Remap(lvel.x, -2200, 2200, -1, 1)
|
||||
|
||||
local targetL = vel + rot + vert
|
||||
local targetR = vel - rot + vert
|
||||
|
||||
paramL = math.Approach(paramL, targetL, (paramL - targetL) * FrameTime() * math.pi)
|
||||
paramR = math.Approach(paramR, targetR, (paramR - targetR) * FrameTime() * math.pi)
|
||||
|
||||
self:ManipulateBoneAngles(2, Angle(0, 0, paramL))
|
||||
self:ManipulateBoneAngles(3, Angle(0, 0, paramR))
|
||||
else
|
||||
self:ManipulateBoneAngles(2, Angle(0, 0, -45))
|
||||
self:ManipulateBoneAngles(3, Angle(0, 0, -45))
|
||||
end
|
||||
|
||||
self.storedLocalVel = lvel
|
||||
|
||||
local desiredPos = self:GetPos()
|
||||
local desiredYaw = self:GetAngles().y
|
||||
|
||||
local ply = self.driver
|
||||
|
||||
if ply and ply:IsValid() then
|
||||
local addPos = Vector(0, 0, 0)
|
||||
|
||||
if ply:KeyDown(IN_FORWARD) then
|
||||
addPos.x = 0.7
|
||||
elseif ply:KeyDown(IN_BACK) then
|
||||
addPos.x = -0.7
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_MOVELEFT) then
|
||||
addPos.y = 0.5
|
||||
elseif ply:KeyDown(IN_MOVERIGHT) then
|
||||
addPos.y = -0.5
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_JUMP) then
|
||||
addPos.z = 0.3
|
||||
elseif ply:KeyDown(IN_SPEED) then
|
||||
addPos.z = -0.3
|
||||
end
|
||||
|
||||
local ang = self:GetAngles()
|
||||
ang.r = 0
|
||||
ang.p = 0
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
desiredYaw = self.storedYaw
|
||||
else
|
||||
desiredYaw = self:WorldToLocalAngles(ply:EyeAngles()).y
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_WALK) then
|
||||
addPos:Rotate(Angle(0, self.storedYaw, 0))
|
||||
else
|
||||
addPos:Rotate(Angle(0, desiredYaw, 0))
|
||||
self.storedYaw = desiredYaw
|
||||
end
|
||||
|
||||
local mult = 1000
|
||||
|
||||
addPos:Mul(mult)
|
||||
|
||||
local dist = math.Clamp(self.storedPos:Distance(addPos), 0, mult)
|
||||
local time = math.Remap(dist, 0, mult, 0, 1)
|
||||
|
||||
local lerp = 1 - math.sin(time * math.pi * 0.5)
|
||||
|
||||
addPos = LerpVector(lerp * delta + (delta * 0.4), self.storedPos, addPos)
|
||||
|
||||
self.storedPos = addPos
|
||||
|
||||
desiredPos = desiredPos + addPos
|
||||
end
|
||||
|
||||
local randPos = Vector(math.sin(math.cos(CurTime())) * 10, math.sin(math.sin(CurTime())) * 10, 0)
|
||||
randPos:Rotate(self:GetAngles())
|
||||
|
||||
desiredPos = desiredPos + randPos
|
||||
|
||||
local move = {}
|
||||
move.secondstoarrive = 0.5
|
||||
move.pos = desiredPos
|
||||
move.angle = Angle(desiredPitch, desiredYaw, desiredRoll)
|
||||
move.maxangular = 12000
|
||||
move.maxangulardamp = 10000
|
||||
move.maxspeed = 12000
|
||||
move.maxspeeddamp = 10000
|
||||
move.dampfactor = 0.6
|
||||
move.teleportdistance = 0
|
||||
move.deltatime = delta
|
||||
|
||||
if IsValid(ply) or GetConVar("aw2_alwayson"):GetBool() then
|
||||
phys:ComputeShadowControl(move)
|
||||
else
|
||||
self.storedPos = Vector(0, 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
50
lua/entities/bacon1/init.lua
Normal file
50
lua/entities/bacon1/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bacon1" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bacon.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bacon1/shared.lua
Normal file
28
lua/entities/bacon1/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bacon Slice"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Bacon"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bacon.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bacon2/init.lua
Normal file
50
lua/entities/bacon2/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bacon2" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/baconcooked.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bacon2/shared.lua
Normal file
28
lua/entities/bacon2/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bacon Slice (Cooked)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Bacon"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/baconcooked.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/baconslab/init.lua
Normal file
50
lua/entities/baconslab/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BaconSlab" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bacon_2.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating_long.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/baconslab/shared.lua
Normal file
28
lua/entities/baconslab/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bacon"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Bacon"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bacon_2.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bagel1/init.lua
Normal file
50
lua/entities/bagel1/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bagel1" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bagel1.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+15)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bagel1/shared.lua
Normal file
28
lua/entities/bagel1/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bagel"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/Bagel1.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bagel2/init.lua
Normal file
50
lua/entities/bagel2/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bagel2" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bagel2.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+15)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bagel2/shared.lua
Normal file
28
lua/entities/bagel2/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bagel"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/Bagel2.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bagel3/init.lua
Normal file
50
lua/entities/bagel3/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bagel3" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bagel3.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+15)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bagel3/shared.lua
Normal file
28
lua/entities/bagel3/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bagel"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/Bagel3.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bagette/init.lua
Normal file
50
lua/entities/bagette/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bagette" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bagette.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating_long.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bagette/shared.lua
Normal file
28
lua/entities/bagette/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Baguette"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A french baguette"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bagette.mdl")
|
||||
|
||||
end
|
||||
263
lua/entities/base_light.lua
Normal file
263
lua/entities/base_light.lua
Normal file
@@ -0,0 +1,263 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
AddCSLuaFile()
|
||||
|
||||
DEFINE_BASECLASS( "base_anim" )
|
||||
|
||||
ENT.Spawnable = false
|
||||
ENT.DisableDuplicator = false
|
||||
ENT.Editable = true
|
||||
|
||||
ENT.Author = "tau"
|
||||
ENT.Contact = "http://steamcommunity.com/id/blue_orng/"
|
||||
ENT.Category = "Render"
|
||||
|
||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||
|
||||
util.PrecacheModel( "models/error.mdl" )
|
||||
|
||||
function ENT:ColorC( val )
|
||||
|
||||
return math.Clamp( math.Round( val ), 0, 255 )
|
||||
|
||||
end
|
||||
|
||||
function ENT:ColorToString( rgb )
|
||||
|
||||
return tostring( self:ColorC( rgb.r ) ).." "..tostring( self:ColorC( rgb.g ) ).." "..tostring( self:ColorC( rgb.b ) )
|
||||
|
||||
end
|
||||
|
||||
function ENT:ColorIntensityToString( rgb, i )
|
||||
|
||||
local i_int = math.Round( i )
|
||||
|
||||
if ( i_int < 1 ) then return "0 0 0 0" end
|
||||
|
||||
return self:ColorToString( rgb ).." "..tostring( i_int )
|
||||
|
||||
end
|
||||
|
||||
function ENT:BoolToString( b )
|
||||
|
||||
if ( b ) then
|
||||
|
||||
return "1"
|
||||
|
||||
else
|
||||
|
||||
return "0"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ENT:VectorToColor( vec )
|
||||
|
||||
return Color( self:ColorC( vec.x ), self:ColorC( vec.y ), self:ColorC( vec.z ) )
|
||||
|
||||
end
|
||||
|
||||
if ( SERVER ) then
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self:SetModel( "models/error.mdl" )
|
||||
self:SetRenderMode( RENDERMODE_TRANSALPHA )
|
||||
self:DrawShadow( false )
|
||||
|
||||
local min, max = Vector( -2, -2, -2 ), Vector( 2, 2, 2 )
|
||||
|
||||
self:PhysicsInitBox( min, max )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetCollisionGroup( COLLISION_GROUP_WORLD )
|
||||
self:SetCollisionBounds( min, max )
|
||||
|
||||
local physobj = self:GetPhysicsObject()
|
||||
|
||||
if ( IsValid( physobj ) ) then
|
||||
|
||||
physobj:EnableGravity( false )
|
||||
physobj:Wake()
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ENT:material_tool( ply, trace )
|
||||
|
||||
if ( not IsValid( ply ) ) then return end
|
||||
|
||||
local wep = ply:GetActiveWeapon()
|
||||
|
||||
if ( ( not IsValid( wep ) ) or ( wep:GetClass() ~= "gmod_tool" ) or ( wep.Mode ~= "material" ) ) then return end
|
||||
|
||||
local toolobj = wep.Tool[ "material" ]
|
||||
|
||||
if ( not toolobj ) then return end
|
||||
|
||||
if ( ply:KeyPressed( IN_ATTACK ) ) then
|
||||
|
||||
local texname = "effects/flashlight001"
|
||||
|
||||
local matname = toolobj:GetClientInfo( "override" )
|
||||
|
||||
if ( isstring( matname ) ) then
|
||||
|
||||
local mat = Material( matname )
|
||||
|
||||
if ( ( mat ) and ( not mat:IsError() ) ) then
|
||||
|
||||
local shader = mat:GetShader()
|
||||
|
||||
if ( isstring( shader ) and ( string.lower( string.sub( shader, 1, 7 ) ) == "refract" ) ) then
|
||||
|
||||
texname = mat:GetString( "$refracttinttexture" )
|
||||
|
||||
else
|
||||
|
||||
texname = mat:GetString( "$basetexture" )
|
||||
|
||||
end
|
||||
|
||||
if ( not isstring( texname ) ) then texname = "effects/flashlight001" end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self:SetLightTexture( texname )
|
||||
|
||||
wep:DoShootEffect( trace.HitPos, trace.HitNormal, self, trace.PhysicsBone, IsFirstTimePredicted() )
|
||||
|
||||
elseif ( ply:KeyPressed( IN_ATTACK2 ) ) then
|
||||
|
||||
self:SetLightTexture( "effects/flashlight001" )
|
||||
|
||||
wep:DoShootEffect( trace.HitPos, trace.HitNormal, self, trace.PhysicsBone, IsFirstTimePredicted() )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ENT:lamp_tool( ply, trace )
|
||||
|
||||
if ( not IsValid( ply ) ) then return end
|
||||
|
||||
local wep = ply:GetActiveWeapon()
|
||||
|
||||
if ( ( not IsValid( wep ) ) or ( wep:GetClass() ~= "gmod_tool" ) or ( wep.Mode ~= "lamp" ) ) then return end
|
||||
|
||||
local toolobj = wep.Tool[ "lamp" ]
|
||||
|
||||
if ( not toolobj ) then return end
|
||||
|
||||
if ( ply:KeyPressed( IN_ATTACK ) ) then
|
||||
|
||||
local texname = "effects/flashlight001"
|
||||
|
||||
local matname = toolobj:GetClientInfo( "texture" )
|
||||
|
||||
if ( isstring( matname ) ) then
|
||||
|
||||
local mat = Material( matname )
|
||||
|
||||
if ( ( mat ) and ( not mat:IsError() ) ) then
|
||||
|
||||
texname = mat:GetString( "$basetexture" )
|
||||
|
||||
if ( not isstring( texname ) ) then texname = "effects/flashlight001" end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self:SetLightTexture( texname )
|
||||
|
||||
wep:DoShootEffect( trace.HitPos, trace.HitNormal, self, trace.PhysicsBone, IsFirstTimePredicted() )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ENT:colour_tool( ply, trace )
|
||||
|
||||
if ( not IsValid( ply ) ) then return end
|
||||
|
||||
local wep = ply:GetActiveWeapon()
|
||||
|
||||
if ( ( not IsValid( wep ) ) or ( wep:GetClass() ~= "gmod_tool" ) or ( wep.Mode ~= "colour" ) ) then return end
|
||||
|
||||
local toolobj = wep.Tool[ "colour" ]
|
||||
|
||||
if ( not toolobj ) then return end
|
||||
|
||||
if ( ply:KeyPressed( IN_ATTACK ) ) then
|
||||
|
||||
self:SetLightColor( Vector( toolobj:GetClientNumber( "r", 255 ), toolobj:GetClientNumber( "g", 255 ), toolobj:GetClientNumber( "b", 255 ) ) )
|
||||
|
||||
wep:DoShootEffect( trace.HitPos, trace.HitNormal, self, trace.PhysicsBone, IsFirstTimePredicted() )
|
||||
|
||||
elseif ( ply:KeyPressed( IN_ATTACK2 ) ) then
|
||||
|
||||
self:SetLightColor( Vector( 255, 255, 255 ) )
|
||||
|
||||
wep:DoShootEffect( trace.HitPos, trace.HitNormal, self, trace.PhysicsBone, IsFirstTimePredicted() )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ENT:light_tool( ply, trace )
|
||||
|
||||
if ( not IsValid( ply ) ) then return end
|
||||
|
||||
local wep = ply:GetActiveWeapon()
|
||||
|
||||
if ( ( not IsValid( wep ) ) or ( wep:GetClass() ~= "gmod_tool" ) or ( wep.Mode ~= "light" ) ) then return end
|
||||
|
||||
local toolobj = wep.Tool[ "light" ]
|
||||
|
||||
if ( not toolobj ) then return end
|
||||
|
||||
if ( ply:KeyPressed( IN_ATTACK ) or ply:KeyPressed( IN_ATTACK2 ) ) then
|
||||
|
||||
self:SetLightColor( Vector( toolobj:GetClientNumber( "r", 255 ), toolobj:GetClientNumber( "g", 255 ), toolobj:GetClientNumber( "b", 255 ) ) )
|
||||
|
||||
wep:DoShootEffect( trace.HitPos, trace.HitNormal, self, trace.PhysicsBone, IsFirstTimePredicted() )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if ( CLIENT ) then
|
||||
|
||||
ENT.c_r = Color( 255, 0, 0, 255 )
|
||||
ENT.c_c = Color( 0, 255, 255, 255 )
|
||||
|
||||
ENT.c_g = Color( 0, 255, 0, 255 )
|
||||
ENT.c_m = Color( 255, 0, 255, 255 )
|
||||
|
||||
ENT.c_b = Color( 0, 0, 255, 255 )
|
||||
ENT.c_y = Color( 255, 255, 0, 255 )
|
||||
|
||||
function ENT:Camera()
|
||||
|
||||
local wep = LocalPlayer():GetActiveWeapon()
|
||||
|
||||
return IsValid( wep ) and ( wep:GetClass() == "gmod_camera" )
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
50
lua/entities/bdcake/init.lua
Normal file
50
lua/entities/bdcake/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BDCake" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cake.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+30)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bdcake/shared.lua
Normal file
28
lua/entities/bdcake/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Birthday Cake"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A birthday cake"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cake.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bdcake2/init.lua
Normal file
50
lua/entities/bdcake2/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BDCake2" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cake_b.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+30)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bdcake2/shared.lua
Normal file
28
lua/entities/bdcake2/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Birthday Cake"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A birthday cake"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cake_b.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bdcakeslice1/init.lua
Normal file
50
lua/entities/bdcakeslice1/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BDCakeslice1" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cakepiece.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bdcakeslice1/shared.lua
Normal file
28
lua/entities/bdcakeslice1/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Birthday Cake (Slice)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A piece of birthday cake"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cakepiece.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bdcakeslice2/init.lua
Normal file
50
lua/entities/bdcakeslice2/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BDCakeslice2" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cakepiece2.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bdcakeslice2/shared.lua
Normal file
28
lua/entities/bdcakeslice2/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Birthday Cake (Slice)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A piece of birthday cake"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cakepiece2.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bdcakeslice3/init.lua
Normal file
50
lua/entities/bdcakeslice3/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BDCakeslice3" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cakeslice1.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bdcakeslice3/shared.lua
Normal file
28
lua/entities/bdcakeslice3/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Birthday Cake (Slice)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A piece of birthday cake"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cakeslice1.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bdcakeslice4/init.lua
Normal file
50
lua/entities/bdcakeslice4/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BDCakeslice4" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cakeslice2.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bdcakeslice4/shared.lua
Normal file
28
lua/entities/bdcakeslice4/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Birthday Cake (Slice)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A piece of birthday cake"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/cakeslice2.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/beer1/init.lua
Normal file
50
lua/entities/beer1/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Beer1" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beer_master.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/beerbottle.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/beer1/shared.lua
Normal file
28
lua/entities/beer1/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Beer (Master)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beer_master.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/beer2/init.lua
Normal file
50
lua/entities/beer2/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Beer2" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beer_stoltz.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/beerbottle.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/beer2/shared.lua
Normal file
28
lua/entities/beer2/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Beer (Stoltz)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beer_stoltz.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/beercan1/init.lua
Normal file
50
lua/entities/beercan1/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BeerCan1" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beercan01.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/can.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/beercan1/shared.lua
Normal file
28
lua/entities/beercan1/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Beer (Duff)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beercan01.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/beercan2/init.lua
Normal file
50
lua/entities/beercan2/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BeerCan2" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beercan02.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/can.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/beercan2/shared.lua
Normal file
28
lua/entities/beercan2/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Beer (Pißwasser)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beercan02.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/beercan3/init.lua
Normal file
50
lua/entities/beercan3/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "BeerCan3" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beercan03.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/can.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/beercan3/shared.lua
Normal file
28
lua/entities/beercan3/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Beer (Hop Knot)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/beercan03.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bread1/init.lua
Normal file
50
lua/entities/bread1/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bread1" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread-1.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating_long.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bread1/shared.lua
Normal file
28
lua/entities/bread1/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bread"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread-1.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bread2/init.lua
Normal file
50
lua/entities/bread2/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bread2" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread-2.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating_long.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bread2/shared.lua
Normal file
28
lua/entities/bread2/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bread"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread-2.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bread3/init.lua
Normal file
50
lua/entities/bread3/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bread3" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread-3.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating_long.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bread3/shared.lua
Normal file
28
lua/entities/bread3/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bread"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread-3.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bread4/init.lua
Normal file
50
lua/entities/bread4/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bread4" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread-4.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating_long.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bread4/shared.lua
Normal file
28
lua/entities/bread4/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bread"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread-1.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bread5/init.lua
Normal file
50
lua/entities/bread5/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bread5" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread_loaf.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+20)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating_long.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bread5/shared.lua
Normal file
28
lua/entities/bread5/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bread"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread_loaf.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bread5b/init.lua
Normal file
50
lua/entities/bread5b/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bread5b" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread_half.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bread5b/shared.lua
Normal file
28
lua/entities/bread5b/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bread (half)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread_half.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/bread5c/init.lua
Normal file
50
lua/entities/bread5c/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Bread5c" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread_slice.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+5)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/bread5c/shared.lua
Normal file
28
lua/entities/bread5c/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Bread (slice)"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "Food"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/bread_slice.mdl")
|
||||
|
||||
end
|
||||
50
lua/entities/burger1/init.lua
Normal file
50
lua/entities/burger1/init.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile( "shared.lua" )
|
||||
include( 'shared.lua' )
|
||||
|
||||
function ENT:SpawnFunction( ply, tr )
|
||||
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 1
|
||||
|
||||
local ent = ents.Create( "Burger1" )
|
||||
ent:SetPos( SpawnPos )
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/burgergtasa.mdl")
|
||||
|
||||
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
||||
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self.Entity:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
|
||||
self.Index = self.Entity:EntIndex()
|
||||
|
||||
local phys = self.Entity:GetPhysicsObject()
|
||||
if phys:IsValid() then
|
||||
phys:Wake()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator)
|
||||
activator:SetHealth(activator:Health()+10)
|
||||
self.Entity:Remove()
|
||||
activator:EmitSound("eating_and_drinking/eating.wav", 50, 100)
|
||||
|
||||
end
|
||||
28
lua/entities/burger1/shared.lua
Normal file
28
lua/entities/burger1/shared.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Burger"
|
||||
ENT.Author = "SaDow4100"
|
||||
ENT.Contact = "Steam"
|
||||
ENT.Purpose = "A Burger"
|
||||
ENT.Instructions = "E"
|
||||
ENT.Category = "Food"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
function ENT:SetupModel()
|
||||
|
||||
self.Entity:SetModel("models/FoodNHouseholdItems/burgergtasa.mdl")
|
||||
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user