Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Some changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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?>
Note: See TracChangeset for help on using the changeset viewer.