Closed ericoporto closed 4 months ago
Is there a reason why not to share same chunk of code found in GUIController.SaveGameAsTemplate
?
https://github.com/adventuregamestudio/ags/blob/ad31da24686e6f78360a8a6bc827b5b914d4f089/Editor/AGS.Editor/GUI/GUIController.cs#L1177-L1189
i.e. pick that out to a private method and call from both, passing a filename, and anything else necessary, as an argument, and return a success/failure boolean result.
Maybe call command /maketemplate
, for clarity, and in case there will be another operation involving template at some point?
Yes, these changes are easy to do, I can try they.
What's your thoughts on rebuilding the game and saving here? I added those to make sure room.crm is updated, but Empty Game template for example has no room and will error when building (the error is ignored here). The other approach is too strictly only run the SaveGameAsTemplate and not recompile, and then the user would usually do both in a sequence in a CI.
Are there situations when the project is modified on load without user's interference?
Upgrading a project may theoretically involve changing file structure: the easiest example is ags3 -> ags4 upgrade, where room contents are unpacked into the subfolders. If a project file is not saved afterwards, then there may be inconsistencies between project version and file structure. This makes me think that saving the project is mandatory here.
EDIT: ...Unless you can make it to not run upgrade on load when making a template, and you think it's worth it and/or a correct behavior.
As for compilation, I am not certain. Maybe it's useful as a test that the game is valid... maybe it could be enabled/disabled with an additional command argument.
I left it exactly as it was - including it recompiling and saving. But I renamed the flag to maketemplate
and did the small refactor on GUI Controller to move the template saving code there.
The name of the template is set automatically as _agsEditor.CurrentGame.Settings.GameFileName + ".agt"
, which will cause it to be generated in the current working dir, which I think is always the game directory.
Another approach is to take two command line arguments so that it can receive a second parameter that is a fullpath of the target name of the template.
I am trying to figure a command line option to build a template in the editor from the command line, so it can be ran in a CI environment.
The idea would it be using it for automation purposes, like https://github.com/adventuregamestudio/ags-template-source/issues/27 .