Example #1
0
 public void HandleControllerCollision(Collider other)
 {
     if (WorldItems.GetIOIFromCollider(other, out mIoiCheck) && mIoiCheck.IOIType == ItemOfInterestType.WorldItem)
     {
         if (mIoiCheck.HasAtLeastOne(ObstructionTypes))
         {
             LastItemsEncountered.Add(mIoiCheck.worlditem);
         }
         //always send OnPlayerCollide regardless of whether it's an obstruction
         //this is used by creatures and plants etc.
         mIoiCheck.worlditem.OnPlayerCollide.SafeInvoke();
     }
 }
Example #2
0
        public override bool CanBePlacedOn(IItemOfInterest targetObject, Vector3 point, Vector3 normal, ref string errorMessage)
        {
            bool isPermitted = true;

            if (PermittedTargetScripts.Count > 0)
            {
                isPermitted &= targetObject.HasAtLeastOne(PermittedTargetScripts);
            }
            return(isPermitted);
        }
Example #3
0
 public void OnIntersectItemOfInterest()
 {
     while (SkillSphere.ItemsOfInterest.Count > 0)
     {
         IItemOfInterest ioi = SkillSphere.ItemsOfInterest.Dequeue();
         if (ioi.IOIType == ItemOfInterestType.WorldItem && ioi.HasAtLeastOne(WaterSourceTypes))
         {
             AvailableWaterSources.SafeAdd(ioi);
         }
     }
 }
Example #4
0
        public void OnIntersectItemOfInterest()
        {
            if (!IsInUse)
            {
                return;
            }

            if (!string.IsNullOrEmpty(Extensions.AddComponentOnUse))
            {
                while (SkillSphere.ItemsOfInterest.Count > 0)
                {
                    IItemOfInterest ioi = SkillSphere.ItemsOfInterest.Dequeue();
                    //see if this is what we want
                    if (ioi != null)
                    {
                        if (!(Extensions.IgnoreCaster && ioi.IOIType == ItemOfInterestType.Player && ioi.player == Player.Local))
                        {
                            if (Flags.Check((uint)ioi.IOIType, (uint)Usage.TargetItemsOfInterest, Flags.CheckType.MatchAny) && ioi.HasAtLeastOne(Usage.TargetWIScriptNames))
                            {
                                OnIntersectTarget(ioi);
                            }
                        }
                    }
                }
            }
        }
Example #5
0
        public void OnCollectiveThoughtStart()
        {
            IItemOfInterest ioi = creature.CurrentThought.CurrentItemOfInterest;

            if (ioi == mMeteorToGather || ioi == mLuminiteToGather || ioi == mThingToInvestigate)
            {
                return;
            }

            switch (BehaviorState)
            {
            case OrbBehaviorState.Burrowing:
            case OrbBehaviorState.Despawning:
            case OrbBehaviorState.Unpowered:
            case OrbBehaviorState.EatingLuminite:
            case OrbBehaviorState.EatingMeteor:
            default:
                return;

            case OrbBehaviorState.ConsideringOptions:
            case OrbBehaviorState.Awakening:
                if (ioi.IOIType == ItemOfInterestType.Player || ioi != null && ioi.HasAtLeastOne(ThingsOrbsFindInteresting))
                {
                    ThingToInvestigate = ioi;
                }
                break;

            case OrbBehaviorState.SeekingLuminite:
            case OrbBehaviorState.SeekingMeteor:
                if (ioi.IOIType == ItemOfInterestType.Player || ioi != null && ioi.HasAtLeastOne(ThingsOrbsFindInteresting))
                {
                    //stop and consider the thing for a moment against our other options
                    ThingToInvestigate = ioi;
                }
                BehaviorState = OrbBehaviorState.ConsideringOptions;
                break;
            }

            //see what we're doing
            if (worlditem.Is <Hostile> (out hostile))
            {
                return;
            }

            //ignore it by default
            creature.CurrentThought.Should(IOIReaction.IgnoreIt);
            if (ioi == damageable.LastDamageSource)
            {
                //always attack a threat
                creature.CurrentThought.Should(IOIReaction.KillIt, 3);
                OrbSpeak(OrbSpeakUnit.TargetIsHostileEngagingTarget, worlditem.tr);
                return;
            }
            else
            {
                //see if it's something we care about
                if (ioi.Has("Luminite"))
                {
                    Luminite luminite = ioi.worlditem.Get <Luminite> ();
                    //if we're already gathering luminite
                    if (HasLuminiteToGather)
                    {
                        if (mLuminiteToGather == luminite)
                        {
                            //d'oh, already gathering, forget it
                            return;
                        }
                        //go for the closer one
                        if (Vector3.Distance(luminite.worlditem.Position, worlditem.Position) < Vector3.Distance(LuminiteToGather.worlditem.Position, worlditem.Position))
                        {
                            LuminiteToGather = luminite;
                            BehaviorState    = OrbBehaviorState.ConsideringOptions;
                        }
                    }
                    else
                    {
                        LuminiteToGather = luminite;
                        LuminiteToGather.IncomingGatherer = this.worlditem;
                        BehaviorState = OrbBehaviorState.ConsideringOptions;
                    }
                }
                else if (ioi.Has("Meteor"))
                {
                    Meteor meteor = ioi.worlditem.Get <Meteor> ();
                    if (HasMeteorToGather)
                    {
                        if (mMeteorToGather == meteor)
                        {
                            //d'oh, already gathering, forget it
                            return;
                        }
                        //go for the closer one
                        if (Vector3.Distance(meteor.worlditem.Position, worlditem.Position) < Vector3.Distance(MeteorToGather.worlditem.Position, worlditem.Position))
                        {
                            MeteorToGather = meteor;
                            BehaviorState  = OrbBehaviorState.ConsideringOptions;
                        }
                    }
                    else
                    {
                        MeteorToGather = meteor;
                        BehaviorState  = OrbBehaviorState.ConsideringOptions;
                    }
                }
                else
                {
                    //see if it has any of the things we care about
                    if (ioi.IOIType == ItemOfInterestType.Player || ioi.HasAtLeastOne(ThingsOrbsFindInteresting))
                    {
                        ThingToInvestigate = ioi;
                        BehaviorState      = OrbBehaviorState.ConsideringOptions;
                    }
                }
            }
        }