forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Что этот PR делает Упрощение создания модуля. По сути то что делал фуриор на пару, но с некоторыми улучшениями (Спасибо чатгпт xdd) - Модуль автоматом инклюдится в корневой `.dme`, при этом все инклюды модулей сортируются в алфавитном порядке - В папке модуля создаётся папка icons - В датуме модуля, фуриор заменяется на имя папки юзера ## Тестирование Я заебался удалять тестовые папки ## Summary by Sourcery New Features: - Add a script to simplify the creation of new modules for the project.
- Loading branch information
Showing
2 changed files
with
42 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@echo off | ||
set /p moduleName="Enter module name: " | ||
set "moduleName=%moduleName: =_%" | ||
|
||
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)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters