Open Stooberton opened 2 years ago
The dumb hack doesn't even work on more complex contraptions.
There's a workaround utilizing the PreUndo
hook, which actually turns out to be a great thing. If we know the contraption is going to be entirely deleted, we can go through and nicely clean up the contraption, bypassing a lot of logic.
I've also added a Defuse
method to the contraption class to safely defuse and remove contraptions that experience the error, which still happens in a currently unknown scenario.
During an undo,
constraint.Ent1
will beNULL
, breaking everything.I have a dumb hack in place to clean it up but it is far from perfect, still breaks on some dupes.
https://github.com/Stooberton/CFW/blob/435108e854d8c0bd5aced005110d8972aacdef53/lua/cfw/core/constraints_sv.lua#L14-L67