Raised This Month: $ Target: $400
 0% 

Solid flags, takedamage, etc?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
404UserNotFound
BANNED
Join Date: Dec 2011
Old 02-25-2015 , 07:21   Solid flags, takedamage, etc?
Reply With Quote #1

So I'm still working on the TF2 grenade plugins, getting ready to release the Dynamite Pack publicly (foregoing my original plan of finishing all the various grenades and releasing one big plugin), but I've got questions regarding some prop related things. I'm once again peering at the tf_weaponbase_grenadeproj.cpp file from the 2008 TF2 source code leak, and seeing things I need to set in the code for "accuracy" of the grenades in general;
PHP Code:
// So it will collide with physics props!
SetSolidFlagsFSOLID_NOT_STANDABLE );
SetSolidSOLID_BBOX );    

AddEffectsEF_NOSHADOW );

// Set the movement type.
SetCollisionGroupTF_COLLISIONGROUP_GRENADES );

// Don't collide with players on the owner's team for the first bit of our life
m_flCollideWithTeammatesTime gpGlobals->curtime 0.25;
m_bCollideWithTeammates false;

VPhysicsInitNormalSOLID_BBOX0false );

m_takedamage DAMAGE_EVENTS_ONLY
What's the SourcePawn equivalent of any of the above?

As well, the orange box trailer shows the resulting Dynamite Sticks emanating from the explosion site of the pack, but they all seem to emanate standing up vertically. Here's the bomblet spawning code from the source code. What part of it controls the vertical emanation? Currently, they spawn when the initial explosion takes place, and the explosion seems to shoot them wildly in many directions (which is quite annoying). I do use the vecVelocity bit in my plugin currently, but I can't tell if they spawn vertically due to the env_explosion tossing them about wildly.

PHP Code:
// Create the bomblets.
for ( int iBomb 0iBomb TF_WEAPON_GRENADE_MIRV_BOMB_COUNT; ++iBomb )
{
    
Vector vecSrc pTrace->endpos Vector001.0f ); 
    
Vector vecVelocityrandom->RandomFloat( -75.0f75.0f ) * 3.0f,
                        
random->RandomFloat( -75.0f75.0f ) * 3.0f,
                        
random->RandomFloat30.0f70.0f ) * 5.0f );
    
Vector vecZero0,0,);
    
CTFPlayer *pPlayer ToTFPlayerGetThrower() );
    
float flTime 2.0f random->RandomFloat0.0f1.0f );

    
CTFGrenadeMirvBomb::CreatevecSrcGetAbsAngles(), vecVelocityvecZeropPlayerflTime );

Finally, I've got a side question. Right now, I'm using a thrown prop_physics_override for the dynamite pack and resulting sticks. I believe the source code utilizes prop_physics_multiplayer, but I'm not sure if that makes any difference.

Last edited by 404UserNotFound; 02-25-2015 at 07:23.
404UserNotFound is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 02-25-2015 , 09:18   Re: Solid flags, takedamage, etc?
Reply With Quote #2

PHP Code:
/*
    m_collisiongroup

    * Generally I only see the following get used for TF2
    1  = No collide with anything but the world itself. Prevents map trigger_ entities from firing Touch outputs.
    2  = No collide with players, certain projectiles, airblast, - But bullets/hitscan still collide
    5  = Normal
    10 = No collide with players, certain projectiles, airblast, bullets. Does not prevent map trigger_ outputs.
*/
enum
{
    
CollisionGroup_None 0,
    
CollisionGroup_Debris,                 //  Collides with nothing but world and static stuff
    
CollisionGroup_Debris_Trigger,         //  Same as debris, but hits triggers
    
CollisionGroup_Interactive_Debris,     //  Collides with everything except other interactive debris or debris
    
CollisionGroup_Interactive,            //  Collides with everything except interactive debris or debris
    
CollisionGroup_Player,                 //  5 = TF2's default for most entities, not just players
    
CollisionGroup_Breakable_Glass,
    
CollisionGroup_Vehicle,
    
CollisionGroup_Player_Movement,        //  For HL2, same as CollisionGroup_Player
                                        
    
CollisionGroup_NPC,                    //  Generic NPC group
    
CollisionGroup_In_Vehicle,             //  for any entity inside a vehicle
    
CollisionGroup_Weapon,                 //  for any weapons that need collision detection
    
CollisionGroup_Vehicle_Clip,           //  vehicle clip brush to restrict vehicle movement
    
CollisionGroup_Projectile,             //  Projectiles!
    
CollisionGroup_Door_Blocker,           //  Blocks entities not permitted to get near moving doors
    
CollisionGroup_Passable_Door,          //  Doors that the player shouldn't collide with
    
CollisionGroup_Dissolving,             //  Things that are dissolving are in this group
    
CollisionGroup_Pushaway,               //  Nonsolid on client and server, pushaway in player code

    
CollisionGroup_NPC_Actor               //  Used so NPCs in scripts ignore the player.

SMLIB has all of the entity solidity stuff.

Code:
// Don't collide with players on the owner's team for the first bit of our life
m_flCollideWithTeammatesTime = gpGlobals->curtime + 0.25;
m_bCollideWithTeammates = false;
For this, probably hook StartTouch / Touch on the entity. Then you could just use something like this

https://forums.alliedmods.net/showthread.php?t=257587

But you might want to make a third enum for something like 8 grenades per 32 players.
__________________
Chdata 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 06:20.


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