-
Notifications
You must be signed in to change notification settings - Fork 37
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
Coordinated spawns hotfixes #229
Coordinated spawns hotfixes #229
Conversation
Calling for a fast merge/publish as this bug was game breaking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have suggested changes in comments, I also intend to work on GetHashCode()
implementation before this goes through as I believe there will be issues with SpawnInfo
if we introduce an Equals
method that is not inline with the GetHashCode
method - particularly if someone ever wants to make a HashSet
of SpawnInfo
instances.
Simply deferring to base.GetHashCode()
when you have modified the logic of Equals
will get the compiler to "shut up", but it will also cause problems down the road.
The `rotation` is stored as a `Quaternion`, not as a `Vector3`.
…>`QuaternionJson` and `Vector3`<->`Vector3Json` for simpler code.
…rs to have been missed in the initial implementation.
…ct)` and `GetHashCode()`
… the expected default. Since the API was being redesigned, also took care of the fact the property names were violating property naming rules.
Tested SMLHelper 2.10.0.6 and i can confirm that the potential bugs were fixed and everything works just fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2.10.0.6 appears to be bug free after testing from @Metious. Issues that were game-breaking are resolved, and no breaking changes for their 2.9.7 build of mods utilising the API.
Changes made in this pull request
public
JsonConverter
classes (QuaternionConverter
/Vector3Converter
) for simplified serializations.SpawnInfo
into astruct
, implementingIEquatable<SpawnInfo>
, customEquals
,GetHashCode
methods and operator overloads for==
and!=
respectively.EntitySpawner.SpawnAsync
was usingTechType.ToString()
rather thanTechType.AsString()
.Builds by @tobeyStraitjacket
5555948 v2.10.0.3:
Equals(object obj)
&GetHashCode()
Equals(object obj)
&GetHashCode()
to provide a value-based equality comparison for all properties ofSpawnInfo
.Equals
andGetHashCode
to provide value-based equality comparison, this is a breaking change for anyone who previously relied onEquals
orGetHashCode
(particularly a problem in the case ofHashSet
), but it solves the problem whereList.Contains
is returningfalse
for deserializedSpawnInfo
instances. However, it also means that we cannot later change the implementation ofEquals
orGetHashCode
without another breaking change for consumers.Subnautica
Stable v2.10.0.3
Experimental v2.10.0.3
Below Zero
Stable v2.10.0.3
Experimental v2.10.0.3
96cdaa3 v2.10.0.5:
IEquatable<SpawnInfo>
Equals(SpawnInfo other)
Equals(object obj)
orGetHashCode
, but instead implementsIEquatable<SpawnInfo>
andEquals(SpawnInfo other)
to provide a value-based equality comparison for all properties ofSpawnInfo
.List.Contains
should defer toEquals(SpawnInfo)
for comparison since we implementIEquatable<SpawnInfo>
, and the issue @Metious was trying to solve should be resolved.Equals(object obj)
andGetHashCode
still operate the same, it is onlyEquals(SpawnInfo other)
that has been changed. Still, the issue remains that if we change this in future, it will have implications for consumers, so it must be approached with caution.Subnautica
Stable v2.10.0.5
Experimental v2.10.0.5
Below Zero
Stable v2.10.0.5
Experimental v2.10.0.5
b9802ce v2.10.0.6:
SpawnInfo
redesigned as astruct
SpawnInfo
as astruct
rather than aclass
.SpawnInfo
API, so a backwards-incompatible change that fixes the design of the API is preferable, should this prove to be true.Subnautica
Stable v2.10.0.6
Experimental v2.10.0.6
Below Zero
Stable v2.10.0.6
Experimental v2.10.0.6
Builds by @Metious ca7018a
SMLHelper_BZ.STABLE.zip
SMLHelper_BZ.STABLE.zip