| 1 | print=function(s) |
|---|
| 2 | Console.Print(tostring(s) .. "\n"); |
|---|
| 3 | end; |
|---|
| 4 | |
|---|
| 5 | exit=function() |
|---|
| 6 | quit=true; |
|---|
| 7 | end |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | function ph(grav) |
|---|
| 11 | grav=grav or -9.81; |
|---|
| 12 | runMapCmd("wait(3); crate_001:SetGravity(0, 0, "..grav..");"); |
|---|
| 13 | end |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | do |
|---|
| 17 | CleanupPersistentConfig("config_p.lua"); |
|---|
| 18 | local Result, ErrorMsg=loadfile("config_p.lua"); |
|---|
| 19 | |
|---|
| 20 | if (Result) then |
|---|
| 21 | Result(); |
|---|
| 22 | else |
|---|
| 23 | print("\nWarning: Error when running config_p.lua ("..ErrorMsg..").\n"); |
|---|
| 24 | end |
|---|
| 25 | end |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | MusicFiles=Console.GetDir("Games/DeathMatch/Music", "f"); |
|---|
| 30 | table.sort(MusicFiles, function (s1, s2) return s1:lower()<s2:lower(); end); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | LevelIntroTitles={}; |
|---|
| 34 | for FileNr, FileName in ipairs(MusicFiles) do |
|---|
| 35 | if ((FileName:sub(-4, -1)==".ogg" or FileName:sub(-4, -1)==".mp3") and FileName:find("Franka Jones, Track3")==nil) then |
|---|
| 36 | LevelIntroTitles[#LevelIntroTitles+1]="Games/DeathMatch/Music/"..FileName; |
|---|
| 37 | end |
|---|
| 38 | end |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | function StartLevelIntroMusic() |
|---|
| 42 | if (#LevelIntroTitles==0) then return end; |
|---|
| 43 | |
|---|
| 44 | local NextTitleNr=0; |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | local File=io.open("Games/DeathMatch/Music/NextTitle.txt", "rt"); |
|---|
| 48 | |
|---|
| 49 | if (File) then |
|---|
| 50 | NextTitleNr=(File:read("*number") or 0) % #LevelIntroTitles; |
|---|
| 51 | File:close(); |
|---|
| 52 | end |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | local File=io.open("Games/DeathMatch/Music/NextTitle.txt", "wt"); |
|---|
| 56 | |
|---|
| 57 | if (File) then |
|---|
| 58 | File:write((NextTitleNr+1) % #LevelIntroTitles); |
|---|
| 59 | File:close(); |
|---|
| 60 | end |
|---|
| 61 | |
|---|
| 62 | MusicLoad(LevelIntroTitles[NextTitleNr+1]); |
|---|
| 63 | MusicSetVolume(0.5); |
|---|
| 64 | MusicPlay(); |
|---|
| 65 | end |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | function pts2csv(fileName) |
|---|
| 69 | if fileName:sub(-4, -1):lower()==".pts" then |
|---|
| 70 | |
|---|
| 71 | fileName=fileName:sub(1, -5); |
|---|
| 72 | end |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | dofile(fileName .. ".pts"); |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | local csvFile=assert(io.open(fileName .. ".csv", "wt")); |
|---|
| 79 | |
|---|
| 80 | csvFile:write('"time","x","y","z","heading","info"\n'); |
|---|
| 81 | for i=1, #Points do |
|---|
| 82 | csvFile:write("\"", table.concat(Points[i], "\",\""), "\"\n"); |
|---|
| 83 | end |
|---|
| 84 | |
|---|
| 85 | csvFile:close(); |
|---|
| 86 | end |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | sv_rc_password="ca3de"; |
|---|
| 94 | cl_rc_password="ca3de"; |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | print("config.lua processed."); |
|---|