1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-02 00:42:29 +00:00

Ownership

Добавлена установка владельцев энтити стандартными фнукциями GMod'а
This commit is contained in:
kosmik641
2025-11-06 08:26:50 +03:00
parent a3b01b69a4
commit 499770d9d3
3 changed files with 26 additions and 5 deletions

View File

@@ -57,6 +57,7 @@ function ENT:PostEntityPaste(ply,ent,createdEntities)
v[1].NoPhysics = v[2] or nil
-- Assign ownership
if IsValid(self:GetOwner()) then v[1]:SetOwner(self:GetOwner()) end
if CPPI and IsValid(self:CPPIGetOwner()) then v[1]:CPPISetOwner(self:CPPIGetOwner()) end
-- Some shared general information about the bogey
@@ -105,8 +106,9 @@ function ENT:Initialize()
end
self:SetUseType(SIMPLE_USE)
-- Prop-protection related
if CPPI and IsValid(self.Owner) then
self:CPPISetOwner(self.Owner)
if IsValid(self.Owner) then
self:SetOwner(self.Owner)
if CPPI then self:CPPISetOwner(self.Owner) end
end
-- Entities that belong to train and must be cleaned up later
self.TrainEntities = {}
@@ -1032,6 +1034,7 @@ function ENT:CreateBogey(pos,ang,forward,typ)
bogey:Spawn()
-- Assign ownership
if IsValid(self:GetOwner()) then bogey:SetOwner(self:GetOwner()) end
if CPPI and IsValid(self:CPPIGetOwner()) then bogey:CPPISetOwner(self:CPPIGetOwner()) end
-- Some shared general information about the bogey
@@ -1069,6 +1072,7 @@ function ENT:CreateBogey(pos,ang,forward,typ)
end
function ENT:AddLightSensor(pos,ang,model)
local sensor = ents.Create("gmod_train_autodrive_coil")
if IsValid(self:GetOwner()) then sensor:SetOwner(self:GetOwner()) end
if CPPI and IsValid(self:CPPIGetOwner()) then sensor:CPPISetOwner(self:CPPIGetOwner()) end
sensor:SetPos(self:LocalToWorld(pos))
sensor:SetAngles(self:LocalToWorldAngles(ang))
@@ -1091,6 +1095,7 @@ function ENT:AddAutodriveCoil(bogey,right)
bogey.CoilL = coil
end
-- Assign ownership
if IsValid(self:GetOwner()) then coil:SetOwner(self:GetOwner()) end
if CPPI and IsValid(self:CPPIGetOwner()) then coil:CPPISetOwner(self:CPPIGetOwner()) end
end
if right then
@@ -1116,6 +1121,7 @@ function ENT:CreateCouple(pos,ang,forward,typ)
coupler:Spawn()
-- Assign ownership
if IsValid(self:GetOwner()) then coupler:SetOwner(self:GetOwner()) end
if CPPI and IsValid(self:CPPIGetOwner()) then coupler:CPPISetOwner(self:CPPIGetOwner()) end
-- Some shared general information about the bogey
@@ -1188,6 +1194,7 @@ function ENT:CreateSeatEntity(seat_info)
self:DrawShadow(false)
--Assign ownership
if IsValid(self:GetOwner()) then seat:SetOwner(self:GetOwner()) end
if CPPI and IsValid(self:CPPIGetOwner()) then seat:CPPISetOwner(self:CPPIGetOwner()) end
-- Hide the entity visually