ACR_CreatureBehavior.CreatureObject.OnPerceptionSeenObject C# (CSharp) Method

OnPerceptionSeenObject() private method

Called when an object first sees an object.
private OnPerceptionSeenObject ( uint PerceivedObjectId, bool InitialDetection ) : void
PerceivedObjectId uint Supplies the perceived object id. ///
InitialDetection bool True if this is the first detection /// event for the perceived object since it last became undetected. ///
return void
        private void OnPerceptionSeenObject(uint PerceivedObjectId,
            bool InitialDetection)
        {
            if (Script.GetObjectType(PerceivedObjectId) != CLRScriptBase.OBJECT_TYPE_CREATURE) return;
            CreatureObject SeenObject = Server.ObjectManager.GetCreatureObject(PerceivedObjectId, true);
            
//===== If we just started seeing this person again, we need to process memberships. ====//
            if (InitialDetection)
            {
                int nReputation = Script.GetReputation(this.ObjectId, PerceivedObjectId);
                if (nReputation < 11 && nReputation > -1)
                {
                    if (Party.EnemiesLost.Contains(SeenObject))
                        Party.EnemiesLost.Remove(SeenObject);
                    Party.AddPartyEnemy(SeenObject);
                    HasCombatRoundProcess = true;
                    if (!UsingEndCombatRound)
                    {
                        Script.DelayCommand(3.0f, delegate() { SelectCombatRoundAction(false); });
                    }
                }
                else if (Script.GetFactionEqual(this.ObjectId, PerceivedObjectId) == CLRScriptBase.TRUE)
                {
                    // Might as well try to recover if we've messed up party memberships.
                    if (SeenObject.Party == null && Script.GetIsPC(SeenObject.ObjectId) == CLRScriptBase.FALSE)
                    {
                        if (Party == null) OnSpawn();
                        Party.AddPartyMember(SeenObject);
                    }
                }
            }
            else
            {
                if (!HasCombatRoundProcess)
                {
                    HasCombatRoundProcess = true;
                    Script.DelayCommand(3.0f, delegate() { SelectCombatRoundAction(false); });
                }
            }
        }