コード例 #1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            var map = (Map)parms.target;

            if (!GuestUtility.GetAllGuests(map).Where(IsHappyGuest).TryMaxBy(GetScore, out var happiestGuest))
            {
                return(false);
            }

            if (happiestGuest == null)
            {
                return(false);
            }

            var title  = "LetterLabelHappyGuestJoins".Translate(happiestGuest.Named("PAWN")).CapitalizeFirst();
            var letter = (ChoiceLetter_GuestJoinRequest)LetterMaker.MakeLetter(title, "HappyGuestJoins".Translate(happiestGuest.Faction.Name, happiestGuest.Named("PAWN")).AdjustedFor(happiestGuest), def.letterDef);

            letter.title          = title;
            letter.radioMode      = true;
            letter.guest          = happiestGuest;
            letter.lookTargets    = happiestGuest;
            letter.relatedFaction = happiestGuest.Faction;
            Find.LetterStack.ReceiveLetter(letter);
            return(true);
        }
コード例 #2
0
        private void SetAllDefaults(Pawn pawn)
        {
            Map map = SelPawn.MapHeld;

            if (map == null)
            {
                return;
            }

            var mapComp = map.GetMapComponent();

            if (pawn.GetComp <CompGuest>() != null)
            {
                mapComp.SetDefaultEntertain(pawn.GetComp <CompGuest>().entertain);
                mapComp.SetDefaultMakeFriends(pawn.GetComp <CompGuest>().makeFriends);
            }

            mapComp.SetDefaultAreaRestriction(pawn.GetGuestArea());
            mapComp.SetDefaultAreaShopping(pawn.GetShoppingArea());

            var guests = GuestUtility.GetAllGuests(map);

            foreach (var guest in guests)
            {
                var comp = guest.GetComp <CompGuest>();
                if (comp != null)
                {
                    comp.SetEntertain(mapComp.defaultEntertain);
                    comp.SetMakeFriends(mapComp.defaultMakeFriends);
                    comp.SetGuestArea(mapComp.defaultAreaRestriction);
                    comp.SetShoppingArea(mapComp.defaultAreaShopping);
                }
            }
        }
コード例 #3
0
        private void SetAllDefaults(Pawn pawn)
        {
            Map map = SelPawn.MapHeld;

            if (map == null)
            {
                return;
            }

            var mapComp = map.GetMapComponent();

            if (pawn.CompGuest() != null)
            {
                mapComp.defaultEntertain   = pawn.CompGuest().entertain;
                mapComp.defaultMakeFriends = pawn.CompGuest().makeFriends;
            }

            mapComp.defaultAreaRestriction = pawn.GetGuestArea();
            mapComp.defaultAreaShopping    = pawn.GetShoppingArea();

            var guests = GuestUtility.GetAllGuests(map);

            foreach (var guest in guests)
            {
                var comp = guest.CompGuest();
                if (comp != null)
                {
                    comp.entertain    = mapComp.defaultEntertain;
                    comp.makeFriends  = mapComp.defaultMakeFriends;
                    comp.GuestArea    = mapComp.defaultAreaRestriction;
                    comp.ShoppingArea = mapComp.defaultAreaShopping;
                }
            }
        }
コード例 #4
0
        private void SetDefaults(PrisonerInteractionModeDef mode)
        {
            Map map = SelPawn.MapHeld;

            if (map == null)
            {
                return;
            }

            var oldMode = Hospitality_MapComponent.Instance(map).defaultInteractionMode;

            if (oldMode == mode)
            {
                return;
            }

            Hospitality_MapComponent.Instance(map).defaultInteractionMode = mode;

            var guests = GuestUtility.GetAllGuests(map);

            foreach (var guest in guests)
            {
                var comp = guest.GetComp <CompGuest>();
                if (comp == null)
                {
                    continue;
                }
                comp.chat = mode == PrisonerInteractionModeDefOf.Chat;
            }
        }
コード例 #5
0
        private void SetAllDefaults(Pawn pawn)
        {
            Map map = SelPawn.MapHeld;

            if (map == null)
            {
                return;
            }

            var mapComp = Hospitality_MapComponent.Instance(map);

            if (pawn.GetComp <CompGuest>() != null)
            {
                mapComp.defaultInteractionMode = pawn.GetComp <CompGuest>().chat ? PrisonerInteractionModeDefOf.ReduceResistance : PrisonerInteractionModeDefOf.NoInteraction;
            }

            mapComp.defaultAreaRestriction = pawn.GetGuestArea();
            mapComp.defaultAreaShopping    = pawn.GetShoppingArea();

            var guests = GuestUtility.GetAllGuests(map);

            foreach (var guest in guests)
            {
                var comp = guest.GetComp <CompGuest>();
                if (comp != null)
                {
                    comp.chat         = mapComp.defaultInteractionMode == PrisonerInteractionModeDefOf.ReduceResistance;
                    comp.GuestArea    = mapComp.defaultAreaRestriction;
                    comp.ShoppingArea = mapComp.defaultAreaShopping;
                }
            }
        }
コード例 #6
0
        protected override bool CanFireNowSub(IncidentParms parms)
        {
            if (!base.CanFireNowSub(parms))
            {
                return(false);
            }

            Map map = (Map)parms.target;

            return(GuestUtility.GetAllGuests(map).Any(IsHappyGuest));
        }
コード例 #7
0
        private void SetAllDefaults(Pawn pawn)
        {
            Map map = SelPawn.MapHeld;

            if (map == null)
            {
                return;
            }

            var mapComp = Hospitality_MapComponent.Instance(map);

            if (pawn.GetComp <CompGuest>() != null)
            {
                mapComp.defaultInteractionMode = pawn.GetComp <CompGuest>().chat
                ? PrisonerInteractionModeDefOf.Chat
                : PrisonerInteractionModeDefOf.NoInteraction;

                mapComp.defaultMayBuy = pawn.GetComp <CompGuest>().mayBuy;
            }

            if (pawn.playerSettings != null)
            {
                mapComp.defaultAreaRestriction = pawn.GetComp <CompGuest>().GuestArea;
            }

            var guests = GuestUtility.GetAllGuests(map);

            foreach (var guest in guests)
            {
                var comp = guest.GetComp <CompGuest>();
                if (comp != null)
                {
                    comp.chat      = mapComp.defaultInteractionMode == PrisonerInteractionModeDefOf.Chat;
                    comp.GuestArea = mapComp.defaultAreaRestriction;
                    comp.mayBuy    = mapComp.defaultMayBuy;
                }
            }
        }