Ejemplo n.º 1
0
        ConfigEntry <T> config <T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
        {
            configSync = new ConfigSync(Info.Metadata.GUID)
            {
                DisplayName = Info.Metadata.Name, CurrentVersion = Info.Metadata.Version.ToString()
            };

            ConfigEntry <T> configEntry = Config.Bind(group, name, value, description);

            SyncedConfigEntry <T> syncedConfigEntry = configSync.AddConfigEntry(configEntry);

            syncedConfigEntry.SynchronizedConfig = synchronizedSetting;

            return(configEntry);
        }
Ejemplo n.º 2
0
        private void Awake()
        {
            configSync = new ConfigSync(Info.Metadata.GUID)
            {
                DisplayName = Info.Metadata.Name, CurrentVersion = Info.Metadata.Version.ToString()
            };

            foreach (int i in Enum.GetValues(typeof(ItemDrop.ItemData.ItemType)))
            {
                typeEnums.Add(Enum.GetName(typeof(ItemDrop.ItemData.ItemType), i));
            }

            context            = this;
            modEnabled         = config <bool>("General", "Enabled", true, "Enable this mod", true);
            serverConfigLocked = config("General", "Lock Configuration", false, "Lock Configuration", true);
            configSync.AddLockingConfigEntry <bool>(serverConfigLocked);
            isDebug            = config <bool>("General", "IsDebug", true, "Enable debug logs", true);
            nexusID            = config <int>("General", "NexusID", 1068, "Nexus mod ID for updates", true);
            keepItemTypes      = config <string>("ItemLists", "KeepItemTypes", "", $"List of items to keep (comma-separated). Leave empty if using DropItemTypes. Valid types: {string.Join(",", typeEnums)}", true);
            dropItemTypes      = config <string>("ItemLists", "DropItemTypes", "", $"List of items to drop (comma-separated). Leave empty if using KeepItemTypes. Valid types: {string.Join(",", typeEnums)}", true);
            destroyItemTypes   = config <string>("ItemLists", "DestroyItemTypes", "", $"List of items to destroy (comma-separated). Overrides other lists. Valid types: {string.Join(",", typeEnums)}", true);
            keepAllItems       = config <bool>("Toggles", "KeepAllItems", false, "Overrides all other item options if true.", true);
            destroyAllItems    = config <bool>("Toggles", "DestroyAllItems", false, "Overrides all other item options except KeepAllItems if true.", true);
            keepEquippedItems  = config <bool>("Toggles", "KeepEquippedItems", false, "Overrides item lists if true.", true);
            keepHotbarItems    = config <bool>("Toggles", "KeepHotbarItems", false, "Overrides item lists if true.", true);
            useTombStone       = config <bool>("Toggles", "UseTombStone", true, "Use tombstone (if false, drops items on ground).", true);
            createDeathEffects = config <bool>("Toggles", "CreateDeathEffects", true, "Create death effects.", true);
            keepFoodLevels     = config <bool>("Toggles", "KeepFoodLevels", false, "Keep food levels.", true);
            keepQuickSlotItems = config <bool>("Toggles", "KeepQuickSlotItems", false, "Keep QuickSlot items.", true);

            useFixedSpawnCoordinates = config <bool>("Spawn", "UseFixedSpawnCoordinates", false, "Use fixed spawn coordinates.", true);
            spawnAtStart             = config <bool>("Spawn", "SpawnAtStart", false, "Respawn at start location.", true);
            fixedSpawnCoordinates    = config <Vector3>("Spawn", "FixedSpawnCoordinates", Vector3.zero, "Fixed spawn coordinates.", true);

            noSkillProtection = config <bool>("Skills", "NoSkillProtection", false, "Prevents skill protection after death.", true);
            reduceSkills      = config <bool>("Skills", "ReduceSkills", true, "Reduce skills.", true);
            skillReduceFactor = config <float>("Skills", "SkillReduceFactor", 0.25f, "Reduce skills by this fraction.", true);

            Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), null);
        }