Skip to content

feat: Dummy actions & making Npc wrapper useful#787

Open
Saskyc wants to merge 5 commits intoExMod-Team:masterfrom
Saskyc:Dummy-Action
Open

feat: Dummy actions & making Npc wrapper useful#787
Saskyc wants to merge 5 commits intoExMod-Team:masterfrom
Saskyc:Dummy-Action

Conversation

@Saskyc
Copy link
Copy Markdown

@Saskyc Saskyc commented Mar 27, 2026

Description

Describe the changes

  • Item now has DummyKeyEmulator as DummyEmulator, so it can be worked with.
  • New methods
    • Shoot makes Npc shoot
    • Cancel use item makes Npc cancel using item such as medkit
    • Reload makes Npc reload
    • Holster makes Npc not equip anything (CurrentItem = null may also be used.)
    • Equip makes Npc equip specific item (CurrentItem = MyItem [Item Instance] may also be used.)
    • Move method that makes Npc move in specific direction (could be later improved to move to specific point in generating direction based on 2 Vectors npc::Position and other position.
    • Look has multiple methods like look in direciton, position vertical and horizontal
    • Jump makes Npc jump
    • Eat candy methods that interacts with candy and makes it the Npc eat. Could be later just moved into different part and that to Scp330 wrapper.
    • GetActions() is all actions Npc can do in a specific moment
    • RunAction() forces specific action to be run with DummyKeyEmulator
    • StopAction() forces specific action to be stopped with DummyKeyEmulator
    • IsBeingDone() checks if action is being executed at the moment. Eg. reload -> hold means it will be held and can't shoot so I can check if Reload IsBeingDone() and stop if it is.

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentations

Submission checklist

  • I have checked the project can be compiled
  • I have tested my changes and it worked as expected

Patches (if there are any changes related to Harmony patches)

  • I have checked no IL patching errors in the console

Other

  • Still requires more testing

Copy link
Copy Markdown

@Someone-193 Someone-193 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +194 to +196
/// <summary>
/// Gets the emulator for dummy actions if the item is Autosync.
/// </summary>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a remark here that the value can be null? (If only Exiled.API was made with nullability on 😔)

Comment on lines +366 to +383
/// <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;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment on lines +385 to +399
/// <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;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe name this TryAddHorizontalLook? The summary docs are also going to need to be improved. For instance, what units is "amount" in? Radians? Degrees?

Comment on lines +401 to +415
/// <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;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe name this TryAddVerticalLook? The summary docs are also going to need to be improved. For instance, what units is "amount" in? Radians? Degrees?

Comment thread EXILED/Exiled.API/Features/Npc.cs Outdated
Comment on lines +434 to +437
/// <summary>
/// Forces Npc to look at certain point.
/// </summary>
/// <param name="dir">Position to look at.</param>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bro pulled a yamato 💔

@Saskyc
Copy link
Copy Markdown
Author

Saskyc commented Mar 28, 2026

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

You are more then welcome. My English is not on a level that Exiled works with, so any gramatical changes are great.

Copy link
Copy Markdown

@Someone-193 Someone-193 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I changed the docs myself. Verify this still works btw @Saskyc, I tried to use some better properties in TryMoveRelative

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants