Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: PlayGunSound Extensions fix #386

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

VALERA771
Copy link

Description

Describe the changes
Brings back PlayGunSound extension

What is the current behavior? (You can also link to an open issue here)

What is the new behavior? (if this is a feature change)

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:
Currently volume of sound is very low. Seems like it depends on gun position but idk how to move gun closer to player so it will work (creating instance in Server.Host inv and move it to player doesn't work). I hope that someone has an idea how to do this


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

@VALERA771
Copy link
Author

Note: Doing things like in PlayGunSound with dummy staying near you works as expected

@louis1706 louis1706 changed the title fix: PlayGunSound extenision fix fix: PlayGunSound Extensions fix Jan 8, 2025
@VALERA771 VALERA771 marked this pull request as ready for review January 10, 2025 16:09
@VALERA771
Copy link
Author

After playing sound player get kicked

@VALERA771 VALERA771 added the Do not merge Don't merge this PR label Jan 10, 2025
@VALERA771 VALERA771 removed the Do not merge Don't merge this PR label Jan 10, 2025
@VALERA771 VALERA771 requested a review from louis1706 January 10, 2025 20:41
Copy link

@louis1706 louis1706 left a comment

Choose a reason for hiding this comment

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

Also the used of Server.Host would ne quite problatic in the case of how it's implemented (for example calling the method for gun sound would probably make crash client because of ServerHost having been put to None role

EXILED/Exiled.API/Extensions/MirrorExtensions.cs Outdated Show resolved Hide resolved
@VALERA771
Copy link
Author

VALERA771 commented Jan 16, 2025

Okay so very strange situation. If we use Fake Sync vars we need delay but if we do like

Server.Host.Role.Set(RoleTypeId.ClassD);
Features.Items.Firearm firearm = Features.Items.Firearm.ItemTypeToFirearmInstance[itemType];
Server.Host.CurrentItem = Features.Items.Firearm.ItemTypeToFirearmInstance[itemType];
firearm.Base.TryGetModule(out AudioModule audioModule);

audioModule.SendRpc(player.ReferenceHub, writer =>
                audioModule.ServerSend(writer, clipIndex, pitch, MixerChannel.Weapons, 12f, position, false));

everything works fine without delays

@VALERA771 VALERA771 requested a review from louis1706 January 16, 2025 17:01
@louis1706
Copy link

Features.Items.Firearm firearm = Features.Items.Firearm.ItemTypeToFirearmInstance[itemType];
Server.Host.CurrentItem = Features.Items.Firearm.ItemTypeToFirearmInstance[itemType];
firearm.Base.TryGetModule(out AudioModule audioModule);

audioModule.SendRpc(player.ReferenceHub, writer =>
                audioModule.ServerSend(writer, clipIndex, pitch, MixerChannel.Weapons, 12f, position, false));

so why we don't use this ?

@VALERA771
Copy link
Author

Cuz someone may use host in some stuff (idk which but it can be used) so if we set it's role for everybody it'll also appear in alive players in spectators list

@louis1706
Copy link

Cuz someone may use host in some stuff (idk which but it can be used) so if we set it's role for everybody it'll also appear in alive players in spectators list

oh didn't seen you used CurrentItem

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.

3 participants