Example #1
0
        protected override IEnumerable<IJob> GetJobs(ILivingObject living)
        {
            foreach (var p in m_area.Range())
            {
                if (m_map[p] == null)
                {
                    var interiorID = m_environment.GetInteriorID(p);

                    if (!interiorID.IsClear())
                    {
                        IJob job;

                        if (interiorID == InteriorID.Tree || interiorID == InteriorID.Sapling)
                        {
                            job = new Dwarrowdelf.Jobs.AssignmentGroups.MoveFellTreeAssignment(this, m_environment, p);
                        }
                        else
                        {
                            throw new NotImplementedException();
                        }

                        AddSubJob(job);
                        m_map[p] = job;
                    }
                }

                if (m_map[p] != null)
                    yield return m_map[p];
            }
        }
Example #2
0
        protected override IEnumerable <IJob> GetJobs(ILivingObject living)
        {
            foreach (var p in m_area.Range())
            {
                if (m_map[p] == null)
                {
                    var td = m_environment.GetTileData(p);

                    if (!td.IsClear)
                    {
                        IJob job;

                        if (td.HasFellableTree)
                        {
                            job = new Dwarrowdelf.Jobs.AssignmentGroups.MoveFellTreeAssignment(this, m_environment, p);
                        }
                        else
                        {
                            throw new NotImplementedException();
                        }

                        AddSubJob(job);
                        m_map[p] = job;
                    }
                }

                if (m_map[p] != null)
                {
                    yield return(m_map[p]);
                }
            }
        }
Example #3
0
 protected override void AssignOverride(ILivingObject worker)
 {
     // start at waypoint closest to the worker
     m_state = m_waypoints
         .Select((p, i) => new Tuple<IntVector3, int>(p, i))
         .OrderBy(t => (t.Item1 - worker.Location).Length).First().Item2;
 }
 protected override void AssignOverride(ILivingObject worker)
 {
     // start at waypoint closest to the worker
     m_state = m_waypoints
               .Select((p, i) => new Tuple <IntVector3, int>(p, i))
               .OrderBy(t => (t.Item1 - worker.Location).Length).First().Item2;
 }
Example #5
0
        JobStatus PreparePath(ILivingObject worker)
        {
            var progress = CheckProgress(worker);

            if (progress != JobStatus.Ok)
            {
                return(progress);
            }

            var path = GetPath(worker);

            if (path == null)
            {
                return(JobStatus.Abort);
            }

            if (path.Count == 0)
            {
                return(JobStatus.Done);
            }

            m_pathDirs         = path;
            m_supposedLocation = worker.Location;

            return(JobStatus.Ok);
        }
 protected override JobStatus CheckProgress(ILivingObject worker)
 {
     if (m_dest.Contains(worker.Location))
         return JobStatus.Done;
     else
         return JobStatus.Ok;
 }
Example #7
0
        IAssignment CreateSleepAssignmentIfNeeded(ILivingObject worker, ActionPriority priority)
        {
            if (priority == ActionPriority.High && worker.Exhaustion < 500)
            {
                return(null);
            }

            if (priority == ActionPriority.Idle && worker.Exhaustion < 100)
            {
                return(null);
            }

            var env = worker.Environment;

            var ob = env.Contents
                     .OfType <IItemObject>()
                     .Where(o => o.ItemID == ItemID.Bed)
                     .Where(o => o.IsReserved == false && o.IsInstalled)
                     .OrderBy(o => (o.Location - worker.Location).ManhattanLength)
                     .Where(o => AStar.CanReach(env, worker.Location, o.Location, DirectionSet.Exact))
                     .FirstOrDefault();

            if (ob != null)
            {
                m_priorityAction = true;
                var job = new MoveSleepAssignment(this, ob);
                ob.ReservedBy = this;
                return(job);
            }

            return(null);
        }
Example #8
0
        protected override IEnumerable<IJob> GetJobs(ILivingObject living)
        {
            foreach (var p in m_area.Range())
            {
                if (m_map[p] == null)
                {
                    var td = m_environment.GetTileData(p);

                    if (!td.IsClear)
                    {
                        IJob job;

                        if (td.HasFellableTree)
                        {
                            job = new Dwarrowdelf.Jobs.AssignmentGroups.MoveFellTreeAssignment(this, m_environment, p);
                        }
                        else
                        {
                            throw new NotImplementedException();
                        }

                        AddSubJob(job);
                        m_map[p] = job;
                    }
                }

                if (m_map[p] != null)
                    yield return m_map[p];
            }
        }
Example #9
0
        JobStatus PreparePath(ILivingObject worker)
        {
            m_dest = m_target.Location;

            if (worker.Location.IsAdjacentTo(m_dest, DirectionSet.Planar))
            {
                m_pathDirs = null;
                return(JobStatus.Done);
            }

            var path = AStar.Find(m_target.Environment, worker.Location, m_dest, DirectionSet.Planar);

            if (path == null)
            {
                return(JobStatus.Abort);
            }

            m_pathDirs = new Queue <Direction>(path);

            if (m_pathDirs.Count == 0)
            {
                return(JobStatus.Done);
            }

            m_supposedLocation = worker.Location;

            return(JobStatus.Ok);
        }
Example #10
0
		IAssignment IJobSource.FindAssignment(ILivingObject _living)
		{
			var living = (LivingObject)_living;

			if (this.CurrentBuildOrder == null)
				return null;

			if (m_currentJob == null)
			{
				var job = CreateJob(this.CurrentBuildOrder);

				if (job == null)
				{
					trace.TraceWarning("XXX failed to create job, removing build order");
					RemoveBuildOrder(this.CurrentBuildOrder);
					return null;
				}

				m_currentJob = job;

				trace.TraceInformation("new build job created");
			}

			foreach (var a in m_currentJob.GetAssignments(living))
			{
				if (a.LaborID == LaborID.None || living.GetLaborEnabled(a.LaborID))
					return m_currentJob.FindAssignment(living);
			}

			return null;
		}
Example #11
0
 public MineActionReport(ILivingObject living, IntVector3 location, Direction direction, MineActionType mineActionType)
     : base(living)
 {
     this.Location       = location;
     this.Direction      = direction;
     this.MineActionType = mineActionType;
 }
Example #12
0
        public IAssignment FindAssignment(ILivingObject living)
        {
            foreach (var job in GetJobs(living))
            {
                var assignment = job as IAssignment;
                if (assignment != null)
                {
                    if (assignment.IsAssigned == false)
                    {
                        return(assignment);
                    }
                }
                else
                {
                    var jobGroup = (IJobGroup)job;
                    assignment = jobGroup.FindAssignment(living);
                    if (assignment != null)
                    {
                        return(assignment);
                    }
                }
            }

            return(null);
        }
Example #13
0
 protected override JobStatus CheckProgress(ILivingObject worker)
 {
     if (worker.Location.IsAdjacentTo(m_dest, this.Positioning))
         return JobStatus.Done;
     else
         return JobStatus.Ok;
 }
Example #14
0
        protected AssignmentAI(ILivingObject worker, byte aiID)
        {
            m_id = aiID;

            this.Worker = worker;
            trace = new MyTraceSource("Dwarrowdelf.AssignmentAI", String.Format("AI {0}", this.Worker));
        }
Example #15
0
        protected AssignmentAI(ILivingObject worker, int playerID)
        {
            Debug.Assert(playerID != 0);

            m_playerID = playerID;

            this.Worker = worker;
            trace       = new MyTraceProxy(this.Worker.Trace, "Dwarrowdelf.AssignmentAI");
        }
Example #16
0
        protected override Queue<Direction> GetPath(ILivingObject worker)
        {
            var path = AStar.Find(m_environment, worker.Location, m_dest, this.Positioning);

            if (path == null)
                return null;

            return new Queue<Direction>(path);
        }
Example #17
0
        protected AssignmentAI(ILivingObject worker, int playerID)
        {
            Debug.Assert(playerID != 0);

            m_playerID = playerID;

            this.Worker = worker;
            trace = new MyTraceProxy(this.Worker.Trace, "Dwarrowdelf.AssignmentAI");
        }
Example #18
0
        protected override IAssignment GetNewOrCurrentAssignment(ActionPriority priority)
        {
            switch (this.State)
            {
            case DwarfState.Working:
            {
                Debug.Assert(m_target == null);

                m_target = AIHelpers.FindNearestEnemy(this.Worker, LivingCategory.Monster);

                if (m_target == null)
                {
                    // continue doing work

                    if (this.CurrentAssignment != null)
                    {
                        return(this.CurrentAssignment);
                    }

                    return(this.JobManager.FindAssignment(this.Worker));
                }

                this.State = DwarfState.Fighting;

                trace.TraceInformation("Found target: {0}", m_target);

                if (this.CurrentAssignment == null || (this.CurrentAssignment is AttackAssignment) == false)
                {
                    trace.TraceInformation("Start attacking: {0}", m_target);

                    var assignment = new AttackAssignment(this, m_target);
                    return(assignment);
                }
                else
                {
                    trace.TraceInformation("Continue attacking: {0}", m_target);
                    return(this.CurrentAssignment);
                }
            }

            case DwarfState.Fighting:
                if (m_target.IsDestructed)
                {
                    return(null);
                }

                Debug.Assert(this.CurrentAssignment != null);

                trace.TraceInformation("Continue attacking: {0}", m_target);

                return(this.CurrentAssignment);

            default:
                throw new Exception();
            }
        }
Example #19
0
        public IAssignment FindAssignment(ILivingObject living)
        {
            foreach (var jobSource in m_jobSources)
            {
                var assignment = jobSource.FindAssignment(living);
                if (assignment != null)
                    return assignment;
            }

            return null;
        }
        public IAssignment FindAssignment(ILivingObject living)
        {
            if (m_jobDataList.Count == 0)
            {
                return(null);
            }

            foreach (var data in m_jobDataList)
            {
                if (data.Job == null)
                {
                    IJob job;

                    switch (data.Mode)
                    {
                    case InstallMode.Install:
                        job = new InstallItemJob(this, data.Item, m_environment, data.Location);
                        break;

                    case InstallMode.Uninstall:
                        job = new MoveInstallItemAssignment(this, data.Item, InstallMode.Uninstall);
                        break;

                    default:
                        throw new Exception();
                    }

                    data.Job = job;
                    m_environment.World.Jobs.Add(job);
                }

                IAssignment assignment;

                if (data.Job is IJobGroup)
                {
                    assignment = ((IJobGroup)data.Job).FindAssignment(living);
                }
                else
                {
                    assignment = (IAssignment)data.Job;
                    if (assignment.IsAssigned)
                    {
                        assignment = null;
                    }
                }

                if (assignment != null)
                {
                    return(assignment);
                }
            }

            return(null);
        }
Example #21
0
        public void Assign(ILivingObject worker)
        {
            Debug.Assert(this.IsAssigned == false);
            Debug.Assert(this.Status == JobStatus.Ok);

            this.Worker = worker;

            AssignOverride(worker);

            Debug.Assert(this.Status == JobStatus.Ok);
        }
Example #22
0
 protected override JobStatus CheckProgress(ILivingObject worker)
 {
     if (worker.Location.IsAdjacentTo(m_dest, this.Positioning))
     {
         return(JobStatus.Done);
     }
     else
     {
         return(JobStatus.Ok);
     }
 }
 protected override JobStatus CheckProgress(ILivingObject worker)
 {
     if (m_dest.Contains(worker.Location))
     {
         return(JobStatus.Done);
     }
     else
     {
         return(JobStatus.Ok);
     }
 }
        protected override Queue<Direction> GetPath(ILivingObject worker)
        {
            var res = AStar.AStarFinder.Find(m_environment, worker.Location, DirectionSet.Exact, new AStar.AStarAreaTarget(m_dest));

            if (res.Status != AStar.AStarStatus.Found)
                return null;

            var path = res.GetPath();

            return new Queue<Direction>(path);
        }
Example #25
0
        protected override Queue <Direction> GetPath(ILivingObject worker)
        {
            var path = AStar.Find(m_environment, worker.Location, m_dest, this.Positioning);

            if (path == null)
            {
                return(null);
            }

            return(new Queue <Direction>(path));
        }
Example #26
0
        IAssignment IJobSource.FindAssignment(ILivingObject living)
        {
            var tick = this.Environment.World.TickNumber;

            var designations = m_map
                               .Where(kvp => kvp.Value.Job == null && kvp.Value.ReachableSimple && kvp.Value.NextReacahbleCheck <= tick)
                               .OrderBy(kvp => (kvp.Key - living.Location).Length);

            foreach (var d in designations)
            {
                var p  = d.Key;
                var dt = d.Value;

                var ds = GetDesignationPositioning(p, dt.Type);

                // XXX we should pass the found path to the job, to avoid re-pathing
                bool canreach = AStar.CanReach(this.Environment, living.Location, p, ds);
                if (!canreach)
                {
                    dt.NextReacahbleCheck = tick + 10;
                    continue;
                }

                IAssignment job;

                switch (dt.Type)
                {
                case DesignationType.Mine:
                case DesignationType.CreateStairs:
                    MineActionType mat = DesignationTypeToMineActionType(dt.Type);

                    job = new Jobs.AssignmentGroups.MoveMineAssignment(this, this.Environment, p, mat);

                    break;

                case DesignationType.FellTree:

                    job = new Jobs.AssignmentGroups.MoveFellTreeAssignment(this, this.Environment, p);
                    break;

                default:
                    throw new Exception();
                }

                this.Environment.World.Jobs.Add(job);
                dt.Job = job;

                return(job);
            }

            return(null);
        }
Example #27
0
        protected override IAssignment GetNewOrCurrentAssignment(ActionPriority priority)
        {
            switch (this.State)
            {
                case DwarfState.Working:
                    {
                        Debug.Assert(m_target == null);

                        m_target = AIHelpers.FindNearestEnemy(this.Worker, LivingCategory.Monster);

                        if (m_target == null)
                        {
                            // continue doing work

                            if (this.CurrentAssignment != null)
                                return this.CurrentAssignment;

                            return this.JobManager.FindAssignment(this.Worker);
                        }

                        this.State = DwarfState.Fighting;

                        trace.TraceInformation("Found target: {0}", m_target);

                        if (this.CurrentAssignment == null || (this.CurrentAssignment is AttackAssignment) == false)
                        {
                            trace.TraceInformation("Start attacking: {0}", m_target);

                            var assignment = new AttackAssignment(this, m_target);
                            return assignment;
                        }
                        else
                        {
                            trace.TraceInformation("Continue attacking: {0}", m_target);
                            return this.CurrentAssignment;
                        }
                    }

                case DwarfState.Fighting:
                    if (m_target.IsDestructed)
                        return null;

                    Debug.Assert(this.CurrentAssignment != null);

                    trace.TraceInformation("Continue attacking: {0}", m_target);

                    return this.CurrentAssignment;

                default:
                    throw new Exception();
            }
        }
        protected override Queue <Direction> GetPath(ILivingObject worker)
        {
            var res = AStar.FindArea(m_environment, worker.Location, DirectionSet.Exact, m_dest);

            if (res.Status != AStarStatus.Found)
            {
                return(null);
            }

            var path = res.GetPath();

            return(new Queue <Direction>(path));
        }
Example #29
0
        public IAssignment FindAssignment(ILivingObject living)
        {
            foreach (var jobSource in m_jobSources)
            {
                var assignment = jobSource.FindAssignment(living);
                if (assignment != null)
                {
                    return(assignment);
                }
            }

            return(null);
        }
Example #30
0
        public IAssignment FindAssignment(ILivingObject living)
        {
            if (m_jobDataList.Count == 0)
                return null;

            foreach (var data in m_jobDataList)
            {
                if (data.Job == null)
                {
                    IJob job;

                    switch (data.Mode)
                    {
                        case InstallMode.Install:
                            job = new InstallItemJob(this, data.Item, m_environment, data.Location);
                            break;

                        case InstallMode.Uninstall:
                            job = new MoveInstallItemAssignment(this, data.Item, InstallMode.Uninstall);
                            break;

                        default:
                            throw new Exception();
                    }

                    data.Job = job;
                    m_environment.World.Jobs.Add(job);
                }

                IAssignment assignment;

                if (data.Job is IJobGroup)
                {
                    assignment = ((IJobGroup)data.Job).FindAssignment(living);
                }
                else
                {
                    assignment = (IAssignment)data.Job;
                    if (assignment.IsAssigned)
                        assignment = null;
                }

                if (assignment != null)
                    return assignment;
            }

            return null;
        }
        public IAssignment FindAssignment(ILivingObject living)
        {
            if (m_jobDataList.Count == 0)
            {
                return(null);
            }

            int tick = m_environment.World.TickNumber;

            foreach (var data in m_jobDataList)
            {
                if (data.Job == null)
                {
                    if (data.NextTick > tick)
                    {
                        continue;
                    }

                    var item = m_environment.ItemTracker.GetReachableItemByDistance(living.Location, data.ItemFilter,
                                                                                    m_unreachables);

                    if (item == null)
                    {
                        Trace.TraceInformation("Failed to find materials");
                        data.NextTick = m_environment.World.TickNumber + 50;
                        continue;
                    }

                    item.ReservedBy = this;
                    data.Item       = item;

                    var job = new ConstructJob(this, data.Mode, new IItemObject[] { data.Item }, m_environment, data.Location);

                    data.Job = job;
                    m_environment.World.Jobs.Add(job);
                }

                var assignment = data.Job.FindAssignment(living);

                if (assignment != null)
                {
                    return(assignment);
                }
            }

            return(null);
        }
Example #32
0
        // return new or current assignment, or null to cancel current assignment, or do nothing is no current assignment
        protected override IAssignment GetNewOrCurrentAssignment(ActionPriority priority)
        {
            if (priority == ActionPriority.Idle)
            {
                return(this.CurrentAssignment);
            }

            if (m_target == null)
            {
                m_target = AIHelpers.FindNearestEnemy(this.Worker, LivingCategory.Civilized);

                if (m_target == null)
                {
                    // continue patrolling
                    if (this.CurrentAssignment == null || (this.CurrentAssignment is RandomMoveAssignment) == false)
                    {
                        trace.TraceInformation("Start random move");
                        return(new RandomMoveAssignment(null));
                    }
                    else
                    {
                        trace.TraceVerbose("Continue patrolling");
                        return(this.CurrentAssignment);
                    }
                }

                trace.TraceInformation("Found target: {0}", m_target);
            }

            Debug.Assert(m_target != null);

            if (this.CurrentAssignment == null || (this.CurrentAssignment is AttackAssignment) == false)
            {
                trace.TraceInformation("Start attacking: {0}", m_target);

                var assignment = new AttackAssignment(this, m_target);
                return(assignment);
            }
            else
            {
                trace.TraceInformation("Continue attacking: {0}", m_target);
                return(this.CurrentAssignment);
            }
        }
Example #33
0
        // return new or current assignment, or null to cancel current assignment, or do nothing is no current assignment
        protected override IAssignment GetNewOrCurrentAssignment(ActionPriority priority)
        {
            if (priority == ActionPriority.Idle)
                return this.CurrentAssignment;

            if (m_target == null)
            {
                m_target = AIHelpers.FindNearestEnemy(this.Worker, LivingCategory.Civilized);

                if (m_target == null)
                {
                    // continue patrolling
                    if (this.CurrentAssignment == null || (this.CurrentAssignment is RandomMoveAssignment) == false)
                    {
                        trace.TraceInformation("Start random move");
                        return new RandomMoveAssignment(null);
                    }
                    else
                    {
                        trace.TraceVerbose("Continue patrolling");
                        return this.CurrentAssignment;
                    }
                }

                trace.TraceInformation("Found target: {0}", m_target);
            }

            Debug.Assert(m_target != null);

            if (this.CurrentAssignment == null || (this.CurrentAssignment is AttackAssignment) == false)
            {
                trace.TraceInformation("Start attacking: {0}", m_target);

                var assignment = new AttackAssignment(this, m_target);
                return assignment;
            }
            else
            {
                trace.TraceInformation("Continue attacking: {0}", m_target);
                return this.CurrentAssignment;
            }
        }
Example #34
0
        public IAssignment FindAssignment(ILivingObject living)
        {
            foreach (var job in GetJobs(living))
            {
                var assignment = job as IAssignment;
                if (assignment != null)
                {
                    if (assignment.IsAssigned == false)
                        return assignment;
                }
                else
                {
                    var jobGroup = (IJobGroup)job;
                    assignment = jobGroup.FindAssignment(living);
                    if (assignment != null)
                        return assignment;
                }
            }

            return null;
        }
Example #35
0
        public IEnumerable <IAssignment> GetAssignments(ILivingObject living)
        {
            foreach (var job in GetJobs(living))
            {
                var assignment = job as IAssignment;
                if (assignment != null)
                {
                    if (assignment.IsAssigned == false)
                    {
                        yield return(assignment);
                    }
                }
                else
                {
                    var jobGroup = (IJobGroup)job;

                    foreach (var a in jobGroup.GetAssignments(living))
                    {
                        yield return(a);
                    }
                }
            }
        }
Example #36
0
        IAssignment IJobSource.FindAssignment(ILivingObject living)
        {
            if (m_itemTracker.IsEnabled == false)
            {
                return(null);
            }

            var ob = m_itemTracker.GetFirst();

            if (ob == null)
            {
                return(null);
            }

            var job = new StoreToStockpileJob(this, this, ob);

            m_jobs.Add(job);

            this.Environment.World.Jobs.Add(job);

            ob.ReservedBy = this;

            return(job);
        }
Example #37
0
 protected LivingReport(ILivingObject living)
 {
     m_living = living;
     this.LivingObjectID = living.ObjectID;
 }
Example #38
0
 public BuildItemActionReport(ILivingObject living, string buildableItemKey)
     : base(living)
 {
     this.BuildableItemKey = buildableItemKey;
 }
Example #39
0
 public AttackActionReport(ILivingObject living, ILivingObject target)
     : base(living)
 {
     this.TargetObjectID = target != null ? target.ObjectID : ObjectID.NullObjectID;
 }
Example #40
0
        public void OnObservableJobStatusChanged(IJob job, JobStatus status)
        {
            trace.TraceInformation("Attack finished: {0} ({1})", m_target, status);

            m_target = null;
        }
Example #41
0
        void SetState(JobStatus status)
        {
            if (this.Status == status)
                return;

            if (status == JobStatus.Ok)
                throw new Exception();

            this.Worker = null;
            this.CurrentAction = null;

            this.Status = status;

            OnStateChanged(status);

            if (this.Parent != null)
                this.Parent.OnObservableJobStatusChanged(this, status);

            if (this.StatusChanged != null)
                StatusChanged(this, status);
            Notify("JobStatus");
        }
Example #42
0
        public void Assign(ILivingObject worker)
        {
            Debug.Assert(this.IsAssigned == false);
            Debug.Assert(this.Status == JobStatus.Ok);

            this.Worker = worker;

            AssignOverride(worker);

            Debug.Assert(this.Status == JobStatus.Ok);
        }
Example #43
0
        protected void SetStatus(JobStatus status)
        {
            if (this.Status == status)
                return;

            D("SetState({0})", status);

            if (status == JobStatus.Ok)
                throw new Exception();

            if (this.Status != JobStatus.Ok)
                throw new Exception();

            this.Status = status;

            this.Worker = null;
            this.CurrentAssignment = null;

            OnStatusChanged(status);

            if (this.Parent != null)
                this.Parent.OnObservableJobStatusChanged(this, status);

            if (this.StatusChanged != null)
                StatusChanged(this, status);

            Notify("JobStatus");
        }
Example #44
0
 protected ItemActionReport(ILivingObject living, IItemObject item)
     : base(living)
 {
     this.ItemObjectID = item != null ? item.ObjectID : ObjectID.NullObjectID;
 }
Example #45
0
 public InstallItemActionReport(ILivingObject living, IItemObject item, InstallMode mode)
     : base(living, item)
 {
     this.Mode = mode;
 }
Example #46
0
        public IAssignment FindAssignment(ILivingObject living)
        {
            if (m_jobDataList.Count == 0)
                return null;

            int tick = m_environment.World.TickNumber;

            foreach (var data in m_jobDataList)
            {
                if (data.Job == null)
                {
                    if (data.NextTick > tick)
                        continue;

                    var item = m_environment.ItemTracker.GetReachableItemByDistance(living.Location, data.ItemFilter,
                        m_unreachables);

                    if (item == null)
                    {
                        Trace.TraceInformation("Failed to find materials");
                        data.NextTick = m_environment.World.TickNumber + 50;
                        continue;
                    }

                    item.ReservedBy = this;
                    data.Item = item;

                    var job = new ConstructJob(this, data.Mode, new IItemObject[] { data.Item }, m_environment, data.Location);

                    data.Job = job;
                    m_environment.World.Jobs.Add(job);
                }

                var assignment = data.Job.FindAssignment(living);

                if (assignment != null)
                    return assignment;
            }

            return null;
        }
Example #47
0
 public AttackAction(ILivingObject target)
 {
     this.Target = target.ObjectID;
 }
Example #48
0
 public static IEnumerable <ILivingObject> FindEnemies(ILivingObject living, LivingCategory categories)
 {
     return(FindEnemies(living.Environment, living.Location, living.VisionRange, categories));
 }
Example #49
0
        IAssignment IJobSource.FindAssignment(ILivingObject living)
        {
            if (m_itemTracker.IsEnabled == false)
                return null;

            var ob = m_itemTracker.GetFirst();

            if (ob == null)
                return null;

            var job = new StoreToStockpileJob(this, this, ob);

            m_jobs.Add(job);

            this.Environment.World.Jobs.Add(job);

            ob.ReservedBy = this;

            return job;
        }
Example #50
0
 public MineActionReport(ILivingObject living, IntPoint3 location, Direction direction, MineActionType mineActionType)
     : base(living)
 {
     this.Location = location;
     this.Direction = direction;
     this.MineActionType = mineActionType;
 }
Example #51
0
 protected virtual void AssignOverride(ILivingObject worker)
 {
 }
Example #52
0
 public MoveActionReport(ILivingObject living, Direction direction)
     : base(living)
 {
     this.Direction = direction;
 }
Example #53
0
 protected virtual void AssignOverride(ILivingObject worker)
 {
 }
Example #54
0
 public SleepActionReport(ILivingObject living)
     : base(living)
 {
 }
Example #55
0
 protected abstract JobStatus CheckProgress(ILivingObject worker);
Example #56
0
 public UnequipItemActionReport(ILivingObject living, IItemObject item)
     : base(living, item)
 {
 }
 public override void DoHit(ILivingObject par) {}
Example #58
0
        protected override void AssignOverride(ILivingObject worker)
        {
            int i = worker.World.Random.Next(8);

            m_dir = DirectionExtensions.PlanarDirections[i];
        }
Example #59
0
 public static ILivingObject FindNearestEnemy(ILivingObject living, LivingCategory categories)
 {
     return(FindNearestEnemy(living.Environment, living.Location, living.VisionRange, categories));
 }
Example #60
0
 public MonsterAI(ILivingObject ob, int playerID)
     : base(ob, playerID)
 {
 }