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

Ham_Touch func_door_rotating


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 03-02-2013 , 05:22   Ham_Touch func_door_rotating
Reply With Quote #1

my goal is to stop players being able to block func_door_rotating opening/closing, but Ham_Touch only triggers when the door is fully open/closed, how would i detect players blocking the door opening/closing?
jimaway is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 03-02-2013 , 07:00   Re: Ham_Touch func_door_rotating
Reply With Quote #2

Ham_Use?
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 03-02-2013 , 09:59   Re: Ham_Touch func_door_rotating
Reply With Quote #3

how would i detect if player is blocking door opening with that?
jimaway is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-02-2013 , 11:57   Re: Ham_Touch func_door_rotating
Reply With Quote #4

Ham_Blocked is sent but it's already too late i think, the code you would need to access belongs to the engine, so you need module such as orpheu or rage and a lot or research.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 03-02-2013 , 12:00   Re: Ham_Touch func_door_rotating
Reply With Quote #5

Quote:
Originally Posted by jimaway View Post
how would i detect if player is blocking door opening with that?
Sorry, I misunderstood your question in the first post.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.

Last edited by bibu; 03-02-2013 at 12:00.
bibu is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 03-03-2013 , 13:28   Re: Ham_Touch func_door_rotating
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
Ham_Blocked is sent but it's already too late i think, the code you would need to access belongs to the engine, so you need module such as orpheu or rage and a lot or research.
just tested this, its actually not too late, the door wont close immediately when i return HAM_SUPERCEDE in the Ham_Block hook, but instead it gets stuck in "opening" state when the player is in the way. i tried calling Ham_Touch with the door in Ham_Block before superceding but it didn't seem to work, then i tried to call Ham_CS_Roundrespawn there to move the player out of the way, but that didn't work neighter.
i also tried setting players z origin little bit higher (so the player is in air and the door will just push him out of the way) with no luck.

any ideas?

Last edited by jimaway; 03-03-2013 at 13:29.
jimaway is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-03-2013 , 14:44   Re: Ham_Touch func_door_rotating
Reply With Quote #7

Set pev_dmg on all doors, once at plugin_init, and players gonna die.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-04-2013 , 06:27   Re: Ham_Touch func_door_rotating
Reply With Quote #8

When exactly do door damage the player with pev_dmg? When the door are stuck because of player blocking them?
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-04-2013 , 07:39   Re: Ham_Touch func_door_rotating
Reply With Quote #9

Yes.

Code:
void CBaseDoor::Blocked( CBaseEntity *pOther )
{
	edict_t	*pentTarget = NULL;
	CBaseDoor	*pDoor		= NULL;


	// Hurt the blocker a little.
	if ( pev->dmg )
		pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH );

	// if a door has a negative wait, it would never come back if blocked,
	// so let it just squash the object to death real fast

	if (m_flWait >= 0)
	{
		if (m_toggle_state == TS_GOING_DOWN)
		{
			DoorGoUp();
		}
		else
		{
			DoorGoDown();
		}
	}

	// Block all door pieces with the same targetname here.
	if ( !FStringNull ( pev->targetname ) )
	{
		for (;;)
		{
			pentTarget = FIND_ENTITY_BY_TARGETNAME(pentTarget, STRING(pev->targetname));

			if ( VARS( pentTarget ) != pev )
			{
				if (FNullEnt(pentTarget))
					break;

				if ( FClassnameIs ( pentTarget, "func_door" ) || FClassnameIs ( pentTarget, "func_door_rotating" ) )
				{
				
					pDoor = GetClassPtr( (CBaseDoor *) VARS(pentTarget) );

					if ( pDoor->m_flWait >= 0)
					{
						if (pDoor->pev->velocity == pev->velocity && pDoor->pev->avelocity == pev->velocity)
						{
							// this is the most hacked, evil, bastardized thing I've ever seen. kjb
							if ( FClassnameIs ( pentTarget, "func_door" ) )
							{// set origin to realign normal doors
								pDoor->pev->origin = pev->origin;
								pDoor->pev->velocity = g_vecZero;// stop!
							}
							else
							{// set angles to realign rotating doors
								pDoor->pev->angles = pev->angles;
								pDoor->pev->avelocity = g_vecZero;
							}
						}

						if ( pDoor->m_toggle_state == TS_GOING_DOWN)
							pDoor->DoorGoUp();
						else
							pDoor->DoorGoDown();
					}
				}
			}
		}
	}
}
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 03-04-2013 , 12:12   Re: Ham_Touch func_door_rotating
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
Set pev_dmg on all doors, once at plugin_init, and players gonna die.
but the player will still block the door opening/closing

PHP Code:
    if ( pev->dmg )
        
pOther->TakeDamagepevpevpev->dmgDMG_CRUSH );

    
// if a door has a negative wait, it would never come back if blocked,
    // so let it just squash the object to death real fast

    
if (m_flWait >= 0)
    {
        if (
m_toggle_state == TS_GOING_DOWN)
        {
            
DoorGoUp();
        }
        else
        {
            
DoorGoDown();
        }
    } 
and im still wondering why respawning player, changing players z origin and calling Ham_Touch in Ham_Blocked didnt work

edit: works with a 0.1 sec task

Last edited by jimaway; 03-04-2013 at 12:32.
jimaway 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 09:31.


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