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

Sandbox.Hitbox.GetName() return <invalid> #4036

Closed
PolSpock opened this issue Sep 19, 2023 · 2 comments
Closed

Sandbox.Hitbox.GetName() return <invalid> #4036

PolSpock opened this issue Sep 19, 2023 · 2 comments
Assignees
Labels
bug Something isn't working confirmed

Comments

@PolSpock
Copy link

PolSpock commented Sep 19, 2023

Describe the bug

Hi,

If you try to use Sandbox.Hitbox.GetName(), you will never grab the name of the hitbox hit by a Trace.
You always get <invalid> instead

Is problematic if you want to do some debugging of the hitbox for your player model

To Reproduce

  1. Download sandbox game (to be sure you playing with Terry models/citizen/citizen.vmdl)
  2. Edit the Player.cs TakeDamage function :
    Add something like this :
public override void TakeDamage( DamageInfo info )
{
	Log.Info( info.Hitbox.GetName() );
	if ( info.Hitbox.HasTag("head")) // Just be sure your trace uses UseHitboxes()
	{
		Log.Info( "Headshot" );
	}
	// [...] trunc
	base.TakeDamage( info );
}
  1. Start a sandbox game, spawn a bot, and shoot him: you will get an <invalid> for info.Hitbox.GetName() but you will get "Headshot" printed if you shoot in the head.

PS : I also tried to add these lines in the Respawn() function but the error is still present

EnableHitboxes = true;
SurroundingBoundsMode = SurroundingBoundsType.Hitboxes;

Expected behavior

The documentation says "Grab the name of the hitbox, please note that internally we store this as a string token, so using this frequently is ill advised." but invalid is not the correct name of the hitbox 🤓

Media/Files

No response

Additional context

No response

@PolSpock PolSpock added the bug Something isn't working label Sep 19, 2023
@DevulTj DevulTj self-assigned this Sep 19, 2023
@DevulTj
Copy link
Member

DevulTj commented Sep 19, 2023

Repro'd - This happens if native fails to grab the string token's original string. Will look into it

@DevulTj
Copy link
Member

DevulTj commented Dec 10, 2023

This struct doesn't exist anymore

@DevulTj DevulTj closed this as completed Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
None yet
Development

No branches or pull requests

2 participants