|
@echo off |
|
|
|
rem Put in "addons" folder |
|
|
|
set basedir=%~dp0 |
|
|
|
rem Make sure you are in the addons directory |
|
cd %basedir% |
|
|
|
setlocal ENABLEDELAYEDEXPANSION |
|
|
|
|
|
rem How many addons do you need? |
|
set /A addonCount=500 |
|
|
|
echo This will create %addonCount% dummy addons. |
|
set /P continueScript=Do you want to continue (Y/[N])? |
|
|
|
IF /I "%continueScript%" NEQ "Y" GOTO FINISH |
|
|
|
|
|
rem Insert the dummy script as serverside only script (1 = On, 0 = Off) |
|
set /A serversideOnlyLua=1 |
|
|
|
rem Insert the dummy script as clientside only script (1 = On, 0 = Off) |
|
set /A clientsideOnlyLua=0 |
|
|
|
rem Path of the dummy files to create, unwanted files can be removed by commenting them out |
|
set luaPath=lua\autorun |
|
set luaPathServerOnly=lua\autorun\server |
|
set luaPathClientOnly=lua\autorun\client |
|
set soundPath=sound\_test_addon_dummies |
|
|
|
|
|
rem Prefix for addon folders |
|
set addonPrefix=_test_addon_dummy_ |
|
|
|
rem Temporary file name for the sound file |
|
set dummySoundFile=_dummy_sound.wav |
|
|
|
rem A copy of sound/synth/sine_1760.wav from Wiremod as hex code |
|
set dummySoundFileData= ^ |
|
52 49 46 46 B6 00 00 00 57 41 56 45 66 6D 74 20 ^ |
|
10 00 00 00 01 00 01 00 44 AC 00 00 88 58 01 00 ^ |
|
02 00 10 00 64 61 74 61 32 00 00 00 8E F5 10 E0 ^ |
|
91 CC 49 BC 3F B0 31 A9 92 A7 79 AB AC B4 94 C2 ^ |
|
54 D4 CF E8 BD FE BF 14 76 29 94 3B F9 49 BD 53 ^ |
|
44 58 46 57 D2 50 50 45 78 35 48 22 F2 0C 63 75 ^ |
|
65 20 1C 00 00 00 01 00 00 00 01 00 00 00 00 00 ^ |
|
00 00 64 61 74 61 00 00 00 00 00 00 00 00 00 00 ^ |
|
00 00 4C 49 53 54 34 00 00 00 61 64 74 6C 6C 74 ^ |
|
78 74 14 00 00 00 01 00 00 00 19 00 00 00 72 67 ^ |
|
6E 20 00 00 00 00 00 00 00 00 6C 61 62 6C 0C 00 ^ |
|
00 00 01 00 00 00 4C 6F 6F 70 20 30 31 00 |
|
|
|
rem Clean up old addons starting with _test_addon_dummy_ (%addonPrefix%) |
|
echo. |
|
echo Deleteing old dummy addons starting with %addonPrefix%* ... |
|
for /d %%G in (%addonPrefix%*) do ( |
|
rd /S /Q "%%~G" 2> nul |
|
echo Deleted addon %%~G |
|
) |
|
|
|
rem Config validation |
|
set /A addLuaFile=1 |
|
set /A addSoundFile=1 |
|
set /A addCSLuaFile=1 |
|
|
|
if %serversideOnlyLua% EQU 1 ( |
|
set luaPath=%luaPathServerOnly% |
|
) |
|
|
|
if %clientsideOnlyLua% EQU 1 ( |
|
set luaPath=%luaPathClientOnly% |
|
) |
|
|
|
if "%luaPath%"=="" ( |
|
set addLuaFile=0 |
|
) |
|
|
|
if %addonCount% LEQ 0 ( |
|
set addLuaFile=0 |
|
) |
|
|
|
if "%soundPath%"=="" ( |
|
set addSoundFile=0 |
|
) |
|
|
|
if "%dummySoundFile%"=="" ( |
|
set addSoundFile=0 |
|
) |
|
|
|
if "%dummySoundFileData%"=="" ( |
|
set addSoundFile=0 |
|
) |
|
|
|
if %addonCount% LEQ 0 ( |
|
set addSoundFile=0 |
|
) |
|
|
|
if %serversideOnlyLua% EQU 1 ( |
|
set addCSLuaFile=0 |
|
) |
|
|
|
if %clientsideOnlyLua% EQU 1 ( |
|
set addCSLuaFile=0 |
|
) |
|
|
|
rem create dummy sound dummy file from hex |
|
if %addSoundFile% EQU 1 ( |
|
|
|
echo. |
|
echo Creating dummy sound file: !dummySoundFile! |
|
|
|
del /F /Q %dummySoundFile% 2> nul |
|
|
|
echo %dummySoundFileData%> %dummySoundFile%.tmp |
|
certutil -f -decodehex %dummySoundFile%.tmp %dummySoundFile% >nul |
|
del /F /Q %dummySoundFile%.tmp 2> nul |
|
) |
|
|
|
if %addLuaFile% NEQ 1 ( |
|
if %addSoundFile% NEQ 1 ( |
|
goto FINISH |
|
) |
|
) |
|
|
|
echo. |
|
set /A addonsCreated=0 |
|
|
|
for /l %%x in (1, 1, %addonCount%) do ( |
|
set fx=000000%%x |
|
set fx=!fx:~-5! |
|
|
|
set addonName=%addonPrefix%!fx! |
|
mkdir !addonName! 2> nul |
|
|
|
set /A addonsCreated=addonsCreated+1 |
|
|
|
rem create the lua dummy file |
|
|
|
if %addLuaFile% EQU 1 ( |
|
set folderAddonLua=!addonName!\%luaPath% |
|
|
|
mkdir !folderAddonLua! 2> nul |
|
|
|
set filename=!addonName!.lua |
|
set file=!folderAddonLua!\!filename! |
|
set fileOutput=!file:\=/! |
|
|
|
echo Creating file: !file! ^(%%x / %addonCount%^) |
|
|
|
echo -- Dummyfile !fileOutput!>> !file! |
|
echo.>> !file! |
|
|
|
if %addCSLuaFile% EQU 1 ( |
|
echo if SERVER then AddCSLuaFile^(^) end>> !file! |
|
echo.>> !file! |
|
) |
|
|
|
echo print^("!fileOutput!"^)>> !file! |
|
echo.>> !file! |
|
|
|
echo return true>> !file! |
|
|
|
echo.>> !file! |
|
echo.>> !file! |
|
) |
|
|
|
rem copy the sound dummy file |
|
|
|
if %addSoundFile% EQU 1 ( |
|
set folderAddonSound=!addonName!\%soundPath% |
|
|
|
mkdir !folderAddonSound! 2> nul |
|
|
|
set filename=!addonName!.wav |
|
set file=!folderAddonSound!\!filename! |
|
|
|
echo Creating file: !file! ^(%%x / %addonCount%^) |
|
|
|
copy /B /Y %dummySoundFile% !file! /B 1> nul |
|
) |
|
) |
|
|
|
if %addSoundFile% EQU 1 ( |
|
del /F /Q %dummySoundFile% 2> nul |
|
|
|
echo. |
|
echo Deleted temp dummy sound file %dummySoundFile% |
|
) |
|
|
|
:FINISH |
|
|
|
set /A addonsCreated=addonsCreated |
|
|
|
cd %basedir% |
|
|
|
echo. |
|
echo %addonsCreated% addons created. |
|
|
|
endlocal |
|
|
|
echo Press any key to close. |
|
pause > nul |
|
|
|
@echo on |
|
@exit /B 0 |