예제 #1
0
        public void LessonTick()
        {
            if (currentState == State.lesson)
            {
                switch (currentLessonState)
                {
                case LessonState.started:
                case LessonState.gathering:
                    if (TeachingUtility.IsActorAvailable(this.teacher))
                    {
                        if (this.teacher.CurJob.def.defName != "TeachLesson")
                        {
                            TeachingUtility.AbortLesson(this, "TeacherUnavailable".Translate());
                            return;
                        }
                    }

                    return;

                case LessonState.finishing:
                    if (!TeachingUtility.IsActorAvailable(this.teacher))
                    {
                        TeachingUtility.AbortLesson(this, "TeacherUnavailable".Translate());
                    }

                    return;

                case LessonState.finished:
                case LessonState.off:
                    currentState = State.notinuse;
                    return;
                }
            }
        }
예제 #2
0
        public void StartLesson(bool forced = false, String skills = "")
        {
            teacher = tempTeacher;


            if (this.Destroyed || !this.Spawned)
            {
                TeachingUtility.AbortLesson(null, "The spot is unavailable.");
                return;
            }
            if (!TeachingUtility.IsActorAvailable(this.teacher))
            {
                TeachingUtility.AbortLesson(this, "TeacherUnavailableNamed".Translate(new object[] { this.teacher.LabelShort }));
                this.teacher = null;
                return;
            }



            //FactionBase factionBase = (FactionBase)this.Map.info.parent;

            //Messages.Message("LessonGathering".Translate(new object[] { factionBase.label, teacher.LabelShort }) + skills, TargetInfo.Invalid, nullSound);

            Settlement factionBase = (Settlement)this.Map.info.parent;

            Messages.Message("LessonGathering".Translate(new object[] { factionBase.Label, teacher.LabelShort }) + skills, TargetInfo.Invalid, MessageTypeDefOf.NeutralEvent);

            ChangeState(State.lesson, LessonState.started);
            //this.currentState = State.started;
            Job job = new Job(DefDatabase <JobDef> .GetNamed("TeachLesson"), this);

            teacher.jobs.jobQueue.EnqueueLast(job);
            teacher.jobs.EndCurrentJob(JobCondition.InterruptForced);
            TeachingUtility.GetLessonGroup(this, Map, forced);
            lastLessonTick = Find.TickManager.TicksGame;
            //  HediffLeader hediff = TeachingUtility.leaderH(teacher);
            //  if (hediff != null) hediff.lastLessonTick = Find.TickManager.TicksGame;
            GameComponent_ColonyLeadership comp = Utility.getCLComp();

            if (comp != null)
            {
                comp.lastLessonTick = Find.TickManager.TicksGame;
            }
        }
예제 #3
0
        public void LessonRareTick()
        {
            if (currentState == State.lesson)
            {
                switch (currentLessonState)
                {
                case LessonState.started:
                case LessonState.gathering:
                case LessonState.teaching:
                    if (!TeachingUtility.IsActorAvailable(this.teacher))
                    {
                        TeachingUtility.AbortLesson(this, "TeacherUnavailable".Translate());
                        return;
                    }
                    if (this.teacher.CurJob.def.defName != "TeachLesson")
                    {
                        TeachingUtility.AbortLesson(this, "TeacherUnavailable".Translate());
                        return;
                    }
                    TeachingUtility.GetLessonGroup(this, Map);

                    return;

                case LessonState.finishing:
                    if (!TeachingUtility.IsActorAvailable(this.teacher))
                    {
                        TeachingUtility.AbortLesson(this, "TeacherUnavailable".Translate());
                        return;
                    }

                    /*if (this.teacher.CurJob.def != CultDefOfs.ReflectOnWorship)
                     *  return;*/
                    TeachingUtility.GetLessonGroup(this, Map);

                    return;

                case LessonState.finished:
                case LessonState.off:
                    currentState = State.notinuse;
                    return;
                }
            }
        }