SmartlyDressedGames / Legally-Distinct-Missile

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

Support the new clearance check in Unturned, and some other things. #19

Open cartman-2000 opened 4 years ago

cartman-2000 commented 4 years ago

Modified the UnturnedPlayer.Teleport methods to allow bypass of the clearance check, and modified /home, /tp, and /tphere to make use for it for those that have internal Unturned admin.

Add teleport obstruction error messages to /tp and /tphere.

Added the ability to use a formatted location in the /tp command (eg. /tp (0, 0, 0) or /tp 0, 0, 0 )

cartman-2000 commented 4 years ago

Other ways that it could be done, without breaking plugins that use UnturnedPlayer.Teleport, would be to implement it in the Teleport method the position and rotation parameters, this doesn't allow it to work with /tphere though, and it wouldn't be compatible with failure messages, the other would be to bypass that altogether and plug directly into the SDG Player.teleportToLocation and Player.teleportToLocationUnsafe methods. The second method would still need plugins to update on their own with a code chnage to support an ability to bypass the clearance check (teleportToLocationUnsafe), With this PR as it is as of this comment, would only need plugins that use rocket's Teleport method to be recompiled, with no code change(if they don't care about supporting it.).

Trojaner commented 4 years ago

If you want to keep it backwards compatible, create an overload instead of adding a new parameter, like: public bool Teleport(string nodeName) public bool Teleport(string nodeName, bool blabla)

cartman-2000 commented 4 years ago

This is currently, with the least amount of modified code in UnturnedPlayer, but yes, this would still allow backwards compatibility with old plugins.

cartman-2000 commented 4 years ago

Uploaded commit for this, leaving the commands as they are though.