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

Fix reload

This commit is contained in:
Ilya Krasnow
2022-01-13 17:56:39 +03:00
committed by GitHub
parent cf37815bcb
commit a5044576ab

View File

@@ -398,8 +398,8 @@ end
function TOOL:Reload(trace) function TOOL:Reload(trace)
if CLIENT then return end if CLIENT then return end
local ply = self:GetOwner()
if IsValid(trace.Entity) and trace.Entity._Settings then if IsValid(trace.Entity) and trace.Entity._Settings then
local ply = self:GetOwner()
ply:ConCommand("gmod_tool train_spawner") ply:ConCommand("gmod_tool train_spawner")
ply:SelectWeapon("gmod_tool") ply:SelectWeapon("gmod_tool")
local tool = ply:GetTool("train_spawner") local tool = ply:GetTool("train_spawner")
@@ -407,14 +407,14 @@ function TOOL:Reload(trace)
tool.Settings = trace.Entity._Settings tool.Settings = trace.Entity._Settings
local ENT = scripted_ents.Get(tool.Settings.Train) local ENT = scripted_ents.Get(tool.Settings.Train)
if not ENT then tool.AllowSpawn = false else tool.Train = ENT end if not ENT then tool.AllowSpawn = false else tool.Train = ENT end
net.Start("train_spawner_open") net.Start("train_spawner_open")
net.WriteTable(tool.Settings) net.WriteTable(tool.Settings)
net.Send(ply) net.Send(ply)
local spawner = ents.Create("gmod_train_spawner")
spawner:SpawnFunction(ply)
end end
local spawner = ents.Create("gmod_train_spawner")
spawner:SpawnFunction(ply)
end end
function TOOL:LeftClick(trace) function TOOL:LeftClick(trace)
if not self.Train then return end if not self.Train then return end