protected override Job TryGiveJob(Pawn guest)
        {
            var guestComp = guest.CompGuest();

            if (guestComp == null)
            {
                return(null);
            }
            if (guestComp.HasBed)
            {
                return(null);
            }

            // Wait longer if we have more money, but do it as soon as otherwise possible
            if (GenTicks.TicksGame < guestComp.lastBedCheckTick + ItemUtility.GetMoney(guest) * 4)
            {
                return(null);
            }

            guestComp.lastBedCheckTick = GenTicks.TicksGame + 500; // Recheck ever x ticks

            var bed = guest.FindBedFor();

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

            return(new Job(BedUtility.jobDefClaimGuestBed, bed)
            {
                takeExtraIngestibles = bed.rentalFee
            });                                                                                         // Store rentalFee to avoid cheating
        }
Пример #2
0
        public override float GetChance(Pawn pawn)
        {
            if (!pawn.IsArrivedGuest())
            {
                return(0);
            }
            if (!pawn.MayBuy())
            {
                return(0);
            }
            var money = ItemUtility.GetMoney(pawn);

            //Log.Message(pawn.NameStringShort + " has " + money + " silver left.");

            return(Mathf.InverseLerp(0, 25, money) * base.GetChance(pawn));
        }