FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    The current pre-release of the client ("pioneer" in the version) is only compatible to itself. So you can only play with other testers. Please be aware!

    Actions Grid Panel

    Scheduled Pinned Locked Moved Modding & Tools
    8 Posts 3 Posters 990 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Ctrl-KC Offline
      Ctrl-K
      last edited by

      An upcoming extendable UI mod providing actions grid panel. Panel is used to provide actions that can be performed with current selection.

      Sample exenstions are:

      • Enhancements extension:
        6ad9d023-9a05-4ede-8d55-c9f2d1ba9ae9-image.png
      • Factory templates extension:
        43d93e8b-c84d-4df7-b1af-55c6d19f6cec-image.png

      Panel supports various settings and can be adjusted if needed:
      9efc8392-3ffe-4ab5-83c6-1665bffb80d4-image.png
      Extensions can be enabled/disabled via dedicated selector:
      707952ef-705c-438b-b974-35e5d38d387a-image.png

      Stay tuned!

      “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
      — Steve Jobs.
      My UI Mods
      Support me

      1 Reply Last reply Reply Quote 9
      • Ctrl-KC Offline
        Ctrl-K
        last edited by Ctrl-K

        How to make your own extension
        Extension starts with specifying in mod_info.lua that mod has anything for actions grid panel to work with.

        AGP = "ExampleHandler"

        In mod’s folder there must be a file with the same name containing a class with the same name.

        ExampleHandler.lua:

        --Generic imports for interfaces
        local ISelectionHandler = import("/mods/AGP/modules/ISelectionHandler.lua").ISelectionHandler
        
        local IItemComponent = import("/mods/AGP/modules/IItemComponent.lua").IItemComponent
        
        
        ---Handler class must implement ISelectionHandler interface to function. 
        ---It also must have a dedicated component class implementing IItemComponent.
        ---@class ExampleHandler : ISelectionHandler
        ExampleHandler = Class(ISelectionHandler)
        {
        	--Name of the extension displayed in extensions selector 
            Name = "Example extension",
        
        	--Description of the extension displayed in extensions selector
            Description = "Extension for testing purposes",
        
        	--Decides whether extension is enabled by default of not
            Enabled = false,
        
        	--called when player’s selection is changed. Here is a logic for providing grid with actions of this extension in particular. These actions then are processed by component below.
            ---@param self ExampleHandler
            ---@param selection UserUnit[]
            ---@return any[]?
            OnSelectionChanged = function(self, selection)    
            end,
        
          	--component class that receives action provided by handler. Since each item in grid has multiple components at once it is important to ensure that active one is not interrupted by disabled ones. Here is interface for it.
            ---@class ExampleComponent : IItemComponent
            ComponentClass = Class(IItemComponent)
            {
                ---Called when component is bond to an item. Initialize your controls and logic here.
                ---@param self ExampleComponent
                ---@param item Item
                Create = function(self, item)
                end,
                
                ---Called when grid item receives an event
                ---@param self ExampleComponent
                ---@param item Item
                ---@param event KeyEvent
                HandleEvent = function(self, item, event)
                end,
        
                ---Called when item is activated with this component. Here you show and enable components controls and logic
                ---@param self ExampleComponent
                ---@param item Item
                Enable = function(self, item)
                end,
        
        		--called when component receives action it is bond to
                ---@param self ExampleComponent
                ---@param action string
        		SetAction = function(self, action)
                end,  
        
                ---Called when item is changing an event handler. Here you hide and disable controls of the component 
                ---@param self ExampleComponent
                ---@param item Item
                Disable = function(self, item)
                end,
        
                ---Called when component is being destroyed. Clear all fields you had and destroy controls.
                ---@param self ExampleComponent
                Destroy = function(self)
                end,
            },
        }
        

        “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
        — Steve Jobs.
        My UI Mods
        Support me

        1 Reply Last reply Reply Quote 0
        • Ctrl-KC Offline
          Ctrl-K
          last edited by

          Mod is uploaded with Factory Templates extension.

          “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
          — Steve Jobs.
          My UI Mods
          Support me

          1 Reply Last reply Reply Quote 2
          • IndexLibrorumI Online
            IndexLibrorum Global Moderator
            last edited by

            Looks useful, good stuff.

            "Design is an iterative process. The required number of iterations is one more than the number you have currently done. This is true at any point in time."

            See all my projects:

            1 Reply Last reply Reply Quote 0
            • Ctrl-KC Offline
              Ctrl-K
              last edited by Ctrl-K

              Updated how to create your own extension. this looks ugly but I was doing that one not on pc 😛
              It also lacks proper syntax highlighting 😞 @Brutus5000 is there a possibility that it will be fixed?

              “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
              — Steve Jobs.
              My UI Mods
              Support me

              1 Reply Last reply Reply Quote 0
              • Ctrl-KC Offline
                Ctrl-K
                last edited by Ctrl-K

                Since there is no proper syntax highlighting I've added it to Mods README.

                “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
                — Steve Jobs.
                My UI Mods
                Support me

                1 Reply Last reply Reply Quote 0
                • C Offline
                  czqawa
                  last edited by

                  Are you still working on the mod? rn i use it only for factory templates and build templates will be very useful

                  1 Reply Last reply Reply Quote 0
                  • Ctrl-KC Offline
                    Ctrl-K
                    last edited by

                    Hello! @czqawa mod is only a base for other mods to expand it. Right now there are Factory Templates and Enhancements extensions, plus one for debugging the game. I'm not planning adding more just yet, because I'm busy with other project.

                    “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.”
                    — Steve Jobs.
                    My UI Mods
                    Support me

                    1 Reply Last reply Reply Quote -1
                    • Ctrl-KC Ctrl-K referenced this topic on
                    • First post
                      Last post