Пример #1
0
        public void DetermineTarget(ZombieAvatar pm, object target)
        {
            IEntity targetedEntity = target as IEntity;

            if (targetedEntity is CacheChest)
            {
                pm.SendMessage(54, "Where do you wish to bury this cache chest?");
                pm.Target = new GenericSelectTarget <object>((m, t) => DetermineBuryLocation(pm, t, targetedEntity), m => { }, -1, true, TargetFlags.None);
                return;
            }
            if (target is LandTarget)
            {
                var tile = ((LandTarget)target);
                if (!Mining.m_MountainAndCaveTiles.Contains(tile.TileID))
                {
                    pm.PlaySound(Utility.RandomList(0x126));
                    pm.Animate(11, 5, 1, true, false, 0);
                    pm.PublicOverheadMessage(MessageType.Label, pm.SpeechHue, true, "*Begins to dig*");
                    var list = tile.Location.GetEntitiesInRange(Map.ZombieLand, 3);
                    if (list.Exists(x => x is CacheChest && ((CacheChest)x).Buried))
                    {
                        pm.SendMessage(54, "You have found a cache!");
                        var chest = list.First(x => x is CacheChest) as CacheChest;
                        if (chest != null)
                        {
                            DigTimer = new InternalDigTimer(chest, pm);
                            DigTimer.Start();
                            pm.Frozen = true;
                        }
                        return;
                    }
                    pm.SendMessage(54, "There is nothing of note in this location.");
                }
                else
                {
                    if (!HarvestSystem.CheckHarvest(pm, this))
                    {
                        return;
                    }

                    DoHarvest(pm, target);
                }
            }
        }