wiremod / advdupe2

Advanced Duplicator 2
http://wiremod.com
Apache License 2.0
90 stars 60 forks source link

Entity Class Black listed, "prop_effect" #155

Closed Mista-Tea closed 6 years ago

Mista-Tea commented 6 years ago

Trying to spawn in a prop_effect while not in the admin/superadmin user group will block the effect.

https://github.com/wiremod/advdupe2/blob/0aa25c3706c209bd12520273bf740e6b05b2528a/lua/advdupe2/sv_clipboard.lua#L784-L793

if !duplicator.IsAllowed(Class) then return false end passes if ( !scripted_ents.GetMember( Class, "Spawnable" ) and not EntityClass ) then return false end does not pass, as prop_effects have Spawnable as false and EntityClass is nil.

I discovered even the built-in Duplicator tool uses roughly the same logic (advdupe2 most likely modeled after it) and blocks non-admins from spawning effects: https://github.com/Facepunch/garrysmod/blob/394ae745df8f8f353ea33c8780f012fc000f4f56/garrysmod/lua/includes/modules/duplicator.lua#L419-L424


Perhaps I should be asking this on the GMod repo instead, but what is the reasoning to block effects?

How are we supposed to allow players to dupe and spawn effects without turning everyone into an admin? I can modify the base gamemode's prop_effect.lua file and set ENT.Spawnable = true, but this seems like a poor workaround with potential consequences I haven't seen yet.

thegrb93 commented 6 years ago

I think it needs to use http://wiki.garrysmod.com/page/duplicator/RegisterEntityClass so that it's not using the generic duplicator function.

thegrb93 commented 6 years ago

scripted ents need to register their duplicator function or the generic duplicator function is used which only works if the scripted ent is spawnable.

thegrb93 commented 6 years ago

I think you should copy this to garrysmod-issues. It's not an advdupe2 issue.

Mista-Tea commented 6 years ago

Thanks for the quick response and for looking into this. I'll try to follow up with garrysmod-issues.