From e5d4f62a357102ae6e4577cc8d63aaa6e1317fd2 Mon Sep 17 00:00:00 2001 From: Aylong <69762909+AyIong@users.noreply.github.com> Date: Sun, 19 Jan 2025 14:18:36 +0200 Subject: [PATCH 1/4] Simplify module creation --- modular_bandastation/create_modpack.bat | 28 +++++++++++++++++++ modular_bandastation/modular_bandastation.dme | 24 ++++++++-------- 2 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 modular_bandastation/create_modpack.bat diff --git a/modular_bandastation/create_modpack.bat b/modular_bandastation/create_modpack.bat new file mode 100644 index 0000000000000..dc79bba855e16 --- /dev/null +++ b/modular_bandastation/create_modpack.bat @@ -0,0 +1,28 @@ +@echo off +set /p moduleName="Enter module name: " + +xcopy "example" "%moduleName%" /s /i + +ren "%moduleName%\_example.dm" "_%moduleName%.dm" +ren "%moduleName%\_example.dme" "_%moduleName%.dme" +ren "%moduleName%\code\example.dm" "%moduleName%.dm" + +mkdir "%moduleName%\icons" + +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'Example modpack', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dm'" +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'example', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dm'" +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dme') -replace 'Example modpack', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dme'" +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dme') -replace 'example', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dme'" +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'furior', '%USERNAME%' | Set-Content '%moduleName%\_%moduleName%.dm'" + +Powershell -Command ^ + "$dmeFile = 'modular_bandastation.dme';" ^ + "$newInclude = '#include \"%moduleName%/_%moduleName%.dme\"';" ^ + "$lines = Get-Content $dmeFile;" ^ + "$startIndex = $lines.IndexOf('// --- MODULES START --- //') + 1;" ^ + "$endIndex = $lines.IndexOf('// --- MODULES END --- //');" ^ + "if ($startIndex -eq -1 -or $endIndex -eq -1) { Write-Host 'Error: Comments not found'; exit 1 }" ^ + "$before = $lines[0..($startIndex - 1)];" ^ + "$moduleLines = $lines[$startIndex..($endIndex - 1)] + $newInclude | Sort-Object;" ^ + "$after = $lines[($endIndex)..($lines.Length - 1)];" ^ + "Set-Content $dmeFile -Value ($before + $moduleLines + $after)" diff --git a/modular_bandastation/modular_bandastation.dme b/modular_bandastation/modular_bandastation.dme index f171704432e88..877348e573e6c 100644 --- a/modular_bandastation/modular_bandastation.dme +++ b/modular_bandastation/modular_bandastation.dme @@ -1,24 +1,26 @@ #include "_modpack.dm" #include "_modpacks.dm" +// --- MODULES START --- // #include "_defines220/_defines220.dme" #include "_helpers220/_helpers220.dme" #include "_rust_utils/_rust_utils.dme" #include "_signals220/_signals220.dme" #include "_singletons/_singletons.dme" -#include "title_screen/_title_screen.dme" #include "admin/_admin.dme" #include "aesthetics/_aesthetics.dme" #include "aesthetics_sounds/_aesthetics_sounds.dme" -#include "automapper/_automapper.dme" #include "ai_laws/_ai_laws.dme" #include "announcers/_announcers.dme" #include "autohiss/_autohiss.dme" +#include "automapper/_automapper.dme" +#include "automatic_crew_transfer/_automatic_crew_transfer.dme" #include "balance/_balance.dme" #include "barsigns/_barsigns.dme" #include "changelog/_changelog.dme" #include "chat_badges/_chat_badges.dme" #include "communication/_communication.dme" +#include "cryosleep/_cryosleep.dme" #include "customization/_customization.dme" #include "cyrillic_fixes/_cyrillic_fixes.dme" #include "database220/_database220.dme" @@ -26,31 +28,31 @@ #include "emote_panel/_emote_panel.dme" #include "examine_panel/_examine_panel.dme" #include "gunhud/_gunhud.dme" +#include "hydroponics/_hydroponics.dme" #include "jobs/_jobs.dme" +#include "jukebox/_jukebox.dme" #include "keybinding/_keybinding.dme" #include "loadout/_loadout.dme" #include "mapping/_mapping.dme" #include "medical/_medical.dme" #include "mobs/_mobs.dme" #include "nanomap/_nanomap.dme" +#include "objects/_objects.dme" +#include "orderables/_orderables.dme" +#include "outfits/_outfits.dme" +#include "overrides/_overrides.dme" #include "pixel_shift/_pixel_shift.dme" +#include "preferences/_preferences.dme" #include "ru_jobs/_ru_jobs.dme" #include "security_levels/_security_levels.dme" #include "species/_species.dme" +#include "title_screen/_title_screen.dme" #include "translations/_translations.dme" #include "tts/_tts.dme" #include "turfs/_turfs.dme" #include "whitelist220/_whitelist220.dme" #include "world_topics/_world_topics.dme" -#include "preferences/_preferences.dme" -#include "jukebox/_jukebox.dme" -#include "cryosleep/_cryosleep.dme" -#include "objects/_objects.dme" -#include "orderables/_orderables.dme" -#include "automatic_crew_transfer/_automatic_crew_transfer.dme" -#include "outfits/_outfits.dme" -#include "overrides/_overrides.dme" -#include "hydroponics/_hydroponics.dme" +// --- MODULES END --- // // --- PRIME --- // From c4eeb6b552957264bec37036700658d9102c7e47 Mon Sep 17 00:00:00 2001 From: Aylong <69762909+AyIong@users.noreply.github.com> Date: Sun, 19 Jan 2025 15:07:08 +0200 Subject: [PATCH 2/4] Add visible name and desc input --- modular_bandastation/create_modpack.bat | 12 +++++++++--- modular_bandastation/example/_example.dm | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/modular_bandastation/create_modpack.bat b/modular_bandastation/create_modpack.bat index dc79bba855e16..06147add87848 100644 --- a/modular_bandastation/create_modpack.bat +++ b/modular_bandastation/create_modpack.bat @@ -1,5 +1,11 @@ @echo off -set /p moduleName="Enter module name: " +set /p moduleName="Введите название модуля. Например: example_module: " +set "moduleName=%moduleName: =_%" + +set /p moduleVisibleName="Введите видимое в игре название модуля. Например: Example module: " +set "moduleVisibleName=%moduleVisibleName:_= %" + +set /p moduleDesc="Введите описание модуля. Например: Это тестовый модуль: " xcopy "example" "%moduleName%" /s /i @@ -9,9 +15,9 @@ ren "%moduleName%\code\example.dm" "%moduleName%.dm" mkdir "%moduleName%\icons" -Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'Example modpack', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dm'" +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'Example name', '%moduleVisibleName%' | Set-Content '%moduleName%\_%moduleName%.dm'" +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'Example desc', '%moduleDesc%' | Set-Content '%moduleName%\_%moduleName%.dm'" Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'example', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dm'" -Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dme') -replace 'Example modpack', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dme'" Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dme') -replace 'example', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dme'" Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'furior', '%USERNAME%' | Set-Content '%moduleName%\_%moduleName%.dm'" diff --git a/modular_bandastation/example/_example.dm b/modular_bandastation/example/_example.dm index 2343367184030..d55b6fc8ce4df 100644 --- a/modular_bandastation/example/_example.dm +++ b/modular_bandastation/example/_example.dm @@ -1,8 +1,8 @@ /datum/modpack/example /// A string name for the modpack. Used for looking up other modpacks in init. - name = "Example modpack" + name = "Example name" /// A string desc for the modpack. Can be used for modpack verb list as description. - desc = "its useless" + desc = "Example desc" /// A string with authors of this modpack. author = "furior" From f0ec23f2dd3959f49d441791f1b6199c185634df Mon Sep 17 00:00:00 2001 From: Aylong <69762909+AyIong@users.noreply.github.com> Date: Sun, 19 Jan 2025 15:09:22 +0200 Subject: [PATCH 3/4] Revert "Add visible name and desc input" This reverts commit c4eeb6b552957264bec37036700658d9102c7e47. --- modular_bandastation/create_modpack.bat | 12 +++--------- modular_bandastation/example/_example.dm | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/modular_bandastation/create_modpack.bat b/modular_bandastation/create_modpack.bat index 06147add87848..dc79bba855e16 100644 --- a/modular_bandastation/create_modpack.bat +++ b/modular_bandastation/create_modpack.bat @@ -1,11 +1,5 @@ @echo off -set /p moduleName="Введите название модуля. Например: example_module: " -set "moduleName=%moduleName: =_%" - -set /p moduleVisibleName="Введите видимое в игре название модуля. Например: Example module: " -set "moduleVisibleName=%moduleVisibleName:_= %" - -set /p moduleDesc="Введите описание модуля. Например: Это тестовый модуль: " +set /p moduleName="Enter module name: " xcopy "example" "%moduleName%" /s /i @@ -15,9 +9,9 @@ ren "%moduleName%\code\example.dm" "%moduleName%.dm" mkdir "%moduleName%\icons" -Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'Example name', '%moduleVisibleName%' | Set-Content '%moduleName%\_%moduleName%.dm'" -Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'Example desc', '%moduleDesc%' | Set-Content '%moduleName%\_%moduleName%.dm'" +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'Example modpack', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dm'" Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'example', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dm'" +Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dme') -replace 'Example modpack', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dme'" Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dme') -replace 'example', '%moduleName%' | Set-Content '%moduleName%\_%moduleName%.dme'" Powershell -Command "(Get-Content '%moduleName%\_%moduleName%.dm') -replace 'furior', '%USERNAME%' | Set-Content '%moduleName%\_%moduleName%.dm'" diff --git a/modular_bandastation/example/_example.dm b/modular_bandastation/example/_example.dm index d55b6fc8ce4df..2343367184030 100644 --- a/modular_bandastation/example/_example.dm +++ b/modular_bandastation/example/_example.dm @@ -1,8 +1,8 @@ /datum/modpack/example /// A string name for the modpack. Used for looking up other modpacks in init. - name = "Example name" + name = "Example modpack" /// A string desc for the modpack. Can be used for modpack verb list as description. - desc = "Example desc" + desc = "its useless" /// A string with authors of this modpack. author = "furior" From 972d245c0c5b7d69826b0feb83fc81ab70fcc55c Mon Sep 17 00:00:00 2001 From: Aylong <69762909+AyIong@users.noreply.github.com> Date: Sun, 19 Jan 2025 15:09:46 +0200 Subject: [PATCH 4/4] Update create_modpack.bat --- modular_bandastation/create_modpack.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/modular_bandastation/create_modpack.bat b/modular_bandastation/create_modpack.bat index dc79bba855e16..432d7fff35f99 100644 --- a/modular_bandastation/create_modpack.bat +++ b/modular_bandastation/create_modpack.bat @@ -1,5 +1,6 @@ @echo off set /p moduleName="Enter module name: " +set "moduleName=%moduleName: =_%" xcopy "example" "%moduleName%" /s /i