mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
42 lines
955 B
Plaintext
42 lines
955 B
Plaintext
include library.ai_lib;
|
|
include ai.ai_combat;
|
|
include library.attrib;
|
|
|
|
const string ALERT_VOLUME_NAME = "alertTriggerVolume";
|
|
|
|
trigger OnAttach()
|
|
{
|
|
setAttributeInterested( self, attrib.HERBIVORE );
|
|
setAttributeInterested( self, attrib.CARNIVORE );
|
|
|
|
if ( getConfigSetting("GameServer", "disableAITriggerVolumes") == null )
|
|
createTriggerVolume( ALERT_VOLUME_NAME, ai_lib.aiGetApproachTriggerRange( self ), true );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnTriggerVolumeEntered( string volumeName, obj_id breacher )
|
|
{
|
|
if ( hasObjVar( breacher, "gm") )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( !isMob( breacher) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( ai_lib.isInCombat( self ) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( breacher == self )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( ai_lib.isAiDead(self) || ai_lib.isAiDead( breacher ))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if (!ai_lib.isMonster( breacher ))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
startCombat( self, breacher );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|