Skip to content

CFW breaks duplicator due to cycles #18

Description

@Python1320

Notes:

  • Version: latest git
  • Unverified in singleplayer yet without other addons, sorry :(

Steps to reproduce:

  1. Spawn two props
  2. Rope them together
  3. in console try executing dupe_save
  4. Observe error in console:
       gamemodes/sandbox/entities/weapons/gmod_tool/stools/duplicator/transport.lua:30: 
                attempt to serialize structure with cyclic reference

The issue is due to the entity table having cycles, namely _contraption's CostObj:

Image

I don't know the codebase enough but likely it seems to be related to

-- This function has caused headaches in other codebases (wiremod's cam controllers for example) and should've always been namedspaced...

Or rather CFW_GetContraption should do something like:

local cfw_contraptions = {}
...
    function ENT:CFW_GetContraption()
        return cfw_contraptions[self]
    end
...

    function CLASS:Add(ent)
        cfw_contraptions[ent] = self
    end

(and same for links, etc)

Activity

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

Metadata

Metadata

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions