Skip to content

Conversation

@Grocel
Copy link
Contributor

@Grocel Grocel commented Dec 13, 2025

In adjacent to: Facepunch/garrysmod#2408

Works like ENTITY:OnDuplicated(ent, entDupeTable) but doesn't require adding/detouring ent.OnDuplicated on OnEntityCreated calls for addon-foreign entities.

This adds a easy way to add generic logic early to the duplication life cycle. It is called a way before duplicator.RegisterEntityModifier() added callers are being iterated. The new hook also reduces the risk of conflicts caused by detours of pre-existing ent.OnDuplicated code.

Test script:

if SERVER then
    hook.Add("OnDuplicated", "Test", function(ent, entTable)
        print(ent)
        PrintTable(entTable)
    end)
end

In adjacent to: Facepunch/garrysmod#2408

Works like `ENTITY:OnDuplicated(ent, entDupeTable)` but doesn't require adding/detouring `ent.OnDuplicated` on `OnEntityCreated` calls for addon-foreign entities.
@Grocel
Copy link
Contributor Author

Grocel commented Dec 13, 2025

The linter results are not relevant to my changes, so I can't fix them.

Grocel added a commit to Grocel/sligwolf_addon_base that referenced this pull request Dec 14, 2025
Removes the need for the "OnEntityCreated" hack.

Requires these pull request to be merged:
- Facepunch/garrysmod#2408
- wiremod/advdupe2#528
@Astralcircle
Copy link
Contributor

I don't see any point in merging this until it's merged into GMOD. Because very few addons rely on the AdvDupe2 duplicator specifically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants