Skip to content
IDMarinas edited this page Jul 29, 2021 · 4 revisions

Migrate Module to Bundle System

Here are some tips to migrate your old modules to the new Bundle system.

At the moment not all modules can be migrated to a Bundle.

Modules that CAN'T be migrated to a Bundle

  • Modules that use module_addeventhook i.e. the special events system of the game.
    • For example, special events in the forest, the village...
  • Modules that make use of the prefs or prefs-* (like prefs-drinks, prefs-mounts...) configuration for now there is no option to transfer this data.

Modules which CAN be migrated to a Bundle

  • Modules that do not fall under the previous section, there should be no problem to migrate them to a Bundle.

Migration tips

  • If the module uses settings for its configuration. You should use the configuration of a Symfony Bundle.
  • For user prefs prefs I'm preparing a Bundle Settings that allow set a settings for bundle and/or user
    • These settings are intended to save certain settings for the user or the bundle itself that will change during runtime.
    • In case you do not need the settings to change at runtime it is better to use the Symfony Bundle configuration system.
  • Modules that use MODULE_run for show content with runmodule.php?module=*.
    • Use:
      • Create controllers for your new Bundle
      • If your module use:
            function MODULE_getmoduleinfo()
            {
                return [
                    //....
                    'allowanonymous'      => true,
                    'override_forced_nav' => true,
                    //....
                ];
            }
        • Replace this with:
          • Implement in controller interface Lotgd\Core\Controller\LotgdControllerInterface
            • Configure as you need. Remember that this configuration is for all methods in controller.
              • If you need some method public and other for user logged, create diferent controller.
      • Replace runmodule.php?module=MODULE_NAME for runmodule.php?method=METHOD_NAME&controller=urlencode(CONTROLLER_NAME)
            //-- Example
            $url = 'runmodule.php?method=index&controller='.urlencode(\Lotgd\Local\Controller\ModuleController::class);
            \LotgdNavigation::addNav('Do anything', $url);

Example of modules migrated to a Bundle system.

New versions: 5.2.* and newer

Game

New versions: 5.0.* to 5.1.*

Game

Older versions: 4.4.* to 4.12.*

Game

Older versions: 4.3.* and earlier

Game Installation

Game Build

Game Development

Advices/Answers

Clone this wiki locally