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

Container system overhaul #1088

Merged
merged 18 commits into from
Mar 10, 2023

Conversation

stilnat
Copy link
Contributor

@stilnat stilnat commented Mar 7, 2023

Summary

This PR improve the current container system in the following ways :

  • Make Container class works on its own (with no networkbehaviour, synclist...), just a plain old c# class, allows for testability of the container class.
  • Merge containerDescriptor and AttachedContainer in just attachedContainer. AttachedContainer keeps
    using a syncList to network changes to containers. Makes setting up a container easier, since there's only one script for it now to attach to a gameObject.
  • Move most logic from AttachedContainer to Container.
  • Remove custom icons interaction settings on container.
  • Modify other scripts to use the new system.
  • Adds an hack to check the content of all containers on the scene.
  • Make container content only visible to client viewing the container.
  • Make toolbox hackproof as an example.

Globally, it's simpler to test, safer, has better reusability, and it's easier to set up for an user.

This PR also add an hack folder. This will contain little scripts that can be attached to game objects at run time to give an unfair advantage to a client over others. These could be later on used in play mode tests to check if the hacks are effective or not.

Technical Notes (optional)

I used an useful pattern to apply the humble object pattern when networking is involved, especially when synclists are involved. The idea is basically to use a reference in the non-behaviour object to the internal list of the synclist. The humble object ask for the non-behaviour to do stuff, and the non-behaviour object handles updating the list of the humble object.

To test the hack is effectively not working on client with this PR.

  • Put the hack on human prefab.
  • Build.
  • Host.
  • Join with client.
  • Put every item you can find in a toolbox (with either client or host)
  • press L to show all container content on host and client.
  • On host you should see the content of the toolbox, not on client.

Future work

  • Add tests for the container class.

Todo

  • Move as much as possible the logic and fields from attachedcontainer to container.
  • Find a way to avoid the synclist being accessible to just any clients in attached container.

Fixes (optional)

close #969
close #970
close #971
close #1099

@stilnat stilnat changed the title Container system overhaul [WIP] Container system overhaul Mar 7, 2023
@stilnat stilnat changed the title [WIP] Container system overhaul Container system overhaul Mar 9, 2023
@stilnat stilnat requested a review from TaylorNAlbarnaz March 10, 2023 06:47
@TaylorNAlbarnaz TaylorNAlbarnaz merged commit 9b48227 into RE-SS3D:develop Mar 10, 2023
@stilnat stilnat deleted the Container-system-overhaul branch April 15, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants