- Timestamp:
- Dec 4, 2008, 10:49:52 PM (16 years ago)
- Location:
- data/contentcreation/pps/MirkoKaiser/CuboidSS/Version2/levels
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
data/contentcreation/pps/MirkoKaiser/CuboidSS/Version2/levels/CuboidSpaceStation2.2.lua
r5306 r5307 1 --<?lua2 3 4 function createSpaceStation()5 1 -- This lua script creates a totally random generated space station for the orxonox computer game! 6 2 7 3 8 4 5 -- This function creates a randomly generated space station. 6 -- The first three arguments (xPos,yPos,zPos) are the position of the space station. 7 -- The next tree arguments (xVel,yVel,zVel) are the velocity of the space station. 8 -- The arguments (xRotAxis,yRotAxis,zRotAxis) are the rotation axis, with respect to which the space ship will rotate. Each argument can be 0 or 1. 9 -- The argument RotRate defines how fast the space station will rotate. 10 -- The arguments (xRotOnce,yRotOnce,zRotOnce) define in which direction the space station will face, if they are all zero, the station will face into the negative 11 -- z-direction, and the positive y-direction is the top side of the station. 12 function createSpaceStation(xPos,yPos,zPos, xVel,yVel,zVel, xRotAxis,yRotAxis,zRotAxis, RotRate, xRotOnce,yRotOnce,zRotOnce) 13 14 15 9 16 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 10 17 -- This prints xml code, which creates a MovableEntity, which I need to attach all the parts of the space station. 11 12 -- If you want to move, rotate or displace the whole space station, this is the line you have to change. 13 print("<MovableEntity scale=1 position=\"0,0,") print(-500) ("\" velocity=\"0,0,0\" rotationaxis=\"0,0,1\" rotationrate=0 yaw=180 >") 18 print("<MovableEntity scale=1 position=\"") print(xPos) print(",") print(yPos) print(",") print(zPos) 19 print("\" velocity=\"") print(xVel) print(",") print(yVel) print(",") print(zVel) 20 print("\" rotationaxis=\"") print(xRotAxis) print(",") print(yRotAxis) print(",") print(zRotAxis) print("\" rotationrate=") print(RotRate) 21 print(" pitch=") print(xRotOnce) print(" yaw=") print(yRotOnce) print(" roll=") print(zRotOnce) print(" >") 14 22 -- End create Movable Entity. 15 23 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 249 257 bodyParts[leftSidePartsIndex[1]][0][0][0][5]="roll=90 pitch="..math.random(0,180) 250 258 bodyParts[rightSidePartsIndex[1]][0][0][0][6]="roll=-90 pitch="..math.random(0,180) 251 259 bodyParts[rightSidePartsIndex[1]][0][0][0][8]="rotationaxis=\"1,0,0\" rotationrate=5" 252 260 bodyParts[leftSidePartsIndex[1]][0][0][0][0]=1 253 261 bodyParts[leftSidePartsIndex[1]][0][0][1][0]=1 … … 545 553 if check == 1 then 546 554 -- This prints the part. 547 printModel(x,y,z,tempSidePartIndex, false,1)555 printModel(x,y,z,tempSidePartIndex,true,1) 548 556 partSet=1 549 557 -- This actualizes the grid array with the values of the array bodyParts at the position tempSidePartIndex. … … 599 607 if check == 1 then 600 608 -- This prints the part. 601 printModel(x,y,z,tempSidePartIndex, false,2)609 printModel(x,y,z,tempSidePartIndex,true,2) 602 610 partSet=1 603 611 -- This actualizes the grid array with the values of the array bodyParts at the position tempSidePartIndex. … … 737 745 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 738 746 739 end 740 741 --?> 747 748 749 -- End the createSpaceStation function. 750 end 751 752 753 -
data/contentcreation/pps/MirkoKaiser/CuboidSS/Version2/levels/CuboidSpaceStation2.lua
r5300 r5307 1 1 <?lua 2 3 4 2 5 -- This lua script creates a totally random generated space station for the orxonox computer game! 3 6 7 8 9 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4 10 -- This prints xml code, which creates a MovableEntity, which I need to attach all the parts of the space station, if you want to move, rotate or displace the whole space station, this is the line you have to change. 5 11 print("<MovableEntity scale=1 position=\"0,0,-5000\" velocity=\"0,0,0\" rotationaxis=\"0,0,1\" rotationrate=0 yaw=180 >") 6 7 8 12 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13 14 15 16 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 9 17 -- Create a randomseed, so that the math.random() function is actually random. 10 18 math.randomseed(os.time()) 11 19 -- End create randomseed. 12 13 14 20 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 21 22 23 24 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 15 25 -- Here you can define some global variables, with which you can modify the space station. 16 26 -- Define the maximal size of the space station, this is actually just for the grid, be sure that this value is big enough. 17 27 sSSize=30 18 28 -- Define how many parts the space station has, this value has to be exact, so be sure to increment it if you're adding a new part. 19 sSParts= 729 sSParts=8 20 30 -- Define how many body parts the space station has, this value has to be exact. Body part means a part, which has connections at least in two directions. 21 31 sSBodyParts=3 … … 29 39 rightSidePartsIndex={} 30 40 -- Define how many top parts you have. 31 topParts= 141 topParts=2 32 42 -- Define which index your top parts have. 33 43 topPartsIndex={} … … 51 61 gridDim=2.25 52 62 -- End define global parameters. 53 54 55 63 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 64 65 66 67 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 56 68 -- This creates a 4-dimensional grid, which tells us if there is a part or not, and in which direction it has connections. 57 69 -- The parameters x,y,z are the axis of the space station, which iterate to sSSize, the maximal size of the space station. … … 75 87 end 76 88 -- End create 4-dim grid. 77 78 79 89 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 90 91 92 93 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 80 94 -- This creates an array which stores all the bodyparts, it's size is depending on the global values pDim and sSParts. 81 95 -- The first parameter i, tells us how many parts fit into the array, so it iterates from 1 to sSParts, each part has his own value i. … … 234 248 bodyParts[topPartsIndex[1]][1][0][3][0]=1 235 249 bodyParts[topPartsIndex[1]][-1][0][3][0]=1 250 251 topPartsIndex[2]=8 252 bodyParts[topPartsIndex[2]][0][0][0][4]="SatelliteDish.mesh" 253 bodyParts[topPartsIndex[2]][0][0][0][5]="pitch=-90" 254 bodyParts[topPartsIndex[2]][0][0][0][0]=1 255 bodyParts[topPartsIndex[2]][0][0][1][0]=1 256 bodyParts[topPartsIndex[2]][0][0][-1][0]=1 257 bodyParts[topPartsIndex[2]][1][0][0][0]=1 258 bodyParts[topPartsIndex[2]][1][0][1][0]=1 259 bodyParts[topPartsIndex[2]][1][0][-1][0]=1 260 bodyParts[topPartsIndex[2]][-1][0][0][0]=1 261 bodyParts[topPartsIndex[2]][-1][0][1][0]=1 262 bodyParts[topPartsIndex[2]][-1][0][-1][0]=1 263 236 264 -- End insert the top parts. 237 265 … … 242 270 243 271 -- End create array bodyParts. 244 272 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 273 274 275 276 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 245 277 -- Here I define some functions which I will use later. 246 278 --This function actualizes the grid, which I have to call always after I have added a new part to the space station. … … 277 309 -- End checkPart function. 278 310 -- End define functions. 279 311 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 312 313 314 315 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 280 316 -- This is xml code, which means now we attach some parts to the MovableEntity. 281 317 print("<attached>") 282 283 284 318 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 319 320 321 322 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 285 323 -- Attach all bodyparts. 286 324 -- Define at which position in the x-direction you're space station will start. … … 322 360 end 323 361 -- End attach all bodyparts. 324 325 326 362 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 363 364 365 366 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 327 367 -- Attach thrusters, if there are some. 328 368 if thrusterIndex ~= false then … … 348 388 end 349 389 -- End attach Thrusters. 350 351 352 390 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 391 392 393 394 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 353 395 -- Attach cockpit, if there is one. 354 396 function setCockpit() … … 398 440 end 399 441 -- End attach cockpit. 400 401 402 442 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 443 444 445 446 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 403 447 -- Attach parts on the left side of the space station. 404 448 function setLeftSidePart() … … 451 495 end 452 496 -- End attach left side parts. 453 454 455 497 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 498 499 500 501 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 456 502 -- Attach parts on the right side of the space station. 457 503 function setRightSidePart() … … 504 550 end 505 551 -- End attach right side parts. 506 507 508 552 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 553 554 555 556 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 509 557 -- Attach parts on top of the space station. 510 558 function setTopPart() … … 526 574 if topPartsIndex[0] ~= false then 527 575 for sPC=1,topParts do 528 tempTopPartsIndex = topPartsIndex[ math.random(1,topParts)]576 tempTopPartsIndex = topPartsIndex[sPC] 529 577 partSet=0 530 578 y=math.floor(sSSize/2) … … 557 605 end 558 606 -- End attach top parts. 559 560 561 607 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 608 609 610 611 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 562 612 -- Attach all connectionparts. 563 613 -- This iterates through the whole grid array. … … 584 634 end 585 635 -- End attach all connectionparts. 586 587 588 636 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 637 638 639 640 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 589 641 -- This is xml code, which ends the attachment and the MovableEntity. 590 642 print("</attached>") 591 643 print("</MovableEntity>") 644 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 645 646 592 647 593 648 ?> -
data/contentcreation/pps/MirkoKaiser/CuboidSS/Version2/levels/CuboidSpaceStation2.oxw
r5300 r5307 17 17 18 18 <?lua 19 include("levels/CuboidSpaceStation2.lua") 19 dofile("../../media/levels/CuboidSpaceStation2.2.lua") 20 createSpaceStation(0,0,-5000, 0,0,0, 0,0,1, 0, 0,180,0) 20 21 ?> 21 22
Note: See TracChangeset
for help on using the changeset viewer.