mirror of
https://github.com/metrostroi-repo/MetrostroiAddon.git
synced 2026-05-02 00:42:29 +00:00
Спавнер.
Фикс ошибки при смене оружия. self.GhostEntities удаляется самим GMod'ом
This commit is contained in:
@@ -163,17 +163,6 @@ function TOOL:Think()
|
|||||||
e.GetBodyColor = function() return Vector(1,1,1) end
|
e.GetBodyColor = function() return Vector(1,1,1) end
|
||||||
e.GetDirtLevel = function() return 0.25 end
|
e.GetDirtLevel = function() return 0.25 end
|
||||||
end
|
end
|
||||||
hook.Add("Think",self.GhostEntities[1],function()
|
|
||||||
if not IsValid(self.Owner:GetActiveWeapon()) or self.Owner:GetActiveWeapon():GetClass()~="gmod_tool" or GetConVar("gmod_toolmode"):GetString() ~= "train_spawner" then
|
|
||||||
self:OnRemove()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
local oldOR = self.GhostEntities[1].OnRemove
|
|
||||||
self.GhostEntities[1].OnRemove = function(ent)
|
|
||||||
hook.Remove("Think",ent)
|
|
||||||
oldOR(ent)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
self:UpdateGhost()
|
self:UpdateGhost()
|
||||||
end
|
end
|
||||||
@@ -388,14 +377,6 @@ function TOOL:SpawnWagon(trace)
|
|||||||
for k,v in pairs(FIXFIXFIX) do SafeRemoveEntity(v) end
|
for k,v in pairs(FIXFIXFIX) do SafeRemoveEntity(v) end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TOOL:OnRemove()
|
|
||||||
self:Finish()
|
|
||||||
end
|
|
||||||
function TOOL:Finish()
|
|
||||||
for _,e in pairs(self.GhostEntities) do SafeRemoveEntity(e) end
|
|
||||||
self.GhostEntities = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
function TOOL:Reload(trace)
|
function TOOL:Reload(trace)
|
||||||
if CLIENT then return end
|
if CLIENT then return end
|
||||||
local ply = self:GetOwner()
|
local ply = self:GetOwner()
|
||||||
|
|||||||
Reference in New Issue
Block a user