Open LeShred opened 2 years ago
IPlayer.Equals()
is inherited from SharedBaseObject.Equals()
, which only compares type and native pointer.
https://github.com/FabianTerhorst/coreclr-module/blob/6f356bef68ba88f19938a00da2699b4dad442d59/api/AltV.Net.Shared/Elements/Entities/SharedBaseObject.cs#L219
This seems like a breaking change for others if the maintainer overrides IPlayer.Equals()
in the module. How about you override it on your side to add your own checks?
Description of the problem
When a player connects he gets a IPlayer instance with a particular Id. When he disconnects and reconnects back later he gets another IPlayer instance with different Id but the two IPlayer instance are equal. It seems that the Equal() is not based on content of the IPlayer instance but on something else because the behavior isn't 100% consistant.
Reproduction steps
Create and in Alt.OnPlayerConnect event that add the IPlayer instance to an HashSet and display an error if the add returned false:
Result:
Here it takes me 2 reconnects to have equal IPlayer instances but sometimes it can take morre or less attempts.
Expected behaviour
Different IPlayer instances with different Id should not be equal.
Additional context
No response
Operating system
Windows 10 21H2
Version
release/10.8