Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 4, 2008, 10:49:52 PM (16 years ago)
Author:
mkaiser
Message:

Some changes.

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 --<?lua
    2 
    3 
    4 function createSpaceStation()
    51-- This lua script creates a totally random generated space station for the orxonox computer game!
    62
    73
    84
     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.
     12function createSpaceStation(xPos,yPos,zPos, xVel,yVel,zVel, xRotAxis,yRotAxis,zRotAxis, RotRate, xRotOnce,yRotOnce,zRotOnce)
     13
     14
     15
    916----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    1017-- 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 >")
     18print("<MovableEntity scale=1 position=\"") print(xPos) print(",") print(yPos) print(",") print(zPos)
     19print("\" velocity=\"") print(xVel) print(",") print(yVel) print(",") print(zVel)
     20print("\" rotationaxis=\"") print(xRotAxis) print(",") print(yRotAxis) print(",") print(zRotAxis) print("\" rotationrate=") print(RotRate)
     21print(" pitch=") print(xRotOnce) print(" yaw=") print(yRotOnce) print(" roll=") print(zRotOnce) print(" >")
    1422-- End create Movable Entity.
    1523----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    249257bodyParts[leftSidePartsIndex[1]][0][0][0][5]="roll=90 pitch="..math.random(0,180)
    250258bodyParts[rightSidePartsIndex[1]][0][0][0][6]="roll=-90 pitch="..math.random(0,180)
    251 
     259bodyParts[rightSidePartsIndex[1]][0][0][0][8]="rotationaxis=\"1,0,0\" rotationrate=5"
    252260bodyParts[leftSidePartsIndex[1]][0][0][0][0]=1
    253261bodyParts[leftSidePartsIndex[1]][0][0][1][0]=1
     
    545553                if check == 1 then
    546554                        -- This prints the part.
    547                         printModel(x,y,z,tempSidePartIndex,false,1)
     555                        printModel(x,y,z,tempSidePartIndex,true,1)
    548556                        partSet=1
    549557                        -- This actualizes the grid array with the values of the array bodyParts at the position tempSidePartIndex.
     
    599607                if check == 1 then
    600608                        -- This prints the part.
    601                         printModel(x,y,z,tempSidePartIndex,false,2)
     609                        printModel(x,y,z,tempSidePartIndex,true,2)
    602610                        partSet=1
    603611                        -- This actualizes the grid array with the values of the array bodyParts at the position tempSidePartIndex.
     
    737745----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    738746
    739 end
    740 
    741 --?>
     747
     748
     749-- End the createSpaceStation function.
     750end
     751
     752
     753
  • data/contentcreation/pps/MirkoKaiser/CuboidSS/Version2/levels/CuboidSpaceStation2.lua

    r5300 r5307  
    11<?lua
     2
     3
     4
    25-- This lua script creates a totally random generated space station for the orxonox computer game!
    36
     7
     8
     9----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    410-- 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.
    511print("<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----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    917-- Create a randomseed, so that the math.random() function is actually random.
    1018        math.randomseed(os.time())
    1119-- End create randomseed.
    12 
    13 
    14 
     20----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     21
     22
     23
     24----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    1525-- Here you can define some global variables, with which you can modify the space station.
    1626        -- Define the maximal size of the space station, this is actually just for the grid, be sure that this value is big enough.
    1727        sSSize=30
    1828        -- 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=7
     29        sSParts=8
    2030        -- 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.
    2131        sSBodyParts=3
     
    2939        rightSidePartsIndex={}
    3040        -- Define how many top parts you have.
    31         topParts=1
     41        topParts=2
    3242        -- Define which index your top parts have.
    3343        topPartsIndex={}
     
    5161        gridDim=2.25
    5262-- End define global parameters.
    53 
    54 
    55 
     63----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     64
     65
     66
     67----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    5668-- This creates a 4-dimensional grid, which tells us if there is a part or not, and in which direction it has connections.
    5769-- The parameters x,y,z are the axis of the space station, which iterate to sSSize, the maximal size of the space station.
     
    7587        end
    7688-- End create 4-dim grid.
    77 
    78 
    79 
     89----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     90
     91
     92
     93----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    8094-- This creates an array which stores all the bodyparts, it's size is depending on the global values pDim and sSParts.
    8195-- 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.
     
    234248        bodyParts[topPartsIndex[1]][1][0][3][0]=1
    235249        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       
    236264        -- End insert the top parts.
    237265
     
    242270
    243271-- End create array bodyParts.
    244 
     272----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     273
     274
     275
     276----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    245277-- Here I define some functions which I will use later.
    246278        --This function actualizes the grid, which I have to call always after I have added a new part to the space station.
     
    277309        -- End checkPart function.
    278310-- End define functions.
    279 
     311----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     312
     313
     314
     315----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    280316-- This is xml code, which means now we attach some parts to the MovableEntity.
    281317print("<attached>")
    282 
    283 
    284 
     318----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     319
     320
     321
     322----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    285323-- Attach all bodyparts.
    286324        -- Define at which position in the x-direction you're space station will start.
     
    322360        end
    323361-- End attach all bodyparts.
    324 
    325 
    326 
     362----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     363
     364
     365
     366----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    327367-- Attach thrusters, if there are some.
    328368        if thrusterIndex ~= false then
     
    348388        end
    349389-- End attach Thrusters.
    350 
    351 
    352 
     390----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     391
     392
     393
     394----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    353395-- Attach cockpit, if there is one.
    354396function setCockpit()
     
    398440        end
    399441-- End attach cockpit.
    400 
    401 
    402 
     442----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     443
     444
     445
     446----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    403447-- Attach parts on the left side of the space station.
    404448function setLeftSidePart()
     
    451495        end
    452496-- End attach left side parts.
    453 
    454 
    455 
     497----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     498
     499
     500
     501----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    456502-- Attach parts on the right side of the space station.
    457503function setRightSidePart()
     
    504550        end
    505551-- End attach right side parts.
    506 
    507 
    508 
     552----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     553
     554
     555
     556----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    509557-- Attach parts on top of the space station.
    510558function setTopPart()
     
    526574        if topPartsIndex[0] ~= false then
    527575                for sPC=1,topParts do
    528                         tempTopPartsIndex = topPartsIndex[math.random(1,topParts)]
     576                        tempTopPartsIndex = topPartsIndex[sPC]
    529577                        partSet=0
    530578                        y=math.floor(sSSize/2)
     
    557605        end
    558606-- End attach top parts.
    559 
    560 
    561 
     607----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     608
     609
     610
     611----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    562612-- Attach all connectionparts.
    563613        -- This iterates through the whole grid array.
     
    584634        end
    585635-- End attach all connectionparts.
    586 
    587 
    588 
     636----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     637
     638
     639
     640----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    589641-- This is xml code, which ends the attachment and the MovableEntity.
    590642print("</attached>")
    591643print("</MovableEntity>")
     644----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     645
     646
    592647
    593648?>
  • data/contentcreation/pps/MirkoKaiser/CuboidSS/Version2/levels/CuboidSpaceStation2.oxw

    r5300 r5307  
    1717
    1818<?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)
    2021?>
    2122
Note: See TracChangeset for help on using the changeset viewer.