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

@@ -149,7 +149,20 @@ function ENT:InitializeWheels()
else
constraint.Weld(self,wheels,0,0,0,1,0)
end
if CPPI then wheels:CPPISetOwner(self:CPPIGetOwner() or self:GetNW2Entity("TrainEntity"):GetOwner()) end
-- Assign ownership
if IsValid(self:GetOwner()) then
wheels:SetOwner(self:GetOwner())
elseif IsValid(self:GetNW2Entity("TrainEntity"):GetOwner()) then
wheels:SetOwner(self:GetNW2Entity("TrainEntity"):GetOwner())
end
if CPPI and IsValid(self:CPPIGetOwner()) then
wheels:CPPISetOwner(self:CPPIGetOwner())
elseif CPPI and IsValid(self:GetNW2Entity("TrainEntity"):CPPIGetOwner()) then
wheels:CPPISetOwner(self:GetNW2Entity("TrainEntity"):CPPIGetOwner())
end
wheels:SetNW2Entity("TrainBogey",self)
self.Wheels = wheels
end