SmartlyDressedGames / Legally-Distinct-Missile

Fork of Rocket for Unturned maintained by the game developers.
MIT License
80 stars 33 forks source link

Deprecate legacy functions #10

Open Trojaner opened 4 years ago

Trojaner commented 4 years ago

Many events and methods used in RocketMod are no longer required and have been replaced by official implementations. I suggest to add a Obsolete attribute with a description that refers to the official implementation.

SDGNelson commented 4 years ago

Which ones do you have in mind? Off the top of my head the console IO classes are stubs in the RocketMod code now *and would be good to mark obsolete.

Trojaner commented 4 years ago

Most of the events which are only wrappers now. https://github.com/SmartlyDressedGames/RocketMod/blob/master/Rocket.Unturned/Events/UnturnedPlayerEvents.cs and here: https://github.com/SmartlyDressedGames/RocketMod/blob/master/Rocket.Unturned/Events/UnturnedEvents.cs

Redunant wrappre classes like these: https://github.com/SmartlyDressedGames/RocketMod/blob/master/Rocket.Unturned/Chat/UnturnedChat.cs https://github.com/SmartlyDressedGames/RocketMod/blob/master/Rocket.Unturned/Effects/UnturnedEffectManager.cs

Maybe even the whole UnturnedPlayer class, as it just provides shortcuts and causes bugs (for example, various NRE's when the player is offline): https://github.com/SmartlyDressedGames/RocketMod/blob/master/Rocket.Unturned/Player/UnturnedPlayer.cs

Console IO classes could be removed completely as they were only used internally and were not meant for plugins. The launcher should also be removed imo.

RocketMod should only focus on its core, which is loading plugins, handling commands, managing configurations, etc. It should not create wrappers for everything.

SDGNelson commented 4 years ago

If there is one thing I have learned these past years with plugin devs, it is that just because something should not be used does not mean it is not being used. :)

I agree with you about RocketMod's core functionality, and that wrappers for everything is undesirable. That said, I am not sure about going so far as to make huge components like UnturnedPlayer obsolete (obviously while also ensuring all needed functionality is available in the base game) because so many plugins are already built around them.

While they are essentially wrappers, it seems to me that these examples do provide at least some value for the meantime. For example:

Leaving this issue open for further discussion and because it ideally will be gradually addressed.

Johnanater commented 4 years ago

In my experience, UnturnedPlayer is quite convenient. It provides a lot of shortcuts that I mostly use for getting the player's Steam64 and a player's different names instead of using player.channel.owner.blah.blah. It's also really handy for parsing player names/ids.

GazziFX commented 3 years ago

Rocket OnPlayerConnected event is very useful, because if you try to give items in Provider.EnemyConnected event you'll get null reference exeption because inventory initializes in Start()