class 1 single_door_keeper : citizen
{
parameter:
	string	SDoorName = "";
	int	close_time = -1;

handler:
	EventHandler CREATED()
	{
		myself.i_ai1 = 0;
	}

	EventHandler MENU_SELECTED(talker,ask,reply,fhtml0)
	{
		if( ask == -35 )
		{
			if( reply == 0 )
			{
				myself::Castle_GateOpenClose2(SDoorName,0);
				if( close_time != -1 && myself.i_ai1 == 0 )
				{
					myself.i_ai1 = 1;
					myself::AddTimerEx(3001,close_time);
				}
			}
			else if( reply == 1 )
			{
				myself::Castle_GateOpenClose2(SDoorName,1);
			}
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id)
	{
		if( timer_id == 3001 )
		{
			myself::Castle_GateOpenClose2(SDoorName,1);
			myself.i_ai1 = 0;
		}
		super;
	}

}
