mirror of
https://github.com/dvdvideo1234/TrackAssemblyTool.git
synced 2025-03-04 03:13:32 -05:00
Replaced: Some concatenations with GetReport
Updated: Date/Time handlers Updated: Variables reset Renamed: StevenTechno's first pack to `1.0` Added: Category extractor and name manipulator for ST's buildings 2.0
This commit is contained in:
parent
2a83cd6a77
commit
4402a207c2
@ -48,14 +48,14 @@ set emd_chew_adddir[4]=SProps
|
||||
set emd_chew_adddir[5]=Magnum's Rails
|
||||
set emd_chew_adddir[6]=Shinji85's Rails
|
||||
set emd_chew_adddir[7]=SligWolf's Railcar
|
||||
set emd_chew_adddir[8]=StephenTechno's Buildings
|
||||
set emd_chew_adddir[8]=StevenTechno's Buildings 1.0
|
||||
set emd_chew_adddir[9]=Mr.Train's M-Gauge
|
||||
set emd_chew_adddir[10]=G Scale Track Pack
|
||||
set emd_chew_adddir[11]=Ron's Minitrain Props
|
||||
set emd_chew_adddir[12]=Battleship's abandoned rails
|
||||
set emd_chew_adddir[13]=AlexCookie's 2ft track pack
|
||||
set emd_chew_adddir[14]=Joe's track pack
|
||||
set emd_chew_adddir[15]=StephenTechno's Buildings 2.0
|
||||
set emd_chew_adddir[15]=StevenTechno's Buildings 2.0
|
||||
|
||||
:: AUTOMATIC STUFF ::
|
||||
|
||||
|
@ -72,7 +72,7 @@ local gtInitLogs = {"*Init", false, 0}
|
||||
|
||||
------ CONFIGURE ASMLIB ------
|
||||
asmlib.InitBase("track","assembly")
|
||||
asmlib.SetOpVar("TOOL_VERSION","7.578")
|
||||
asmlib.SetOpVar("TOOL_VERSION","7.579")
|
||||
asmlib.SetIndexes("V" , "x", "y", "z")
|
||||
asmlib.SetIndexes("A" ,"pitch","yaw","roll")
|
||||
asmlib.SetIndexes("WV",1,2,3)
|
||||
@ -207,9 +207,9 @@ cvarsAddChangeCallback(gsVarName, function(sVar, vOld, vNew)
|
||||
local mkTab, ID = asmlib.GetBuilderID(1), 1
|
||||
while(mkTab) do local sTim = arTim[ID]
|
||||
local defTab = mkTab:GetDefinition(); mkTab:TimerSetup(sTim)
|
||||
asmlib.LogInstance("Timer apply {"..defTab.Nick.."}<"..tostring(sTim)..">",gtInitLogs)
|
||||
asmlib.LogInstance("Timer apply "..asmlib.GetReport2(defTab.Nick,sTim),gtInitLogs)
|
||||
ID = ID + 1; mkTab = asmlib.GetBuilderID(ID) -- Next table on the list
|
||||
end; asmlib.LogInstance("Timer update <"..tostring(vNew)..">",gtInitLogs)
|
||||
end; asmlib.LogInstance("Timer update "..asmlib.GetReport(vNew),gtInitLogs)
|
||||
end, gsVarName..gsCbcHash)
|
||||
|
||||
-------- RECORDS ----------
|
||||
@ -227,7 +227,7 @@ asmlib.SetOpVar("STRUCT_SPAWN",{
|
||||
local fmt = asmlib.GetOpVar("FORM_DRAWDBG")
|
||||
local fky = asmlib.GetOpVar("FORM_DRWSPKY")
|
||||
for iR = 1, 4 do
|
||||
local out = "{"..tostring(iR).."}["..tableConcat(tab[iR], ",").."]"
|
||||
local out = asmlib.GetReport2(iR,tableConcat(tab[iR], ","))
|
||||
scr:DrawText(fmt:format(fky:format(key), typ, out, inf))
|
||||
end
|
||||
end,
|
||||
@ -682,17 +682,7 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
|
||||
function(oPly,oCom,oArgs) gtArgsLogs[1] = "*RESET_VARIABLES"
|
||||
local devmode = asmlib.GetAsmConvar("devmode", "BUL")
|
||||
asmlib.LogInstance("{"..tostring(devmode).."@"..tostring(command).."}",gtArgsLogs)
|
||||
if(not inputIsKeyDown(KEY_LSHIFT)) then
|
||||
asmlib.SetAsmConvar(oPly,"nextx" , 0)
|
||||
asmlib.SetAsmConvar(oPly,"nexty" , 0)
|
||||
asmlib.SetAsmConvar(oPly,"nextz" , 0)
|
||||
asmlib.SetAsmConvar(oPly,"nextpic", 0)
|
||||
asmlib.SetAsmConvar(oPly,"nextyaw", 0)
|
||||
asmlib.SetAsmConvar(oPly,"nextrol", 0)
|
||||
if(not devmode) then
|
||||
asmlib.LogInstance("Developer mode disabled",gtArgsLogs); return nil end
|
||||
asmlib.SetLogControl(asmlib.GetAsmConvar("logsmax" , "INT"), asmlib.GetAsmConvar("logfile" , "BUL"))
|
||||
else
|
||||
if(inputIsKeyDown(KEY_LSHIFT)) then
|
||||
if(not devmode) then
|
||||
asmlib.LogInstance("Developer mode disabled",gtArgsLogs); return nil end
|
||||
oPly:ConCommand("sbox_max"..asmlib.GetOpVar("CVAR_LIMITNAME").." 1500\n")
|
||||
@ -714,6 +704,17 @@ if(CLIENT) then asmlib.InitLocalify(varLanguage:GetString())
|
||||
asmlib.SetAsmConvar(oPly, "bnderrmod", "LOG")
|
||||
asmlib.SetAsmConvar(oPly, "maxfruse" , 50)
|
||||
asmlib.LogInstance("Variables reset complete",gtArgsLogs)
|
||||
else
|
||||
asmlib.SetAsmConvar(oPly,"nextx" , 0)
|
||||
asmlib.SetAsmConvar(oPly,"nexty" , 0)
|
||||
asmlib.SetAsmConvar(oPly,"nextz" , 0)
|
||||
asmlib.SetAsmConvar(oPly,"nextpic", 0)
|
||||
asmlib.SetAsmConvar(oPly,"nextyaw", 0)
|
||||
asmlib.SetAsmConvar(oPly,"nextrol", 0)
|
||||
if(devmode) then
|
||||
asmlib.SetLogControl(asmlib.GetAsmConvar("logsmax","INT"),
|
||||
asmlib.GetAsmConvar("logfile","BUL"))
|
||||
end
|
||||
end
|
||||
asmlib.LogInstance("Success",gtArgsLogs); return nil
|
||||
end)
|
||||
@ -2318,7 +2319,7 @@ else
|
||||
PIECES:Record({"models/props_viaduct_event/underworld_bridge04.mdl", "#", "#", 2, "", "-2.253, 480.851, 10.696", "0, 90,0"})
|
||||
PIECES:Record({"models/props_wasteland/bridge_low_res.mdl", "#", "#", 1, "", "5056, 219.145, 992.765", ""})
|
||||
PIECES:Record({"models/props_wasteland/bridge_low_res.mdl", "#", "#", 2, "", "-576, 219.145, 992.765", "0, 180,0"})
|
||||
asmlib.GetCategory("StephenTechno's Buildings",[[function(m)
|
||||
asmlib.GetCategory("StevenTechno's Buildings 1.0",[[function(m)
|
||||
local function conv(x) return " "..x:sub(2,2):upper() end
|
||||
local r = m:gsub("models/buildingspack/",""):gsub("_","/")
|
||||
local s = r:find("/"); r = (s and r:sub(1,s-1) or "")
|
||||
@ -3657,7 +3658,11 @@ else
|
||||
PIECES:Record({"models/joe/jtp/grades/1024_32.mdl", "#", "#", 1, "", "0,512,-9.43457", "0,90,0", ""})
|
||||
PIECES:Record({"models/joe/jtp/grades/1024_32.mdl", "#", "#", 2, "", "0,-512,22.56836", "0,-90,0", ""})
|
||||
PIECES:Record({"models/joe/jtp/throw/harpstand_2_pos.mdl", "#", "#", 1, "", "0, -86, 0", "", ""})
|
||||
asmlib.GetCategory("StephenTechno's Buildings 2.0")
|
||||
asmlib.GetCategory("StevenTechno's Buildings 2.0",[[function(m) local o = {r}
|
||||
local function conv(x) return " "..x:sub(2,2):upper() end
|
||||
local r = m:match("/.*/"):sub(2,-2):match("/.*$"):sub(2,-1)
|
||||
for i = 1, #o do o[i] = ("_"..o[i]):gsub("_%w", conv):sub(2,-1) end; return o end]])
|
||||
asmlib.ModelToNameRule("SET",nil,{"^[%d-_]*",""},nil)
|
||||
PIECES:Record({"models/roads_pack/single_lane/0-0_single_lane_x1.mdl", "#", "#", 1, "", "0,0,3.03125", "", ""})
|
||||
PIECES:Record({"models/roads_pack/single_lane/0-0_single_lane_x1.mdl", "#", "#", 2, "", "-72,0,3.03125", "0,-180,0", ""})
|
||||
if(gsMoDB == "SQL") then sqlCommit() end
|
||||
|
@ -254,9 +254,18 @@ function GetSign(nVal)
|
||||
end
|
||||
|
||||
-- Gets the date according to the specified format
|
||||
function GetDate()
|
||||
return (osDate(GetOpVar("DATE_FORMAT"))
|
||||
.." "..osDate(GetOpVar("TIME_FORMAT")))
|
||||
function GetDate(vD, fD)
|
||||
return osDate(fD or GetOpVar("DATE_FORMAT"), vD)
|
||||
end
|
||||
|
||||
-- Gets the time according to the specified format
|
||||
function GetTime(vT, fT)
|
||||
return osDate(fT or GetOpVar("TIME_FORMAT"), vT)
|
||||
end
|
||||
|
||||
-- Gets the date and time according to the specified format
|
||||
function GetDateTime(vDT, fDT)
|
||||
return GetDate(vDT, fDT).." "..GetTime(vDT, fDT)
|
||||
end
|
||||
|
||||
-- Strips a string from quotes
|
||||
@ -288,16 +297,17 @@ end
|
||||
local function Log(vMsg, bCon)
|
||||
local iMax = GetOpVar("LOG_MAXLOGS")
|
||||
if(iMax <= 0) then return end
|
||||
local sMsg = tostring(vMsg)
|
||||
local iCur = GetOpVar("LOG_CURLOGS") + 1
|
||||
local sData = tostring(vMsg); SetOpVar("LOG_CURLOGS",iCur)
|
||||
if(IsFlag("en_logging_file") and not bCon) then
|
||||
local lbNam = GetOpVar("NAME_LIBRARY")
|
||||
local fName = GetOpVar("LOG_FILENAME")
|
||||
if(iCur > iMax) then iCur = 0; fileDelete(fName) end
|
||||
fileAppend(fName,GetLogID().." ["..GetDate().."] "..sData.."\n")
|
||||
if(iCur > iMax) then
|
||||
fileDelete(fName); SetOpVar("LOG_CURLOGS",1) end
|
||||
fileAppend(fName,GetLogID().." ["..GetDateTime().."] "..sMsg.."\n")
|
||||
else -- The current has values 1..nMaxLogs(0)
|
||||
if(iCur > iMax) then iCur = 0 end
|
||||
print(GetLogID().." ["..GetDate().."] "..sData)
|
||||
if(iCur > iMax) then SetOpVar("LOG_CURLOGS",1) end
|
||||
print(GetLogID().." ["..GetDateTime().."] "..sMsg)
|
||||
end
|
||||
end
|
||||
|
||||
@ -2717,7 +2727,7 @@ function ExportCategory(vEq, tData, sPref)
|
||||
if(not F) then LogInstance("("..fPref..") fileOpen("..fName..") failed from"); return false end
|
||||
local sEq, nLen, sMoDB = ("="):rep(nEq), (nEq+2), GetOpVar("MODE_DATABASE")
|
||||
local tCat = (IsTable(tData) and tData or GetOpVar("TABLE_CATEGORIES"))
|
||||
F:Write("# "..sFunc..":("..tostring(nEq).."@"..fPref..") "..GetDate().." [ "..sMoDB.." ]\n")
|
||||
F:Write("# "..sFunc..":("..tostring(nEq).."@"..fPref..") "..GetDateTime().." [ "..sMoDB.." ]\n")
|
||||
for cat, rec in pairs(tCat) do
|
||||
if(IsString(rec.Txt)) then
|
||||
local exp = "["..sEq.."["..cat..sEq..rec.Txt:Trim().."]"..sEq.."]"
|
||||
@ -2797,7 +2807,7 @@ function ExportDSV(sTable, sPref, sDelim)
|
||||
local fsLog = GetOpVar("FORM_LOGSOURCE") -- read the log source format
|
||||
local ssLog = "*"..fsLog:format(defTab.Nick,sFunc,"%s")
|
||||
local sMoDB, symOff = GetOpVar("MODE_DATABASE"), GetOpVar("OPSYM_DISABLE")
|
||||
F:Write("#1 "..sFunc..":("..fPref.."@"..sTable..") "..GetDate().." [ "..sMoDB.." ]\n")
|
||||
F:Write("#1 "..sFunc..":("..fPref.."@"..sTable..") "..GetDateTime().." [ "..sMoDB.." ]\n")
|
||||
F:Write("#2 "..sTable..":("..makTab:GetColumnList(sDelim)..")\n")
|
||||
if(sMoDB == "SQL") then
|
||||
local Q = makTab:Select():Order(unpack(defTab.Query[sFunc])):Get()
|
||||
@ -2942,7 +2952,7 @@ function SynchronizeDSV(sTable, tData, bRepl, sPref, sDelim)
|
||||
LogInstance("("..fPref.."@"..sTable..") Sorting failed"); return false end
|
||||
local O = fileOpen(fName, "wb" ,"DATA"); if(not O) then
|
||||
LogInstance("("..fPref.."@"..sTable..") Write fileOpen("..fName..") failed"); return false end
|
||||
O:Write("# "..sFunc..":("..fPref.."@"..sTable..") "..GetDate().." [ "..sMoDB.." ]\n")
|
||||
O:Write("# "..sFunc..":("..fPref.."@"..sTable..") "..GetDateTime().." [ "..sMoDB.." ]\n")
|
||||
O:Write("# "..sTable..":("..makTab:GetColumnList(sDelim)..")\n")
|
||||
for iKey = 1, tSort.Size do local key = tSort[iKey].Val
|
||||
local vK = makTab:Match(key,1,true,"\"",true); if(not IsHere(vK)) then
|
||||
@ -2978,7 +2988,7 @@ function TranslateDSV(sTable, sPref, sDelim)
|
||||
LogInstance("("..fPref..") fileOpen("..sNdsv..") failed",sTable); return false end
|
||||
local I = fileOpen(sNins, "wb", "DATA"); if(not I) then
|
||||
LogInstance("("..fPref..") fileOpen("..sNins..") failed",sTable); return false end
|
||||
I:Write("# "..sFunc..":("..fPref.."@"..sTable..") "..GetDate().." [ "..sMoDB.." ]\n")
|
||||
I:Write("# "..sFunc..":("..fPref.."@"..sTable..") "..GetDateTime().." [ "..sMoDB.." ]\n")
|
||||
I:Write("# "..sTable..":("..makTab:GetColumnList(sDelim)..")\n")
|
||||
local sLine, isEOF, symOff = "", false, GetOpVar("OPSYM_DISABLE")
|
||||
local sFr, sBk = sTable:upper()..":Record({", "})\n"
|
||||
|
@ -1227,8 +1227,8 @@ function TOOL:DrawToolScreen(w, h)
|
||||
local workmode, workname = self:GetWorkingMode()
|
||||
scrTool:DrawCircle(xyPs, mathClamp(actrad/maxrad,0,1)*nRad, "c","SURF")
|
||||
scrTool:DrawCircle(xyPs, nRad, "m")
|
||||
scrTool:DrawText("Date: "..osDate(asmlib.GetOpVar("DATE_FORMAT")),"w")
|
||||
scrTool:DrawText("Time: "..osDate(asmlib.GetOpVar("TIME_FORMAT")))
|
||||
scrTool:DrawText("Date: "..asmlib.GetDate(),"w")
|
||||
scrTool:DrawText("Time: "..asmlib.GetTime())
|
||||
if(trRLen) then scrTool:DrawCircle(xyPs, nRad * mathClamp(trRLen/maxrad,0,1),"y") end
|
||||
scrTool:DrawText("Work: ["..workmode.."] "..workname, "wm")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user