Entity creator is not set to player spawning the dupe (#408)

* Fixed: Creator is not set correctly when dupe is pasted

* Added: Creator update after every `ents.Create`
This commit is contained in:
Deyan Dobromirov 2023-01-12 02:37:55 +02:00 committed by GitHub
parent b83f6fd028
commit 2c12f32a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -805,7 +805,7 @@ end
--[[
Name: GenericDuplicatorFunction
Desc: Override the default duplicator's GenericDuplicatorFunction function
Params: <player> Player, <table> data
Params: <table> data, <player> Player
Returns: <entity> Entity
]]
local function GenericDuplicatorFunction(data, Player)
@ -830,6 +830,7 @@ local function GenericDuplicatorFunction(data, Player)
end
duplicator.DoGeneric(Entity, data)
if (Player) then Entity:SetCreator(Player) end
Entity:Spawn()
Entity:Activate()
DoGenericPhysics(Entity, data, Player)
@ -870,6 +871,7 @@ local function MakeProp(Player, Pos, Ang, Model, PhysicsObject, Data)
if not IsValid(Prop) then return false end
duplicator.DoGeneric(Prop, Data)
if (Player) then Prop:SetCreator(Player) end
Prop:Spawn()
Prop:Activate()
DoGenericPhysics(Prop, Data, Player)

View File

@ -498,6 +498,7 @@ if(SERVER)then
spawner:SetAngles(Ang)
spawner:SetModel(model)
spawner:SetRenderMode(RENDERMODE_TRANSALPHA)
spawner:SetCreator(ply)
spawner:Spawn()
duplicator.ApplyEntityModifiers(ply, spawner)