Пример #1
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData modRegistrationData = new ModRegistrationData();

        modRegistrationData.RegisterEntityHandler(QuantumStorageControllerKey);
        modRegistrationData.RegisterEntityUI(QuantumStorageControllerKey, new QuantumStorageControllerWindow());
        modRegistrationData.RegisterEntityUI(QuantumOutputPortKey, new QuantumOutputPortWindow());
        modRegistrationData.RegisterEntityUI(QuantumIoPortKey, new QuantumIoPortWindow());
        modRegistrationData.RegisterEntityHandler(QuantumStorageKey);
        modRegistrationData.RegisterEntityHandler(QuantumIoPortKey);
        modRegistrationData.RegisterEntityHandler(QuantumOutputPortKey);
        modRegistrationData.RegisterEntityHandler(QuantumInputPortKey);

        UIManager.NetworkCommandFunctions.Add(QuantumStorageControllerWindowKey,
                                              QuantumStorageControllerWindow.HandleNetworkCommand);

        UIManager.NetworkCommandFunctions.Add(QuantumOutputPortWindowKey,
                                              QuantumOutputPortWindow.HandleNetworkCommand);

        UIManager.NetworkCommandFunctions.Add(QuantumIoPortWindowKey,
                                              QuantumIoPortWindow.HandleNetworkCommand);

        LogUtils.LogDebug(ModName, "registered");

        return(modRegistrationData);
    }
Пример #2
0
        public override ModRegistrationData Register()
        {
            var mrd = new ModRegistrationData();

            mrd.RegisterEntityHandler(eSegmentEntity.OreSmelter);
            mrd.RegisterEntityHandler(eSegmentEntity.ForcedInduction);
            return(mrd);
        }
Пример #3
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData modRegistrationData = new ModRegistrationData();

        modRegistrationData.RegisterEntityHandler("nailgunster2.PowerDissipator");
        return(modRegistrationData);
    }
Пример #4
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData mrd = new ModRegistrationData();

        mrd.RegisterEntityHandler(PowWowMk1.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk2.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk3.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk4.VALUE_NAME);

        mrd.RegisterEntityHandler(CompactSolarMk1.VALUE_NAME);
        mrd.RegisterEntityHandler(CompactSolarMk2.VALUE_NAME);
        mrd.RegisterEntityHandler(CompactSolarMk3.VALUE_NAME);

        powWowCube   = getCubeValue(PowWow.CUBE_NAME);
        powWowMk1Val = getValueValue(PowWowMk1.VALUE_NAME);
        powWowMk2Val = getValueValue(PowWowMk2.VALUE_NAME);
        powWowMk3Val = getValueValue(PowWowMk3.VALUE_NAME);
        powWowMk4Val = getValueValue(PowWowMk4.VALUE_NAME);

        compactSolarCube   = getCubeValue(CompactSolar.CUBE_NAME);
        compactSolarMk1Val = getValueValue(CompactSolarMk1.VALUE_NAME);
        compactSolarMk2Val = getValueValue(CompactSolarMk2.VALUE_NAME);
        compactSolarMk3Val = getValueValue(CompactSolarMk3.VALUE_NAME);

        log(LOGGER_PREFIX, "Registered mod");

        return(mrd);
    }
        public override ModRegistrationData Register()
        {
            var data = new ModRegistrationData();

            foreach (String key in _constructors.Keys)
            {
                data.RegisterEntityHandler(key);
            }
            return(data);
        }
Пример #6
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData mrd = new ModRegistrationData();

        mrd.RegisterEntityHandler(PowWowMk1.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk2.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk3.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk4.VALUE_NAME);

        TerrainDataEntry      terrainDataEntry;
        TerrainDataValueEntry terrainDataValueEntry;

        TerrainData.GetCubeByKey(PowWow.CUBE_NAME, out terrainDataEntry, out terrainDataValueEntry);
        if (terrainDataEntry != null)
        {
            powWowCube = terrainDataEntry.CubeType;
        }
        TerrainData.GetCubeByKey(PowWowMk1.VALUE_NAME, out terrainDataEntry, out terrainDataValueEntry);
        if (terrainDataValueEntry != null)
        {
            powWowMk1Val = terrainDataValueEntry.Value;
        }
        TerrainData.GetCubeByKey(PowWowMk2.VALUE_NAME, out terrainDataEntry, out terrainDataValueEntry);
        if (terrainDataValueEntry != null)
        {
            powWowMk2Val = terrainDataValueEntry.Value;
        }
        TerrainData.GetCubeByKey(PowWowMk3.VALUE_NAME, out terrainDataEntry, out terrainDataValueEntry);
        if (terrainDataValueEntry != null)
        {
            powWowMk3Val = terrainDataValueEntry.Value;
        }
        TerrainData.GetCubeByKey(PowWowMk4.VALUE_NAME, out terrainDataEntry, out terrainDataValueEntry);
        if (terrainDataValueEntry != null)
        {
            powWowMk4Val = terrainDataValueEntry.Value;
        }

        log(LOGGER_PREFIX, "Registered mod");

        return(mrd);
    }
Пример #7
0
        public override ModRegistrationData Register()
        {
            var registrationData = new ModRegistrationData();

            registrationData.RegisterEntityHandler("Innominate.BoringCompany");
            TerrainData.GetCubeByKey("Innominate.BoringCompany", out var entry, out var valueEntry);
            if (entry != null)
            {
                this.TunnelBoreCubeType = entry.CubeType;
            }
            return(registrationData);
        }
Пример #8
0
        public void registerMachine(ModRegistrationData mrd, Type type)
        {
            object[] segEntityAttr = type.GetCustomAttributes(typeof(FCESegmentEntityAttribute), false);
            if (segEntityAttr.Length == 0)
            {
                return;
            }
            FCESegmentEntityAttribute segEntity = segEntityAttr[0] as FCESegmentEntityAttribute;

            log("Registering {0} to {1} ...", segEntity.key, type.FullName);
            if (machineByKey.ContainsKey(segEntity.key))
            {
                log("--- Key {0} is already registered to {1}", segEntity.key, machineByKey[segEntity.key].type.FullName);
                return;
            }
            // TODO: confirm that type it has a proper constructor
            mrd.RegisterEntityHandler(segEntity.key);

            // find the cubeType and CubeValue that was assigned
            TerrainDataEntry      terrainDataEntry;
            TerrainDataValueEntry terrainDataValueEntry;

            TerrainData.GetCubeByKey(segEntity.key, out terrainDataEntry, out terrainDataValueEntry);
            ushort?cubeType  = terrainDataEntry?.CubeType;
            ushort cubeValue = terrainDataValueEntry?.Value ?? 0;

            // add it to our list so that we can create it later
            MachineRegistration mr = new MachineRegistration(type, segEntity.objectType);

            machineById.Add(new MachineKey(cubeType, cubeValue), mr);
            machineByKey.Add(segEntity.key, mr);


            // Check the class to see if it has has global static fields to store the cube and value type in
            MemberInfo[] props = type.GetMembers(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

            foreach (MemberInfo p in props)
            {
                if (p.GetCustomAttributes(typeof(FCECubeType), false).Length > 0)
                {
                    (p as PropertyInfo)?.SetValue(null, cubeType, null);
                    (p as FieldInfo)?.SetValue(null, cubeType);
                }
                if (p.GetCustomAttributes(typeof(FCECubeValue), false).Length > 0)
                {
                    (p as PropertyInfo)?.SetValue(null, cubeValue, null);
                    (p as FieldInfo)?.SetValue(null, cubeValue);
                }
            }

            log("  Registered {0} to {1} with key={2}, value={3}, objectType={4}", segEntity.key, type.Name, cubeType, cubeValue, segEntity.objectType);
        }
Пример #9
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData modRegistrationData = new ModRegistrationData();

        modRegistrationData.RegisterEntityHandler("steveman0.MSAccessPort");
        modRegistrationData.RegisterEntityUI("steveman0.MSAccessPort", new MSAccessPortWindow());

        Debug.Log("Mass Storage Access Port Mod v6 registered");

        UIManager.NetworkCommandFunctions.Add("steveman0.MSAccessPortWindow", new UIManager.HandleNetworkCommand(MSAccessPortWindow.HandleNetworkCommand));

        return(modRegistrationData);
    }
    public override ModRegistrationData Register()
    {
        ModRegistrationData modRegData = new ModRegistrationData();

        modRegData.RegisterEntityHandler("MarkNstein.AutoLensSwapper");
        //modRegData.RegisterEntityUI("MarkNstein.AutoLensSwapper", new AutoLensMachineWindow());
        // ^^^ still need to make the window handler

        Debug.Log("MarkNstein.AutoLensSwapper registered. Version 2.");

        //UIManager.NetworkCommandFunctions.Add("MarkNstein.AutoLensSwapperInterface", new UIManager.HandleNetworkCommand(AutoLensMachineWindow.HandleNetworkCommand));
        // ^^^ Still need to make window handler, and network capabilities.

        return(modRegData);
    }
Пример #11
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData modRegistrationData = new ModRegistrationData();

        modRegistrationData.RegisterEntityHandler("steveman0.MSManufacturer");
        modRegistrationData.RegisterEntityUI("steveman0.MSManufacturer", new MSManufacturerWindow());
        //modRegistrationData.RegisterEntityHandler("steveman0.MSManufacturerMK1");
        //modRegistrationData.RegisterEntityHandler("steveman0.MSManufacturerMK2");
        //modRegistrationData.RegisterEntityHandler("steveman0.MSManufacturerMK3");

        Debug.Log("Mass Storage Manufacturer Mod V10 registered");

        UIManager.NetworkCommandFunctions.Add("steveman0.MSManufacturerWindow", new UIManager.HandleNetworkCommand(MSManufacturerWindow.HandleNetworkCommand));


        return(modRegistrationData);
    }
Пример #12
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData modRegistrationData = new ModRegistrationData();

        modRegistrationData.RegisterEntityHandler("MyAuthorID.MyModMachine");
        modRegistrationData.RegisterEntityUI("MyAutherID.MyModMachine", new MyModMachineWindow());

        //It's nice to be able to confirm in the log that the mod registered properly and to know what version it is
        //Remember to increment it though if you change versions
        //This is strictly a nicety that I do with all my mods
        //It's helpful when trying to debug user's problems when you can see what mod version is in use from the log
        Debug.Log("My Mod V1 Registered!");

        //Register Network Commands for the machine
        UIManager.NetworkCommandFunctions.Add("MyAuthorID.MyModMachineInterface", new UIManager.HandleNetworkCommand(MyModMachineWindow.HandleNetworkCommand));

        return(modRegistrationData);
    }
Пример #13
0
    public override ModRegistrationData Register()
    {
        //Registers my mod, so FC knows what to load
        ModRegistrationData modRegistrationData = new ModRegistrationData();

        modRegistrationData.RegisterEntityHandler("Tricky.ExtraStorageHoppers");
        modRegistrationData.RegisterEntityUI("Tricky.ExtraStorageHoppers", ExtraStorageHopperUI);
        UIManager.NetworkCommandFunctions.Add("ExtraStorageHopperWindowNew", new UIManager.HandleNetworkCommand(ExtraStorageHopperWindowNew.HandleNetworkCommand));
        TerrainDataEntry      CubeEntry;
        TerrainDataValueEntry EntryValue;

        TerrainData.GetCubeByKey("Tricky.ExtraStorageHoppers", out CubeEntry, out EntryValue);
        if (CubeEntry != null)
        {
            mHopperCubeType  = CubeEntry.CubeType;
            mHopperCubeEntry = CubeEntry;
        }
        return(modRegistrationData);
    }
Пример #14
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData mrd = new ModRegistrationData();

        mrd.RegisterEntityHandler(PowWowMk1.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk2.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk3.VALUE_NAME);
        mrd.RegisterEntityHandler(PowWowMk4.VALUE_NAME);

        mrd.RegisterEntityHandler(CompactSolarMk1.VALUE_NAME);
        mrd.RegisterEntityHandler(CompactSolarMk2.VALUE_NAME);
        mrd.RegisterEntityHandler(CompactSolarMk3.VALUE_NAME);

        mrd.RegisterEntityHandler(MassGiverVanilla.VALUE_NAME);
        mrd.RegisterEntityHandler(MassGiverMk1.VALUE_NAME);
        mrd.RegisterEntityHandler(MassGiverMk2.VALUE_NAME);
        mrd.RegisterEntityHandler(MassGiverMk3.VALUE_NAME);
        mrd.RegisterEntityHandler(MassGiverMk4.VALUE_NAME);
        mrd.RegisterEntityHandler(MassGiverMk5.VALUE_NAME);

        mrd.RegisterEntityHandler(MassCrateModuleVanilla.VALUE_NAME);
        mrd.RegisterEntityHandler(MassCrateModuleLinker.VALUE_NAME);
        mrd.RegisterEntityHandler(MassCrateModule100.VALUE_NAME);
        mrd.RegisterEntityHandler(MassCrateModule200.VALUE_NAME);
        mrd.RegisterEntityHandler(MassCrateModule500.VALUE_NAME);
        mrd.RegisterEntityHandler(MassCrateModule1000.VALUE_NAME);
        mrd.RegisterEntityHandler(MassCrateModule10000.VALUE_NAME);
        mrd.RegisterEntityHandler(MassCrateModulePoweredMk1.VALUE_NAME);

        mrd.RegisterEntityHandler(MassTakerVanilla.VALUE_NAME);
        mrd.RegisterEntityHandler(MassTakerMk1.VALUE_NAME);
        mrd.RegisterEntityHandler(MassTakerMk2.VALUE_NAME);
        mrd.RegisterEntityHandler(MassTakerMk3.VALUE_NAME);
        mrd.RegisterEntityHandler(MassTakerMk4.VALUE_NAME);
        mrd.RegisterEntityHandler(MassTakerMk5.VALUE_NAME);

        powWowCube   = getCubeValue(PowWow.CUBE_NAME);
        powWowMk1Val = getValueValue(PowWowMk1.VALUE_NAME);
        powWowMk2Val = getValueValue(PowWowMk2.VALUE_NAME);
        powWowMk3Val = getValueValue(PowWowMk3.VALUE_NAME);
        powWowMk4Val = getValueValue(PowWowMk4.VALUE_NAME);

        compactSolarCube   = getCubeValue(CompactSolar.CUBE_NAME);
        compactSolarMk1Val = getValueValue(CompactSolarMk1.VALUE_NAME);
        compactSolarMk2Val = getValueValue(CompactSolarMk2.VALUE_NAME);
        compactSolarMk3Val = getValueValue(CompactSolarMk3.VALUE_NAME);

        massGiverCube         = getCubeValue(MassGiver.CUBE_NAME);
        massGiverVanillaValue = getValueValue(MassGiverVanilla.VALUE_NAME);
        massGiverMk1Value     = getValueValue(MassGiverMk1.VALUE_NAME);
        massGiverMk2Value     = getValueValue(MassGiverMk2.VALUE_NAME);
        massGiverMk3Value     = getValueValue(MassGiverMk3.VALUE_NAME);
        massGiverMk4Value     = getValueValue(MassGiverMk4.VALUE_NAME);
        massGiverMk5Value     = getValueValue(MassGiverMk5.VALUE_NAME);

        massCrateModuleCube            = getCubeValue(MassCrateModule.CUBE_NAME);
        massCrateModuleVanillaValue    = getValueValue(MassCrateModuleVanilla.VALUE_NAME);
        massCrateModuleLinkerValue     = getValueValue(MassCrateModuleLinker.VALUE_NAME);
        massCrateModule100Value        = getValueValue(MassCrateModule100.VALUE_NAME);
        massCrateModule200Value        = getValueValue(MassCrateModule200.VALUE_NAME);
        massCrateModule500Value        = getValueValue(MassCrateModule500.VALUE_NAME);
        massCrateModule1000Value       = getValueValue(MassCrateModule1000.VALUE_NAME);
        massCrateModule10000Value      = getValueValue(MassCrateModule10000.VALUE_NAME);
        massCrateModulePoweredMk1Value = getValueValue(MassCrateModulePoweredMk1.VALUE_NAME);

        massTakerCube         = getCubeValue(MassTaker.CUBE_NAME);
        massTakerVanillaValue = getValueValue(MassTakerVanilla.VALUE_NAME);
        massTakerMk1Value     = getValueValue(MassTakerMk1.VALUE_NAME);
        massTakerMk2Value     = getValueValue(MassTakerMk2.VALUE_NAME);
        massTakerMk3Value     = getValueValue(MassTakerMk3.VALUE_NAME);
        massTakerMk4Value     = getValueValue(MassTakerMk4.VALUE_NAME);
        massTakerMk5Value     = getValueValue(MassTakerMk5.VALUE_NAME);

        log(LOGGER_PREFIX, "Registered mod");

        return(mrd);
    }
Пример #15
0
    public override ModRegistrationData Register()
    {
        XMLConfigPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

        Debug.Log("Mk2Excavator AssemblyPath: " + XMLConfigPath);

        //XMLConfigPath = ModManager.GetModPath();
        //string text = Path.Combine(XMLConfigPath, XMLModID + Path.DirectorySeparatorChar + XMLModVersion);

        string configfile = Path.Combine(XMLConfigPath, XMLConfigFile);

        //text += String.Concat(Path.DirectorySeparatorChar + XMLConfigFile);

        Debug.Log("Mk2Excavator: Checking if XMLConfig File Exists at " + configfile);

        if (File.Exists(configfile))
        {
            mXMLFileExists = true;
            Debug.Log("Mk2Excavator: XMLConfig File Exists, loading.");
            string xmltext = File.ReadAllText(configfile);
            try
            {
                mConfig = (Mk2ExcavatorConfig)XMLParser.DeserializeObject(xmltext, typeof(Mk2ExcavatorConfig));
                // catch insane values, clamp them to lesser insane values
                if (mConfig.DigHeight < 4)
                {
                    mConfig.DigHeight = 4;
                }
                if (mConfig.DigRadius < 1)
                {
                    mConfig.DigRadius = 1;
                }
                if (mConfig.PowerPerBlockDefault < 1)
                {
                    mConfig.PowerPerBlockDefault = 1;
                }
                if (mConfig.PowerPerBlockOre < 1)
                {
                    mConfig.PowerPerBlockOre = 1;
                }
                if (mConfig.DigHeight > 2048)
                {
                    mConfig.DigHeight = 2048;
                }
                if (mConfig.DigRadius > 1024)
                {
                    mConfig.DigRadius = 1024;
                }
                if (mConfig.PowerPerBlockDefault > 10000)
                {
                    mConfig.PowerPerBlockDefault = 10000;
                }
                if (mConfig.PowerPerBlockOre > 40000)
                {
                    mConfig.PowerPerBlockOre = 40000;
                }
                if (mConfig.MaxPower > 100000)
                {
                    mConfig.MaxPower = 100000;
                }
                if (mConfig.OPBlock > 20)
                {
                    mConfig.OPBlock = 20;
                }
                if (mConfig.OPBlock < 2)
                {
                    mConfig.OPBlock = 1;
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Mk2Excavator: Something is wrong with ConfigXML, using defaults.\n Exception: " + e.ToString());
                mXMLFileExists = false;
            }
            Debug.Log("Mk2Excavator: XMLConfig File Loaded.");
        }
        else
        {
            Debug.LogWarning("Mk2Excavator: ERROR: XML File Does not exist at " + configfile);
            mXMLFileExists = false;
        }

        ModRegistrationData lRegData = new ModRegistrationData();

        lRegData.RegisterEntityHandler("FlexibleGames.Mk2Excavator");
        TerrainDataEntry      ltde;
        TerrainDataValueEntry ltdve;

        global::TerrainData.GetCubeByKey("FlexibleGames.Mk2Excavator", out ltde, out ltdve);
        bool flag = ltde != null;

        if (flag)
        {
            this.mExcavatorCubeType = ltde.CubeType;
        }
        UIManager.NetworkCommandFunctions.Add("FlexibleGames.Mk2ExcavatorWindow", new UIManager.HandleNetworkCommand(Mk2ExcavatorWindow.HandleNetworkCommand));

        return(lRegData);
    }
    // mod initializaion

    /// <summary>
    /// Register Mod
    /// </summary>
    /// <returns>ModRegistrationData for FlexibleGames.AdvancedQuarrys</returns>
    public override ModRegistrationData Register()
    {
        // load XML configurations
        //XMLConfigPath = ModManager.GetModPath();
        //string text = Path.Combine(XMLConfigPath, XMLModID + Path.DirectorySeparatorChar + XMLModVersion);
        //text += String.Concat(Path.DirectorySeparatorChar + XMLConfigFile);

        XMLConfigPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

        Debug.Log("AdvQuarrys: AssemblyPath: " + XMLConfigPath);

        string configfile = Path.Combine(XMLConfigPath, XMLConfigFile);

        Debug.Log("AdvQuarrys: Checking if XMLConfig File Exists at " + configfile);
        if (File.Exists(configfile))
        {
            mXMLFileExists = true;
            Debug.Log("AdvQuarrys: XMLConfig File Exists, loading.");
            string xmltext = File.ReadAllText(configfile);
            try
            {
                mConfig = (QuarryConfig)XMLParser.DeserializeObject(xmltext, typeof(QuarryConfig));
            }
            catch (Exception e)
            {
                Debug.LogError("AdvQuarrys: Something is wrong with ConfigXML, using defaults.\n Exception: " + e.ToString());
                mXMLFileExists = false;
                mConfig        = new QuarryConfig();
            }
            if (mXMLFileExists)
            {
                Debug.Log("AdvQuarrys: XMLConfig File Loaded.");
            }
        }
        else
        {
            GameManager.DoLocalChat("AdvQuarrys: ERROR: XML File Does not exist at " + configfile);
            mXMLFileExists = false;
        }
        if (mXMLFileExists)
        {
            if (!ValidateConfig())
            {
                mXMLFileExists = false;
                GameManager.DoLocalChat("AdvQuarrys: Quarry Config file is invalid.");
            }
        }
        // load Mk4 XML configurations
        //XMLConfigPath = ModManager.GetModPath();
        //text = Path.Combine(XMLConfigPath, XMLModID + Path.DirectorySeparatorChar + XMLModVersion);
        //text += String.Concat(Path.DirectorySeparatorChar + XMLMk4ConfigFile);
        configfile = Path.Combine(XMLConfigPath, XMLMk4ConfigFile);
        Debug.Log("AdvQuarrys: Checking if Mk4 XMLConfig File Exists at " + configfile);
        if (File.Exists(configfile))
        {
            mMk4XMLFileExists = true;
            Debug.Log("AdvQuarrys: XMLConfig File Exists, loading.");
            string xmltext = File.ReadAllText(configfile);
            try
            {
                mMk4Config = (Mk4QuarryConfig)XMLParser.DeserializeObject(xmltext, typeof(Mk4QuarryConfig));
            }
            catch (Exception e)
            {
                Debug.LogError("AdvQuarrys: Something is wrong with Mk4 ConfigXML, using defaults.\n Exception: " + e.ToString());
                mMk4XMLFileExists = false;
                mMk4Config        = new Mk4QuarryConfig();
            }
            if (mMk4XMLFileExists)
            {
                Debug.Log("AdvQuarry: Mk4 XMLConfig File Loaded.");
            }
        }
        else
        {
            GameManager.DoLocalChat("AdvQuarrys: ERROR: Mk4 XML File Does not exist at " + configfile);
            mMk4XMLFileExists = false;
        }
        if (mMk4XMLFileExists)
        {
            if (!ValidateMk4Config())
            {
                mMk4XMLFileExists = false;
                mMk4Config.Mine1  = "None";
                mMk4Config.Mine2  = "None";
                mMk4Config.Mine3  = "None";
                mMk4Config.Mine4  = "None";
                mMk4Config.Size   = 15;
                GameManager.DoLocalChat("AdvQuarrys: Mk4 Quarry Config file is invalid.");
            }
        }

        // Mk5 quarry config.
        configfile = Path.Combine(XMLConfigPath, XMLMk5ConfigFile);
        Debug.Log("AdvQuarrys: Checking if Mk5 XMLConfig File Exists at " + configfile);
        if (File.Exists(configfile))
        {
            mMk5XMLFileExists = true;
            Debug.Log("AdvQuarrys: Mk5 XMLConfig File Exists, loading.");
            string xmltext = File.ReadAllText(configfile);
            try
            {
                mMk5Config = (Mk5QuarryConfig)XMLParser.DeserializeObject(xmltext, typeof(Mk5QuarryConfig));
            }
            catch (Exception e)
            {
                Debug.LogError("AdvQuarrys: Something is wrong with Mk5 ConfigXML, using defaults.\n Exception: " + e.ToString());
                mMk5XMLFileExists = false;
                mMk5Config        = new Mk5QuarryConfig();
            }
            if (mMk5XMLFileExists)
            {
                Debug.Log("AdvQuarrys: Mk5 XMLConfig File Loaded.");
            }
        }
        else
        {
            GameManager.DoLocalChat("AdvQuarrys: ERROR: Mk5 XML File Does not exist at " + configfile);
            mMk5XMLFileExists = false;
        }
        if (mMk5XMLFileExists)
        {
            if (!ValidateMk5Config())
            {
                mMk5XMLFileExists = false;
                mMk5Config.Mine1  = "None";
                mMk5Config.Mine2  = "None";
                mMk5Config.Mine3  = "None";
                mMk5Config.Mine4  = "None";
                mMk5Config.Mine5  = "None";
                mMk5Config.Mine6  = "None";
                mMk5Config.Mine7  = "None";
                mMk5Config.Mine8  = "None";
                mMk5Config.Size   = 9;
                GameManager.DoLocalChat("AdvQuarrys: Mk5 Quarry Config file is invalid.");
            }
        }


        // register mod
        ModRegistrationData lmoddata = new ModRegistrationData();

        lmoddata.RegisterEntityHandler("FlexibleGames.AdvancedQuarrys");
        lmoddata.RegisterEntityHandler("FlexibleGames.Mk5Quarry");
        lmoddata.RegisterEntityHandler("FlexibleGames.Mk5QuarryBlock");
        lmoddata.RegisterEntityHandler("FlexibleGames.Mk5QuarryCenter");
        lmoddata.RegisterEntityHandler("FlexibleGames.Mk5QuarryPlacement");

        // UIManager.NetworkCommandFunctions.Add("FlexibleGames.Mk2ExcavatorWindow", new UIManager.HandleNetworkCommand(Mk2ExcavatorWindow.HandleNetworkCommand));

        UIManager.NetworkCommandFunctions.Add("FlexibleGames.FlexibleQuarryWindow", new UIManager.HandleNetworkCommand(FlexibleQuarryWindow.HandleNetworkCommand));

        TerrainDataEntry      lterraindata;
        TerrainDataValueEntry lterraindatavalue;

        global::TerrainData.GetCubeByKey("FlexibleGames.AdvancedQuarrys", out lterraindata, out lterraindatavalue);
        bool flag = lterraindata != null;

        if (flag)
        {
            this.mQuarryType = lterraindata.CubeType;
        }
        return(lmoddata);
    }
Пример #17
0
    public override ModRegistrationData Register()
    {
        ModRegistrationData modRegistrationData = new ModRegistrationData();

        modRegistrationData.RegisterEntityHandler("steveman0.FreightCartStation");
        modRegistrationData.RegisterMobHandler("steveman0.FreightCart_T1");
        modRegistrationData.RegisterMobHandler("steveman0.FreightCart_T2");
        modRegistrationData.RegisterMobHandler("steveman0.FreightCart_T3");
        modRegistrationData.RegisterMobHandler("steveman0.FreightCart_T4");
        modRegistrationData.RegisterMobHandler("steveman0.FreightCartMK1");
        modRegistrationData.RegisterMobHandler("steveman0.FreightCart_Tour");
        modRegistrationData.RegisterMobHandler("steveman0.FreightCart_TourBasic");
        modRegistrationData.RegisterMobHandler("steveman0.OreFreighter_T1");
        modRegistrationData.RegisterMobHandler("steveman0.OreFreighter_T2");
        modRegistrationData.RegisterMobHandler("steveman0.OreFreighter_T3");
        modRegistrationData.RegisterMobHandler("steveman0.OreFreighter_T4");
        modRegistrationData.RegisterMobHandler("steveman0.ScrapCartMK1");
        modRegistrationData.RegisterMobHandler("steveman0.ScrapOreFreighterMK1");
        modRegistrationData.RegisterEntityHandler("steveman0.FreightSystemMonitor");
        modRegistrationData.RegisterEntityHandler("steveman0.FreightCartFactory");
        modRegistrationData.RegisterEntityHandler("steveman0.TrackJunction");
        modRegistrationData.RegisterEntityHandler("steveman0.TourCartStation");
        modRegistrationData.RegisterEntityHandler("steveman0.ScrapTrack");
        modRegistrationData.RegisterEntityUI("steveman0.FreightCartStation", new FreightCartWindow());
        modRegistrationData.RegisterEntityUI("steveman0.FreightSystemMonitor", new SystemMonitorWindow());
        modRegistrationData.RegisterServerComms("steveman0.NetworkStatus", NetworkSync.SendNetworkStatus, NetworkSync.ReadNetworkStatus);
        modRegistrationData.RegisterServerComms("steveman0.TrackNetworks", NetworkSync.SendTrackNetworks, NetworkSync.ReadTrackNetworks);

        UIManager.NetworkCommandFunctions.Add(FreightCartWindow.InterfaceName, new UIManager.HandleNetworkCommand(FreightCartWindow.HandleNetworkCommand));
        UIManager.NetworkCommandFunctions.Add(TrackJunctionWindow.InterfaceName, new UIManager.HandleNetworkCommand(TrackJunctionWindow.HandleNetworkCommand));
        UIManager.NetworkCommandFunctions.Add(TourStationWindow.InterfaceName, new UIManager.HandleNetworkCommand(TourStationWindow.HandleNetworkCommand));
        UIManager.NetworkCommandFunctions.Add(SystemMonitorWindow.InterfaceName, new UIManager.HandleNetworkCommand(SystemMonitorWindow.HandleNetworkCommand));

        //new FreightCartManager();

        //For generating the sync class on the Unity thread after moving freight cart manager to LFU
        GameObject Sync = new GameObject("ManagerSync");

        Sync.AddComponent <ManagerSync>();
        Sync.SetActive(true);
        Sync.GetComponent <ManagerSync>().enabled = true;

        Debug.Log("Freight Cart Mod V9 registered");

        // Instanced track rendering
        if (!PersistentSettings.mbHeadlessServer)
        {
            Material TrackMaterial = InstanceManager.instance.maSimpleMaterials[(int)InstanceManager.eSimpleInstancerType.eMinecartStraight];
            Mesh     TrackMesh     = InstanceManager.instance.maSimpleMeshes[(int)InstanceManager.eSimpleInstancerType.eMinecartStraight];
            TrackInstances.Init(TrackMesh, TrackMaterial);
            FreightTrackJunction.TrackMesh     = TrackMesh;
            FreightTrackJunction.TrackMaterial = TrackMaterial;
            Material scrapmat = new Material(TrackMaterial);
            scrapmat.color = new Color(200 / 256f, 117 / 256f, 51 / 256f);
            FreightTrackJunction.ScrapTrackMat = scrapmat;
            ScrapTrack.StraightTrackMesh       = TrackMesh;
            ScrapTrack.StraightTrackMaterial   = scrapmat;
            Mesh ShrinkMesh = SetupMesh(TrackMesh);
            FreightTrackJunction.TrackMesh2 = ShrinkMesh;
        }
        return(modRegistrationData);
    }