Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elastics may be causing errors during undos #1

Open
Stooberton opened this issue Jun 27, 2022 · 2 comments
Open

Elastics may be causing errors during undos #1

Stooberton opened this issue Jun 27, 2022 · 2 comments

Comments

@Stooberton
Copy link
Collaborator

During an undo, constraint.Ent1 will be NULL, 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

@Stooberton Stooberton changed the title Wire Hydraulics break everything during an undo operation Elastics and hydraulics break everything during an undo operation Jul 1, 2022
@Stooberton
Copy link
Collaborator Author

The dumb hack doesn't even work on more complex contraptions.

@Stooberton
Copy link
Collaborator Author

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.

https://github.com/Stooberton/CFW/blob/5b9c9dd59b4b84b50c0cf765b010e78f9624e2fe/lua/cfw/core/constraints_sv.lua#L59-L90

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.

@Stooberton Stooberton changed the title Elastics and hydraulics break everything during an undo operation Elastics may be causing errors during undos Sep 16, 2022
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

No branches or pull requests

1 participant