space-wizards / space-station-14

A multiplayer game about paranoia and chaos on a space station. Remake of the cult-classic Space Station 13.
https://spacestation14.io
MIT License
2.72k stars 3.46k forks source link

Pulling needs cleanup #4840

Open metalgearsloth opened 3 years ago

metalgearsloth commented 3 years ago

Ideally:

mirrorcult commented 3 years ago

move all of the logic out of giant fucking setters please

20kdc commented 3 years ago

the state management system was created in the wake of tons of pulling state bugs because people kept mucking around with the pulling state when they really shouldn't, failing to trigger the necessary events. It might be an idea to move things like pull joint creation into event handlers, but I would not recommend removing the state management system.

20kdc commented 3 years ago

Just to be totally clear, the separation of the state management system was done on purpose as a defensive measure against accidental state-corrupting changes.

There appeared to be confusion about which functions were actually supposed to mutate state, i.e. https://github.com/space-wizards/space-station-14/blob/e801ffac45bc70edccd4b5233f1de7c227399741/Content.Shared/Pulling/Components/SharedPullableComponent.cs#L260 wasn't supposed to be messing with _pullJoint.

The State Management System should make this clearer.

metalgearsloth commented 3 years ago

I'm still not convinced the system isn't a bandaid tbh

20kdc commented 3 years ago

if you have a better way to guarantee that only the specific setup functions access the state fields, please implement it

metalgearsloth commented 3 years ago

hence the issue...

gradientvera commented 3 years ago

Literally just make a single system that handles this, and EXPLICITLY say using comments which methods should be used to modify the component state. With Friend, you can prevent anything but the system that handles pulling write the component's members, which in my opinion is way more than enough. You don't need a snowflake system to handle the state, just let a single system handle all this and leave comments so people don't fuck it up.