mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
51
addons/pillpack/lua/entities/pill_attachment_wep.lua
Normal file
51
addons/pillpack/lua/entities/pill_attachment_wep.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
--[[
|
||||
| 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.AutomaticFrameAdvance = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Vector", 0, "WepOffset")
|
||||
self:NetworkVar("Angle", 0, "WepAng")
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
if self.attachment then
|
||||
self:Fire("setparentattachment", "anim_attachment_RH", 0)
|
||||
else
|
||||
self:AddEffects(bit.bor(EF_BONEMERGE, EF_BONEMERGE_FASTCULL))
|
||||
end
|
||||
|
||||
self:SetRenderMode(RENDERMODE_TRANSALPHA)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
local offset = self:GetWepOffset()
|
||||
local ang = self:GetWepAng()
|
||||
|
||||
if offset ~= Vector(0, 0, 0) then
|
||||
self:SetRenderOrigin(self:LocalToWorld(offset))
|
||||
end
|
||||
|
||||
if ang ~= Angle(0, 0, 0) then
|
||||
self:SetRenderAngles(self:LocalToWorldAngles(ang))
|
||||
end
|
||||
|
||||
self:DrawModel()
|
||||
end
|
||||
31
addons/pillpack/lua/entities/pill_attachment_zed.lua
Normal file
31
addons/pillpack/lua/entities/pill_attachment_zed.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
--[[
|
||||
| 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"
|
||||
|
||||
function ENT:Initialize()
|
||||
self:AddCallback("BuildBonePositions", self.BoneItUp)
|
||||
|
||||
if SERVER then
|
||||
self:AddEffects(bit.bor(EF_BONEMERGE, EF_BONEMERGE_FASTCULL)) --fastcull seems to fix laggy bullshit garbage
|
||||
end
|
||||
|
||||
self:GetParent():SetSubMaterial(0, "models/effects/vol_light001")
|
||||
end
|
||||
|
||||
function ENT:BoneItUp(boneCount)
|
||||
local boneId = self:LookupBone("ValveBiped.Bip01_Head1")
|
||||
if not boneId then return end
|
||||
local matrix = self:GetBoneMatrix(boneId)
|
||||
if not matrix then return end
|
||||
matrix:Scale(Vector(.01, .01, .01))
|
||||
self:SetBoneMatrix(boneId, matrix)
|
||||
end
|
||||
51
addons/pillpack/lua/entities/pill_barnacle_tongue.lua
Normal file
51
addons/pillpack/lua/entities/pill_barnacle_tongue.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
--[[
|
||||
| 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.PrintName = "Barnacle Tongue"
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
--Physics
|
||||
self:SetModel("models/props_junk/PopCan01a.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
phys:SetMass(100)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:StartTouch(ent)
|
||||
if IsValid(self.connected) or ent:IsWorld() then return end
|
||||
|
||||
if util.IsValidRagdoll(ent:GetModel()) and not ent:IsRagdoll() and not ent:IsPlayer() then
|
||||
local doll = ents.Create("prop_ragdoll")
|
||||
doll:SetModel(ent:GetModel())
|
||||
doll:SetPos(ent:GetPos())
|
||||
doll:SetAngles(ent:GetAngles())
|
||||
doll:Spawn()
|
||||
ent:Remove()
|
||||
ent = doll
|
||||
self:SetPos(ent:GetPhysicsObject(0):GetPos())
|
||||
end
|
||||
|
||||
constraint.Weld(self, ent, 0, 0, 0, true, false)
|
||||
self.connected = ent
|
||||
self:EmitSound("npc/barnacle/neck_snap1.wav")
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
end
|
||||
151
addons/pillpack/lua/entities/pill_dropship_container.lua
Normal file
151
addons/pillpack/lua/entities/pill_dropship_container.lua
Normal file
@@ -0,0 +1,151 @@
|
||||
--[[
|
||||
| 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.PrintName = "Dropship Container"
|
||||
ENT.Category = "Pill Pack Entities"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
ENT.AutomaticFrameAdvance = true
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
--Physics
|
||||
self:SetModel("models/Combine_Dropship_Container.mdl")
|
||||
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:Wake()
|
||||
end
|
||||
|
||||
self.mode = 1
|
||||
self.full = true
|
||||
end
|
||||
|
||||
self:SetPlaybackRate(1)
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:Deploy()
|
||||
local dropship = self:GetParent()
|
||||
|
||||
if not self.full then
|
||||
dropship:PillSound("alert_empty")
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
self.full = false
|
||||
self:SetSequence(self:LookupSequence("open"))
|
||||
dropship:PillLoopSound("deploy")
|
||||
|
||||
local doClose = function()
|
||||
if not IsValid(self) then return end
|
||||
self:SetSequence(self:LookupSequence("close"))
|
||||
|
||||
if IsValid(dropship) and self:GetParent() == dropship then
|
||||
dropship:PillLoopStop("deploy")
|
||||
end
|
||||
end
|
||||
|
||||
if self.mode ~= 6 then
|
||||
local mode = self.mode
|
||||
timer.Simple(12, doClose)
|
||||
|
||||
local doDeploy = function()
|
||||
if not IsValid(self) then return end
|
||||
local m = mode == 5 and math.random(1, 4) or mode
|
||||
local startAngPos = self:GetAttachment(self:LookupAttachment("deploy_landpoint"))
|
||||
local combine = ents.Create("pill_jumper_combine")
|
||||
combine:SetPos(startAngPos.Pos)
|
||||
combine:SetAngles(self:GetAngles())
|
||||
combine.myNpc = m == 4 and "npc_metropolice" or "npc_combine_s"
|
||||
combine.myWeapon = m == 2 and "weapon_shotgun" or m == 4 and "weapon_smg1" or "weapon_ar2"
|
||||
|
||||
if m == 1 or m == 2 then
|
||||
combine:SetModel("models/combine_soldier.mdl")
|
||||
elseif m == 3 then
|
||||
combine:SetModel("models/Combine_Super_Soldier.mdl")
|
||||
elseif m == 4 then
|
||||
combine:SetModel("models/police.mdl")
|
||||
end
|
||||
|
||||
if m == 2 then
|
||||
combine:SetSkin(1)
|
||||
end
|
||||
|
||||
combine:SetParent(self)
|
||||
combine:Spawn()
|
||||
end
|
||||
|
||||
for i = 1, 5 do
|
||||
timer.Simple(i * 2, doDeploy)
|
||||
end
|
||||
else
|
||||
timer.Simple(5.5, doClose)
|
||||
|
||||
local doDeploy = function()
|
||||
if not IsValid(self) then return end
|
||||
local mine = ents.Create("npc_rollermine")
|
||||
mine:SetPos(self:LocalToWorld(Vector(100, 0, 0)))
|
||||
mine:Spawn()
|
||||
mine:GetPhysicsObject():SetVelocity(self:GetAngles():Forward() * 500)
|
||||
end
|
||||
|
||||
for i = 1, 10 do
|
||||
timer.Simple(i / 2, doDeploy)
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:Use(ply)
|
||||
if self.mode >= 6 then
|
||||
self.mode = 1
|
||||
else
|
||||
self.mode = self.mode + 1
|
||||
end
|
||||
|
||||
if self.mode == 1 then
|
||||
ply:ChatPrint("Mode 1: 5 Soldiers")
|
||||
elseif self.mode == 2 then
|
||||
ply:ChatPrint("Mode 2: 5 Shotgunners")
|
||||
elseif self.mode == 3 then
|
||||
ply:ChatPrint("Mode 3: 5 Elites")
|
||||
elseif self.mode == 4 then
|
||||
ply:ChatPrint("Mode 4: 5 Metrocops")
|
||||
elseif self.mode == 5 then
|
||||
ply:ChatPrint("Mode 5: 5 Random Combine")
|
||||
elseif self.mode == 6 then
|
||||
ply:ChatPrint("Mode 6: 10 Rollermines")
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:SpawnFunction(ply, tr, ClassName)
|
||||
if (not tr.Hit) then return end
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 100
|
||||
local ent = ents.Create(ClassName)
|
||||
ent:SetPos(SpawnPos)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
170
addons/pillpack/lua/entities/pill_dropship_strider.lua
Normal file
170
addons/pillpack/lua/entities/pill_dropship_strider.lua
Normal file
@@ -0,0 +1,170 @@
|
||||
--[[
|
||||
| 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.PrintName = "Dropship Strider"
|
||||
ENT.Category = "Pill Pack Entities"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminSpawnable = true
|
||||
|
||||
--ENT.AutomaticFrameAdvance = true
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
--Physics
|
||||
--self:SetModel("models/Combine_Strider.mdl")
|
||||
self:SetModel("models/Combine_Dropship_Container.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
self:SetRenderMode(RENDERMODE_NONE)
|
||||
self:DrawShadow(false)
|
||||
--self:SetSequence(self:LookupSequence("carried"))
|
||||
self.strider = ents.Create("prop_dynamic")
|
||||
self.strider:SetModel("models/Combine_Strider.mdl")
|
||||
self.strider:SetParent(self)
|
||||
self.strider:SetLocalPos(Vector(0, 0, -140))
|
||||
self.strider:SetLocalAngles(Angle(0, 0, 0))
|
||||
self.strider:Spawn()
|
||||
self.strider:SetSequence(self.strider:LookupSequence("carried"))
|
||||
end
|
||||
--self:SetPlaybackRate(1)
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if self.droppedfrom then
|
||||
local angs = self:GetAngles()
|
||||
angs.p = 0
|
||||
angs.r = 0
|
||||
self.strider:SetAngles(angs)
|
||||
local trace = util.QuickTrace(self:GetPos(), Vector(0, 0, -600), {self, self.droppedfrom})
|
||||
|
||||
if trace.Hit then
|
||||
self:Remove()
|
||||
local stridernpc = ents.Create("npc_strider")
|
||||
stridernpc:SetPos(self:GetPos())
|
||||
stridernpc:SetAngles(angs)
|
||||
stridernpc:Spawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Deploy()
|
||||
self.strider:ResetSequence(self.strider:LookupSequence("deploy"))
|
||||
|
||||
timer.Simple(2, function()
|
||||
if not IsValid(self) then return end
|
||||
self:EmitSound("npc/strider/striderx_alert2.wav")
|
||||
end)
|
||||
|
||||
timer.Simple(3, function()
|
||||
if not IsValid(self) then return end
|
||||
local dropship = self:GetParent()
|
||||
if not IsValid(dropship) then return end
|
||||
dropship.container = nil
|
||||
self.droppedfrom = dropship
|
||||
self:SetParent()
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
--self:SetPos(dropship:GetPos())
|
||||
--self:SetAngles(dropship:GetAngles())
|
||||
self:GetPhysicsObject():Wake()
|
||||
self.strider:SetLocalPos(Vector(0, 0, 0))
|
||||
end)
|
||||
--[[local dropship = self:GetParent()
|
||||
|
||||
if !self.full then dropship:PillSound("alert_empty") return end
|
||||
self.full=false
|
||||
|
||||
self:SetSequence(self:LookupSequence("open"))
|
||||
dropship:PillLoopSound("deploy")
|
||||
|
||||
local doClose = function()
|
||||
if !IsValid(self) then return end
|
||||
self:SetSequence(self:LookupSequence("close"))
|
||||
|
||||
if IsValid(dropship)&&self:GetParent()==dropship then
|
||||
dropship:PillLoopStop("deploy")
|
||||
end
|
||||
end
|
||||
|
||||
if self.mode!=6 then
|
||||
local mode = self.mode
|
||||
timer.Simple(12,doClose)
|
||||
|
||||
local doDeploy=function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
local m = mode==5&&math.random(1,4)||mode
|
||||
|
||||
local startAngPos = self:GetAttachment(self:LookupAttachment("deploy_landpoint"))
|
||||
local combine = ents.Create("pill_jumper_combine")
|
||||
combine:SetPos(startAngPos.Pos)
|
||||
combine:SetAngles(self:GetAngles())
|
||||
|
||||
combine.myNpc= m==4&&"npc_metropolice"||"npc_combine_s"
|
||||
combine.myWeapon= m==2&&"weapon_shotgun"||m==4&&"weapon_smg1"||"weapon_ar2"
|
||||
|
||||
if m==1 or m==2 then
|
||||
combine:SetModel("models/combine_soldier.mdl")
|
||||
elseif m==3 then
|
||||
combine:SetModel("models/Combine_Super_Soldier.mdl")
|
||||
elseif m==4 then
|
||||
combine:SetModel("models/police.mdl")
|
||||
end
|
||||
|
||||
if m==2 then
|
||||
combine:SetSkin(1)
|
||||
end
|
||||
|
||||
combine:SetParent(self)
|
||||
combine:Spawn()
|
||||
end
|
||||
|
||||
for i=1,5 do
|
||||
timer.Simple(i*2,doDeploy)
|
||||
end
|
||||
else
|
||||
timer.Simple(5.5,doClose)
|
||||
|
||||
local doDeploy=function()
|
||||
if !IsValid(self) then return end
|
||||
|
||||
local mine = ents.Create("npc_rollermine")
|
||||
mine:SetPos(self:LocalToWorld(Vector(100,0,0)))
|
||||
mine:Spawn()
|
||||
mine:GetPhysicsObject():SetVelocity(self:GetAngles():Forward()*500)
|
||||
end
|
||||
|
||||
for i=1,10 do
|
||||
timer.Simple(i/2,doDeploy)
|
||||
end
|
||||
end
|
||||
|
||||
return true]]
|
||||
end
|
||||
|
||||
function ENT:SpawnFunction(ply, tr, ClassName)
|
||||
if (not tr.Hit) then return end
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 100
|
||||
local ent = ents.Create(ClassName)
|
||||
ent:SetPos(SpawnPos)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
return ent
|
||||
end
|
||||
945
addons/pillpack/lua/entities/pill_ent_costume.lua
Normal file
945
addons/pillpack/lua/entities/pill_ent_costume.lua
Normal file
@@ -0,0 +1,945 @@
|
||||
--[[
|
||||
| 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.AutomaticFrameAdvance = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("String", 0, "PillForm")
|
||||
self:NetworkVar("Entity", 0, "PillUser")
|
||||
self:NetworkVar("Entity", 1, "Puppet")
|
||||
self:NetworkVar("Float", 0, "ChargeTime")
|
||||
self:NetworkVar("Angle", 0, "ChargeAngs")
|
||||
self:NetworkVar("Float", 1, "CloakLeft")
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
self.formTable = pk_pills.getPillTable(self:GetPillForm())
|
||||
local ply = self:GetPillUser()
|
||||
|
||||
if not self.formTable or not IsValid(ply) then
|
||||
if SERVER then self:Remove() end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local hull = self.formTable.hull or Vector(32, 32, 72)
|
||||
local duckBy = self.formTable.duckBy or (self.formTable.hull and 0 or 36)
|
||||
ply:SetHull(-Vector(hull.x / 2, hull.y / 2, 0), Vector(hull.x / 2, hull.y / 2, hull.z))
|
||||
ply:SetHullDuck(-Vector(hull.x / 2, hull.y / 2, 0), Vector(hull.x / 2, hull.y / 2, hull.z - duckBy or 0))
|
||||
ply:SetRenderMode(RENDERMODE_NONE)
|
||||
--Do this so weapon equips are not blocked
|
||||
pk_pills.mapEnt(ply, nil)
|
||||
|
||||
if SERVER then
|
||||
self:SetModel("models/Combine_Helicopter/helicopter_bomb01.mdl")
|
||||
self:SetPos(ply:GetPos())
|
||||
self:SetParent(ply)
|
||||
self:DrawShadow(false)
|
||||
ply:StripWeapons()
|
||||
ply:RemoveAllAmmo()
|
||||
|
||||
if self.formTable.flies then
|
||||
ply:SetMoveType(MOVETYPE_FLY)
|
||||
else
|
||||
ply:SetMoveType(MOVETYPE_WALK)
|
||||
end
|
||||
|
||||
if ply:FlashlightIsOn() then
|
||||
ply:Flashlight(false)
|
||||
end
|
||||
|
||||
ply:Freeze(false)
|
||||
ply:SetNotSolid(false)
|
||||
ply:DrawViewModel(false)
|
||||
--ply:DrawWorldModel(false)
|
||||
local camOffset = self.formTable.camera and self.formTable.camera.offset or Vector(0, 0, 64)
|
||||
--clside this?
|
||||
ply:SetStepSize(hull.z / 4)
|
||||
ply:SetViewOffset(camOffset)
|
||||
ply:SetViewOffsetDucked(camOffset - Vector(0, 0, duckBy))
|
||||
local speed = self.formTable.moveSpeed or {}
|
||||
ply:SetWalkSpeed(speed.walk or 200)
|
||||
ply:SetRunSpeed(speed.run or speed.walk or 500)
|
||||
|
||||
if speed.ducked then
|
||||
ply:SetCrouchedWalkSpeed(speed.ducked / (speed.walk or 200))
|
||||
elseif duckBy == 0 then
|
||||
ply:SetCrouchedWalkSpeed(1)
|
||||
else
|
||||
ply:SetCrouchedWalkSpeed(.3)
|
||||
end
|
||||
|
||||
ply:SetJumpPower(self.formTable.jumpPower or 200)
|
||||
self.loopingSounds = {}
|
||||
|
||||
if self.formTable.sounds then
|
||||
for k, v in pairs(self.formTable.sounds) do
|
||||
if string.sub(k, 1, 5) == "loop_" then
|
||||
self.loopingSounds[string.sub(k, 6)] = CreateSound(self, v)
|
||||
elseif string.sub(k, 1, 5) == "auto_" and isstring(v) then
|
||||
local func
|
||||
|
||||
func = function()
|
||||
if IsValid(self) then
|
||||
local f = self.formTable.sounds[k .. "_func"]
|
||||
if not f then return end
|
||||
local play, time = f(self:GetPillUser(), self)
|
||||
|
||||
if play then
|
||||
self:PillSound(k)
|
||||
end
|
||||
|
||||
timer.Simple(time, func)
|
||||
end
|
||||
end
|
||||
|
||||
func()
|
||||
end
|
||||
end
|
||||
|
||||
if self.loopingSounds.move then
|
||||
self:PillLoopSound("move")
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.health then
|
||||
self:GetPillUser():SetHealth(self.formTable.health)
|
||||
self:GetPillUser():SetMaxHealth(self.formTable.health)
|
||||
else
|
||||
self:GetPillUser():GodEnable()
|
||||
end
|
||||
|
||||
ply:SetArmor(0)
|
||||
|
||||
if self.formTable.loadout then
|
||||
for _, v in pairs(self.formTable.loadout) do
|
||||
ply:Give(v)
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.ammo then
|
||||
for k, v in pairs(self.formTable.ammo) do
|
||||
ply:SetAmmo(v, k)
|
||||
end
|
||||
end
|
||||
|
||||
--[[if self.formTable.seqInit then
|
||||
self:PillAnim(self.formTable.seqInit,true)
|
||||
end]]
|
||||
--[[if self.formTable.bodyGroups then
|
||||
for _,v in pairs(self.formTable.bodyGroups) do
|
||||
self:SetBodygroup(v,1)
|
||||
end
|
||||
end]]
|
||||
--self:SetPlaybackRate(1)
|
||||
pk_pills.setAiTeam(ply, self.formTable.side or "default")
|
||||
local model = self.formTable.model
|
||||
local skin = self.formTable.skin
|
||||
local attachments = self.formTable.attachments
|
||||
|
||||
if self.formTable.options then
|
||||
local options = self.formTable.options()
|
||||
|
||||
if self.option and options[self.option] then
|
||||
local pickedOption = options[self.option]
|
||||
|
||||
if pickedOption.model then
|
||||
model = pickedOption.model
|
||||
end
|
||||
|
||||
if pickedOption.skin then
|
||||
skin = pickedOption.skin
|
||||
end
|
||||
|
||||
if pickedOption.attachments then
|
||||
attachments = pickedOption.attachments
|
||||
end
|
||||
else
|
||||
local pickedOption = table.Random(options)
|
||||
|
||||
if not model then
|
||||
model = pickedOption.model
|
||||
end
|
||||
|
||||
if not skin then
|
||||
skin = pickedOption.skin
|
||||
end
|
||||
|
||||
if not attachments then
|
||||
attachments = pickedOption.attachments
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local puppet = ents.Create("pill_puppet")
|
||||
puppet:SetModel(model or "models/Humans/corpse1.mdl")
|
||||
|
||||
if skin then
|
||||
puppet:SetSkin(skin)
|
||||
end
|
||||
|
||||
if attachments then
|
||||
for _, mdl in pairs(attachments) do
|
||||
local a = ents.Create("pill_attachment")
|
||||
a:SetParent(puppet)
|
||||
a:SetModel(mdl)
|
||||
a:Spawn()
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.visColor then
|
||||
puppet:SetColor(self.formTable.visColor)
|
||||
elseif self.formTable.visColorRandom then
|
||||
puppet:SetColor(HSVToColor(math.Rand(0, 360), 1, 1))
|
||||
end
|
||||
|
||||
if self.formTable.visMat then
|
||||
puppet:SetMaterial(self.formTable.visMat)
|
||||
end
|
||||
|
||||
if self.formTable.bodyGroups then
|
||||
for _, v in pairs(self.formTable.bodyGroups) do
|
||||
if v then
|
||||
puppet:SetBodygroup(v, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.modelScale then
|
||||
puppet:SetModelScale(self.formTable.modelScale, .1)
|
||||
end
|
||||
|
||||
if self.formTable.boneMorphs then
|
||||
for k, v in pairs(self.formTable.boneMorphs) do
|
||||
local b = puppet:LookupBone(k)
|
||||
|
||||
if b then
|
||||
if v.pos then
|
||||
puppet:ManipulateBonePosition(b, v.pos)
|
||||
end
|
||||
|
||||
if v.rot then
|
||||
puppet:ManipulateBoneAngles(b, v.rot)
|
||||
end
|
||||
|
||||
if v.scale then
|
||||
puppet:ManipulateBoneScale(b, v.scale)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.cloak then
|
||||
self:SetCloakLeft(self.formTable.cloak.max)
|
||||
end
|
||||
|
||||
--puppet:SetParent(self)
|
||||
puppet:Spawn()
|
||||
self:DeleteOnRemove(puppet)
|
||||
self:SetPuppet(puppet)
|
||||
end
|
||||
|
||||
pk_pills.mapEnt(ply, self)
|
||||
--self:SetPlaybackRate(1)
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
local ply = self:GetPillUser()
|
||||
|
||||
if SERVER then
|
||||
self:PillLoopStopAll()
|
||||
end
|
||||
|
||||
local newType = pk_pills.unmapEnt(self:GetPillUser(), self)
|
||||
|
||||
if newType ~= "ply" and IsValid(ply) then
|
||||
ply:ResetHull()
|
||||
|
||||
if SERVER then
|
||||
ply:SetViewOffset(Vector(0, 0, 64))
|
||||
ply:SetViewOffsetDucked(Vector(0, 0, 28))
|
||||
ply:SetStepSize(18)
|
||||
-- Not sure if this chunk is needed... leaving it for now.
|
||||
ply:Freeze(false)
|
||||
|
||||
if ply:Alive() then
|
||||
ply:SetMoveType(MOVETYPE_WALK)
|
||||
end
|
||||
|
||||
ply:SetNotSolid(false)
|
||||
|
||||
if ply:Alive() then
|
||||
-- Just respawn the player to reset most stuff.
|
||||
local angs = ply:EyeAngles()
|
||||
local pos = ply:GetPos()
|
||||
local vel = ply:GetVelocity()
|
||||
local hp = ply:Health()
|
||||
ply:StripWeapons()
|
||||
ply:StripAmmo()
|
||||
ply:Spawn()
|
||||
ply:SetEyeAngles(angs)
|
||||
ply:SetPos(pos)
|
||||
ply:SetVelocity(vel)
|
||||
ply:SetHealth(hp)
|
||||
end
|
||||
|
||||
if not newType then
|
||||
ply:SetRenderMode(RENDERMODE_NORMAL)
|
||||
pk_pills.setAiTeam(ply, "default")
|
||||
end
|
||||
elseif not newType then
|
||||
if ply == LocalPlayer() then
|
||||
if ply.pk_pill_gmpEnabled then
|
||||
ply.pk_pill_gmpEnabled = nil
|
||||
--RunConsoleCommand("gmp_enabled","1")
|
||||
end
|
||||
--ply.ShouldDisableLegs=nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
local ply = self:GetPillUser()
|
||||
local puppet = self:GetPuppet()
|
||||
if not IsValid(puppet) or not IsValid(ply) then return end
|
||||
local vel = ply:GetVelocity():Length()
|
||||
|
||||
if SERVER then
|
||||
--Anims
|
||||
local anims = table.Copy(self.formTable.anims.default or {})
|
||||
table.Merge(anims, (IsValid(ply:GetActiveWeapon()) and self.formTable.anims[ply:GetActiveWeapon():GetHoldType()]) or (self.forceAnimSet and self.formTable.anims[self.forceAnimSet]) or {})
|
||||
local anim
|
||||
--local useSeqVel=true
|
||||
local overrideRate
|
||||
|
||||
if (not self.anim or not anims[self.anim]) then
|
||||
self.animFreeze = nil
|
||||
self.animStart = nil
|
||||
end
|
||||
|
||||
if self.animFreeze and not self.plyFrozen then
|
||||
ply:SetWalkSpeed(ply:GetWalkSpeed() / 2)
|
||||
ply:SetRunSpeed(ply:GetWalkSpeed() / 2)
|
||||
self.plyFrozen = true
|
||||
elseif not self.animFreeze and self.plyFrozen then
|
||||
local speed = self.formTable.moveSpeed or {}
|
||||
ply:SetWalkSpeed(speed.walk or 200)
|
||||
ply:SetRunSpeed(speed.run or speed.walk or 500)
|
||||
self.plyFrozen = nil
|
||||
end
|
||||
|
||||
if self.anim and anims[self.anim] then
|
||||
anim = anims[self.anim]
|
||||
overrideRate = anims[self.anim .. "_rate"] or 1
|
||||
local cycle = puppet:GetCycle()
|
||||
|
||||
if not self.animStart then
|
||||
if cycle == 1 or (self.animCycle and self.animCycle > cycle) or (string.lower(anim) ~= string.lower(puppet:GetSequenceName(puppet:GetSequence()))) then
|
||||
self.anim = nil
|
||||
self.animCycle = nil
|
||||
|
||||
if self.animFreeze then
|
||||
self.animFreeze = nil
|
||||
end
|
||||
elseif self.animCycle then
|
||||
self.animCycle = cycle
|
||||
end
|
||||
end
|
||||
elseif self.tickAnim and anims[self.tickAnim] then
|
||||
anim = anims[self.tickAnim]
|
||||
overrideRate = anims[self.tickAnim .. "_rate"] or 1
|
||||
self.tickAnim = nil
|
||||
elseif self.burrowed then
|
||||
anim = anims["burrow_loop"]
|
||||
elseif ply:WaterLevel() > 2 then
|
||||
anim = anims["swim"] or anims["glide"] or anims["idle"]
|
||||
elseif ply:IsOnGround() then
|
||||
if ply:Crouching() then
|
||||
if vel > ply:GetCrouchedWalkSpeed() / 4 then
|
||||
anim = anims["crouch_walk"] or anims["crouch"] or anims["walk"] or anims["idle"]
|
||||
else
|
||||
anim = anims["crouch"] or anims["idle"]
|
||||
end
|
||||
else
|
||||
if vel > (ply:GetWalkSpeed() + ply:GetRunSpeed()) / 2 then
|
||||
anim = anims["run"] or anims["walk"] or anims["idle"]
|
||||
elseif vel > ply:GetWalkSpeed() / 4 then
|
||||
anim = anims["walk"] or anims["idle"]
|
||||
else
|
||||
anim = anims["idle"]
|
||||
end
|
||||
end
|
||||
else
|
||||
anim = anims["glide"] or anims["idle"]
|
||||
end
|
||||
|
||||
if anim == anims["idle"] or anim == anims["crouch"] then
|
||||
overrideRate = 1
|
||||
end
|
||||
|
||||
if (anim and puppet:GetSequence() ~= puppet:LookupSequence(anim)) or self.animStart or (self.formTable.autoRestartAnims and puppet:GetCycle() == 1) then
|
||||
puppet:ResetSequence(puppet:LookupSequence(anim))
|
||||
puppet:SetCycle(0)
|
||||
self.animCycle = 0
|
||||
end
|
||||
|
||||
self.animStart = nil
|
||||
local seq_vel = puppet:GetSequenceGroundSpeed(puppet:GetSequence())
|
||||
|
||||
--if true then
|
||||
if self.formTable.movePoseMode ~= "xy" and self.formTable.movePoseMode ~= "xy-bot" and not overrideRate then
|
||||
local rate = overrideRate or vel / seq_vel
|
||||
|
||||
--goofy limitation (floods console with errors if above 12!)
|
||||
if rate > 12 then
|
||||
rate = 12
|
||||
end
|
||||
|
||||
puppet:SetPlaybackRate(rate)
|
||||
else
|
||||
--puppet:SetPlaybackRate(1)
|
||||
end
|
||||
|
||||
--print(puppet:GetCycle())
|
||||
if self.formTable.movePoseMode then
|
||||
--
|
||||
if self.formTable.movePoseMode == "yaw" then
|
||||
local move_dir = puppet:WorldToLocalAngles(ply:GetVelocity():Angle())
|
||||
puppet:SetPoseParameter("move_yaw", move_dir.y)
|
||||
elseif self.formTable.movePoseMode == "xy" then
|
||||
if not overrideRate then
|
||||
local localvel = ply:WorldToLocal(ply:GetPos() + ply:GetVelocity())
|
||||
local maxdim = math.Max(math.abs(localvel.x), math.abs(localvel.y))
|
||||
local clampedvel = maxdim == 0 and Vector(0, 0, 0) or localvel / maxdim
|
||||
puppet:SetPoseParameter("move_x", clampedvel.x)
|
||||
puppet:SetPoseParameter("move_y", -clampedvel.y)
|
||||
seq_vel = puppet:GetSequenceGroundSpeed(puppet:GetSequence())
|
||||
|
||||
if seq_vel ~= 0 then
|
||||
puppet:SetPoseParameter("move_x", math.Clamp(localvel.x / seq_vel, -.99, .99))
|
||||
puppet:SetPoseParameter("move_y", math.Clamp(-localvel.y / seq_vel, -.99, .99))
|
||||
end
|
||||
--print(puppet:GetPlaybackRate())
|
||||
else
|
||||
puppet:SetPoseParameter("move_x", 0)
|
||||
puppet:SetPoseParameter("move_y", 0)
|
||||
end
|
||||
elseif self.formTable.movePoseMode == "xy-bot" then
|
||||
if not overrideRate then
|
||||
local localvel = ply:WorldToLocal(ply:GetPos() + ply:GetVelocity())
|
||||
local maxdim = math.Max(math.abs(localvel.x), math.abs(localvel.y))
|
||||
local clampedvel = maxdim == 0 and Vector(0, 0, 0) or localvel / maxdim
|
||||
local move_dir = puppet:WorldToLocalAngles(ply:GetVelocity():Angle())
|
||||
puppet:SetPoseParameter("move_x", clampedvel.x)
|
||||
puppet:SetPoseParameter("move_y", -clampedvel.y)
|
||||
puppet:SetPoseParameter("move_yaw", move_dir.y)
|
||||
puppet:SetPoseParameter("move_scale", 1)
|
||||
seq_vel = puppet:GetSequenceGroundSpeed(puppet:GetSequence())
|
||||
|
||||
if seq_vel ~= 0 then
|
||||
puppet:SetPoseParameter("move_x", math.Clamp(localvel.x / seq_vel, -.99, .99))
|
||||
puppet:SetPoseParameter("move_y", math.Clamp(-localvel.y / seq_vel, -.99, .99))
|
||||
puppet:SetPoseParameter("move_scale", math.Clamp(localvel:Length() / seq_vel, -.99, .99))
|
||||
end
|
||||
--print(puppet:GetPlaybackRate())
|
||||
else
|
||||
puppet:SetPoseParameter("move_x", 0)
|
||||
puppet:SetPoseParameter("move_y", 0)
|
||||
puppet:SetPoseParameter("move_yaw", 0)
|
||||
puppet:SetPoseParameter("move_scale", 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Aimage
|
||||
if self.formTable.aim then
|
||||
if self.formTable.aim.xPose then
|
||||
local yaw = math.AngleDifference(ply:EyeAngles().y, puppet:GetAngles().y)
|
||||
|
||||
if self.formTable.aim.xInvert then
|
||||
yaw = -yaw
|
||||
end
|
||||
|
||||
puppet:SetPoseParameter(self.formTable.aim.xPose, yaw)
|
||||
end
|
||||
|
||||
if self.formTable.aim.yPose then
|
||||
local pitch = math.AngleDifference(ply:EyeAngles().p, puppet:GetAngles().p)
|
||||
|
||||
if self.formTable.aim.yInvert then
|
||||
pitch = -pitch
|
||||
end
|
||||
|
||||
puppet:SetPoseParameter(self.formTable.aim.yPose, pitch)
|
||||
end
|
||||
end
|
||||
|
||||
--gliding and landing
|
||||
if not ply:IsOnGround() and ply:WaterLevel() == 0 and self.formTable.glideThink then
|
||||
self.formTable.glideThink(ply, self)
|
||||
end
|
||||
|
||||
if not ply:IsOnGround() and not self.touchingWater and ply:WaterLevel() > 0 and self.formTable.land then
|
||||
self.formTable.land(ply, self)
|
||||
end
|
||||
|
||||
--water death
|
||||
self.touchingWater = ply:WaterLevel() > 1
|
||||
|
||||
if (self.formTable.damageFromWater and self.touchingWater) then
|
||||
if self.formTable.damageFromWater == -1 then
|
||||
--self:PillDie()
|
||||
ply:Kill()
|
||||
else
|
||||
ply:TakeDamage(self.formTable.damageFromWater)
|
||||
--TODO APPLY DAMAGE
|
||||
end
|
||||
end
|
||||
|
||||
--tick attack
|
||||
if ply:KeyDown(IN_ATTACK) and self.formTable.attack and self.formTable.attack.mode == "tick" then
|
||||
self.formTable.attack.func(ply, self, self.formTable.attack)
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_ATTACK2) and self.formTable.attack2 and self.formTable.attack2.mode == "tick" then
|
||||
self.formTable.attack2.func(ply, self, self.formTable.attack2)
|
||||
end
|
||||
|
||||
--auto attack
|
||||
if ply:KeyDown(IN_ATTACK) and self.formTable.attack and self.formTable.attack.mode == "auto" then
|
||||
if not self.formTable.aim then
|
||||
self:PillLoopSound("attack")
|
||||
else
|
||||
self:PillLoopStop("attack")
|
||||
end
|
||||
|
||||
if (not self.lastAttack or (self.formTable.attack.interval or self.formTable.attack.delay) < CurTime() - self.lastAttack) then
|
||||
self.formTable.attack.func(ply, self, self.formTable.attack)
|
||||
self.lastAttack = CurTime()
|
||||
end
|
||||
else
|
||||
self:PillLoopStop("attack")
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_ATTACK2) and self.formTable.attack2 and self.formTable.attack2.mode == "auto" then
|
||||
if not self.formTable.aim then
|
||||
self:PillLoopSound("attack2")
|
||||
else
|
||||
self:PillLoopStop("attack2")
|
||||
end
|
||||
|
||||
if not self.lastAttack2 or (self.formTable.attack2.interval or self.formTable.attack2.delay) < CurTime() - self.lastAttack2 then
|
||||
self.formTable.attack2.func(ply, self, self.formTable.attack2)
|
||||
self.lastAttack2 = CurTime()
|
||||
end
|
||||
else
|
||||
self:PillLoopStop("attack2")
|
||||
end
|
||||
|
||||
--charge
|
||||
if self:GetChargeTime() ~= 0 then
|
||||
if ply:OnGround() then
|
||||
local charge = self.formTable.charge
|
||||
local angs = ply:EyeAngles()
|
||||
self:PillAnimTick("charge_loop")
|
||||
local hit_ent = ply:TraceHullAttack(ply:EyePos(), ply:EyePos() + angs:Forward() * 100, Vector(-20, -20, -20), Vector(20, 20, 20), charge.dmg, DMG_CRUSH, 1, true)
|
||||
|
||||
if IsValid(hit_ent) then
|
||||
self:PillAnim("charge_hit", true)
|
||||
self:PillGesture("charge_hit")
|
||||
self:PillSound("charge_hit")
|
||||
self:SetChargeTime(0)
|
||||
self:PillLoopStop("charge")
|
||||
end
|
||||
else
|
||||
self:SetChargeTime(0)
|
||||
self:PillLoopStop("charge")
|
||||
end
|
||||
end
|
||||
|
||||
--Cloak
|
||||
if self.formTable.cloak then
|
||||
local cloak = self.formTable.cloak
|
||||
|
||||
if self.iscloaked then
|
||||
local cloakamt = self:GetCloakLeft()
|
||||
|
||||
if cloakamt ~= -1 then
|
||||
cloakamt = cloakamt - FrameTime()
|
||||
|
||||
if cloakamt < 0 then
|
||||
cloakamt = 0
|
||||
self:ToggleCloak()
|
||||
end
|
||||
|
||||
self:SetCloakLeft(cloakamt)
|
||||
end
|
||||
else
|
||||
local cloakamt = self:GetCloakLeft()
|
||||
|
||||
if cloakmt ~= -1 and cloakamt < cloak.max then
|
||||
cloakamt = cloakamt + FrameTime() * cloak.rechargeRate
|
||||
|
||||
if cloakamt > cloak.max then
|
||||
cloakamt = cloak.max
|
||||
end
|
||||
|
||||
self:SetCloakLeft(cloakamt)
|
||||
end
|
||||
end
|
||||
|
||||
local color = self:GetPuppet():GetColor()
|
||||
|
||||
if self.iscloaked then
|
||||
if color.a > 0 then
|
||||
color.a = color.a - 5
|
||||
self:GetPuppet():SetColor(color)
|
||||
end
|
||||
else
|
||||
if color.a < 255 then
|
||||
color.a = color.a + 5
|
||||
self:GetPuppet():SetColor(color)
|
||||
end
|
||||
end
|
||||
|
||||
--PrintTable(color)
|
||||
if IsValid(self.wepmdl) and self.wepmdl:GetColor().a ~= color.a then
|
||||
self.wepmdl:SetColor(color)
|
||||
end
|
||||
end
|
||||
|
||||
--if !IsValid(ply) then self:NextThink(CurTime()) return true end
|
||||
--wepon-no longer SO hackey
|
||||
if not self.formTable.hideWeapons then
|
||||
local realWep = self:GetPillUser():GetActiveWeapon()
|
||||
|
||||
--&&self:GetPillUser()!=ply or pk_pills.var_thirdperson:GetBool()) then
|
||||
if IsValid(realWep) and realWep:GetModel() ~= "" then
|
||||
--hiding the real thing [BROKEN]
|
||||
--[[if realWep:GetRenderMode()!=RENDERMODE_NONE then
|
||||
realWep:SetRenderMode(RENDERMODE_NONE)
|
||||
end]]
|
||||
if realWep.pill_attachment then
|
||||
if IsValid(self.wepmdl) then
|
||||
self.wepmdl:Remove()
|
||||
end
|
||||
|
||||
self.wepmdl = ents.Create("pill_attachment_wep")
|
||||
self.wepmdl:SetParent(self:GetPuppet())
|
||||
self.wepmdl:SetModel(realWep:GetModel())
|
||||
self.wepmdl.attachment = realWep.pill_attachment
|
||||
self.wepmdl:Spawn()
|
||||
|
||||
if realWep.pill_offset then
|
||||
self.wepmdl:SetWepOffset(realWep.pill_offset)
|
||||
end
|
||||
|
||||
if realWep.pill_angle then
|
||||
self.wepmdl:SetWepAng(realWep.pill_angle)
|
||||
end
|
||||
|
||||
realWep.pill_proxy = self.wepmdl
|
||||
elseif not IsValid(self.wepmdl) then
|
||||
self.wepmdl = ents.Create("pill_attachment_wep")
|
||||
self.wepmdl:SetParent(self:GetPuppet())
|
||||
self.wepmdl:SetModel(realWep:GetModel())
|
||||
self.wepmdl:Spawn()
|
||||
realWep.pill_proxy = self.wepmdl
|
||||
elseif self.wepmdl:GetModel() ~= realWep:GetModel() then
|
||||
self.wepmdl:SetModel(realWep:GetModel())
|
||||
end
|
||||
elseif IsValid(self.wepmdl) then
|
||||
self.wepmdl:Remove()
|
||||
end
|
||||
end
|
||||
else
|
||||
if self:GetPillUser() ~= LocalPlayer() or pk_pills.convars.cl_thirdperson:GetBool() then
|
||||
puppet:SetNoDraw(false)
|
||||
else
|
||||
puppet:SetNoDraw(true)
|
||||
end
|
||||
|
||||
local realWep = self:GetPillUser():GetActiveWeapon()
|
||||
|
||||
if IsValid(realWep) and realWep:GetModel() ~= "" and not realWep:GetNoDraw() then
|
||||
realWep:SetNoDraw(true)
|
||||
end
|
||||
end
|
||||
|
||||
--Align pos and angles with player
|
||||
if SERVER then
|
||||
puppet:SetPos(ply:GetPos())
|
||||
else
|
||||
puppet:SetRenderOrigin(ply:GetPos())
|
||||
end
|
||||
|
||||
if vel > 0 or math.abs(math.AngleDifference(puppet:GetAngles().y, ply:EyeAngles().y)) > 60 then
|
||||
local angs = ply:EyeAngles()
|
||||
angs.p = 0
|
||||
|
||||
if SERVER then
|
||||
puppet:SetAngles(angs)
|
||||
else
|
||||
--puppet:SetAngles(angs)
|
||||
puppet:SetRenderAngles(angs)
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:DoKeyPress(ply, key)
|
||||
if self.animFreeze then return end
|
||||
|
||||
if self:GetChargeTime() ~= 0 then
|
||||
self:SetChargeTime(0)
|
||||
self:PillLoopStop("charge")
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
if key == IN_ATTACK and self.formTable.attack and self.formTable.attack.mode == "trigger" then
|
||||
self.formTable.attack.func(ply, self, self.formTable.attack)
|
||||
end
|
||||
|
||||
if key == IN_ATTACK2 and self.formTable.attack2 and self.formTable.attack2.mode == "trigger" then
|
||||
self.formTable.attack2.func(ply, self, self.formTable.attack2)
|
||||
end
|
||||
|
||||
if key == IN_RELOAD and self.formTable.reload then
|
||||
self.formTable.reload(ply, self)
|
||||
end
|
||||
|
||||
if key == IN_DUCK then
|
||||
if self.formTable.canBurrow then
|
||||
if not self.burrowed then
|
||||
local trace = util.QuickTrace(ply:GetPos(), Vector(0, 0, -1), ply)
|
||||
|
||||
if trace.Hit and (trace.MatType == MAT_DIRT or trace.MatType == MAT_SAND or trace.MatType == MAT_GRASS) then
|
||||
self:PillAnim("burrow_in")
|
||||
self:PillSound("burrow_in")
|
||||
ply:SetLocalVelocity(Vector(0, 0, 0))
|
||||
ply:SetMoveType(MOVETYPE_NONE)
|
||||
ply:SetNotSolid(true)
|
||||
self.burrowed = true
|
||||
self:GetPuppet():DrawShadow(false)
|
||||
--local p=ply:GetPos()
|
||||
--ent:SetPos(Vector(p.x,p.y,trace.HitPos.z-options.burrow))
|
||||
--ent:SetMoveType(MOVETYPE_NONE)
|
||||
--if ent.formTable.model then ent:SetModel(ent.formTable.model) end
|
||||
--ent:PillSound("burrow")
|
||||
--ent:PillLoopStopAll()
|
||||
end
|
||||
else
|
||||
self:PillAnim("burrow_out")
|
||||
self:PillSound("burrow_out")
|
||||
ply:SetMoveType(MOVETYPE_WALK)
|
||||
ply:SetNotSolid(false)
|
||||
self.burrowed = nil
|
||||
self:GetPuppet():DrawShadow(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:DoJump()
|
||||
if self.formTable.jump then
|
||||
self.formTable.jump(self:GetPillUser(), self)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillDie()
|
||||
local ply = self:GetPillUser()
|
||||
|
||||
if self.formTable.die then
|
||||
self.formTable.die(ply, self)
|
||||
end
|
||||
|
||||
self:PillSound("die")
|
||||
|
||||
if IsValid(self:GetPuppet()) and not self.formTable.noragdoll then
|
||||
local r = ents.Create("prop_ragdoll")
|
||||
r:SetModel(self.subModel or self:GetPuppet():GetModel())
|
||||
r:SetPos(ply:GetPos())
|
||||
r:SetAngles(ply:GetAngles())
|
||||
--r:SetOwner(ply)
|
||||
r:Spawn()
|
||||
r:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
|
||||
r:Fire("FadeAndRemove", nil, 10)
|
||||
end
|
||||
|
||||
self:Remove()
|
||||
pk_pills.handeDeathCommon(self)
|
||||
end
|
||||
|
||||
--[[function ENT:PillDie()
|
||||
if self.dead then return end
|
||||
self:GetPillUser():KillSilent()
|
||||
if self.formTable.die then
|
||||
self.formTable.die(self:GetPillUser(),self)
|
||||
end
|
||||
self:PillSound("die")
|
||||
self:Remove()
|
||||
self.dead=true
|
||||
end]]
|
||||
function ENT:PillAnim(name, freeze)
|
||||
self.anim = name
|
||||
self.animStart = true
|
||||
self.animFreeze = true
|
||||
end
|
||||
|
||||
function ENT:PillAnimTick(name)
|
||||
self.tickAnim = name
|
||||
end
|
||||
|
||||
function ENT:PillGesture(name)
|
||||
local ply = self:GetPillUser()
|
||||
local puppet = self:GetPuppet()
|
||||
if not IsValid(puppet) then return end
|
||||
local anims = table.Copy(self.formTable.anims.default or {})
|
||||
table.Merge(anims, IsValid(ply:GetActiveWeapon()) and self.formTable.anims[ply:GetActiveWeapon():GetHoldType()] or {})
|
||||
local gesture = anims["g_" .. name]
|
||||
|
||||
if gesture then
|
||||
puppet:RestartGesture(puppet:GetSequenceActivity(puppet:LookupSequence(gesture)))
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillChargeAttack()
|
||||
if not self:GetPillUser():OnGround() or self.burrowed then return end
|
||||
self:PillAnim("charge_start", true)
|
||||
self:PillSound("charge_start")
|
||||
|
||||
local function doStart()
|
||||
if not IsValid(self) then return end
|
||||
self:SetChargeTime(CurTime())
|
||||
local angs = self:GetPillUser():EyeAngles()
|
||||
angs.p = 0
|
||||
self:SetChargeAngs(angs)
|
||||
self:PillLoopSound("charge")
|
||||
end
|
||||
|
||||
if self.formTable.charge.delay then
|
||||
timer.Simple(self.formTable.charge.delay, doStart)
|
||||
else
|
||||
doStart()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillFilterCam(ent)
|
||||
net.Start("pk_pill_filtercam")
|
||||
net.WriteEntity(self)
|
||||
net.WriteEntity(ent)
|
||||
net.Send(self:GetPillUser())
|
||||
end
|
||||
else
|
||||
function ENT:GetPillHealth()
|
||||
return self:GetPillUser():Health()
|
||||
end
|
||||
end
|
||||
|
||||
--The "bulk" parameter should only be used if you plan to play a ton of sounds in quick succession.
|
||||
function ENT:PillSound(name, bulk)
|
||||
if not self.formTable.sounds then return end
|
||||
local s = self.formTable.sounds[name]
|
||||
|
||||
if (istable(s)) then
|
||||
s = table.Random(s)
|
||||
end
|
||||
|
||||
if isstring(s) then
|
||||
if bulk then
|
||||
sound.Play(s, self:GetPos(), self.formTable.sounds[name .. "_level"] or (name == "step" and 75 or 100), self.formTable.sounds[name .. "_pitch"] or 100, 1)
|
||||
else
|
||||
self:EmitSound(s, self.formTable.sounds[name .. "_level"] or (name == "step" and 75 or 100), self.formTable.sounds[name .. "_pitch"] or 100)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillLoopSound(name, volume, pitch)
|
||||
if not self.loopingSounds[name] then return end
|
||||
local s = self.loopingSounds[name]
|
||||
|
||||
if s:IsPlaying() then
|
||||
if volume then
|
||||
s:ChangeVolume(volume)
|
||||
end
|
||||
|
||||
if pitch then
|
||||
s:ChangePitch(pitch, .1)
|
||||
end
|
||||
else
|
||||
if volume or pitch then
|
||||
s:PlayEx(volume or 1, pitch or 100)
|
||||
else
|
||||
s:Play()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillLoopStop(name)
|
||||
if not self.loopingSounds[name] then return end
|
||||
local s = self.loopingSounds[name]
|
||||
s:FadeOut(.1)
|
||||
end
|
||||
|
||||
function ENT:PillLoopStopAll()
|
||||
if self.loopingSounds then
|
||||
for _, v in pairs(self.loopingSounds) do
|
||||
v:Stop()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:ToggleCloak()
|
||||
local ply = self:GetPillUser()
|
||||
|
||||
if self.iscloaked then
|
||||
self.iscloaked = nil
|
||||
self:PillSound("uncloak")
|
||||
pk_pills.setAiTeam(ply, self.formTable.side or "default")
|
||||
else
|
||||
local cloakleft = self:GetCloakLeft()
|
||||
|
||||
if cloakleft > 0 or cloakleft == -1 then
|
||||
self.iscloaked = true
|
||||
self:PillSound("cloak")
|
||||
pk_pills.setAiTeam(ply, "harmless")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
--Align pos and angles with player
|
||||
--[[local puppet = self:GetPuppet()
|
||||
local ply = self:GetPillUser()
|
||||
local vel=ply:GetVelocity():Length()
|
||||
|
||||
if IsValid(puppet) then
|
||||
puppet:SetRenderOrigin(ply:GetPos())
|
||||
|
||||
if vel>0||math.abs(math.AngleDifference(puppet:GetAngles().y,ply:EyeAngles().y))>60 then
|
||||
local angs=ply:EyeAngles()
|
||||
angs.p=0
|
||||
|
||||
puppet:SetRenderAngles(angs)
|
||||
end
|
||||
end
|
||||
|
||||
puppet:DrawModel()]]
|
||||
end
|
||||
602
addons/pillpack/lua/entities/pill_ent_phys.lua
Normal file
602
addons/pillpack/lua/entities/pill_ent_phys.lua
Normal file
@@ -0,0 +1,602 @@
|
||||
--[[
|
||||
| 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.AutomaticFrameAdvance = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("String", 0, "PillForm")
|
||||
self:NetworkVar("Entity", 0, "PillUser")
|
||||
--self:NetworkVar("Int",0,"PillHealth")
|
||||
self:NetworkVar("Entity", 1, "PillAimEnt")
|
||||
end
|
||||
|
||||
function ENT:SetPillHealth(h)
|
||||
local ply = self:GetPillUser()
|
||||
|
||||
if IsValid(ply) then
|
||||
ply:SetHealth(h)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:GetPillHealth(h)
|
||||
local ply = self:GetPillUser()
|
||||
if IsValid(ply) then return ply:Health() end
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
pk_pills.mapEnt(self:GetPillUser(), self)
|
||||
self.formTable = pk_pills.getPillTable(self:GetPillForm())
|
||||
local ply = self:GetPillUser()
|
||||
|
||||
if not self.formTable or not IsValid(ply) then
|
||||
self:Remove()
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
ply:SetRenderMode(RENDERMODE_NONE)
|
||||
|
||||
if SERVER then
|
||||
local model = self.formTable.model
|
||||
local skin = self.formTable.skin
|
||||
local visMat = self.formTable.visMat
|
||||
|
||||
if self.formTable.options then
|
||||
local options = self.formTable.options()
|
||||
|
||||
if self.option and options[self.option] then
|
||||
local pickedOption = options[self.option]
|
||||
|
||||
if pickedOption.model then
|
||||
model = pickedOption.model
|
||||
end
|
||||
|
||||
if pickedOption.skin then
|
||||
skin = pickedOption.skin
|
||||
end
|
||||
|
||||
if pickedOption.visMat then
|
||||
visMat = pickedOption.visMat
|
||||
end
|
||||
else
|
||||
local pickedOption = table.Random(options)
|
||||
|
||||
if not model then
|
||||
model = pickedOption.model
|
||||
end
|
||||
|
||||
if not skin then
|
||||
skin = pickedOption.skin
|
||||
end
|
||||
|
||||
if not visMat then
|
||||
visMat = pickedOption.visMat
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:SetModel(model or "models/props_junk/watermelon01.mdl")
|
||||
|
||||
if skin then
|
||||
self:SetSkin(skin)
|
||||
end
|
||||
|
||||
--Physics
|
||||
if self.formTable.sphericalPhysics then
|
||||
self:PhysicsInitSphere(self.formTable.sphericalPhysics)
|
||||
self:GetPhysicsObject():SetMass(250)
|
||||
elseif self.formTable.boxPhysics then
|
||||
self:PhysicsInitBox(self.formTable.boxPhysics[1], self.formTable.boxPhysics[2])
|
||||
self:GetPhysicsObject():SetMass(250)
|
||||
else
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
end
|
||||
|
||||
if self.formTable.spawnFrozen then
|
||||
self:GetPhysicsObject():EnableMotion(false)
|
||||
end
|
||||
|
||||
ply:DeleteOnRemove(self)
|
||||
--ply:PhysicsInit(SOLID_NONE)
|
||||
ply:SetMoveType(MOVETYPE_NONE)
|
||||
ply:SetSolid(SOLID_NONE)
|
||||
ply:GodEnable()
|
||||
ply:SetArmor(0)
|
||||
ply:StripWeapons()
|
||||
ply:RemoveAllAmmo()
|
||||
|
||||
if ply:FlashlightIsOn() then
|
||||
ply:Flashlight(false)
|
||||
end
|
||||
|
||||
pk_pills.setAiTeam(ply, "harmless")
|
||||
|
||||
if self.formTable.health then
|
||||
ply:SetHealth(self.formTable.health)
|
||||
ply:SetMaxHealth(self.formTable.health)
|
||||
end
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if IsValid(phys) then
|
||||
phys:Wake()
|
||||
|
||||
if self.formTable.physMat then
|
||||
phys:SetMaterial(self.formTable.physMat)
|
||||
end
|
||||
end
|
||||
|
||||
self.drive = {
|
||||
functions = pk_pills.getDrive(self.formTable.driveType),
|
||||
options = self.formTable.driveOptions
|
||||
}
|
||||
|
||||
self.loopingSounds = {}
|
||||
|
||||
if self.formTable.sounds then
|
||||
for k, v in pairs(self.formTable.sounds) do
|
||||
if v == false then continue end
|
||||
|
||||
if string.sub(k, 1, 5) == "loop_" then
|
||||
self.loopingSounds[string.sub(k, 6)] = CreateSound(self, v)
|
||||
elseif string.sub(k, 1, 5) == "auto_" and isstring(v) then
|
||||
local func
|
||||
|
||||
func = function()
|
||||
if IsValid(self) then
|
||||
local f = self.formTable.sounds[k .. "_func"]
|
||||
if not f then return end
|
||||
local play, time = f(ply, self)
|
||||
|
||||
if play then
|
||||
self:PillSound(k)
|
||||
end
|
||||
|
||||
timer.Simple(time, func)
|
||||
end
|
||||
end
|
||||
|
||||
func()
|
||||
end
|
||||
end
|
||||
|
||||
if self.loopingSounds.move and not self.formTable.moveSoundControl then
|
||||
self:PillLoopSound("move")
|
||||
end
|
||||
end
|
||||
|
||||
--[[if self.formTable.health then
|
||||
self:SetPillHealth(self.formTable.health)
|
||||
end]]
|
||||
if self.formTable.seqInit then
|
||||
self:PillAnim(self.formTable.seqInit, true)
|
||||
end
|
||||
|
||||
if visMat then
|
||||
self:SetMaterial(visMat)
|
||||
end
|
||||
|
||||
if self.formTable.subMats then
|
||||
for k, v in pairs(self.formTable.subMats) do
|
||||
self:SetSubMaterial(k, v)
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.modelScale then
|
||||
self:SetModelScale(self.formTable.modelScale, .1)
|
||||
end
|
||||
|
||||
if self.formTable.trail then
|
||||
local t = self.formTable.trail
|
||||
local start = t.width or 40
|
||||
local endd = start / 2
|
||||
util.SpriteTrail(self, 0, t.color or Color(255, 255, 255), false, start, endd, t.length or 4, 1 / (start + endd) * .5, t.texture)
|
||||
end
|
||||
|
||||
if self.formTable.bodyGroups then
|
||||
for _, v in pairs(self.formTable.bodyGroups) do
|
||||
self:SetBodygroup(v, 1)
|
||||
end
|
||||
end
|
||||
|
||||
local mins, maxs = self:GetCollisionBounds()
|
||||
local points = {Vector(mins.x, 0, 0), Vector(0, mins.y, 0), Vector(0, 0, mins.z), Vector(maxs.x, 0, 0), Vector(0, maxs.y, 0), Vector(0, 0, maxs.z)}
|
||||
self:AddFlags(FL_OBJECT)
|
||||
pk_pills.setAiTeam(self, self.formTable.side or "default")
|
||||
self:SetOwner(ply)
|
||||
--self:SetPhysicsAttacker(ply)
|
||||
self:SetPlaybackRate(1)
|
||||
else
|
||||
if ply == LocalPlayer() then
|
||||
--Compatibility with gm+
|
||||
if gmp and gmp.Enabled:GetBool() then
|
||||
ply.pk_pill_gmpEnabled = true
|
||||
--RunConsoleCommand("gmp_enabled","0")
|
||||
end
|
||||
|
||||
--Compatibility with Gmod Legs
|
||||
--ply.ShouldDisableLegs=true
|
||||
self.camTraceFilter = {self}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsUpdate()
|
||||
if SERVER and self.drive.functions then
|
||||
self.drive.functions.think(self:GetPillUser(), self, self.drive.options)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
local ply = self:GetPillUser()
|
||||
|
||||
if SERVER then
|
||||
self:PillLoopStopAll()
|
||||
end
|
||||
|
||||
if not pk_pills.unmapEnt(self:GetPillUser(), self) then
|
||||
if SERVER then
|
||||
pk_pills.setAiTeam(ply, "default")
|
||||
ply:SetRenderMode(RENDERMODE_NORMAL)
|
||||
|
||||
if not self.dead then
|
||||
local angs = ply:EyeAngles()
|
||||
ply:Spawn()
|
||||
ply:SetEyeAngles(angs)
|
||||
ply:SetPos(self:GetPos())
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if phys:IsValid() then
|
||||
ply:SetVelocity(phys:GetVelocity())
|
||||
end
|
||||
else
|
||||
ply:KillSilent()
|
||||
end
|
||||
else
|
||||
if ply == LocalPlayer() then
|
||||
if ply.pk_pill_gmpEnabled then
|
||||
ply.pk_pill_gmpEnabled = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
--Clientside think hook-used for pose params
|
||||
function ENT:Think()
|
||||
if self.formTable then
|
||||
if self.formTable.renderOffset then
|
||||
local offset = self.formTable.renderOffset(self:GetPillUser(), self)
|
||||
self:SetRenderOrigin(self:GetNetworkOrigin() + offset)
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
else
|
||||
function ENT:Think()
|
||||
local ply = self:GetPillUser()
|
||||
if not IsValid(ply) then return end
|
||||
ply:SetPos(self:GetPos())
|
||||
|
||||
if self.formTable.pose then
|
||||
for k, f in pairs(self.formTable.pose) do
|
||||
local old = self:GetPoseParameter(k)
|
||||
local new = f(self:GetPillUser(), self, old)
|
||||
|
||||
if new then
|
||||
self:SetPoseParameter(k, new)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.aim and not self.formTable.aim.usesSecondaryEnt or IsValid(self:GetPillAimEnt()) then
|
||||
local aimEnt = self.formTable.aim.usesSecondaryEnt and self:GetPillAimEnt() or self
|
||||
|
||||
if self.formTable.aim.xPose and self.formTable.aim.yPose then
|
||||
if not self.formTable.canAim or self.formTable.canAim(ply, self) then
|
||||
local ang = ply:EyeAngles()
|
||||
local locang = aimEnt:WorldToLocalAngles(ang)
|
||||
local xOffset = self.formTable.aim.xOffset or 0
|
||||
|
||||
if not self.formTable.aim.xInvert then
|
||||
aimEnt:SetPoseParameter(self.formTable.aim.xPose, math.NormalizeAngle(locang.y + xOffset))
|
||||
else
|
||||
aimEnt:SetPoseParameter(self.formTable.aim.xPose, math.NormalizeAngle(-locang.y + xOffset))
|
||||
end
|
||||
|
||||
if not self.formTable.aim.yInvert then
|
||||
aimEnt:SetPoseParameter(self.formTable.aim.yPose, locang.p)
|
||||
else
|
||||
aimEnt:SetPoseParameter(self.formTable.aim.yPose, -locang.p)
|
||||
end
|
||||
elseif not self.formTable.useDefAim or self.formTable.useDefAim(ply, self) then
|
||||
aimEnt:SetPoseParameter(self.formTable.aim.xPose, self.formTable.aim.xDef or 0)
|
||||
aimEnt:SetPoseParameter(self.formTable.aim.yPose, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.boneMorphs then
|
||||
for k, v in pairs(self.formTable.boneMorphs) do
|
||||
local b = self:LookupBone(k)
|
||||
|
||||
if b then
|
||||
if isfunction(v) then
|
||||
v = v(ply, self)
|
||||
end
|
||||
|
||||
if not istable(v) then continue end
|
||||
|
||||
if v.pos then
|
||||
self:ManipulateBonePosition(b, v.pos)
|
||||
end
|
||||
|
||||
if v.rot then
|
||||
self:ManipulateBoneAngles(b, v.rot)
|
||||
end
|
||||
|
||||
if v.scale then
|
||||
self:ManipulateBoneScale(b, v.scale)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.formTable.moveSoundControl then
|
||||
local p = self.formTable.moveSoundControl(ply, self)
|
||||
|
||||
if p then
|
||||
self:PillLoopSound("move", nil, p)
|
||||
else
|
||||
self:PillLoopStop("move")
|
||||
end
|
||||
end
|
||||
|
||||
if (self.formTable.damageFromWater and self:WaterLevel() > 1) then
|
||||
if self.formTable.damageFromWater == -1 then
|
||||
self:PillDie()
|
||||
else
|
||||
--TODO APPLY DAMAGE
|
||||
end
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_ATTACK) and self.formTable.attack and self.formTable.attack.mode == "auto" then
|
||||
if not self.formTable.aim or not self.formTable.aim.usesSecondaryEnt or IsValid(self:GetPillAimEnt()) then
|
||||
self:PillLoopSound("attack")
|
||||
else
|
||||
self:PillLoopStop("attack")
|
||||
end
|
||||
|
||||
if (not self.lastAttack or self.formTable.attack.delay < CurTime() - self.lastAttack) then
|
||||
self.formTable.attack.func(ply, self, self.formTable.attack)
|
||||
self.lastAttack = CurTime()
|
||||
end
|
||||
else
|
||||
self:PillLoopStop("attack")
|
||||
end
|
||||
|
||||
if ply:KeyDown(IN_ATTACK2) and self.formTable.attack2 and self.formTable.attack2.mode == "auto" then
|
||||
if not self.formTable.aim or not self.formTable.aim.usesSecondaryEnt or IsValid(self:GetPillAimEnt()) then
|
||||
self:PillLoopSound("attack2")
|
||||
else
|
||||
self:PillLoopStop("attack2")
|
||||
end
|
||||
|
||||
if not self.lastAttack2 or self.formTable.attack2.delay < CurTime() - self.lastAttack2 then
|
||||
self.formTable.attack2.func(ply, self, self.formTable.attack2)
|
||||
self.lastAttack2 = CurTime()
|
||||
end
|
||||
else
|
||||
self:PillLoopStop("attack2")
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:DoKeyPress(ply, key)
|
||||
if self.drive.functions then
|
||||
self.drive.functions.key(ply, self, self.drive.options, key)
|
||||
end
|
||||
|
||||
if key == IN_ATTACK and self.formTable.attack and self.formTable.attack.mode == "trigger" then
|
||||
self.formTable.attack.func(ply, self, self.formTable.attack)
|
||||
end
|
||||
|
||||
if key == IN_ATTACK2 and self.formTable.attack2 and self.formTable.attack2.mode == "trigger" then
|
||||
self.formTable.attack2.func(ply, self, self.formTable.attack2)
|
||||
end
|
||||
|
||||
if key == IN_RELOAD and self.formTable.reload then
|
||||
self.formTable.reload(ply, self)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:StartTouch(TouchEnt)
|
||||
if not IsValid(TouchEnt:GetPhysicsObject()) then return end
|
||||
|
||||
if (TouchEnt:IsPlayer() or TouchEnt:IsNPC() or TouchEnt:GetClass() == "pill_ent_phys") and TouchEnt:GetPhysicsObject():GetMaterial() ~= "metal" then
|
||||
if self.formTable.contact then
|
||||
local dmg_amt, dmg_type, dmg_force = self.formTable.contact(self:GetPillUser(), self, TouchEnt)
|
||||
|
||||
if dmg_amt then
|
||||
local dmg = DamageInfo()
|
||||
dmg:SetDamage(20)
|
||||
dmg:SetDamagePosition(self:GetPos())
|
||||
dmg:SetAttacker(self:GetPillUser())
|
||||
|
||||
if dmg_type then
|
||||
dmg:SetDamageType(dmg_type)
|
||||
end
|
||||
|
||||
if dmg_force then
|
||||
local force_vector = (TouchEnt:GetPos() - self:GetPos())
|
||||
|
||||
if self.formTable.contactForceHorizontal then
|
||||
force_vector.z = 0
|
||||
end
|
||||
|
||||
force_vector:Normalize()
|
||||
force_vector = force_vector * dmg_force
|
||||
dmg:SetDamageForce(force_vector)
|
||||
self:GetPhysicsObject():ApplyForceCenter(-force_vector)
|
||||
end
|
||||
|
||||
TouchEnt:TakeDamageInfo(dmg)
|
||||
self:PillSound("contact")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(collide, phys)
|
||||
if self.formTable.collide then
|
||||
self.formTable.collide(self:GetPillUser(), self, collide)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnTakeDamage(dmg)
|
||||
if (self.formTable.diesOnExplode and dmg:GetDamageType() == DMG_BLAST) then
|
||||
self:PillDie()
|
||||
end
|
||||
|
||||
if self.formTable.health then
|
||||
if not self.formTable.onlyTakesExplosiveDamage then
|
||||
local newHealth = self:GetPillHealth() - dmg:GetDamage()
|
||||
|
||||
if newHealth <= 0 then
|
||||
self:PillDie()
|
||||
else
|
||||
self:SetPillHealth(newHealth)
|
||||
end
|
||||
elseif dmg:GetDamageType() == DMG_BLAST then
|
||||
local newHealth = self:GetPillHealth() - 1
|
||||
|
||||
if newHealth <= 0 then
|
||||
self:PillDie()
|
||||
else
|
||||
self:SetPillHealth(newHealth)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillDie()
|
||||
if self.dead then return end
|
||||
|
||||
if self.formTable.die then
|
||||
self.formTable.die(self:GetPillUser(), self)
|
||||
end
|
||||
|
||||
self:GetPillUser():SetPos(self:GetPos()) --This makes the post-death camera position correctly
|
||||
self:PillSound("die")
|
||||
self:Remove()
|
||||
self.dead = true
|
||||
pk_pills.handeDeathCommon(self)
|
||||
end
|
||||
|
||||
function ENT:PillAnim(seq, force)
|
||||
if force then
|
||||
--self:ResetSequenceInfo()
|
||||
self:ResetSequence(self:LookupSequence(seq))
|
||||
else
|
||||
self:SetSequence(self:LookupSequence(seq))
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillFilterCam(ent)
|
||||
net.Start("pk_pill_filtercam")
|
||||
net.WriteEntity(self)
|
||||
net.WriteEntity(ent)
|
||||
net.Send(self:GetPillUser())
|
||||
end
|
||||
end
|
||||
|
||||
--The "bulk" parameter should only be used if you plan to play a ton of sounds in quick succession.
|
||||
function ENT:PillSound(name, bulk)
|
||||
if not self.formTable.sounds then return end
|
||||
local s = self.formTable.sounds[name]
|
||||
|
||||
if (istable(s)) then
|
||||
s = table.Random(s)
|
||||
end
|
||||
|
||||
if isstring(s) then
|
||||
if bulk then
|
||||
sound.Play(s, self:GetPos(), self.formTable.sounds[name .. "_level"] or 100, self.formTable.sounds[name .. "_pitch"] or 100, 1)
|
||||
else
|
||||
self:EmitSound(s, self.formTable.sounds[name .. "_level"] or 100, self.formTable.sounds[name .. "_pitch"] or 100)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillLoopSound(name, volume, pitch)
|
||||
if not self.loopingSounds[name] then return end
|
||||
local s = self.loopingSounds[name]
|
||||
|
||||
if s:IsPlaying() then
|
||||
if volume then
|
||||
s:ChangeVolume(volume)
|
||||
end
|
||||
|
||||
if pitch then
|
||||
s:ChangePitch(pitch, .1)
|
||||
end
|
||||
else
|
||||
if volume or pitch then
|
||||
s:PlayEx(volume or 1, pitch or 100)
|
||||
else
|
||||
s:Play()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PillLoopStop(name)
|
||||
if not self.loopingSounds[name] then return end
|
||||
local s = self.loopingSounds[name]
|
||||
s:FadeOut(.1)
|
||||
end
|
||||
|
||||
function ENT:PillLoopStopAll()
|
||||
if not self.loopingSounds then return end
|
||||
|
||||
for _, v in pairs(self.loopingSounds) do
|
||||
v:Stop()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
if self:GetPillUser() ~= LocalPlayer() or pk_pills.convars.cl_thirdperson:GetBool() then
|
||||
if self.formTable.sprite then
|
||||
if not self.spriteMat then
|
||||
self.spriteMat = Material(self.formTable.sprite.mat)
|
||||
end
|
||||
|
||||
local size = self.formTable.sprite.size or 40
|
||||
cam.Start3D(EyePos(), EyeAngles())
|
||||
render.SetMaterial(self.spriteMat)
|
||||
render.DrawSprite(self:GetPos() + (self.formTable.sprite.offset or Vector(0, 0, 0)), size, size, self.formTable.sprite.color or Color(255, 255, 255))
|
||||
cam.End3D()
|
||||
else
|
||||
self:DrawModel()
|
||||
end
|
||||
end
|
||||
end
|
||||
224
addons/pillpack/lua/entities/pill_hopper.lua
Normal file
224
addons/pillpack/lua/entities/pill_hopper.lua
Normal file
@@ -0,0 +1,224 @@
|
||||
--[[
|
||||
| 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.PrintName = "Hopper"
|
||||
|
||||
--[[
|
||||
Light
|
||||
0 - None
|
||||
1 - Blue
|
||||
2 - Yellow
|
||||
3 - Green
|
||||
4 - Red
|
||||
|
||||
Legs
|
||||
0 - Open
|
||||
1 - Close
|
||||
2 - Moving
|
||||
]]
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
--Physics
|
||||
self:SetModel("models/props_combine/combine_mine01.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
self.armed = false
|
||||
self.armCounter = 0
|
||||
self.held = false
|
||||
self.critical = false
|
||||
self.friendly = false
|
||||
self.alertSound = CreateSound(self, "npc/roller/mine/combine_mine_active_loop1.wav")
|
||||
--self:SetLegs(2)
|
||||
self:SetLight(1)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Int", 0, "Light")
|
||||
self:NetworkVar("Int", 1, "Legs")
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if SERVER then
|
||||
--CurTime()
|
||||
if not self.armed and self:GetVelocity():Length() < 10 and not self.held then
|
||||
local tr = util.QuickTrace(self:GetPos(), Vector(0, 0, -15), self)
|
||||
|
||||
if tr.Hit then
|
||||
if self.armCounter < 5 then
|
||||
self.armCounter = self.armCounter + 1
|
||||
else
|
||||
local trUp = util.QuickTrace(self:GetPos(), self:LocalToWorldAngles(Angle(-90, 0, 0)):Forward() * 15, self)
|
||||
|
||||
if trUp.Hit then
|
||||
self:GetPhysicsObject():ApplyForceCenter(Vector(0, 0, 3000))
|
||||
self:GetPhysicsObject():AddAngleVelocity(VectorRand() * 500)
|
||||
self:EmitSound("npc/roller/mine/rmine_blip3.wav", 100, 100)
|
||||
else
|
||||
local trDown = util.QuickTrace(self:GetPos(), self:LocalToWorldAngles(Angle(90, 0, 0)):Forward() * 15, self)
|
||||
|
||||
if trDown.Hit then
|
||||
self.armed = true
|
||||
self:SetLight(0)
|
||||
self:SetLegs(1)
|
||||
self:EmitSound("npc/roller/blade_cut.wav", 100, 100)
|
||||
local weld = constraint.Weld(self, trDown.Entity, 0, 0, 5000, true)
|
||||
|
||||
if weld then
|
||||
weld:CallOnRemove("DeMine", function()
|
||||
if not self.held and not self.critical then
|
||||
self:SetLight(1)
|
||||
self:SetLegs(0)
|
||||
self.armed = false
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.armCounter = 0
|
||||
end
|
||||
end
|
||||
--print("AHH")
|
||||
end
|
||||
|
||||
if self:GetPhysicsObject():HasGameFlag(FVPHYSICS_PLAYER_HELD) ~= self.held then
|
||||
if not self.held then
|
||||
self:SetLight(2)
|
||||
self:SetLegs(2)
|
||||
self.held = true
|
||||
self.armed = false
|
||||
self.friendly = true
|
||||
self.critical = false
|
||||
self.alertSound:Stop()
|
||||
else
|
||||
--print(self:GetVelocity():Length())
|
||||
if self:GetVelocity():Length() > 500 then
|
||||
self:SetLight(4)
|
||||
self.critical = true
|
||||
else
|
||||
self:SetLight(1)
|
||||
self:SetLegs(0)
|
||||
end
|
||||
|
||||
self.held = false
|
||||
end
|
||||
end
|
||||
|
||||
if self.armed then
|
||||
local near = ents.FindInSphere(self:GetPos(), 200)
|
||||
local goGreen = false
|
||||
local goRed = false
|
||||
|
||||
for _, e in pairs(near) do
|
||||
local t = pk_pills.getAiTeam(e)
|
||||
|
||||
if t then
|
||||
if t == (self.friendly and "default" or "hl_combine") or t == "harmless" then
|
||||
goGreen = true
|
||||
else
|
||||
goRed = true
|
||||
|
||||
if self:GetPos():Distance(e:GetPos()) < 100 then
|
||||
constraint.RemoveAll(self)
|
||||
self:SetLight(4)
|
||||
self:SetLegs(0)
|
||||
self.alertSound:Stop()
|
||||
self.critical = true
|
||||
self:EmitSound("npc/roller/blade_in.wav", 100, 100)
|
||||
|
||||
timer.Simple(.01, function()
|
||||
self:GetPhysicsObject():ApplyForceCenter(Vector(0, 0, 5000) + (e:GetPos() + e:GetVelocity() * .8 - self:GetPos()) * 10)
|
||||
self:GetPhysicsObject():AddAngleVelocity(VectorRand() * 200)
|
||||
end)
|
||||
end
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not self.critical then
|
||||
if goRed then
|
||||
self:SetLight(4)
|
||||
self.alertSound:Play()
|
||||
elseif goGreen then
|
||||
self:SetLight(3)
|
||||
self.alertSound:Stop()
|
||||
else
|
||||
self:SetLight(0)
|
||||
self.alertSound:Stop()
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
local legState = self:GetLegs()
|
||||
local legPose = 65
|
||||
|
||||
if legState == 1 then
|
||||
legPose = 0
|
||||
elseif legState == 2 then
|
||||
legPose = (math.sin(CurTime() * 8) + 1) * 32.5
|
||||
end
|
||||
|
||||
self:SetPoseParameter('blendstates', legPose)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide()
|
||||
if self.critical then
|
||||
self:Splode()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Splode()
|
||||
self:Remove()
|
||||
local explode = ents.Create("env_explosion")
|
||||
explode:SetPos(self:GetPos())
|
||||
explode:Spawn()
|
||||
--explode:SetOwner(self:GetOwner())
|
||||
explode:SetKeyValue("iMagnitude", "100")
|
||||
explode:SetOwner(self:GetOwner())
|
||||
explode:Fire("Explode", 0, 0)
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
local lightState = self:GetLight()
|
||||
local lightColor
|
||||
|
||||
if lightState == 1 then
|
||||
lightColor = Color(0, 0, 255)
|
||||
elseif lightState == 2 then
|
||||
lightColor = Color(255, 255, 0)
|
||||
elseif lightState == 3 then
|
||||
lightColor = Color(0, 255, 0)
|
||||
elseif lightState == 4 then
|
||||
lightColor = Color(255, 0, 0)
|
||||
end
|
||||
|
||||
if lightColor then
|
||||
--print("draw")
|
||||
--PrintTable(lightColor)
|
||||
cam.Start3D(EyePos(), EyeAngles())
|
||||
render.SetMaterial(Material("sprites/light_glow02_add"))
|
||||
render.DrawSprite(self:LocalToWorld(Vector(0, 0, 12)), 64, 64, lightColor) --color
|
||||
cam.End3D()
|
||||
end
|
||||
end
|
||||
96
addons/pillpack/lua/entities/pill_jumper_combine.lua
Normal file
96
addons/pillpack/lua/entities/pill_jumper_combine.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
--[[
|
||||
| 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.PrintName = "Combine Jumper"
|
||||
ENT.AutomaticFrameAdvance = true
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
--Physics
|
||||
--self:SetModel("models/combine_soldier.mdl")
|
||||
self:PhysicsInit(SOLID_BBOX)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_BBOX)
|
||||
--self.myNpc="npc_combine_s"
|
||||
--self.myWeapon="weapon_smg1"
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
self.dropping = false
|
||||
self.falltime = 0
|
||||
self:ResetSequence(self:LookupSequence("dropship_deploy"))
|
||||
|
||||
timer.Simple(2.4, function()
|
||||
if not IsValid(self) then return end
|
||||
self:SetParent()
|
||||
self:PhysicsInit(SOLID_BBOX)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
self:SetSequence(self:LookupSequence("jump_holding_glide"))
|
||||
self.dropping = true
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if SERVER then
|
||||
if self.dropping then
|
||||
self.falltime = self.falltime + 1
|
||||
local tr = util.QuickTrace(self:GetPos(), Vector(0, 0, -15), self)
|
||||
|
||||
if tr.Hit then
|
||||
local dude = ents.Create(self.myNpc)
|
||||
dude:SetModel(self:GetModel())
|
||||
dude:SetSkin(self:GetSkin())
|
||||
dude:SetPos(self:GetPos())
|
||||
dude:SetAngles(Angle(0, self:GetAngles().y, 0))
|
||||
dude:SetKeyValue("additionalequipment", self.myWeapon)
|
||||
dude:Spawn()
|
||||
|
||||
if self.falltime > 50 then
|
||||
dude:GetActiveWeapon():Remove()
|
||||
dude:Fire("BecomeRagdoll", "", 0)
|
||||
else
|
||||
local p = self:GetPos() + self:GetForward() * 300 + Vector(math.random(-200, 200), math.random(-200, 200), 0)
|
||||
|
||||
timer.Simple(.1, function()
|
||||
if not IsValid(dude) then return end
|
||||
dude:SetSchedule(SCHED_FORCED_GO)
|
||||
end)
|
||||
end
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
if IsValid(self:GetParent()) then
|
||||
self:SetRenderOrigin(self:GetParent():LocalToWorld(self:GetNetworkOrigin() + Vector(-200, 0, 0) * (1 - self:GetCycle())))
|
||||
else
|
||||
self:SetRenderOrigin(self:GetNetworkOrigin())
|
||||
end
|
||||
|
||||
self:DrawModel()
|
||||
end
|
||||
49
addons/pillpack/lua/entities/pill_jumper_headcrab.lua
Normal file
49
addons/pillpack/lua/entities/pill_jumper_headcrab.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.Type = "anim"
|
||||
ENT.PrintName = "Headcrab Jumper"
|
||||
ENT.AutomaticFrameAdvance = true
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
--Physics
|
||||
self:SetModel("models/headcrabblack.mdl")
|
||||
self:PhysicsInit(SOLID_BBOX)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_BBOX)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
self:ResetSequence(self:LookupSequence("drown"))
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if SERVER then
|
||||
local tr = util.QuickTrace(self:GetPos(), Vector(0, 0, -15), self)
|
||||
|
||||
if tr.Hit then
|
||||
local crab = ents.Create("npc_headcrab_black")
|
||||
crab:SetPos(self:GetPos())
|
||||
crab:SetAngles(Angle(0, self:GetAngles().y, 0))
|
||||
crab:Spawn()
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
46
addons/pillpack/lua/entities/pill_proj_arrow.lua
Normal file
46
addons/pillpack/lua/entities/pill_proj_arrow.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
--[[
|
||||
| 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.PrintName = "Rocket"
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER and self.particle then
|
||||
ParticleEffectAttach(self.particle, PATTACH_ABSORIGIN_FOLLOW, self, 0)
|
||||
end
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Think()
|
||||
if self.stuck then return end
|
||||
local tr = util.QuickTrace(self:GetPos(), self:GetAngles():Forward() * (self.speed or 3000) * FrameTime(), {self, self:GetOwner()})
|
||||
|
||||
if tr.HitWorld then
|
||||
self:StopParticles()
|
||||
self.stuck = true
|
||||
|
||||
timer.Simple(10, function()
|
||||
if IsValid(self) then
|
||||
self:Remove()
|
||||
end
|
||||
end)
|
||||
elseif tr.Hit then
|
||||
tr.Entity:TakeDamage(self.damage, self:GetOwner(), self)
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
self:SetPos(tr.HitPos)
|
||||
self:SetAngles(self:GetAngles() + Angle(12, 0, 0) * FrameTime())
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
122
addons/pillpack/lua/entities/pill_proj_bomb.lua
Normal file
122
addons/pillpack/lua/entities/pill_proj_bomb.lua
Normal file
@@ -0,0 +1,122 @@
|
||||
--[[
|
||||
| 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.PrintName = "Bomb"
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("String", 0, "Particle")
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
if self.sphere then
|
||||
self:PhysicsInitSphere(self.sphere)
|
||||
else
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
end
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
phys:EnableDrag(false)
|
||||
phys:SetDamping(0, 0)
|
||||
phys:SetVelocity(self:GetAngles():Forward() * (self.speed or 1000))
|
||||
end
|
||||
|
||||
if self.sticky then
|
||||
self:SetCustomCollisionCheck(true)
|
||||
end
|
||||
|
||||
timer.Simple(self.fuse or 3, function()
|
||||
if IsValid(self) then
|
||||
if self.sticky then
|
||||
self.armed = true
|
||||
ParticleEffect("stickybomb_pulse_red", self:GetPos(), Angle(0, 0, 0))
|
||||
else
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if self:GetParticle() ~= "" then
|
||||
ParticleEffectAttach(self:GetParticle(), PATTACH_ABSORIGIN_FOLLOW, self, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if SERVER then
|
||||
if self.sticky and not self.armed then return end
|
||||
|
||||
if self.tf2 then
|
||||
ParticleEffect("ExplosionCore_MidAir", self:GetPos(), Angle(0, 0, 0))
|
||||
self:EmitSound("weapons/explode1.wav")
|
||||
util.BlastDamage(self, self:GetOwner(), self:GetPos(), 100, 100)
|
||||
else
|
||||
local explode = ents.Create("env_explosion")
|
||||
explode:SetPos(self:GetPos())
|
||||
explode:Spawn()
|
||||
explode:SetKeyValue("iMagnitude", "100")
|
||||
explode:Fire("Explode", 0, 0)
|
||||
explode:SetOwner(self:GetOwner())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if SERVER and self.sticky then
|
||||
if not IsValid(self:GetOwner()) or not self:GetOwner():Alive() then
|
||||
self.armed = false
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
if self.armed and self:GetOwner():KeyDown(IN_ATTACK2) then
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:StartTouch(ent)
|
||||
if not self.sticky and (ent:IsNPC() or ent:IsPlayer() or ent:GetClass() == "pill_ent_phys") then
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(colData, collider)
|
||||
if self.sticky and self:GetPhysicsObject():IsMotionEnabled() then
|
||||
self:GetPhysicsObject():EnableMotion(false)
|
||||
|
||||
if not colData.HitEntity:IsWorld() then
|
||||
self:SetParent(colData.HitEntity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add("ShouldCollide", "pk_pill_bomberman", function(bomb, other)
|
||||
if bomb:GetClass() == "pill_proj_bomb" then
|
||||
elseif other:GetClass() == "pill_proj_bomb" then
|
||||
local temp = bomb
|
||||
bomb = other
|
||||
other = temp
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
if other:GetClass() == "pill_proj_bomb" or other:IsNPC() or other:IsPlayer() then return false end
|
||||
end)
|
||||
40
addons/pillpack/lua/entities/pill_proj_energy_grenade.lua
Normal file
40
addons/pillpack/lua/entities/pill_proj_energy_grenade.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Energy Grenade"
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
--Physics
|
||||
self:SetModel("models/items/ar2_grenade.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
util.SpriteTrail(self, 0, Color(255, 0, 255), true, 15, 1, 5, 1 / (15 + 1) * 0.5, "trails/physbeam.vmt")
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
phys:SetVelocity(self:GetAngles():Forward() * 1200)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(collide, phys)
|
||||
self:Remove()
|
||||
local explode = ents.Create("env_explosion")
|
||||
explode:SetPos(self:GetPos())
|
||||
explode:Spawn()
|
||||
explode:SetOwner(self:GetOwner())
|
||||
explode:SetKeyValue("iMagnitude", "100")
|
||||
explode:Fire("Explode", 0, 0)
|
||||
end
|
||||
51
addons/pillpack/lua/entities/pill_proj_prop.lua
Normal file
51
addons/pillpack/lua/entities/pill_proj_prop.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
--[[
|
||||
| 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.PrintName = "Prop Projectile"
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
phys:EnableGravity(false)
|
||||
phys:EnableDrag(false)
|
||||
phys:SetDamping(0, 0)
|
||||
phys:SetVelocity(self:GetAngles():Forward() * 3000)
|
||||
end
|
||||
|
||||
if self.sound then
|
||||
self.flySound = CreateSound(self, self.sound)
|
||||
self.flySound:Play()
|
||||
end
|
||||
|
||||
if self.trail then
|
||||
util.SpriteTrail(self, 0, self.tcolor or Color(255, 255, 255), false, 40, 10, 5, 1 / 100, self.trail)
|
||||
end
|
||||
|
||||
timer.Simple(10, function()
|
||||
if IsValid(self) then
|
||||
self:Remove()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if SERVER and self.flySound then
|
||||
self.flySound:Stop()
|
||||
end
|
||||
end
|
||||
114
addons/pillpack/lua/entities/pill_proj_rocket.lua
Normal file
114
addons/pillpack/lua/entities/pill_proj_rocket.lua
Normal file
@@ -0,0 +1,114 @@
|
||||
--[[
|
||||
| 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.PrintName = "Rocket"
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("String", 0, "Particle")
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
if not self.noPhys then
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
end
|
||||
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
phys:EnableGravity(false)
|
||||
phys:EnableDrag(false)
|
||||
phys:SetDamping(0, 0)
|
||||
phys:SetVelocity(self:GetAngles():Forward() * (self.speed or 3000))
|
||||
end
|
||||
|
||||
if self.sound then
|
||||
self.flySound = CreateSound(self, self.sound)
|
||||
self.flySound:Play()
|
||||
end
|
||||
|
||||
if self.trail then
|
||||
util.SpriteTrail(self, 0, self.tcolor or Color(255, 255, 255), false, 40, 10, 5, 1 / 100, self.trail)
|
||||
end
|
||||
end
|
||||
|
||||
if self:GetParticle() ~= "" then
|
||||
ParticleEffectAttach(self:GetParticle(), PATTACH_ABSORIGIN_FOLLOW, self, 0)
|
||||
end
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Think()
|
||||
local tr
|
||||
|
||||
if self.noPhys then
|
||||
tr = util.QuickTrace(self:GetPos(), self:GetAngles():Forward() * (self.speed or 3000) * FrameTime(), {self, self.shooter})
|
||||
end
|
||||
|
||||
if self:WaterLevel() > 0 or tr and tr.Hit then
|
||||
if self.altExplode then
|
||||
ParticleEffect(self.altExplode.particle, self:GetPos(), Angle(0, 0, 0))
|
||||
self:EmitSound(self.altExplode.sound)
|
||||
util.BlastDamage(self, self:GetOwner(), self:GetPos(), 100 * (self.radmod or 1), 100 * (self.dmgmod or 1))
|
||||
else
|
||||
local explode = ents.Create("env_explosion")
|
||||
explode:SetPos(self:GetPos())
|
||||
--explode:SetOwner(ply)
|
||||
explode:Spawn()
|
||||
explode:SetKeyValue("iMagnitude", "100")
|
||||
explode:Fire("Explode", 0, 0)
|
||||
explode:SetOwner(self:GetOwner())
|
||||
end
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
if tr then
|
||||
self:SetPos(tr.HitPos)
|
||||
|
||||
if self.spin then
|
||||
self:SetAngles(self:GetAngles() + Angle(0, 0, 180) * FrameTime())
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
if SERVER and self.flySound then
|
||||
self.flySound:Stop()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:PhysicsCollide(data, physobj)
|
||||
if self.altExplode then
|
||||
ParticleEffect(self.altExplode.particle, self:GetPos(), Angle(0, 0, 0))
|
||||
self:EmitSound(self.altExplode.sound)
|
||||
util.BlastDamage(self, self:GetOwner(), self:GetPos(), 100 * (self.radmod or 1), 100 * (self.dmgmod or 1))
|
||||
else
|
||||
local explode = ents.Create("env_explosion")
|
||||
explode:SetPos(self:GetPos())
|
||||
--explode:SetOwner(ply)
|
||||
explode:Spawn()
|
||||
explode:SetKeyValue("iMagnitude", "100")
|
||||
explode:Fire("Explode", 0, 0)
|
||||
explode:SetOwner(self:GetOwner())
|
||||
end
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
25
addons/pillpack/lua/entities/pill_puppet.lua
Normal file
25
addons/pillpack/lua/entities/pill_puppet.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
--[[
|
||||
| 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 = "ai"
|
||||
ENT.Base = "base_entity"
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetRenderMode(RENDERMODE_TRANSALPHA)
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
function ENT:DrawTranslucent()
|
||||
self:Draw()
|
||||
end
|
||||
165
addons/pillpack/lua/entities/pill_target.lua
Normal file
165
addons/pillpack/lua/entities/pill_target.lua
Normal file
@@ -0,0 +1,165 @@
|
||||
--[[
|
||||
| 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"
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel("models/props_junk/PopCan01a.mdl")
|
||||
self:DrawShadow(false)
|
||||
|
||||
if SERVER then
|
||||
self:SetName("pill_target_" .. self:EntIndex())
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
end
|
||||
--[[
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Entity",0,"Owner")
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
local owner = self:GetOwner()
|
||||
owner.pill_cam = self
|
||||
|
||||
if SERVER then
|
||||
owner:SetViewEntity(self)
|
||||
self:SetPos(owner:GetPos())
|
||||
self:SetParent(owner)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function ENT:Think()
|
||||
local owner = self:GetOwner()
|
||||
local ent = pk_pills.getMappedEnt(owner)
|
||||
|
||||
if IsValid(ent) then
|
||||
if CLIENT then
|
||||
local mv_diff = owner:GetPos()-owner:GetNetworkOrigin()
|
||||
|
||||
local startpos
|
||||
if ent.formTable.type=="phys" then
|
||||
startpos = ent:LocalToWorld(ent.formTable.camera&&ent.formTable.camera.offset||Vector(0,0,0))
|
||||
else
|
||||
startpos=owner:EyePos()
|
||||
end
|
||||
//startpos=startpos-mv_diff
|
||||
|
||||
|
||||
local angles = owner:EyeAngles()
|
||||
|
||||
if pk_pills.var_thirdperson:GetBool() then
|
||||
local dist
|
||||
if ent.formTable.type=="phys"&&ent.formTable.camera&&ent.formTable.camera.distFromSize then
|
||||
dist = ent:BoundingRadius()*5
|
||||
else
|
||||
dist = ent.formTable.camera&&ent.formTable.camera.dist||100
|
||||
end
|
||||
|
||||
local offset = LocalToWorld(Vector(-dist,0,dist/5),Angle(0,0,0),Vector(0,0,0),angles)
|
||||
local basevel
|
||||
if ent.formTable.type=="phys" then
|
||||
basevel=ent:GetVelocity()
|
||||
else
|
||||
basevel = owner:GetVelocity()
|
||||
end
|
||||
|
||||
local tr = util.TraceHull({
|
||||
start=startpos,
|
||||
endpos=startpos+offset,
|
||||
filter=ent.camTraceFilter,
|
||||
mins=Vector(-10,-10,-10),
|
||||
maxs=Vector(10,10,10),
|
||||
mask=MASK_VISIBLE
|
||||
})
|
||||
//PrintTable(ent.camTraceFilter)
|
||||
local troffset = -tr.HitNormal:Dot(basevel*FrameTime())*1.2
|
||||
self:SetNetworkOrigin(tr.HitPos+tr.HitNormal*troffset)
|
||||
//view.vm_origin = view.origin+view.angles:Forward()*-500
|
||||
|
||||
else
|
||||
self:SetNetworkOrigin(startpos)
|
||||
end
|
||||
self:SetAngles(angles)
|
||||
else
|
||||
//self:SetNetworkOrigin(ent:GetPos())
|
||||
end
|
||||
elseif SERVER then
|
||||
self:Remove()
|
||||
owner.pill_cam=nil
|
||||
|
||||
if SERVER then
|
||||
owner:SetViewEntity()
|
||||
end
|
||||
end
|
||||
|
||||
self:NextThink(CurTime())
|
||||
return true
|
||||
end
|
||||
|
||||
/*
|
||||
hook.Add("Think","pk_pill_cam_position",function()
|
||||
local camera = CLIENT and LocalPlayer().pill_cam
|
||||
if IsValid(camera) then
|
||||
camera:MoveCam()
|
||||
end
|
||||
end)
|
||||
|
||||
function ENT:MoveCam()
|
||||
local owner = self:GetOwner()
|
||||
local ent = pk_pills.getMappedEnt(owner)
|
||||
|
||||
if IsValid(ent) then
|
||||
//if CLIENT then
|
||||
local startpos
|
||||
if ent.formTable.type=="phys" then
|
||||
startpos = ent:LocalToWorld(ent.formTable.camera&&ent.formTable.camera.offset||Vector(0,0,0))
|
||||
else
|
||||
startpos=owner:EyePos()
|
||||
end
|
||||
|
||||
local angles = owner:EyeAngles()
|
||||
|
||||
if pk_pills.var_thirdperson:GetBool() then
|
||||
local dist
|
||||
if ent.formTable.type=="phys"&&ent.formTable.camera&&ent.formTable.camera.distFromSize then
|
||||
dist = ent:BoundingRadius()*5
|
||||
else
|
||||
dist = ent.formTable.camera&&ent.formTable.camera.dist||100
|
||||
end
|
||||
|
||||
local offset = LocalToWorld(Vector(-dist,0,dist/5),Angle(0,0,0),Vector(0,0,0),angles)
|
||||
local tr = util.TraceHull({
|
||||
start=startpos,
|
||||
endpos=startpos+offset,
|
||||
filter=ent.camTraceFilter,
|
||||
mins=Vector(-5,-5,-5),
|
||||
maxs=Vector(5,5,5),
|
||||
mask=MASK_VISIBLE
|
||||
})
|
||||
//PrintTable(ent.camTraceFilter)
|
||||
|
||||
self:SetNetworkOrigin(tr.HitPos)
|
||||
|
||||
//view.vm_origin = view.origin+view.angles:Forward()*-500
|
||||
|
||||
else
|
||||
self:SetNetworkOrigin(startpos)
|
||||
end
|
||||
|
||||
self:SetAngles(angles)
|
||||
//end
|
||||
end
|
||||
end
|
||||
]]
|
||||
72
addons/pillpack/lua/entities/pill_worldent.lua
Normal file
72
addons/pillpack/lua/entities/pill_worldent.lua
Normal file
@@ -0,0 +1,72 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
AddCSLuaFile()
|
||||
ENT.Type = "anim"
|
||||
ENT.PrintName = "Pill World Entity"
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("String", 0, "PillForm")
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
if SERVER then
|
||||
--Physics
|
||||
self:SetModel("models/Items/combine_rifle_ammo01.mdl")
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
local phys = self:GetPhysicsObject()
|
||||
|
||||
if (phys:IsValid()) then
|
||||
phys:Wake()
|
||||
end
|
||||
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
|
||||
if self.DarkRPItem then
|
||||
self:SetPillForm(self.DarkRPItem.pill)
|
||||
end
|
||||
else
|
||||
self.mat = Material("pills/" .. self:GetPillForm() .. ".png")
|
||||
self.randoff = math.Rand(0, 10)
|
||||
end
|
||||
end
|
||||
|
||||
if SERVER then
|
||||
function ENT:Use(ply)
|
||||
if pk_pills.convars.preserve:GetBool() then
|
||||
local ent = pk_pills.getMappedEnt(ply)
|
||||
if IsValid(ent) then return end
|
||||
end
|
||||
|
||||
ply:EmitSound("weapons/bugbait/bugbait_squeeze1.wav")
|
||||
pk_pills.apply(ply, self:GetPillForm())
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
if self:WaterLevel() > 0 then
|
||||
self:EmitSound("weapons/underwater_explode3.wav")
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
local ang = LocalPlayer():EyeAngles()
|
||||
ang.p = 0
|
||||
cam.Start3D2D(self:GetPos(), ang + Angle(-0, -90, 90), 1)
|
||||
surface.SetDrawColor(255, 255, 255)
|
||||
surface.SetMaterial(self.mat)
|
||||
surface.DrawTexturedRect(-10, TimedSin(1, 0, 3, self.randoff) - 30, 20, 20)
|
||||
cam.End3D2D()
|
||||
end
|
||||
Reference in New Issue
Block a user