Example #1
0
        public static bool IsAndroid(Pawn pawn)
        {
            if (!Active)
            {
                return(false);
            }

            FleshTypeDef fleshType = pawn.RaceProps.FleshType;

            return(fleshType.defName.Equals(AndroidFlesh.defName) || fleshType.defName.Equals(MechFlesh.defName));
        }
            public static void Listener(ThingDef t, ref bool __result, FleshTypeDef ___fleshType, float ___gestationPeriodDays)
            {
                if (Utils.insideAddHumanlikeOrders && Settings.androidsCanConsumeLivingPlants && Settings.hideMenuAllowingForceEatingLivingPlants)
                    if (___fleshType != null && t != null && ___fleshType.defName == "Android" && t.plant != null)
                        __result = false;

                if (Settings.allowHumanDrugsForAndroids)
                    return;

                if (___fleshType != null && t != null && ___fleshType.defName == "Android" && Utils.BlacklistAndroidFood.Contains(t.defName) &&
                    !(Settings.allowHumanDrugsForT3PlusAndroids && ___gestationPeriodDays == 2)) __result = false;
            }
Example #3
0
        static Androids()
        {
            if (ModLister.GetActiveModWithIdentifier("atlas.androidtiers") == null)
            {
                return;
            }

            AndroidSurgery = AccessTools.TypeByName("MOARANDROIDS.Recipe_SurgeryAndroids");
            AndroidFlesh   = DefDatabase <FleshTypeDef> .GetNamedSilentFail("Android");

            MechFlesh = DefDatabase <FleshTypeDef> .GetNamedSilentFail("MechanisedInfantry");

            Active = AndroidSurgery != null;
        }
Example #4
0
        public static void PatchAndroids(Harmony harmony)
        {
            //patch the drawOverviewTab, so we can pass info about the current pawn displayed to the medicalcaresetter
            harmony.Patch(typeof(HealthCardUtility).GetMethod("DrawOverviewTab", BindingFlags.NonPublic | BindingFlags.Static), new HarmonyMethod(typeof(DrawOverviewTab).GetMethod("_Prefix")), new HarmonyMethod(typeof(DrawOverviewTab).GetMethod("_Postfix")));

            //unpatch the medical care select button, we'll take over that for andoirdtiers

            /*var androidMedCareSelectPatch = AccessTools.Inner(AccessTools.TypeByName("MOARANDROIDS.MedicalCareUtility_Patch"), "MedicalCareSelectButton_Patch").GetMethod("Listener", BindingFlags.Static);
             * harmony.Unpatch(typeof(MedicalCareUtility).GetMethod("MedicalCareSelectButton"),androidMedCareSelectPatch);
             */
            harmony.Unpatch(typeof(MedicalCareUtility).GetMethod("MedicalCareSelectButton"), HarmonyPatchType.Prefix, "rimworld.rwmods.androidtiers");

            //get android flesh type
            AndroidFlesh = (FleshTypeDef)GenDefDatabase.GetDef(typeof(FleshTypeDef), "AndroidTier", true);

            //create android-only med list and store
            androidMedList = new List <ModMedicine>();
            humanMedList   = new List <ModMedicine>();

            for (int i = 0; i < medList.Count; i++)
            {
                //always add no care and no medicine
                if (i == 0)
                {
                    androidMedList.Add(medList[i]);
                    humanMedList.Add(medList[i]);
                }
                else if (i == 1)
                {
                    humanMedList.Add(medList[i]);
                    //change no medicine texture for androids
                    androidMedList.Add(new ModMedicine((MedicalCareCategory)1, 0, ContentFinder <Texture2D> .Get("Things/Misc/ATPP_OnlyDocVisit", true)));
                }
                else
                {
                    if (IsAndroidMedicine(medList[i]))
                    {
                        androidMedList.Add(medList[i]);
                    }
                    else
                    {
                        humanMedList.Add(medList[i]);
                    }
                }
            }
        }
            public static void Listener(ThingDef t, ref bool __result, FleshTypeDef ___fleshType, float ___gestationPeriodDays)
            {
                //Si inside insideAddHumanlikeOrders et que param activé alors masquage capacité a forcer manger living plants
                if (Utils.insideAddHumanlikeOrders && Settings.androidsCanConsumeLivingPlants && Settings.hideMenuAllowingForceEatingLivingPlants)
                {
                    if (___fleshType != null && t != null && ___fleshType.defName == "Android" && t.plant != null)
                    {
                        __result = false;
                    }
                }


                if (Settings.allowHumanDrugsForAndroids)
                {
                    return;
                }

                //Si android alors on desactive les drogues humaines
                if (___fleshType != null && t != null && ___fleshType.defName == "Android" && Utils.BlacklistAndroidFood.Contains(t.defName) && !(Settings.allowHumanDrugsForT3PlusAndroids && ___gestationPeriodDays == 2))
                {
                    __result = false;
                }
            }
 static PawnExt()
 {
     orkFlesh = DefDatabase <FleshTypeDef> .GetNamed("Ork");
 }
Example #7
0
 static PawnExt()
 {
     necronFlesh = DefDatabase <FleshTypeDef> .GetNamed("Necron");
 }
 public static bool isConstruct(this FleshTypeDef def)
 {
     return(def.defName.Contains("OG_Flesh_Construct"));
 }
Example #9
0
 public static void SetFleshType(RaceProperties p, FleshTypeDef d)
 {
     typeof(RaceProperties).GetField("fleshType", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(p, d);
 }