Exemplo n.º 1
0
        public override void Patch()
        {
            base.Patch();

            ObjectInteraction makeOferring = RogueLibsInteractions.CreateOriginalInteraction("MakeOffering", InteractionType.Button,
                                                                                             (agent, obj) => obj is Altar a && !agent.interactionHelper.interactingFar);

            makeOferring.Action = (_, obj) =>
            {
                Altar altar = (Altar)obj;
                if (altar.offeringsMade >= altar.offeringLimit)
                {
                    altar.gc.audioHandler.Play(altar, "CantDo");
                    return(true);
                }
                altar.interactingAgent.SayDialogue("OfferingMustBeInBuilding");
                altar.commander = altar.interactingAgent;
                altar.interactingAgent.mainGUI.invInterface.ShowTarget(altar, "MakeOffering");
                IEnumerator enumerator = (IEnumerator)AccessTools.Method(typeof(Altar), "MakingOffer").Invoke(altar, new object[0]);
                altar.StartCoroutine(enumerator);
                return(false);
            };
        }