Raised This Month: $51 Target: $400
 12% 

Can SourceMod detect texture surface props?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 05-29-2020 , 14:22   Can SourceMod detect texture surface props?
Reply With Quote #1

Opening any Source VMT file for a game texture, the properties will usually have what type of surface prop to use so it reacts properly in the world when bullets or something else interacts with it (metal, grass, glass, snow, etc) via '$surfaceprop'.

Is there any way possible for SourceMod to detect this?

Some examples, find out what the player is standing on... or if a traceray was pointed at a "grass" texture ...or a bullet hit it...etc.

Example VMT
Code:
"lightmappedGeneric"
{
	"$basetexture"	"sometexturename"
        "$surfaceprop" 	"metal"
}
Thanks for any insight!
__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT

Last edited by scorpius2k1; 05-29-2020 at 14:32.
scorpius2k1 is offline
Balimbanana
Member
Join Date: Jan 2017
Old 06-08-2020 , 21:55   Re: Can SourceMod detect texture surface props?
Reply With Quote #2

A bit of a late reply, but it is possible with SourceMod 1.10+ I believe.
Code:
float clpos[3];
float eyeang[3];
GetClientEyePosition(client, clpos);
GetClientEyeAngles(client, eyeang);
char surfname[128];
Handle trace = TR_TraceRayFilterEx(clpos, eyeang, MASK_SHOT, RayType_Infinite, TraceEntityFilter, client);
int surfflags = TR_GetSurfaceFlags(trace);
TR_GetSurfaceName(trace,surfname,sizeof(surfname));
int surfprops = TR_GetSurfaceProps(trace);
CloseHandle(trace);
PrintToChat(client,"TRMaterial Flags %i Props %i Name %s",surfflags,surfprops,surfname);
The SURF_ defines are in scripting\include\sdktools_trace.inc
Although I don't think it gives info like $surfaceprop, the $basetexture is in SurfaceName though. Maybe you can use the info in the flags and props or do a
if (StrContains(surfname,"metal",false) != -1)
Balimbanana is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode