Exemple #1
0
        public SetUpCamp(ModContentPack content) : base(content)
        {
            settings = GetSettings <SetUpCampSettings>();
            var           harmony = new Harmony("Syrchalis.Rimworld.SetUpCamp");
            MethodInfo    method  = typeof(Caravan).GetMethod("GetGizmos");
            HarmonyMethod prefix  = null;
            HarmonyMethod postfix = new HarmonyMethod(typeof(SetUpCamp).GetMethod("GetGizmosPostfix"));;

            harmony.Patch(method, prefix, postfix, null);
#if DEBUG
            Log.Message("[SetUpCamp] loaded...");
#endif
        }
Exemple #2
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            SetUpCampSettings settings = LoadedModManager.GetMod <SetUpCamp>().GetSettings <SetUpCampSettings>();

            foreach (Gizmo g in base.GetGizmos())
            {
                yield return(g);

                g.disabledReason = null;
            }
            bool showDestroyButton = HasMap && SetUpCampSettings.permanentCamps;

            if (showDestroyButton)
            {
                yield return(new Command_Action
                {
                    defaultLabel = "SetUpCampDestroyCamp".Translate(),
                    defaultDesc = "SetUpCampDestroyCampDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/DeleteCamp", true),
                    action = delegate()
                    {
                        bool pawnblock = Map.mapPawns.AnyPawnBlockingMapRemoval;
                        if (!pawnblock)
                        {
                            Find.WindowStack.Add(new Dialog_MessageBox("SetUpCampAbandonDialogue".Translate(),
                                                                       "AcceptButton".Translate(), delegate()
                            {
                                Messages.Message("SetUpCampAbandoned".Translate(), MessageTypeDefOf.TaskCompletion);
                                shouldBeDeleted = true;
                                Tick();
                            },
                                                                       "CancelButton".Translate(), null, null, false, null, null));
                        }
                        else
                        {
                            Messages.Message("SetUpCampStillInUse".Translate(), MessageTypeDefOf.RejectInput);
                            shouldBeDeleted = false;
                        }
                    }
                });
            }
            yield break;
        }
Exemple #3
0
 public SetUpCamp(ModContentPack content) : base(content)
 {
     settings = GetSettings <SetUpCampSettings>();
 }