eventloadactor TIMEACTIVATOR
   getactor[THISACTOR].hitag HITAGSAVED
   getactor[THISACTOR].lotag LOTAGSAVED
   getactor[THISACTOR].owner trigger_var
   setactor[THISACTOR].hitag 0
   setactor[THISACTOR].lotag 0
	//state find_rx_tx_cannels
	 cstat 32768
enda

actor TIMEACTIVATOR
getactor[THISACTOR].zvel tr_bits
ifvare tr_bits 0 //одиночное срабатывание
{
	ifvarg active 0
	{
		ifvarvarl COUNTER LOTAGSAVED addvar COUNTER 1
		ifvarvare COUNTER LOTAGSAVED ifvare peractor 0 
		{ state rx_cansetactive ifvare trigger_var 1 setvar peractor 1 else { setvar COUNTER 0 setactorvar[THISACTOR].active 0 } }
	} else setvar COUNTER 0
	
} 
else 
ifvare tr_bits 1 //циклическое срабатывание
{
	ifvarg peractor 1 setvar peractor 0

	ifvarg active 0
	{
		ifvarvarl COUNTER LOTAGSAVED addvar COUNTER 1
		ifvarvare COUNTER LOTAGSAVED { state rx_cansetactive addvar peractor 1 setvar COUNTER 0 }
	} 
	else ifvare active 0
	{
		ifvare peractor 1 
		{ 
			//ifvarg rx_id_numbers 0 
			{  
				getactor[THISACTOR].yvel tx_can 
				ifvarn tx_can 0
				{
					setvar sectorid 0
					whilevarvarn sectorid NUMSECTORS 
					{
						headspritesect spriteid sectorid
						whilevarn spriteid -1 
						{
							//getactor[spriteid].xvel rx_can
							getactorvar[spriteid].se_xvel rx_can
							ifvarvare tx_can rx_can 
							{ 
								getactor[spriteid].picnum picnum
								ifvare picnum TIMEACTIVATOR { setactorvar[spriteid].active 0 setactorvar[spriteid].activatedby THISACTOR } else
								{ getactorvar[spriteid].active tmp addvar tmp 1 setactorvar[spriteid].active tmp setactorvar[spriteid].activatedby THISACTOR }
							}
							nextspritesect spriteid spriteid
						}
						addvar sectorid 1
					}
				}
			}
			setvar peractor 0 
		} else
		{
			//ifvarg rx_id_numbers 0 
			{  
				getactor[THISACTOR].yvel tx_can 
				ifvarn tx_can 0
				{
					setvar sectorid 0
					whilevarvarn sectorid NUMSECTORS 
					{
						headspritesect spriteid sectorid
						whilevarn spriteid -1 
						{
							//getactor[spriteid].xvel rx_can
							getactorvar[spriteid].se_xvel rx_can
							ifvarvare tx_can rx_can 
							{ setactorvar[spriteid].active 0 setactorvar[spriteid].activatedby THISACTOR }
							nextspritesect spriteid spriteid
						}
						addvar sectorid 1
					}
				}
			}
		}
		setvar COUNTER 0
	}
}
else
ifvare tr_bits 2 //Рэндомное срабатывание
{
	ifvare HITAGSAVED 1 setactorvar[THISACTOR].active 1 
	getactorvar[THISACTOR].active active
	ifvarg active 0
	{
		addvar peractor 1
		ifvarg peractor 2 { randvarvar COUNTER LOTAGSAVED setvar peractor 0 }
		ifvare COUNTER 1 { ifvare peractor 1 { state rx_cansetactive } } 
	} 
}
ifvare tr_bits 3 //Срабатывание по требованию
{
	ifvarg active 0
	{
		ifvarvarl COUNTER LOTAGSAVED addvar COUNTER 1
		ifvarvare COUNTER LOTAGSAVED 
		{ 
		state rx_cansetactive 
		setvar COUNTER 0
		}
	}
}
enda