public override float VoluntaryJoinPriorityFor(Pawn p)
 {
     if (IsFiance(p))
     {
         if (!MarriageCeremonyUtility.FianceCanContinueCeremony(p, (p == firstPawn) ? secondPawn : firstPawn))
         {
             return(0f);
         }
         return(VoluntarilyJoinableLordJobJoinPriorities.MarriageCeremonyFiance);
     }
     if (IsGuest(p))
     {
         if (!MarriageCeremonyUtility.ShouldGuestKeepAttendingCeremony(p))
         {
             return(0f);
         }
         if (!lord.ownedPawns.Contains(p))
         {
             if (IsCeremonyAboutToEnd())
             {
                 return(0f);
             }
             LordToil_MarriageCeremony lordToil_MarriageCeremony = lord.CurLordToil as LordToil_MarriageCeremony;
             if (lordToil_MarriageCeremony != null && !SpectatorCellFinder.TryFindSpectatorCellFor(p, lordToil_MarriageCeremony.Data.spectateRect, base.Map, out IntVec3 _, lordToil_MarriageCeremony.Data.spectateRectAllowedSides))
             {
                 return(0f);
             }
         }
         return(VoluntarilyJoinableLordJobJoinPriorities.MarriageCeremonyGuest);
     }
     return(0f);
 }
Ejemplo n.º 2
0
 public override float VoluntaryJoinPriorityFor(Pawn p)
 {
     if (this.IsFiance(p))
     {
         if (!MarriageCeremonyUtility.FianceCanContinueCeremony(p))
         {
             return(0f);
         }
         return(VoluntarilyJoinableLordJobJoinPriorities.MarriageCeremonyFiance);
     }
     if (this.IsGuest(p))
     {
         if (!MarriageCeremonyUtility.ShouldGuestKeepAttendingCeremony(p))
         {
             return(0f);
         }
         if (!base.lord.ownedPawns.Contains(p))
         {
             if (this.IsCeremonyAboutToEnd())
             {
                 return(0f);
             }
             LordToil_MarriageCeremony lordToil_MarriageCeremony = base.lord.CurLordToil as LordToil_MarriageCeremony;
             IntVec3 intVec = default(IntVec3);
             if (lordToil_MarriageCeremony != null && !SpectatorCellFinder.TryFindSpectatorCellFor(p, lordToil_MarriageCeremony.Data.spectateRect, base.Map, out intVec, lordToil_MarriageCeremony.Data.spectateRectAllowedSides, 1, (List <IntVec3>)null))
             {
                 return(0f);
             }
         }
         return(VoluntarilyJoinableLordJobJoinPriorities.MarriageCeremonyGuest);
     }
     return(0f);
 }
        public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph     = new StateGraph();
            LordToil_Party lordToil_Party = new LordToil_Party(this.spot, 2200);

            stateGraph.AddToil(lordToil_Party);
            LordToil_MarriageCeremony lordToil_MarriageCeremony = new LordToil_MarriageCeremony(this.firstPawn, this.secondPawn, this.spot);

            stateGraph.AddToil(lordToil_MarriageCeremony);
            LordToil_Party lordToil_Party2 = new LordToil_Party(this.spot, 2200);

            stateGraph.AddToil(lordToil_Party2);
            LordToil_End lordToil_End = new LordToil_End();

            stateGraph.AddToil(lordToil_End);
            Transition transition = new Transition(lordToil_Party, lordToil_MarriageCeremony, false, true);

            transition.AddTrigger(new Trigger_TickCondition(() => this.lord.ticksInToil >= 5000 && this.AreFiancesInPartyArea(), 1));
            transition.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyStarts".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, this.firstPawn, null, 1f));
            stateGraph.AddTransition(transition, false);
            Transition transition2 = new Transition(lordToil_MarriageCeremony, lordToil_Party2, false, true);

            transition2.AddTrigger(new Trigger_TickCondition(() => this.firstPawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, this.secondPawn), 1));
            transition2.AddPreAction(new TransitionAction_Message("MessageNewlyMarried".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            transition2.AddPreAction(new TransitionAction_Custom(delegate
            {
                this.AddAttendedWeddingThoughts();
            }));
            stateGraph.AddTransition(transition2, false);
            Transition transition3 = new Transition(lordToil_Party2, lordToil_End, false, true);

            transition3.AddTrigger(new Trigger_TickCondition(() => this.ShouldAfterPartyBeCalledOff(), 1));
            transition3.AddTrigger(new Trigger_PawnKilled());
            transition3.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            stateGraph.AddTransition(transition3, false);
            this.afterPartyTimeoutTrigger = new Trigger_TicksPassed(7500);
            Transition transition4 = new Transition(lordToil_Party2, lordToil_End, false, true);

            transition4.AddTrigger(this.afterPartyTimeoutTrigger);
            transition4.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyAfterPartyFinished".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, this.firstPawn, null, 1f));
            stateGraph.AddTransition(transition4, false);
            Transition transition5 = new Transition(lordToil_MarriageCeremony, lordToil_End, false, true);

            transition5.AddSource(lordToil_Party);
            transition5.AddTrigger(new Trigger_TickCondition(() => this.lord.ticksInToil >= 120000 && (this.firstPawn.Drafted || this.secondPawn.Drafted || !this.firstPawn.Position.InHorDistOf(this.spot, 4f) || !this.secondPawn.Position.InHorDistOf(this.spot, 4f)), 1));
            transition5.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            stateGraph.AddTransition(transition5, false);
            Transition transition6 = new Transition(lordToil_MarriageCeremony, lordToil_End, false, true);

            transition6.AddSource(lordToil_Party);
            transition6.AddTrigger(new Trigger_TickCondition(() => this.ShouldCeremonyBeCalledOff(), 1));
            transition6.AddTrigger(new Trigger_PawnKilled());
            transition6.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            stateGraph.AddTransition(transition6, false);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph     = new StateGraph();
            LordToil_Party lordToil_Party = new LordToil_Party(spot, GatheringDefOf.Party);

            stateGraph.AddToil(lordToil_Party);
            LordToil_MarriageCeremony lordToil_MarriageCeremony = new LordToil_MarriageCeremony(firstPawn, secondPawn, spot);

            stateGraph.AddToil(lordToil_MarriageCeremony);
            LordToil_Party lordToil_Party2 = new LordToil_Party(spot, GatheringDefOf.Party);

            stateGraph.AddToil(lordToil_Party2);
            LordToil_End lordToil_End = new LordToil_End();

            stateGraph.AddToil(lordToil_End);
            Transition transition = new Transition(lordToil_Party, lordToil_MarriageCeremony);

            transition.AddTrigger(new Trigger_TickCondition(() => lord.ticksInToil >= 5000 && AreFiancesInPartyArea()));
            transition.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyStarts".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, firstPawn));
            stateGraph.AddTransition(transition);
            Transition transition2 = new Transition(lordToil_MarriageCeremony, lordToil_Party2);

            transition2.AddTrigger(new Trigger_TickCondition(() => firstPawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, secondPawn)));
            transition2.AddPreAction(new TransitionAction_Message("MessageNewlyMarried".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, new TargetInfo(spot, base.Map)));
            transition2.AddPreAction(new TransitionAction_Custom((Action) delegate
            {
                AddAttendedWeddingThoughts();
            }));
            stateGraph.AddTransition(transition2);
            Transition transition3 = new Transition(lordToil_Party2, lordToil_End);

            transition3.AddTrigger(new Trigger_TickCondition(() => ShouldAfterPartyBeCalledOff()));
            transition3.AddTrigger(new Trigger_PawnKilled());
            stateGraph.AddTransition(transition3);
            afterPartyTimeoutTrigger = new Trigger_TicksPassed(7500);
            Transition transition4 = new Transition(lordToil_Party2, lordToil_End);

            transition4.AddTrigger(afterPartyTimeoutTrigger);
            transition4.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyAfterPartyFinished".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, firstPawn));
            stateGraph.AddTransition(transition4);
            Transition transition5 = new Transition(lordToil_MarriageCeremony, lordToil_End);

            transition5.AddSource(lordToil_Party);
            transition5.AddTrigger(new Trigger_TickCondition(() => lord.ticksInToil >= 120000 && (firstPawn.Drafted || secondPawn.Drafted || !firstPawn.Position.InHorDistOf(spot, 4f) || !secondPawn.Position.InHorDistOf(spot, 4f))));
            transition5.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(spot, base.Map)));
            stateGraph.AddTransition(transition5);
            Transition transition6 = new Transition(lordToil_MarriageCeremony, lordToil_End);

            transition6.AddSource(lordToil_Party);
            transition6.AddTrigger(new Trigger_TickCondition(() => ShouldCeremonyBeCalledOff()));
            transition6.AddTrigger(new Trigger_PawnKilled());
            transition6.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(spot, base.Map)));
            stateGraph.AddTransition(transition6);
            return(stateGraph);
        }