Thread: how to tell if a door is not locked

Results 1 to 3 of 3
  1. #1
    SvenCoop Bot AI Developer Cheeseh's Avatar
    Join Date
    Sep 2003
    Location
    holy crap!
    Posts
    209

    how to tell if a door is not locked

    So, IsLockedByMaster doesn't appear to work, so I tried the method below, it seems to work fine for most doors on the auspices map, but the osprey map, doesn't appear to work on the SECURE ACCESS door to AREA 2. Seems to be caused when door is only activated by button and not by master. any ideas??

    this is what I've got so far:

    Code:
    bool UTIL_DoorIsOpen ( CBaseDoor@ door, CBaseEntity@ pActivator )
    {
        string masterName = door.m_sMaster;
    
        CBaseEntity@ pMaster = FIND_ENTITY_BY_TARGETNAME(null,masterName);
    	CBaseEntity@ pButton;
    
        if ( pMaster !is null )
        {
            return pMaster.IsTriggered(pActivator);
        }
    
    	// no master , find button
    	@pButton = FIND_ENTITY_BY_TARGET(null, door.pev.targetname );
    
    	if ( pButton !is null )
    	{
    		CBaseToggle@ pToggle = cast<CBaseToggle@>( pButton );
    
    		// something needed in here???
    
        	@pMaster = FIND_ENTITY_BY_TARGETNAME(null,pToggle.m_sMaster);
    
    		if ( pMaster !is null )
    		{
    			return pMaster.IsTriggered(pActivator);
    		}
    
    		return pButton.IsTriggered(pActivator);
    	}
    
    	// no master / no button
    	return door.IsTriggered(pActivator);
    }
    
    }
    Last edited by Cheeseh; 04-11-2018 at 05:50 PM.
    - Cheeseh :P

    Get SvenCoop's little helpers!

    http://rcbot.bots-united.com RCBot

    http://rcbot2.sourceforge.net RCBot 2 files + sources

  2. #2
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,575

    Re: how to tell if a door is not locked

    If its master is triggered, then the door is not itself locked. Any door with a targetname will require something else to trigger it though (unless the "USE only" flag is set). The entity that triggers the door might be locked by a master, but that's not the case for osprey.

    If the point is to check if you can pass through the door, then another options is to check if it's already open (like in osprey after the button is pressed). To do that you can compare the current position/angle with the open position/angle (m_vecPosition2/m_vecAngle2):
    https://baso88.github.io/SC_AngelScr.../CBaseDoor.htm
    Last edited by w00tguy123; 04-11-2018 at 11:52 PM.
    Love,
    w00tguy

  3. #3
    begadang jangan begadang =_= anggara_nothing's Avatar
    Join Date
    Jan 2016
    Location
    Indonesia
    Posts
    155

    Re: how to tell if a door is not locked

    Also, you can check them with CBaseDoor.GetToggleState() or CBaseDoor.m_toggle_state

    https://baso88.github.io/SC_AngelScr...GGLE_STATE.htm

    TS_AT_TOP => door is open.
    TS_AT_BOTTOM => door is closed.
    TS_GOING_UP => door is about to open. (moving)
    TS_GOING_DOWN => door is about to close. (moving)

    https://github.com/ValveSoftware/hal....cpp#L535-L554

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •