Hand MTA the IPL index, section index and item index to make LOD implementation possible

This commit is contained in:
Fierelier 2021-09-12 18:41:10 +02:00
parent 93d125ff2d
commit c11fdadfad
2 changed files with 9 additions and 3 deletions

View File

@ -99,11 +99,11 @@ function registerObjectNow(id,model,texture,drawDistance)
displayStatus("Loaded model: " ..model.. ", " ..tostring(#objectsToRegister).. " remaining...")
end
function placeObject(...) -- id,interior,x,y,z,rx,ry,rz,rw,lod
function placeObject(...) -- iplIndex,sectionIndex,itemIndex,id,interior,x,y,z,rx,ry,rz,rw,lod
table.insert(objectsToPlace,arg)
end
function placeObjectNow(id,interior,x,y,z,rx,ry,rz,rw,lod)
function placeObjectNow(iplIndex,sectionIndex,itemIndex,id,interior,x,y,z,rx,ry,rz,rw,lod)
if objectRegister[id] == nil then return end
erx,ery,erz = fromQuaternion(rx,ry,rz,rw)
obj = createObject(objectRegister[id]["realID"],x,y + 6000,z,erx,ery,erz)

View File

@ -195,6 +195,7 @@ def main():
fileMeta.write('<script src="gta/' +ipl.replace("\\","/")+ '.lua" type="client"/>\n')
objectIDs = []
iplIndex = 0
for ipl in data["ipl"]:
pathIpl = p(pathOut,"gta",ipl.replace("\\",os.path.sep) + ".lua")
try:
@ -202,12 +203,17 @@ def main():
except:
pass
with open(pathIpl,"w") as fileIpl:
sectionIndex = 0
for section in data["ipl"][ipl]:
itemIndex = 0
if section == "inst":
for element in data["ipl"][ipl][section]:
if not element["id"] in objectIDs:
objectIDs.append(element["id"])
fileIpl.write('placeObject(' +element["id"]+ ',' +element["interior"]+ ',' +element["position"][0]+ ',' +element["position"][1]+ ',' +element["position"][2]+ ',' +element["rotation"][0]+ ',' +element["rotation"][1]+ ',' +element["rotation"][2]+ ',' +element["rotation"][3]+ ',' +element["lod"]+ ')\n')
fileIpl.write('placeObject(' +str(iplIndex)+ ',' +str(sectionIndex)+ ',' +str(itemIndex)+ ',' +element["id"]+ ',' +element["interior"]+ ',' +element["position"][0]+ ',' +element["position"][1]+ ',' +element["position"][2]+ ',' +element["rotation"][0]+ ',' +element["rotation"][1]+ ',' +element["rotation"][2]+ ',' +element["rotation"][3]+ ',' +element["lod"]+ ')\n')
itemIndex += 1
sectionIndex += 1
iplIndex += 1
modelNames = []
textureNames = []