static Building_ReverseCycleCooler() { UI_ROTATE_RIGHT = ContentFinder <Texture2D> .Get("UI/RotRight", true); UI_TEMPERATURE_COOLING = ContentFinder <Texture2D> .Get("UI/Temperature_Cooling", true); UI_TEMPERATURE_HEATING = ContentFinder <Texture2D> .Get("UI/Temperature_Heating", true); UI_TEMPERATURE_AUTO = ContentFinder <Texture2D> .Get("UI/Temperature_Auto", true); if (MP.enabled) { if (!MP.API.Equals("0.1")) { Log.Error("ReverseCycleCooler: MP API version mismatch. This mod is designed to work with MPAPI version 0.1"); } else { MP.RegisterAll(); //Log.Message("ReverseCycleCooler: MP init"); } } }
static RJW_Multiplayer() { if (!MP.enabled) { return; } // This is where the magic happens and your attributes // auto register, similar to Harmony's PatchAll. MP.RegisterAll(); /* * Log.Message("RJW MP compat testing"); * var type = AccessTools.TypeByName("rjw.RJWdesignations"); * //Log.Message("rjw MP compat " + type.Name); * Log.Message("is host " + MP.IsHosting); * Log.Message("PlayerName " + MP.PlayerName); * Log.Message("IsInMultiplayer " + MP.IsInMultiplayer); * * //MP.RegisterSyncMethod(type, "Comfort"); * /* * MP.RegisterSyncMethod(type, "<GetGizmos>Service"); * MP.RegisterSyncMethod(type, "<GetGizmos>BreedingHuman"); * MP.RegisterSyncMethod(type, "<GetGizmos>BreedingAnimal"); * MP.RegisterSyncMethod(type, "<GetGizmos>Breeder"); * MP.RegisterSyncMethod(type, "<GetGizmos>Milking"); * MP.RegisterSyncMethod(type, "<GetGizmos>Hero"); */ // You can choose to not auto register and do it manually // with the MP.Register* methods. // Use MP.IsInMultiplayer to act upon it in other places // user can have it enabled and not be in session }
static StaticConstructorClass() { // Add CompRenamable to ThingDefs foreach (var tDef in DefDatabase <ThingDef> .AllDefs.Where(t => typeof(ThingWithComps).IsAssignableFrom(t.thingClass))) { if (tDef.comps == null) { tDef.comps = new List <CompProperties>(); } // Weapon if (tDef.IsWeapon) { tDef.comps.Add(new CompProperties_Renamable { renameTranslationKey = "RenameEverything.RenameWeapon", inspectStringTranslationKey = "ShootReportWeapon" }); } // Apparel else if (tDef.IsApparel) { tDef.comps.Add(new CompProperties_Renamable { renameTranslationKey = "RenameEverything.RenameApparel", inspectStringTranslationKey = "Apparel" }); } // Building else if (tDef.IsBuildingArtificial) { tDef.comps.Add(new CompProperties_Renamable { renameTranslationKey = "RenameEverything.RenameBuilding", inspectStringTranslationKey = "RenameEverything.Building" }); } // Plant else if (typeof(Plant).IsAssignableFrom(tDef.thingClass)) { tDef.comps.Add(new CompProperties_Renamable { renameTranslationKey = "RenameEverything.RenamePlant", inspectStringTranslationKey = "RenameEverything.Plant" }); } // Not a pawn, corpse or minified building else if (!typeof(Pawn).IsAssignableFrom(tDef.thingClass) && !typeof(Corpse).IsAssignableFrom(tDef.thingClass) && !typeof(MinifiedThing).IsAssignableFrom(tDef.thingClass)) { tDef.comps.Add(new CompProperties_Renamable()); } } // Multiplayer compatibility if (MP.enabled) { MP.RegisterAll(); } }