nanoblox / core

https://nanoblox.github.io/core/
Mozilla Public License 2.0
57 stars 18 forks source link

Option to automatically make test players in studio X rank #146

Open Lucke0051 opened 2 years ago

Lucke0051 commented 2 years ago

Consider making an option to automatically rank any user with a negative UserID (test players/guests) the rank configured by the user. Currently when I'm testing games locally with multiple users I want to be able to use commands in studio as a guest/test player without having to set it up manually (although I suppose it's not that difficult to just add -1 and -2 to the hard-coded rank list).

1ForeverHD commented 2 years ago

Nice idea, I've needed that a fair few times myself over the years!

I've added a localTestPlayers Role Giver to achieve this (see below).

For some additional details:

Similar to Discord/Guilded, we split our role settings into three categories:

  1. Display
  2. Permissions
  3. Members

image

image

There are currently 23 role settings, enough to customise roles for virtually all needs, and few-enough to make role setup and configuration fast and easy. These role settings are configured using components like Toggles, Color Pickers, Stackable Options, etc to make configuration intuitive and straightforward.

A StackableOption (which Role Givers is) will function similar to the following - a list of items (such as groupRoles, gamepasses, premiumPlayers, localTestPlayers, etc) with mini descriptions, which you can then add to your main stack: https://thumbs.gfycat.com/CleverShowyAlaskanhusky-mobile.mp4

You can find your localTestPlayers Role Giver under the Role Inheritance settings group:

{SettingType.Category, "Display", {

    {SettingType.ShortText, {
        key = "name",
        desc = false,
        value = "Unnamed Role",
    }},

    {SettingType.ColorPicker, {
        key = "roleColor",
        desc = "Members use the color of their most senior role.",
        value = Color3.fromRGB(255, 255, 255),
    }},

    {SettingType.Toggle, {
        key = "hideRole",
        desc = "Hidden roles are only viewable by its members or users with role edit permissions.",
        value = false,
    }},

    {SettingType.Toggle, {
        key = "showTopbarIcon",
        desc = "",
        value = true,
    }},

    {SettingType.StackableOptions, {
        key = "prompts",
        desc = "",
        value = {
            welcomeRankNotice = true,
        },
        options = {
            {key = "welcomeRankNotice", imageId = 0, limitToOne = true, desc = ""},
        },
    }},

    {SettingType.ToggleGroup, {
        key = "customBubbleChat",
        desc = "",
        value = {
            enabled = false,
            imageColor = Color3.fromRGB(255, 255, 255),
            textColor = Color3.fromRGB(255, 255, 255),
            textFont = "SourceSans",
        },
    }},

    {SettingType.ToggleGroup, {
        key = "customMenuChat",
        desc = "",
        value = {
            enabled = false,
            nameColor = Color3.fromRGB(255, 255, 255),
            chatColor = Color3.fromRGB(255, 255, 255),
            chatTags = {
                --[[{
                    tagText = "",
                    tagColor = Color3.fromRGB(255, 255, 255),
                }--]]
            },
        },
    }},

    {SettingType.ToggleGroup, {
        key = "customTitle",
        desc = "",
        value = {
            enabled = false,
            text = "Unnamed Title",
            primaryColor = Color3.fromRGB(255, 255, 255),
            strokeColor = Color3.fromRGB(255, 255, 255),
        },
    }},

}},

{SettingType.Category, "Permissions", {

    {SettingType.Group, "Role Behaviour", {

        {SettingType.LockedInteger, {
            key = "roleUID",
            desc = "The Roles Unique Identifier (UID) is a randomised individual string assigned to the role on its creation.",
            value = "",
        }},

        {SettingType.Integer, {
            key = "roleOrder",
            desc = "A roles order can only be customised if below your most senior role. Role orders can also be customised by dragging.",
            value = false,
        }},

        {SettingType.SingleChoice, {
            key = "environmentType",
            title = "Environment",
            desc = "Environments determine where roles will function (such as across all servers, within a specific private server, etc).",
            value = false,
        }},

    }},

    {SettingType.Group, "User Role Inheritance", {

        {SettingType.StackableOptions, {
            key = "roleGivers",
            desc = "Add Role Givers to determine who receives the role (e.g. players who own a gamepass, members of a group, etc).",
            value = {},
            options = {
                {key = "everyone", imageId = 0, limitToOne = true, desc = ""},
                {key = "creator", imageId = 0, limitToOne = true, desc = "The owner of the experience or the experiences group owner."},
                {key = "privateServerOwner", imageId = 0, limitToOne = true, desc = ""},
                {key = "privateServerPlayers", imageId = 0, limitToOne = true, desc = ""},
                {key = "premiumPlayers", imageId = 0, limitToOne = true, desc = ""},
                {key = "starCreators", imageId = 0, limitToOne = true, desc = "Members of the Video Stars Group (4199740)"},
                {key = "localTestPlayers", imageId = 0, limitToOne = true, desc = "These are the test accounts with negative UserIds created on Studio Local Server Start."},
                {key = "nanocoins", imageId = 0, limitToOne = true, desc = "The amount of Nanocoins required to purchase the role. Nanocoin developer products can be customised under Game Settings.", properties = {
                    Price = 1,
                    RemoveOnLeave = false,
                }},
                {key = "gamepass", imageId = 0, limitToOne = false, desc = "", properties = {
                    GamepassId = 0,
                }},
                {key = "group", imageId = 0, limitToOne = false, desc = "Members of a specified Roblox Group", properties = {
                    GroupId = 0,
                }},
                {key = "groupRole", imageId = 0, limitToOne = false, desc = "Members of a specified Roblox Group Role", properties = {
                    GroupId = 0,
                    RoleNameOrRank = "",
                }},
                {key = "marketplaceItem", imageId = 0, limitToOne = false, desc = "", properties = {
                    LibraryItemId = 0,
                }},
                {key = "catalogItem", imageId = 0, limitToOne = false, desc = "", properties = {
                    CatalogItemId = 0,
                }},
                {key = "playersWearingCatalogItem", imageId = 0, limitToOne = false, desc = "", properties = {
                    CatalogItemId = 0,
                }},
                {key = "friendsOfUser", imageId = 0, limitToOne = false, desc = "", properties = {
                    UserId = 0,
                }},
                {key = "playersOfMinimumAccountAge", imageId = 0, limitToOne = true, desc = "", properties = {
                    MinimumAccountAge = 0,
                }},
            },
        }},

        {SettingType.StackableOptions, {
            key = "roleTakers",
            desc = "Add Role Takers to determine when a role is removed.",
            value = {},
            options = {
                {key = "afterNumberOfCommandExecutions", imageId = 0, limitToOne = true, desc = "A Command Execution is when a command belonging to the role is successfully called by a user."},
                {key = "afterRespawning", imageId = 0, limitToOne = true, desc = ""},
            },
        }},

    }},

    {SettingType.Group, "Command Inheritance", {

        {SettingType.StackableOptions, {
            key = "commandInheritors",
            desc = "Add Command Inheritors to determine what commands players with the role can use.",
            value = {
                commandsFromJuniorRoles = true,
            },
            options = {
                {key = "allCommands", imageId = 0, limitToOne = true, desc = ""},
                {key = "specificCommand", imageId = 0, limitToOne = false, desc = "", properties = {
                    CommandName = "",
                }},
                {key = "commandsWithTag", imageId = 0, limitToOne = false, desc = "", properties = {
                    TagName = "",
                }},
                {key = "commandsFromSpecificRole", imageId = 0, limitToOne = false, desc = "", properties = {
                    RoleNameOrUID = "",
                }},
                {key = "commandsFromJuniorRoles", imageId = 0, limitToOne = true, desc = "Junior Roles are roles below this role within the role order list."},
            },
        }},
    }},

    {SettingType.Group, "Command Restrictions", {

        {SettingType.StackableOptions, {
            key = "commandLimiters",
            desc = "Add Command Limiters to reduce abusive actions of its inherited commands by users with the role.",
            value = {
                --!!! Note: these should default to tables {e.g. CapAmount = 10, RefreshInterval = 10} if a non-table value when should be a table
                capCommandRequest = true,
                capGlobalExecutions = true,
                respectCommandCooldowns = true,
                respectCommandRestrictions = true,
                scaleCap = true,
                blockDenylistedIDs = true,
            },
            options = {
                {key = "capCommandRequest", imageId = 0, limitToOne = true, desc = "The CapAmount determines how many commands can be requested every RefreshInterval (in seconds).", properties = {
                    CapAmount = 10,
                    RefreshInterval = 10,
                }},
                {key = "capGlobalExecutions", imageId = 0, limitToOne = true, desc = "The CapAmount determines how many times the 'global' or 'perm' modifier can be used per RefreshInterval (in seconds).", properties = {
                    CapAmount = 5,
                    RefreshInterval = 20,
                }},
                {key = "respectCommandCooldowns", imageId = 0, limitToOne = true, desc = "This prevents the same command being executed on a player or server until the original one has expired."},
                {key = "respectCommandRestrictions", imageId = 0, limitToOne = true, desc = "Some commands have specific restrictions, such as the ;clone command which limits the total amount of clones a player can create."},
                {key = "scaleCap", imageId = 0, limitToOne = true, desc = "The CapAmount determines the maximum size body parts can be scaled to when using commands such as ;size.", properties = {
                    CapAmount = 5,
                }},
                {key = "blockDenylistedIDs", imageId = 0, limitToOne = true, desc = "This blocks denylistedIds (under Game Settings) from being loaded (such as gears, music, accessories, etc)"},
                {key = "onlyPermitAllowlistedIDs", imageId = 0, limitToOne = true, desc = "This only permits allowlistedIds (under Game Settings) from being loaded (such as gears, music, accessories, etc)"},
                {key = "capPlayerTargets", imageId = 0, limitToOne = true, desc = "This limits how many players can be targeted in a single command. For example, if CapAmount was 1, calling ``;bring all`` would only bring 1 player instead of every player within the server.", properties = {
                    CapAmount = 1,
                }},
            },
        }},

        {SettingType.StackableOptions, {
            key = "permittedTargets",
            desc = "This determines who can be targeted by commands inherited from this role by users owning this role.",
            value = {
                self = true,
                friends = true,
            },
            options = {
                {key = "self", imageId = 0, limitToOne = true, desc = ""},
                {key = "friends", imageId = 0, limitToOne = true, desc = ""},
                {key = "others", imageId = 0, limitToOne = true, desc = ""},
            },
        }},

        {SettingType.StackableOptions, {
            key = "permittedModifiers",
            desc = "This determines what modifiers can be attached to commands inherited from this role by users owning this role.",
            value = {
                preview = true,
                random = true,
                undo = true,
                epoch = true,
                delay = true,
                spawn = true,
                expire = true,
            },
            options = {
                {key = "all", imageId = 0, limitToOne = true, desc = ""},
                {key = "preview", imageId = 0, limitToOne = true, desc = ""},
                {key = "random", imageId = 0, limitToOne = true, desc = ""},
                {key = "perm", imageId = 0, limitToOne = true, desc = ""},
                {key = "global", imageId = 0, limitToOne = true, desc = ""},
                {key = "undo", imageId = 0, limitToOne = true, desc = ""},
                {key = "epoch", imageId = 0, limitToOne = true, desc = ""},
                {key = "delay", imageId = 0, limitToOne = true, desc = ""},
                {key = "loop", imageId = 0, limitToOne = true, desc = ""},
                {key = "spawn", imageId = 0, limitToOne = true, desc = ""},
                {key = "expire", imageId = 0, limitToOne = true, desc = ""},
            },
        }},

        {SettingType.StackableOptions, {
            key = "canBlockCommandsFrom",
            desc = "This enables members to block command executions from other players.",
            value = {
                juniors = true,
            },
            options = {
                {key = "juniors", imageId = 0, limitToOne = true, desc = "Users with a maximum role above this role."},
                {key = "peers", imageId = 0, limitToOne = true, desc = "Users with a maximum role as this role."},
                {key = "seniors", imageId = 0, limitToOne = true, desc = "Users with a maximum role below this role."},
            },
        }},

        {SettingType.StackableOptions, {
            key = "canRevokeCommandsFrom",
            desc = "This enables members to revoke (i.e. cancel or undo) command executions (aka 'tasks' or 'jobs') from other players.",
            value = {},
            options = {
                {key = "juniors", imageId = 0, limitToOne = true, desc = "Users with a maximum role above this role."},
                {key = "peers", imageId = 0, limitToOne = true, desc = "Users with a maximum role as this role."},
                {key = "seniors", imageId = 0, limitToOne = true, desc = "Users with a maximum role below this role."},
            },
        }},

    }},

    {SettingType.Group, "Member Powers", {

        {SettingType.StackableOptions, {
            key = "canViewPages",
            desc = "This enables members to view the selected pages.",
            value = {
                unusableCommands = true,
                rolesList = true,
                tempRoles = true,
            },
            options = {
                {key = "all", imageId = 0, limitToOne = true, desc = ""},
                {key = "unusableCommands", imageId = 0, limitToOne = true, desc = ""},
                {key = "rolesList", imageId = 0, limitToOne = true, desc = ""},
                {key = "tempRoles", imageId = 0, limitToOne = true, desc = ""},
                {key = "permRoles", imageId = 0, limitToOne = true, desc = ""},
                {key = "bans", imageId = 0, limitToOne = true, desc = ""},
                {key = "warnings", imageId = 0, limitToOne = true, desc = ""},
                {key = "logs", imageId = 0, limitToOne = true, desc = ""},
                {key = "systemSettings", imageId = 0, limitToOne = true, desc = ""},
                {key = "playerSettings", imageId = 0, limitToOne = true, desc = ""},
            },
        }},

        {SettingType.StackableOptions, {
            key = "canEditPages",
            desc = "This enables members to edit the selected pages.",
            value = {},
            options = {
                {key = "all", imageId = 0, limitToOne = true, desc = ""},
                {key = "rolesList", imageId = 0, limitToOne = true, desc = ""},
                {key = "tempRoles", imageId = 0, limitToOne = true, desc = ""},
                {key = "permRoles", imageId = 0, limitToOne = true, desc = ""},
                {key = "bans", imageId = 0, limitToOne = true, desc = ""},
                {key = "warnings", imageId = 0, limitToOne = true, desc = ""},
                {key = "logs", imageId = 0, limitToOne = true, desc = ""},
                {key = "systemSettings", imageId = 0, limitToOne = true, desc = ""},
                {key = "playerSettings", imageId = 0, limitToOne = true, desc = ""},
            },
        }},

        {SettingType.Toggle, {
            key = "cmdbar1",
            desc = "",
            value = true,
        }},

        {SettingType.Toggle, {
            key = "cmdbar2",
            desc = "",
            value = false,
        }},

    }},

}},

{SettingType.Category, "Members"}