Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/planetLevelHS15/data/levels/luaTest.oxw @ 10965

Last change on this file since 10965 was 10951, checked in by luhug, 9 years ago

Put together the elements of our project in a new Level, planetLevelHS15.oxw

File size: 5.0 KB
Line 
1<LevelInfo
2 name = "Lua Test"
3 description = "A level with absolutely nothing in it."
4 tags = "test"
5 screenshot = "emptylevel.png"
6/>
7
8<?lua
9  include("stats.oxo")
10  include("HUDTemplates3.oxo")
11  include("templates/lodInformation.oxt")
12?>
13
14<?lua
15  include("templates/spaceshipAssff2.oxt")
16  include("templates/spaceshipPirate.oxt")
17  include("templates/spaceshipEscort.oxt")
18  include("templates/spaceshipRing.oxt")
19  include("templates/spaceshipSwallow.oxt")
20?>
21
22<!-- randomly generate houses -->
23<?lua
24function randomHouses(x,y,cellSize)
25    returnString = ""
26    for currentX = 1, x, 1 do
27      for currentY = 1, y, 1 do
28        houseNr = math.floor(math.random()*6 + 1)
29        orientation = math.floor(math.random()*4)*90
30        houses = {"Glasstower1","ETH","Hausc1","PrimeTower","Hausc2","101"}
31        scales = {100,80,100,100,100,100}
32        collisionShapes = {--[[Glasstower1]]"<BoxCollisionShape position=\"0,405,0\" halfExtents=\"90,405,90\" /><BoxCollisionShape  position=\"0,855,0\" halfExtents=\"110, 45, 110\" /><BoxCollisionShape      position=\"0,957,0\" halfExtents=\"5, 70, 5\" />  ",--[[ETH]]"<BoxCollisionShape      position=\"-83.496,22.423,3.439\" halfExtents=\"89.5,30.4,151.5\" /><BoxCollisionShape      position=\"105.607996,22.905,-137.980005\" halfExtents=\"31.40,23.55,39.25\" /><BoxCollisionShape      position=\"105.607996,22.905,137.078003\" halfExtents=\"31.40,23.55,39.25\" /><BoxCollisionShape      position=\"65.356,22.905,118.208997\" halfExtents=\"31.40,23.55,20.40\" /><BoxCollisionShape      position=\"65.356,22.905,-121.712\" halfExtents=\"31.40,23.55,20.40\" /><SphereCollisionShape  position=\"44.985001,60.196997,0.352 \" radius=\"31.65\" />",--[[Hausc1]]"<BoxCollisionShape position=\"0,71.43,0\" halfExtents=\"142.86, 71.43, 142.86\" /><BoxCollisionShape position=\"-71.43,285.72,-71.43\" halfExtents=\"71.43, 142.86, 71.43\" /><BoxCollisionShape position=\"71.43,428.58,0\" halfExtents=\"71.43, 285.72, 142.86\" /><BoxCollisionShape position=\"71.43,857.16,-71.43\" halfExtents=\"71.43, 142.86, 71.43\" /><BoxCollisionShape position=\"-35.715,214.29,35.715\" halfExtents=\"35.715, 71.43, 35.715\" /><BoxCollisionShape position=\"-35.715,500.01,-107.145\" halfExtents=\"35.715, 71.43, 35.715\" /><BoxCollisionShape position=\"107.145,785.73,35.715\" halfExtents=\"35.715, 71.43, 35.715\" />",--[[PrimeTower]]"<BoxCollisionShape      position=\"-16.1,278.6,-053.\" halfExtents=\"063,296,063\" yaw=\"-16.5\" /> <BoxCollisionShape      position=\"007.1,278.6,027.3\" halfExtents=\"065,296,065\" yaw=\"-28\" /><BoxCollisionShape      position=\"012.8,278.6,-633\" halfExtents=\"076,296,076\" yaw=\"4\" /> <BoxCollisionShape      position=\"0.2318,278.6,-135.4\" halfExtents=\"067.7,296,067.7\" yaw=\"-28\" />",--[[Hausc2]]"<BoxCollisionShape      position=\"0,349.999,-166.667\" halfExtents=\"83.333, 349.999, 83.333\" /><BoxCollisionShape      position=\"0,349.999,166.667\" halfExtents=\"83.333, 349.999, 83.333\" /><BoxCollisionShape      position=\"41.666,291.666,0\" halfExtents=\"41.666, 58.333, 83.333\" /><BoxCollisionShape      position=\"-41.666,524.999,0\" halfExtents=\"41.666, 58.333, 83.333\" /> ",--[[101]]"<BoxCollisionShape    position=\"0,565.7,0\" halfExtents=\"76,565.7,76\" /><BoxCollisionShape position=\"-2.8,1210,1\" halfExtents=\"39,82,39\" />"}
33        if (currentX > 0 and currentX < x and currentY > 1 --[[and currentY ~= y]]) then
34        returnString = returnString .. "<StaticEntity collisionType=\"static\" position=\"" .. (currentX*cellSize) .. "," .. (currentY*cellSize - (cellSize/2)) .. ",0\" direction=\"0,1,0\" pitch=\"0\" roll=\"0\" yaw=\"" .. orientation .. "\">  <attached> <Model position=\"0,0,0\" mesh=\"" .. houses[houseNr] .. ".mesh\" scale=\"" .. scales[houseNr] .. "\"/></attached><collisionShapes>" .. collisionShapes[houseNr] .. "</collisionShapes></StaticEntity>\n\n"
35        end
36        returnString = returnString .. "<StaticEntity collisionType=\"static\" position=\"" .. (currentX*cellSize - cellSize/2) .. "," .. (currentY*cellSize) .. ",0\" direction=\"0,1,0\" pitch=\"0\" roll=\"0\" yaw=\"0\">  <attached> <Model position=\"0,0,0\" mesh=\"CityGround.mesh\" scale=\"" .. cellSize .. "\"/></attached><collisionShapes><BoxCollisionShape position=\"0,0,0\" halfExtents=\"500,0,500\"/></collisionShapes></StaticEntity>\n\n"
37      end
38    end
39    return returnString
40end
41
42?>
43
44<Level>
45  <templates>
46    <Template link=lodtemplate_default />
47  </templates>
48  <?lua include("includes/notifications.oxi") ?>
49
50  <Scene
51    ambientlight = "0.8, 0.8, 0.8"
52    skybox       = "Orxonox/Starbox"
53  >
54
55   
56
57
58  <?lua print(randomHouses(5,5,600)) ?>
59  <StaticEntity position="0,0,0" direction="0,0,0" collisionType=static mass=0 friction=0.01 yaw=90 roll=90 >
60    <attached>
61        <Model position="0,0,0" mesh="skyboxHoenggerberg.mesh" scale3D="1000000,1000000,1000000" lodLevel="0"/>
62        <--!<PortalEndPoint position="0,0,0" id="1" distance="40" target="Pawn" design="PortalDefault"/>-->
63        <Light type="point" position="0,0,0" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
64    </attached>
65</StaticEntity>
66</Scene>
67</Level>
68
Note: See TracBrowser for help on using the repository browser.