Skip to content
Merged
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
8 changes: 4 additions & 4 deletions lua/entities/gmod_wire_expression2/core/custom/prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ function PropCore.CreateSent(self, class, pos, angles, freeze, data)
return self:throw("Failed to spawn '" .. class .. "'. (Internal error). Traceback: " .. tostring(errMessage), NULL) -- Not sure, if we should provide tracebacks to scare people.
end
elseif sent then -- Spawning an entity from entity tab.
if sent.AdminOnly and not self.player:IsAdmin() then return self:throw("You do not have permission to spawn '" .. class .. "' (admin-only)!", NULL) end
if scripted_ents.GetMember(class, "AdminOnly") and not self.player:IsAdmin() then return self:throw("You do not have permission to spawn '" .. class .. "' (admin-only)!", NULL) end

local stored_sent = scripted_ents.GetStored(class)
local spawn_function = scripted_ents.GetMember(class, "SpawnFunction")

if stored_sent and stored_sent.t.SpawnFunction then
if spawn_function then
local mockTrace = {
FractionLeftSolid = 0,
HitNonWorld = true,
Expand All @@ -338,7 +338,7 @@ function PropCore.CreateSent(self, class, pos, angles, freeze, data)
WorldToLocal = Vector(0, 0, 0),
}

entity = stored_sent.t.SpawnFunction(stored_sent.t, self.player, mockTrace, class)
entity = spawn_function(scripted_ents.GetStored(class).t, self.player, mockTrace, class)
else
entity = ents.Create( class )
if IsValid(entity) then
Expand Down
Loading