Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lua/entities/ent_peplus_grip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ ENT.PEPlus_Grip = true //lets us detect if an ent is an ent_peplus_grip withou



local setOwner
if SERVER then
setOwner = function(ent, ply)
if CPPI then ent:CPPISetOwner(ply)
else ent:SetOwner(ply) end
end
end

function ENT:Initialize()

Expand Down Expand Up @@ -200,6 +207,8 @@ duplicator.RegisterEntityClass("ent_peplus_grip", function(ply, data)
local ent = ents.Create("ent_peplus_grip")
if !ent:IsValid() then return false end

setOwner(ent, ply)

//duplicator.GenericDuplicatorFunction(ply, data)
duplicator.DoGeneric(ent, data)
duplicator.DoGenericPhysics(ent, ply, data)
Expand Down
10 changes: 10 additions & 0 deletions lua/entities/ent_peplus_sfx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ ENT.Spawnable = false
ENT.PEPlus_SpecialEffect = true


local setOwner
if SERVER then
setOwner = function(ent, ply)
if CPPI then ent:CPPISetOwner(ply)
else ent:SetOwner(ply) end
end
end


function ENT:Initialize()
Expand All @@ -37,6 +44,7 @@ function ENT:Initialize()
constraint.PEPlus_SpecialEffect(self, g, ply)
self:SetSpecialEffectDefaults()
self.DoneFirstSpawn = true
setOwner(self, self:GetCreator())
end
end

Expand Down Expand Up @@ -315,6 +323,7 @@ if SERVER then
local g = ents.Create("ent_peplus_grip")
if !IsValid(g) then return false end
g:Spawn()
setOwner(g, ply)

local p = self:GetCPointPos()
local _, bboxtop1 = ent:GetRotatedAABB(ent:GetCollisionBounds())
Expand Down Expand Up @@ -652,6 +661,7 @@ if SERVER then
ent.IsBlank = self.IsBlank //this is the only functional change from base_entity's SpawnFunction; used by blank variants
ent:Spawn()
ent:Activate()
setOwner(ent, ply)

ent:DropToFloor()
ply:AddCount("peplus", ent)
Expand Down