public ModWorld(CModInfo modInfo)
        {
            Mod = modInfo;

            s_WorldsModIdLookup[Mod.Id] = this;
            AllWorlds.Add(this);
        }
        public static ModWorld GetOrCreate(CModInfo modInfo)
        {
            if (s_WorldsModIdLookup.TryGetValue(modInfo.Id, out var world))
            {
                return(world);
            }

            return(new ModWorld(modInfo));
        }
 public static ModWorld GetWorld(this CModInfo modInfo)
 {
     return(World.DefaultGameObjectInjectionWorld.GetOrCreateSystem <CModManager>().GetModWorld(modInfo));
 }
 internal void SetModInfoInternal(CModInfo modInfo)
 {
     ModInfo = modInfo;
 }
Example #5
0
 /// <summary>
 ///     Get the world of the target mod
 /// </summary>
 /// <param name="modInfo">The target mod</param>
 /// <returns>The world of the mod</returns>
 public ModWorld GetModWorld(CModInfo modInfo)
 {
     return(ModWorld.GetOrCreate(modInfo));
 }