This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Entity solid or not solid


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-sang-
BANNED
Join Date: Jun 2009
Location: Russia
Old 01-13-2011 , 05:20   Entity solid or not solid
Reply With Quote #1

There is any way to learn entity solid for player or not, If the index entity is known?

Like this:

PHP Code:
public IsSolidEntity(entity)
{
   
//???????

-sang- is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 01-13-2011 , 11:10   Re: Entity solid or not solid
Reply With Quote #2

PHP Code:
if ((GetEntProp(entityProp_Send"m_nSolidType") != 0) && ((GetEntProp(entityProp_Send"m_usSolidFlags") & 4) == 0))
{
    
//entity is solid


Last edited by blodia; 01-13-2011 at 17:04. Reason: fixed value
blodia is offline
-sang-
BANNED
Join Date: Jun 2009
Location: Russia
Old 01-13-2011 , 14:16   Re: Entity solid or not solid
Reply With Quote #3

Thanks!
-sang- is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 01-13-2011 , 16:14   Re: Entity solid or not solid
Reply With Quote #4

This code above is dirty and also won't work.

Use Entity_IsSolid(entity) from my stock functions:

PHP Code:
enum SolidFlags_t
{
    
FSOLID_CUSTOMRAYTEST        0x0001,    // Ignore solid type + always call into the entity for ray tests
    
FSOLID_CUSTOMBOXTEST        0x0002,    // Ignore solid type + always call into the entity for swept box tests
    
FSOLID_NOT_SOLID            0x0004,    // Are we currently not solid?
    
FSOLID_TRIGGER                0x0008,    // This is something may be collideable but fires touch functions
                                            // even when it's not collideable (when the FSOLID_NOT_SOLID flag is set)
    
FSOLID_NOT_STANDABLE        0x0010,    // You can't stand on this
    
FSOLID_VOLUME_CONTENTS        0x0020,    // Contains volumetric contents (like water)
    
FSOLID_FORCE_WORLD_ALIGNED    0x0040,    // Forces the collision rep to be world-aligned even if it's SOLID_BSP or SOLID_VPHYSICS
    
FSOLID_USE_TRIGGER_BOUNDS    0x0080,    // Uses a special trigger bounds separate from the normal OBB
    
FSOLID_ROOT_PARENT_ALIGNED    0x0100,    // Collisions are defined in root parent's local coordinate space
    
FSOLID_TRIGGER_TOUCH_DEBRIS    0x0200,    // This trigger will touch debris objects

    
FSOLID_MAX_BITS    10
};

/**
 * Gets the solid flags of the entity
 *
 * @param entity            Entity index.
 * @return                    Solid Flags.
 */
stock SolidFlags_t:Entity_GetSolidFlags(entity)
{
    return 
SolidFlags_t:GetEntProp(entityProp_Send"m_usSolidFlags"2);
}

/**
 * Checks whether certain solid flags are set on th entity.
 *
 * @param entity            Entity index.
 * @param flags                Solid Flags.
 * @return                    True if the specified flags are set, false otherwise.
 */
stock bool:Entity_SolidFlagsSet(entitySolidFlags_t:flagMask)
{
    return 
bool:(Entity_GetSolidFlags(entity) & flagMask);
}

enum SolidType_t
{
    
SOLID_NONE            0,    // no solid model
    
SOLID_BSP            1,    // a BSP tree
    
SOLID_BBOX            2,    // an AABB
    
SOLID_OBB            3,    // an OBB (not implemented yet)
    
SOLID_OBB_YAW        4,    // an OBB, constrained so that it can only yaw
    
SOLID_CUSTOM        5,    // Always call into the entity for tests
    
SOLID_VPHYSICS        6,    // solid vphysics object, get vcollide from the model and collide with that
    
SOLID_LAST,
};

/**
 * Gets the solidity type of the entity
 *
 * @param entity            Entity index.
 * @return                    Solid Type
 */
stock SolidType_t:Entity_GetSolidType(entity)
{
    return 
SolidType_t:GetEntProp(entityProp_Send"m_nSolidType"1);
}

/**
 * Checks whether the entity is solid or not.
 *
 * @param entity            Entity index.
 * @return                    True if the entity is solid, false otherwise.
 */
stock bool:Entity_IsSolid(entity)
{
    return (
Entity_GetSolidType(entity) != SOLID_NONE &&
            !
Entity_SolidFlagsSet(entityFSOLID_NOT_SOLID));

__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 01-13-2011 , 16:40   Re: Entity solid or not solid
Reply With Quote #5

lol you're joking right?, you took your stock function from the same place i got that check from, const.h. only difference is your is a bit more readable. i have had no issues with my homing missile plugin that uses it.
blodia is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 01-13-2011 , 16:56   Re: Entity solid or not solid
Reply With Quote #6

I never joke, GetEntProp(entity, Prop_Send, "m_usSolidFlags") & 8) is wrong, FSOLID_NOT_SOLID has the value 4 and not 8,
that's why I always use constant defines instead of numbers, because I don't make mistakes with them.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 01-13-2011 , 17:04   Re: Entity solid or not solid
Reply With Quote #7

oops, guess i looked at the wrong value when i was reading along the line. i was going to say my code is exactly the same as yours. weird how it worked fine for my homing missiles plugin, better fix it.

EDIT: changed my plugins to use constant defines where applicable so i don't make the same mistake again.

Last edited by blodia; 01-14-2011 at 17:08.
blodia is offline
zeroibis
Veteran Member
Join Date: Jun 2007
Old 01-16-2011 , 00:26   Re: Entity solid or not solid
Reply With Quote #8

On a simular note what ever happened to the knife constant for css? I have been manually entering in 2 but I know that a long time ago there used to be a constant.
__________________
zeroibis 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 08:04.


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