feat: Dummy actions & making Npc wrapper useful#787
feat: Dummy actions & making Npc wrapper useful#787Saskyc wants to merge 5 commits intoExMod-Team:masterfrom
Conversation
Someone-193
left a comment
There was a problem hiding this comment.
Can I just rewrite these docs for you? You arent a native english speaker right? Anyways, I commented here on some of the docs you could improve, but there's a lot of little grammatical changes I would make
| /// <summary> | ||
| /// Gets the emulator for dummy actions if the item is Autosync. | ||
| /// </summary> |
There was a problem hiding this comment.
Maybe add a remark here that the value can be null? (If only Exiled.API was made with nullability on 😔)
| /// <summary> | ||
| /// Moves Npc by direction times distance. | ||
| /// For future maintainer: <see cref="FpcMotor"/> implements <see cref="IDummyActionProvider"/>. | ||
| /// </summary> | ||
| /// <param name="dir">Direction where Npc should move.</param> | ||
| /// <param name="distance">The distance that the Npc should move by.</param> | ||
| /// <returns>true if moved.</returns> | ||
| public bool MoveRelative(Vector3 dir, float distance) | ||
| { | ||
| if (Role is not FpcRole fpcRole) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| Vector3 vector = ReferenceHub.PlayerCameraReference.TransformDirection(dir).NormalizeIgnoreY(); | ||
| fpcRole.FirstPersonController.FpcModule.Motor.ReceivedPosition = new RelativePosition(Position + (vector * distance)); | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Maybe name this TryMoveRelative? Also the summary docs are a bit strange. I'd leave out the "future maintainer" note and just leave it as "Moves this Npc in a target direction multiplied by their rotation, a target distance" or something similar. Also cant you use CameraTransform here instead of ReferenceHub.PlayerCameraReference?
| /// <summary> | ||
| /// Makes the Npc look horizontal. Right or Left. | ||
| /// </summary> | ||
| /// <param name="amount">Amount that will be added to horizontal.</param> | ||
| /// <returns>True if successful.</returns> | ||
| public bool LookHorizontal(float amount) | ||
| { | ||
| if (Role is not FpcRole fpcRole) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| fpcRole.FirstPersonController.FpcModule.MouseLook.CurrentHorizontal += amount; | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Maybe name this TryAddHorizontalLook? The summary docs are also going to need to be improved. For instance, what units is "amount" in? Radians? Degrees?
| /// <summary> | ||
| /// Makes the Npc look vertical. Up or Down. | ||
| /// </summary> | ||
| /// <param name="amount">Amount that will be added to vertical.</param> | ||
| /// <returns>True if successful.</returns> | ||
| public bool LookVertical(float amount) | ||
| { | ||
| if (Role is not FpcRole fpcRole) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| fpcRole.FirstPersonController.FpcModule.MouseLook.CurrentVertical += amount; | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Maybe name this TryAddVerticalLook? The summary docs are also going to need to be improved. For instance, what units is "amount" in? Radians? Degrees?
| /// <summary> | ||
| /// Forces Npc to look at certain point. | ||
| /// </summary> | ||
| /// <param name="dir">Position to look at.</param> |
You are more then welcome. My English is not on a level that Exiled works with, so any gramatical changes are great. |
Someone-193
left a comment
There was a problem hiding this comment.
Ok I changed the docs myself. Verify this still works btw @Saskyc, I tried to use some better properties in TryMoveRelative
Description
Describe the changes
What is the current behavior? (You can also link to an open issue here)
X
What is the new behavior? (if this is a feature change)
X
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No this PR only introduces new methods and properties.
Other information:
Test reporitory: https://github.com/Saskyc/ExiledTest/tree/Dummy-Action-Test
Youtube video showing new behaviour: https://www.youtube.com/watch?v=HjHgxjdN6tA
Types of changes
Submission checklist
Patches (if there are any changes related to Harmony patches)
Other