FANDOM


-- <pre>
local utils = require('Module:Utils')
local yesno = require('Dev:Yesno')
local class_tags = require('Module:Class tags')
 
local p = {}
 
local function make_icon_link(filename, classname)
    return "[[File:" .. filename .. "|link=Class:" .. classname .. "]]"
end
 
-- Returns a class' specific icon file link.
-- If there isn't an icon, returns nil.
-- This does not support custom icon overrides or blank or object icons.
function p.get_specific_class_icon(classname)
    local class_icon = p.icons[classname]
    local filename
    if type(class_icon) == 'number' then
        filename = "ExplorerImageIndex " .. tostring(class_icon) .. ".png"
    elseif type(class_icon) == 'string' then
        filename = class_icon
    elseif class_icon == nil then
        local explorer_image_index = require('Module:ReflectionMetadataHelpers').get_explorer_image_index(classname)
        if not explorer_image_index then
            return
        end
        filename = "ExplorerImageIndex " .. tostring(explorer_image_index) .. ".png"
    else
        return error("invalid class icon")
    end
    return make_icon_link(filename, classname)
end
 
-- Returns a class' icon file link.
-- This does not support custom icon overrides. It is used with no fallback in the class infoboxes.
-- If fallback is true, object icon is used for notbrowsable classes with no specific icon.
function p.get_class_icon(classname, fallback)
    local class_icon = p.get_specific_class_icon(classname)
    if class_icon then
        return class_icon
    elseif class_tags.has_tag(classname, 'NotBrowsable') then
        if fallback then
            return make_icon_link("Object icon.png", classname)
        end
    else
        return make_icon_link("ExplorerImageIndex 0.png", classname)
    end
end
 
-- This is used with fallback in the class reference and inheritance lists and without fallback in class links.
-- Custom icons have priority over specific icons.
function p.get_custom_class_icon(classname, fallback)
    local class_borrowed_from = p.custom_icons_borrowed[classname]
    if class_borrowed_from then
        return p.get_specific_class_icon(class_borrowed_from)
    end
    local custom_image_index = p.custom_icon_indices[classname]
    if custom_image_index then
        return make_icon_link("ExplorerImageIndex " .. tostring(custom_image_index) .. ".png", classname)
    end
    local custom_file = p.custom_icon_files[classname]
    if custom_file then
        return make_icon_link(custom_file, classname)
    end
    return p.get_class_icon(classname, fallback)
end
 
-- Keys: class names
-- Values: either a file name or an explorer image index
-- The explorer image indices can be found in ReflectionMetadata.xml:
-- https://github.com/CloneTrooper1019/Roblox-Client-Watch/blob/roblox/ReflectionMetadata.xml
-- Icons should be uploaded with the correct file name and added to [[Category:Explorer icons]].
p.icons = {
    Hole = "Blank icon.png";
    Beam = 96;
    WeldConstraint = 94,
    CylindricalConstraint = 95,
    BindableFunction = 66;
    BindableEvent = 67;
    TouchTransmitter = 37;
    ForceField = 37;
    Hat = 45;
    Accessory = 32;
    Attachment = 81;
    BallSocketConstraint = 86;
    RopeConstraint = 89;
    RodConstraint = 90;
    SpringConstraint = 91;
    HingeConstraint = 87;
    PrismaticConstraint = 88;
    Weld = 34;
    PackageLink = 34;
    ClickDetector = 41;
    Smoke = 59;
    ParticleEmitter = 80;
    Sparkles = 42;
    Explosion = 36;
    Fire = 61;
    Seat = 35;
    Platform = 35;
    SkateboardPlatform = 35;
    VehicleSeat = 35;
    Tool = 17;
    Flag = 38;
    FlagStand = 39;
    Decal = 7;
    JointInstance = 34;
    Message = 33;
    Hint = 33;
    IntValue = 4;
    RayValue = 4;
    IntConstrainedValue = 4;
    DoubleConstrainedValue = 4;
    BoolValue = 4;
    CustomEvent = 4;
    CustomEventReceiver = 4;
    TextureTrail = 4;
    FloorWire = 4;
    NumberValue = 4;
    StringValue = 4;
    Vector3Value = 4;
    CFrameValue = 4;
    Color3Value = 4;
    BrickColorValue = 4;
    ObjectValue = 4;
    SpecialMesh = 8;
    BlockMesh = 8;
    CylinderMesh = 8;
    Texture = 10;
    Sound = 11;
    EchoSoundEffect = 84;
    FlangeSoundEffect = 84;
    DistortionSoundEffect = 84;
    PitchShiftSoundEffect = 84;
    ChorusSoundEffect = 84;
    TremoloSoundEffect = 84;
    ReverbSoundEffect = 84;
    EqualizerSoundEffect = 84;
    CompressorSoundEffect = 84;
    SoundGroup = 85;
    SoundService = 31;
    Backpack = 20;
    StarterPack = 20;
    StarterPlayer = 79;
    StarterGear = 20;
    CoreGui = 46;
    PluginGuiService = 46;
    UIListLayout = 26;
    UIGridLayout = 26;
    UISizeConstraint = 26;
    UITextSizeConstraint = 26;
    UIAspectRatioConstraint = 26;
    StarterGui = 46;
    Chat = 33;
    ChatService = 33;
    LocalizationService = 92;
    MarketplaceService = 46;
    Sky = 28;
    ColorCorrectionEffect = 83;
    BloomEffect = 83;
    BlurEffect = 83;
    SunRaysEffect = 83;
    Humanoid = 9;
    Shirt = 43;
    Pants = 44;
    ShirtGraphic = 40;
    BodyGyro = 14;
    BodyPosition = 14;
    RocketPropulsion = 14;
    BodyVelocity = 14;
    BodyAngularVelocity = 14;
    BodyForce = 14;
    BodyThrust = 14;
    Teams = 23;
    Team = 24;
    Trail = 93;
    SpawnLocation = 25;
    NetworkClient = 16;
    NetworkServer = 15;
    Script = 6;
    LocalScript = 18;
    NetworkReplicator = 29;
    Model = 2;
    Status = 2;
    HopperBin = 22;
    Camera = 5;
    Players = 21;
    ReplicatedStorage = 70;
    ReplicatedFirst = 70;
    ServerStorage = 69;
    ServerScriptService = 71;
    Lighting = 13;
    TestService = 68;
    Debris = 30;
    Accoutrement = 32;
    Player = 12;
    Workspace = 19;
    Part = 1;
    TrussPart = 1;
    WedgePart = 1;
    PrismPart = 1;
    PyramidPart = 1;
    ParallelRampPart = 1;
    RightAngleRampPart = 1;
    CornerWedgePart = 1;
    PlayerGui = 46;
    PlayerScripts = 78;
    StarterPlayerScripts = 78;
    StarterCharacterScripts = 78;
    GuiMain = 47;
    ScreenGui = 47;
    BillboardGui = 64;
    SurfaceGui = 64;
    Frame = 48;
    ScrollingFrame = 48;
    ImageLabel = 49;
    TextLabel = 50;
    TextButton = 51;
    TextBox = 51;
    GuiButton = 52;
    ImageButton = 52;
    Handles = 53;
    ArcHandles = 56;
    SelectionBox = 54;
    SelectionSphere = 54;
    SurfaceSelection = 55;
    Configuration = 58;
    HumanoidDescription = 104;
    NoCollisionConstraint = 105;
    Folder = 77;
    SelectionPartLasso = 57;
    SelectionPointLasso = 57;
    PartPairLasso = 57;
    Pose = 60;
    Keyframe = 60;
    Animation = 60;
    AnimationTrack = 60;
    AnimationController = 60;
    CharacterMesh = 60;
    Dialog = 62;
    DialogChoice = 63;
    UnionOperation = 73;
    NegateOperation = 72;
    MeshPart = 73;
    Terrain = 65;
    PointLight = 13;
    SpotLight = 13;
    SurfaceLight = 13;
    RemoteFunction = 74;
    RemoteEvent = 75;
    TerrainRegion = 65;
    ModuleScript = 76;
    LocalizationTable = 97;
}
 
-- Keys: class names
-- Values: name of the class the icon is borrowed from
-- Only specific icons are borrowed, no fallbacks or custom icons.
p.custom_icons_borrowed = {
    FileMesh = 'SpecialMesh',
    JointsService = 'Weld',
    ScriptContext = 'PlayerScripts',
    GroupService = 'Players',
    ChangeHistoryService = 'ServerStorage',
    OrderedDataStore = 'ServerStorage',
    Button = 'ImageLabel',
    NetworkMarker = 'ClientReplicator',
    PathfindingService = 'ForceField',
    NavigationService = 'ForceField',
    Chat = 'Message',
    KeyframeSequence = 'Keyframe',
    KeyframeSequenceProvider = 'Keyframe',
    Animator = 'Keyframe',
    ScriptDebugger = 'ModuleScript',
    InputObject = 'ClickDetector',
    ContextActionService = 'ClickDetector',
    RenderingTest='Camera';
    Dragger = 'ClickDetector',
    StatsItem = 'IntValue',
    RunningAverageItemDouble = 'IntValue',
    RunningAverageItemInt = 'IntValue',
    RunningAverageTimeIntervalItem = 'IntValue',
    TotalCountTimeIntervalItem = 'IntValue',
    BoxHandleAdornment = 'SelectionBox',
    ConeHandleAdornment = 'SelectionBox',
    CylinderHandleAdornment = 'SelectionBox',
    ImageHandleAdornment = 'SelectionBox',
    LineHandleAdornment = 'SelectionBox',
    SphereHandleAdornment = 'SelectionBox',
    Selection = 'SelectionBox',
    PhysicsService = 'Debris',
    RbxUtility = 'HopperBin',
    PluginGui = 'ScreenGui',
    TextService = 'TextLabel',
    TextFilterResult = 'TextLabel',
    Translator = 'Dialog',
    GamePassService = 'Workspace',
    GuiItem = 'Frame',
    TeleportService = 'ReplicatedStorage',
    FriendService = 'Players',
}
 
-- Keys: class names
-- Values: explorer image index
p.custom_icon_indices = {
    Button = 49,
    GuiService = 27,
}
 
-- Keys: class names
-- Values: file name for the icon
p.custom_icon_files = {
    AdService = "AdService.png",
    AssetService = "AssetService.png",
    BadgeService = "BadgeService.png",
    DataStoreService = "AssetService.png",
    GlobalDataStore = "AssetService.png",
    DebuggerWatch = "DebuggerWatch.png",
    DebuggerBreakpoint = "DebuggerBreakpoint.png",
    DebuggerManager = "DebuggerManager.png",
    Hole = "Hole.png",
    MotorFeature = "MotorFeature.png",
}
 
return p
Community content is available under CC-BY-SA unless otherwise noted.