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

Finding the owner of an Weapon correctly #340

Closed
wants to merge 1 commit into from

Conversation

Astralcircle
Copy link
Contributor

@Astralcircle Astralcircle commented Nov 14, 2024

We already do this for weapons created by toolgun, but not for those given out via Q-menu or other means. I did this because some addons like Wiremod use CanTool for CPPI checks. But since we can't interact with our weapon, some functions stop working (like weapon core).
It might be worth overwriting the weapon owner to always match :GetOwner(), but I'm not sure if that's what you want to do, so I copied the PlayerSpawnedSWEP behavior

@Astralcircle Astralcircle changed the title Finding the owner of an entity correctly Finding the owner of an Weapon correctly Nov 14, 2024
Copy link
Owner

@FPtje FPtje left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I did this because some addons like Wiremod use CanTool for CPPI checks. But since we can't interact with our weapon, some functions stop working (like weapon core).

I'm not sure I understand the problem you're describing. What are weapon core functions and what does "stop working" entail specifically?

@Astralcircle
Copy link
Contributor Author

Astralcircle commented Nov 15, 2024

I'm not sure I understand the problem you're describing. What are weapon core functions and what does "stop working" entail specifically?

The problem is that the player doesn't own his weapon. We also get :DropWeapon() support to know who dropped it

@Astralcircle Astralcircle deleted the weaponowner branch November 15, 2024 16:55
@FPtje
Copy link
Owner

FPtje commented Nov 15, 2024

Why was this closed?

@Astralcircle
Copy link
Contributor Author

I thought that this is not what should be added.

@FPtje
Copy link
Owner

FPtje commented Nov 15, 2024

Oh, I think I may have come across differently than I intended. Sorry about that. My questions were asking for clarification on what problem it solves exactly. You may indeed be right in that this is a good solution.

So as I understand it now, the CPPIOwner is not set for carried weapons. I guess some addons don't realize that these entities are carried weapons (e.g. E2) , so instead of using .Owner they try to get the CPPIOwner, which fails due to the missing owner. Is that correct?

@Astralcircle
Copy link
Contributor Author

Yes. That's what I'm trying to get across.

Copy link
Owner

@FPtje FPtje left a comment

Choose a reason for hiding this comment

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

Ah, I see. I think in that case the solution looks good. I have just one small comment. Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants