yanipku / advdupe2

Automatically exported from code.google.com/p/advdupe2
0 stars 0 forks source link

Aliases of entities cannot be duplicated #52

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

At Wiremod, we've recently renamed an entity (from `gmod_wire_adv_pod` to 
`gmod_wire_pod`). We then call the function

{{{scripted_ents.Alias("gmod_wire_adv_pod", "gmod_wire_pod")}}}

in order to maintain compatibility with old dupes. This works for both the 
Duplicator and the Advanced Duplicator.

However, apparently it doesn't work with Advanced Duplicator 2. We've worked 
around this, see 
https://github.com/wiremod/wire/commit/8a6b3d177876cbd46401d06551dc620ab2359df7 
, but it's really not nice to have to do this.

Original issue reported on code.google.com by abigail....@gmail.com on 8 Aug 2013 at 8:57

GoogleCodeExporter commented 9 years ago
Alternatively, add your voice to draw attention to  
https://github.com/garrynewman/garrysmod/pull/487 , fixing the problem at its 
source.

Original comment by ben1...@gmail.com on 8 Aug 2013 at 9:37

GoogleCodeExporter commented 9 years ago
There's nothing I can really do about it. It's not a problem with the 
duplicator, it's what ben1120 has pointed out, which is used to allow or block 
entities from being spawned.

Original comment by tbzipper@gmail.com on 8 Aug 2013 at 10:25

GoogleCodeExporter commented 9 years ago
Given that the Duplicator and Advanced Duplicator both cope absolutely fine 
with it, I think it's somewhat disingenuous to say "There's nothing I can do 
about it". You build your duplication whitelist with scripted_ents.GetList(), 
which I would argue is the wrong thing to do, and Garry agrees with me: 
https://github.com/garrynewman/garrysmod/pull/487

Instead of getting the whitelist from scripted_ents.GetList() you should check 
on-demand with scripted_ents.Get(class).

Original comment by abigail....@gmail.com on 9 Aug 2013 at 8:33

GoogleCodeExporter commented 9 years ago
The attached addition (line 360-369) would add aliases registered with 
duplicator.RegisterEntityClass to your whitelist.

There are alternatively edits possible inside CreateEntityFromTable, such as 
replacing (unedited line number) 846:

elseif( game.SinglePlayer() or AdvDupe2.duplicator.WhiteList[EntTable.Class] or 
(EntTable.BuildDupeInfo.IsNPC and 
(tobool(GetConVarString("AdvDupe2_AllowNPCPasting")) and 
string.sub(EntTable.Class, 1, 4)=="npc_")))then

with

elseif( game.SinglePlayer() or (not EntTable.AdminSpawnable or 
EntTable.Spawnable)  or (EntTable.BuildDupeInfo.IsNPC and 
(tobool(GetConVarString("AdvDupe2_AllowNPCPasting")) and 
string.sub(EntTable.Class, 1, 4)=="npc_")))then

Which would mean not checking the whitelist if the entity has been 
duplicator.RegisterEntityClass'd.

Original comment by ben1...@gmail.com on 9 Aug 2013 at 5:50

Attachments:

GoogleCodeExporter commented 9 years ago
There's been a patch for this issue since August, and is blocking progress on 
refactoring in Wiremod (because people complain at us if AdvDupe2 is broken), 
and is something that even Garry's duplicator supports.

Original comment by abigail....@gmail.com on 5 Jan 2014 at 2:18