[Orxonox-commit 5553] r10216 - in code/trunk: . data/gui/scripts data/levels data/levels/includes data/levels/templates data/overlays src/modules src/modules/invader src/modules/objects src/modules/weapons/projectiles src/orxonox src/orxonox/collisionshapes src/orxonox/controllers src/orxonox/items src/orxonox/worldentities src/orxonox/worldentities/pawns
landauf at orxonox.net
landauf at orxonox.net
Sat Jan 31 18:03:17 CET 2015
Author: landauf
Date: 2015-01-31 18:03:17 +0100 (Sat, 31 Jan 2015)
New Revision: 10216
Added:
code/trunk/data/gui/scripts/testscript.lua
code/trunk/data/levels/ModularShipsTest0.oxw
code/trunk/data/levels/ModularShipsTest1.oxw
code/trunk/data/levels/jump.oxw
code/trunk/data/levels/levelTry.oxw
code/trunk/data/levels/michaelstestfile.lua
code/trunk/data/levels/scriptController.oxw
code/trunk/data/levels/templates/ModularSpaceShipTest.oxt
code/trunk/data/levels/templates/standardTurret.oxt
code/trunk/data/overlays/jumpHUD.oxo
code/trunk/src/modules/jump/
code/trunk/src/modules/objects/controllers/
code/trunk/src/orxonox/ShipPartManager.cc
code/trunk/src/orxonox/ShipPartManager.h
code/trunk/src/orxonox/controllers/ControllerDirector.cc
code/trunk/src/orxonox/controllers/ControllerDirector.h
code/trunk/src/orxonox/controllers/ScriptController.cc
code/trunk/src/orxonox/controllers/ScriptController.h
code/trunk/src/orxonox/controllers/testscript.lua
code/trunk/src/orxonox/items/PartDestructionEvent.cc
code/trunk/src/orxonox/items/PartDestructionEvent.h
code/trunk/src/orxonox/items/ShipPart.cc
code/trunk/src/orxonox/items/ShipPart.h
code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h
Removed:
code/trunk/src/orxonox/controllers/ScriptController.cc
code/trunk/src/orxonox/controllers/ScriptController.h
Modified:
code/trunk/
code/trunk/data/levels/includes/weaponSettingsTurret.oxi
code/trunk/data/levels/templates/HeavyCruiser.oxt
code/trunk/data/levels/turretTest.oxw
code/trunk/src/modules/CMakeLists.txt
code/trunk/src/modules/invader/InvaderWeapon.cc
code/trunk/src/modules/objects/CMakeLists.txt
code/trunk/src/modules/objects/Turret.cc
code/trunk/src/modules/objects/Turret.h
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
code/trunk/src/modules/weapons/projectiles/Projectile.cc
code/trunk/src/modules/weapons/projectiles/Projectile.h
code/trunk/src/modules/weapons/projectiles/Rocket.cc
code/trunk/src/modules/weapons/projectiles/Rocket.h
code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
code/trunk/src/orxonox/CMakeLists.txt
code/trunk/src/orxonox/OrxonoxPrereqs.h
code/trunk/src/orxonox/Scene.cc
code/trunk/src/orxonox/collisionshapes/CollisionShape.cc
code/trunk/src/orxonox/controllers/ArtificialController.cc
code/trunk/src/orxonox/controllers/CMakeLists.txt
code/trunk/src/orxonox/controllers/NewHumanController.cc
code/trunk/src/orxonox/items/CMakeLists.txt
code/trunk/src/orxonox/worldentities/MovableEntity.cc
code/trunk/src/orxonox/worldentities/MovableEntity.h
code/trunk/src/orxonox/worldentities/WorldEntity.h
code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
Log:
merged branch presentationFS14 back to trunk
Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/Racingbot:9388-9513
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/sfxThilo:9691-9917
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
+ /code/branches/Racingbot:9388-9513
/code/branches/ScriptableController:9999-10075
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/modularships:9994-10071
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationFS14:10069-10215
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/sfxThilo:9691-9917
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/turretFS14:9998-10070
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
Copied: code/trunk/data/gui/scripts/testscript.lua (from rev 10215, code/branches/presentationFS14/data/gui/scripts/testscript.lua)
===================================================================
--- code/trunk/data/gui/scripts/testscript.lua (rev 0)
+++ code/trunk/data/gui/scripts/testscript.lua 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,92 @@
+-- Set some test variables
+xm = 1000
+ym = 0
+zm = 0
+
+xl = -1000
+yl = 3000
+zl = -1000
+
+xr = 2000
+yr = 500
+zr = 2000
+
+d = 5
+Tabs = 0
+
+pi = 3.1415
+
+-- Get a local pointer to a scriptcontroller
+local ctrl = orxonox.ScriptController:getScriptController()
+
+-- If it worked, call its "movetoposition" function
+if ctrl ~= nil then
+ -- Move to the starting point at (xl+3000,yl,zl) while looking
+ -- at xl,yl,zl over the time span of 3 seconds
+ ctrl:eventScheduler("mal", xl+3000,yl,zl, xl,yl,zl, 1, 0)
+
+ -- From there, perform a rotation around the harvester placed there
+ -- in 100 steps
+ dt = math.pi/100
+ for t = 0,math.pi,dt do
+ xt = math.cos(t)
+ yt = math.sin(t)
+
+ ctrl:eventScheduler("mal", xl+3000*xt, yl+3000*yt, zl, xl, yl, zl, dt, t+0.9)
+ end
+
+
+ -- Update absolute time
+ Tabs = math.pi + 0.9
+
+
+
+ -- Move away again, still looking at the station
+ ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3, Tabs+0.4)
+
+
+
+ -- Update absolute time
+ Tabs = Tabs + 0.4 + 3
+
+
+
+
+
+ -- Transition the look from (xl,yl,zl) to (3500,0,0) in 3 seconds
+ ctrl:eventScheduler("chl", xl, yl, zl, xr, yr, zr, 2, Tabs+0.2)
+
+ Tabs = Tabs + 2 + 0.2
+
+ ctrl:eventScheduler("mal", xr + 600,yr,zr, xr,yr,zr, 4, Tabs+0)
+
+ Tabs = Tabs + 4
+
+ for t = 0,math.pi,dt do
+ xt = math.cos(t)
+ zt = math.sin(t)
+
+ ctrl:eventScheduler("mal", xr+600*xt, yr, zr+600*zt, xr, yr, zr, dt, Tabs+t)
+ end
+
+ Tabs = Tabs + math.pi
+
+ ctrl:eventScheduler("chl", xr, yr, zr, xl, yl, zl, 3, Tabs+0.2)
+
+ Tabs = Tabs + 3 + 0.2
+
+ ctrl:eventScheduler("mal", xm,ym,zm, xl,yl,zl, 4, Tabs+2.5)
+
+
+end
+
+
+
+-- Output the newctrlid variable we set from the C++ code
+if newctrlid ~= nil then
+ orxonox.execute("orxout message test " .. newctrlid)
+end
+
+--orxonox.execute("setPause 1")
+
+
Copied: code/trunk/data/levels/ModularShipsTest0.oxw (from rev 10215, code/branches/presentationFS14/data/levels/ModularShipsTest0.oxw)
===================================================================
--- code/trunk/data/levels/ModularShipsTest0.oxw (rev 0)
+++ code/trunk/data/levels/ModularShipsTest0.oxw 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,76 @@
+<LevelInfo
+ name = "Modular Ships - Test 0"
+ description = "A level to test the basic functions of modular spaceships using simple boxes."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff2.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipEscort.oxt")
+ include("templates/HeavyCruiser.oxt")
+ include("templates/ModularSpaceShipTest.oxt")
+?>
+
+<Level>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+ <ModularSpaceShip position="0,0,0" health="2000" maxhealth="4000" initialhealth="2000">
+ <templates>
+ <Template link=ModularSpaceShipTest />
+ </templates>
+ </ModularSpaceShip>
+
+ <StaticEntity position="0,0,60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity position="0,60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity position="0,0,-60" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ </collisionShapes>
+ </StaticEntity>
+
+ </Scene>
+</Level>
+
Copied: code/trunk/data/levels/ModularShipsTest1.oxw (from rev 10215, code/branches/presentationFS14/data/levels/ModularShipsTest1.oxw)
===================================================================
--- code/trunk/data/levels/ModularShipsTest1.oxw (rev 0)
+++ code/trunk/data/levels/ModularShipsTest1.oxw 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,109 @@
+<LevelInfo
+ name = "Modular Ships - Test 1"
+ description = "A level to test the implementation of HeavyCruiser as modular spaceship."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff2.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipEscort.oxt")
+ include("templates/HeavyCruiser.oxt")
+?>
+
+<Level>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <!-- <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort /> -->
+ <SpawnPoint team=0 position="-500,0,0" lookat="0,0,0" spawnclass=ModularSpaceShip pawndesign=HeavyCruiser />
+
+ <MovableEntity position="0,0,0" collisionType=dynamic scale=1 linearDamping=0.8 angularDamping=0 collisiondamage=0.005 enablecollisiondamage=true>
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="40,40,40" />
+ <StaticEntity position="0,90,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="40,40,40" />
+ </collisionShapes>
+ </MovableEntity>
+
+ <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,-100" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Pawn 0" >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
+ <StaticEntity position="0,-120,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,0,60" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,0,60" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+ <StaticEntity position="0,-180,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </Pawn>
+
+ <Pawn health=1000 initialhealth=1000 maxhealth=1000 position="0,-100,100" direction="0,0,0" collisionType=dynamic mass=1000 name=box radarname = "Pawn 1" >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+ <Model position="0,-60,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ <BoxCollisionShape position="0,-60,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </Pawn>
+
+ <ModularSpaceShip position="0,-100,-200">
+ <templates>
+ <Template link=spaceshippirate />
+ </templates>
+ </ModularSpaceShip>
+
+ <ModularSpaceShip position="0,-1000,-200" health="2000" maxhealth="4000" initialhealth="2000">
+ <templates>
+ <Template link=HeavyCruiser />
+ </templates>
+ </ModularSpaceShip>
+
+ </Scene>
+</Level>
+
Modified: code/trunk/data/levels/includes/weaponSettingsTurret.oxi
===================================================================
--- code/trunk/data/levels/includes/weaponSettingsTurret.oxi 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/data/levels/includes/weaponSettingsTurret.oxi 2015-01-31 17:03:17 UTC (rev 10216)
@@ -10,13 +10,13 @@
<DefaultWeaponmodeLink firemode=0 weaponmode=0 />
</links>
<Weapon>
- <attached>
- <Model mesh="sphere.mesh" position="3,3,-2.2" scale=0.6 />
- </attached>
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 3, 3,-2.2" />
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 3,-3,-2.2" />
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-3, 3,-2.2" />
- <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-3,-3,-2.2" />
+ <!-- <attached>
+ <Model mesh="sphere.mesh" position="1.7,1.7,-24.5" scale=0.6 />
+ </attached> -->
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="1.7, 1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="1.7, -1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="-1.7, 1.7,-30" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="-1.7, -1.7,-30" />
</Weapon>
</WeaponPack>
</weapons>
Copied: code/trunk/data/levels/jump.oxw (from rev 10215, code/branches/presentationFS14/data/levels/jump.oxw)
===================================================================
--- code/trunk/data/levels/jump.oxw (rev 0)
+++ code/trunk/data/levels/jump.oxw 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,260 @@
+<LevelInfo
+ name = "Jump"
+ description = "Jump in space!"
+ tags = "minigame"
+ screenshot = "jump.png"
+/>
+
+<?lua
+ include("HUDTemplates3.oxo")
+ include("jumpHUD.oxo")
+ include("stats.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<Template name=jumpfigurecameras defaults=0>
+ <JumpFigure>
+ <camerapositions>
+ <CameraPosition position="0,-150,0" absolute=true mouselook=false drag=false lookat="0,0,0"/>
+ </camerapositions>
+ </JumpFigure>
+</Template>
+
+<Template name=figureLeftHand defaults=0>
+ <Model position="4.0,0.0,5.0" mesh="JumpFigureLeftHand.mesh" scale=1>
+ </Model>
+</Template>
+
+<Template name=figureRightHand defaults=0>
+ <Model position="-4.0,0.0,5.0" mesh="JumpFigureRightHand.mesh" scale=1>
+ </Model>
+</Template>
+
+<Template name=jumpFigureTemplate>
+ <JumpFigure camerapositiontemplate=jumpfigurecameras mouseFactor="100.0" modelLefthand=figureLeftHand modelRighthand=figureRightHand rocketPos=8.0 propellerPos=8.0 bootsPos=-5.2 jumpSpeed=250.0 handMinAngle=-20 handMaxAngle=75 handSpeed=250 rocketSpeed=250.0 propellerSpeed=150.0>
+ <attached>
+ <Model position="0,0,0" mesh="JumpFigure.mesh" scale=1 pitch=90/>
+ </attached>
+ </JumpFigure>
+</Template>
+
+<Template name=jumpProjectileTemplate>
+ <JumpProjectile>
+ <attached>
+ <Model mesh="JumpProjectile.mesh" scale=1 pitch=90/>
+ <ParticleEmitter scale=1 pitch=0 roll=0 position="0, 0, 0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
+ </attached>
+ </JumpProjectile>
+</Template>
+
+<Template name=jumpPlatformStaticTemplate>
+ <JumpPlatformStatic height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform01.mesh" scale=1 pitch=90/>
+ <Backlight scale=0.2 colour="0.9, 0.4, 0.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </JumpPlatformStatic>
+</Template>
+
+<Template name=jumpPlatformHMoveTemplate>
+ <JumpPlatformHMove height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform02.mesh" scale=1 pitch=90/>
+ <Backlight scale=0.2 colour="0.1, 0.1, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </JumpPlatformHMove>
+</Template>
+
+<Template name=jumpPlatformVMoveTemplate>
+ <JumpPlatformVMove height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform03.mesh" scale=1 pitch=90/>
+ <Backlight scale=0.2 colour="1.0, 0.1, 1.0" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </JumpPlatformVMove>
+</Template>
+
+<Template name=jumpPlatformDisappearTemplate>
+ <JumpPlatformDisappear height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform04.mesh" scale=1 pitch=90/>
+ <Backlight scale=0.2 colour="0.1, 1.0, 0.1" width=7 length=500 lifetime=0.3 elements=20 trailmaterial="Trail/backlighttrail" material="Examples/Flare" loop=1 />
+ </attached>
+ </JumpPlatformDisappear>
+</Template>
+
+<Template name=jumpPlatformTimerTemplate>
+ <JumpPlatformTimer height=3 width=19 effectPath="Orxonox/BigExplosion1part2" effectStartTime="0.4">
+ <attached>
+ <Model mesh="JumpPlatform05.mesh" scale=1 pitch=90/>
+ <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="-4, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
+ <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="0, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
+ <ParticleEmitter scaled3D="5.0, 1.0, 2.0" pitch=0 roll=0 position="4, 0, -2.0" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=0.0 />
+ </attached>
+ </JumpPlatformTimer>
+</Template>
+
+<Template name=jumpPlatformFakeTemplate>
+ <JumpPlatformFake height=3 width=19>
+ <attached>
+ <Model mesh="JumpPlatform06.mesh" scale=1 pitch=90/>
+ <ParticleEmitter scale3D="0.2,0.2,0.2" pitch=0 roll=0 position="0, 0, -2.5" source="Orxonox/sparks" lifetime=1.0 loop=1 startdelay=0.0 />
+ </attached>
+ </JumpPlatformFake>
+</Template>
+
+<Template name=jumpEnemy1Template>
+ <JumpEnemy height=13 width=35>
+ <attached>
+ <Model mesh="JumpEnemy1.mesh" scale=1 pitch=90/>
+ <FadingBillboard active=true scale=0.09 position="0, 0, 10" colour="0.2, 1.0, 0.65, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <Backlight scale=0.33 name=bltest position="0, 0, -10" colour="0.6, 0.8, 0.75, 0.7" width=25 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+ </attached>
+ </JumpEnemy>
+</Template>
+
+<Template name=jumpEnemy2Template>
+ <JumpEnemy height=15 width=36>
+ <attached>
+ <Model mesh="JumpEnemy2.mesh" scale=1 pitch=90/>
+ <MovableEntity position="-16, 0, 2" rotationaxis="0, 1, 0" rotationrate=500 >
+ <attached>
+ <Model mesh="JumpEnemy2Wing.mesh" scale=1 pitch=90/>
+ </attached>
+ </MovableEntity>
+ <MovableEntity position="16, 0, 2" rotationaxis="0, 1, 0" rotationrate=500 >
+ <attached>
+ <Model mesh="JumpEnemy2Wing.mesh" scale=1 pitch=90/>
+ </attached>
+ </MovableEntity>
+ <ParticleEmitter scale3D="1.0,1.0,1.0" pitch=0 roll=0 position="-1, 0, -3" source="Orxonox/laser" lifetime=1.0 loop=1 startdelay=0.0 />
+ </attached>
+ </JumpEnemy>
+</Template>
+
+<Template name=jumpEnemy3Template>
+ <JumpEnemy height=18.5 width=14>
+ <attached>
+ <Model mesh="JumpEnemy3.mesh" scale=1 pitch=90/>
+ <Backlight scale3D="0.1, 0.1, 1.0" position="0, -11, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
+ <Backlight scale3D="0.1, 0.1, 1.0" position="6.32, 5.5, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
+ <Backlight scale3D="0.1, 0.1, 1.0" position="-6.32, 5.5, -4" colour="1.0, 0.0, 0.9, 1.0" width=1 length=1 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1"/>
+ </attached>
+ </JumpEnemy>
+</Template>
+
+<Template name=jumpEnemy4Template>
+ <JumpEnemy height=12.5 width=36 rotationaxis="0, 0, 1" rotationrate=40 >
+ <attached>
+ <Model mesh="JumpEnemy4.mesh" scale=1 pitch=90/>
+ </attached>
+ </JumpEnemy>
+</Template>
+
+<Template name=jumpSpringTemplate>
+ <JumpSpring height=6 width=9.25>
+ <attached>
+ <Model mesh="JumpSpring.mesh" scale=1 rotationaxis="0, 0, 1" pitch=90 position="0.0, 0.0, 0.0"/>
+ </attached>
+ </JumpSpring>
+</Template>
+
+<Template name=jumpRocketTemplate>
+ <JumpRocket height=8.5 width=13.5>
+ <attached>
+ <Model mesh="JumpRocket.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
+ </attached>
+ </JumpRocket>
+</Template>
+
+<Template name=jumpPropellerTemplate>
+ <JumpPropeller height=4 width=15.5>
+ <attached>
+ <Model mesh="JumpPropeller.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
+ </attached>
+ </JumpPropeller>
+</Template>
+
+<Template name=jumpBootsTemplate>
+ <JumpBoots height=5.2 width=3.5>
+ <attached>
+ <Model mesh="JumpBoots.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
+ </attached>
+ </JumpBoots>
+</Template>
+
+<Template name=jumpShieldTemplate>
+ <JumpShield height=1.55 width=15.5>
+ <attached>
+ <Model mesh="JumpShield.mesh" scale=1 pitch=90 position="0.0, 0.0, 1.0"/>
+ </attached>
+ </JumpShield>
+</Template>
+
+<Level gametype = "Jump">
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true"/>
+ <JumpBot />
+
+ <Scene ambientlight="1.0, 1.0, 1.0" skybox="Orxonox/skyBoxBasic">
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
+ <SpawnPoint position="991.729, -110.11, 435.404" orientation="0.534038, 0.563456, 0.212168, 0.593553" />
+
+ <MovableEntity>
+ <attached>
+ <JumpCenterpoint
+ name=jumpcenter
+ dimension="120,80"
+ sectionLength="150"
+ platformSpeed="20"
+ cameraOffset="10"
+
+ platformStaticTemplate=jumpPlatformStaticTemplate
+ platformHMoveTemplate=jumpPlatformHMoveTemplate
+ platformVMoveTemplate=jumpPlatformVMoveTemplate
+ platformDisappearTemplate=jumpPlatformDisappearTemplate
+ platformTimerTemplate=jumpPlatformTimerTemplate
+ platformFakeTemplate=jumpPlatformFakeTemplate
+ figureTemplate=jumpFigureTemplate
+ projectileTemplate=jumpProjectileTemplate
+ springTemplate=jumpSpringTemplate
+ rocketTemplate=jumpRocketTemplate
+ propellerTemplate=jumpPropellerTemplate
+ bootsTemplate=jumpBootsTemplate
+ shieldTemplate=jumpShieldTemplate
+ enemy1Template=jumpEnemy1Template
+ enemy2Template=jumpEnemy2Template
+ enemy3Template=jumpEnemy3Template
+ enemy4Template=jumpEnemy4Template
+ >
+
+ <attached>
+
+ <Model position="0,0,-1000" mesh="JumpPlatform01.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform02.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform03.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform04.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform05.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPlatform06.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpProjectile.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy1.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy2.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy2Wing.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy3.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpEnemy4.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpSpring.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpRocket.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpPropeller.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpShield.mesh" scale="1" />
+ <Model position="0,0,-1000" mesh="JumpBoots.mesh" scale="1" />
+ </attached>
+ </JumpCenterpoint>
+ </attached>
+ </MovableEntity>
+ </Scene>
+</Level>
Copied: code/trunk/data/levels/levelTry.oxw (from rev 10215, code/branches/presentationFS14/data/levels/levelTry.oxw)
===================================================================
--- code/trunk/data/levels/levelTry.oxw (rev 0)
+++ code/trunk/data/levels/levelTry.oxw 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,178 @@
+<!-- First levelFile of mkronig and samuezu. It was copied from dockingToASpaceStation.oxw and modified a little bit -->
+<LevelInfo
+ name = "levelTry"
+ description = "Docking into a spacestation."
+ tags = "showcase"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+ include("templates/pickupRepresentationTemplates.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipEscort.oxt")
+ include("templates/bigship.oxt")
+ include("templates/spaceshipTurret.oxt")
+ include("templates/spaceshipCollateralDamage.oxt")
+ include("templates/FPS.oxt")
+?>
+
+<Level
+ gametype = Deathmatch
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
+ <Scene
+ ambientlight = "0.5, 0.5, 0.5"
+ skybox = "Orxonox/Starbox"
+ negativeWorldRange = "-100000, -100000, -100000"
+ positiveWorldRange = " 100000, 100000, 100000"
+ gravity = "0,0,0"
+ hasPhysics = true
+ >
+
+ <?lua
+ include("includes/pickups.oxi")
+ ?>
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0,1.0,1.0,0.5" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="3200,0,0" lookat="2800,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+ <!--
+ <StaticEntity position = "2800,0,0" mass=10000 collisionType=static >
+ <attached>
+ <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=50 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="-560,0,0" halfExtents="115,100,245" />
+ <BoxCollisionShape position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
+ <BoxCollisionShape position="290,0,480" halfExtents="115,100,245" yaw=-240 />
+ <BoxCollisionShape position="-280,0,0" halfExtents="163,50,50" />
+ <BoxCollisionShape position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
+ <BoxCollisionShape position="140,0,240" halfExtents="163,50,50" yaw=-240 />
+ <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" />
+ <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" yaw=-120 />
+ <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" yaw=-240 />
+ <BoxCollisionShape position="0,400,0" halfExtents="43,110,26" yaw=-30 />
+ <BoxCollisionShape position="-200,100,0" halfExtents="26,50,43" />
+ <BoxCollisionShape position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
+ <BoxCollisionShape position="100,100,-173" halfExtents="43,50,26" yaw=30 />
+ <BoxCollisionShape position="-100,264,0" halfExtents="26,105,43" roll=-49 />
+ <BoxCollisionShape position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
+ <BoxCollisionShape position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
+ </collisionShapes>
+ </StaticEntity>
+ -->
+
+
+ <Billboard position="2500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
+ <DistanceTrigger position="2500,0,0" distance="200" target="Pawn"
+ beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
+ />
+
+ <StaticEntity position = "2000,500,2000" mass=10000 collisionType=static >
+ <attached>
+ <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=10 />
+ </attached>
+ </StaticEntity>
+
+ <StaticEntity position = "-1000,3000,-1000" mass=10000 collisionType=static >
+ <attached>
+ <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=80 />
+ </attached>
+ </StaticEntity>
+
+
+
+
+<!-- ControllerDirector waits for the event takeControl to attach a new Controller -->
+ <ControllerDirector position="0,0,0">
+ <events>
+ <takeControl>
+ <EventListener event="takeControl" />
+ </takeControl>
+ </events>
+ </ControllerDirector>
+
+<!-- FPS Player as destination of the dock -->
+<FpsPlayer template = "fps" radarname = "First Person Player" position = "0,-19900,0" >
+ <attached>
+ <DockingTarget name="spaceShip" />
+ <DistanceTriggerBeacon name="bcnDestroyer" />
+ <DockingTarget name="destroyer" />
+ </attached>
+</FpsPlayer>
+
+
+<!-- Cube as test SpaceStation
+
+The station can either be hidden outside of the skybox, within the hull of the space station if it is big enough or within a planet.
+Complex spacestations can be placed very far away from the spaceship so it is rendered at low resolution while the player uses the space ship.
+
+-->
+ <StaticEntity position="0,-20000,0" direction="0,-1,0" collisionType=static mass=100000 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
+ </collisionShapes>
+ </StaticEntity>
+
+<!-- Homogenous gravitationfield to simulate local gravity (activating the normal gravity will affect the spaceship terribly) -->
+<ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-500,0" />
+
+
+<!-- Some more stuff -->
+
+ <!-- triple large belt around the planet -->
+ <?lua
+ dofile("includes/asteroidField.lua")
+ asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1)
+ ?>
+ <?lua
+ dofile("includes/asteroidField.lua")
+ asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1)
+ ?>
+ <?lua
+ dofile("includes/asteroidField.lua")
+ asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1)
+ ?>
+
+ <Planet
+ position="15000,0,-1000"
+ scale="5000"
+ collisionType="dynamic"
+ linearDamping="0.8"
+ angularDamping="0"
+ mass="10000000"
+ pitch="0"
+ mesh="planets/ganymede.mesh"
+ atmosphere="atmosphere1"
+ rotationaxis="1,0,0"
+ rotationrate="1.0"
+ atmospheresize="80.0f"
+ imagesize="1024.0f"
+ collisiondamage = 2
+ enablecollisiondamage = true
+ >
+ <attached>
+ <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="5000" position="0,0,0" />
+ </collisionShapes>
+ </Planet>
+
+ </Scene>
+
+</Level>
+
Copied: code/trunk/data/levels/michaelstestfile.lua (from rev 10215, code/branches/presentationFS14/data/levels/michaelstestfile.lua)
===================================================================
--- code/trunk/data/levels/michaelstestfile.lua (rev 0)
+++ code/trunk/data/levels/michaelstestfile.lua 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1 @@
+orxout("event: theme")
Copied: code/trunk/data/levels/scriptController.oxw (from rev 10215, code/branches/presentationFS14/data/levels/scriptController.oxw)
===================================================================
--- code/trunk/data/levels/scriptController.oxw (rev 0)
+++ code/trunk/data/levels/scriptController.oxw 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,198 @@
+<!-- First levelFile of mkronig and samuezu. It was copied from dockingToASpaceStation.oxw and modified a little bit -->
+<LevelInfo
+ name = "Fancy orxout tests"
+ description = "Docking into a spacestation."
+ tags = "showcase"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+ include("templates/pickupRepresentationTemplates.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipEscort.oxt")
+ include("templates/bigship.oxt")
+ include("templates/spaceshipTurret.oxt")
+ include("templates/spaceshipCollateralDamage.oxt")
+ include("templates/FPS.oxt")
+?>
+
+<Level
+ gametype = Deathmatch
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
+ <Scene
+ ambientlight = "0.5, 0.5, 0.5"
+ skybox = "Orxonox/Starbox"
+ negativeWorldRange = "-100000, -100000, -100000"
+ positiveWorldRange = " 100000, 100000, 100000"
+ gravity = "0,0,0"
+ hasPhysics = true
+ >
+
+ <?lua
+ include("includes/pickups.oxi")
+ ?>
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0,1.0,1.0,0.5" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="3200,0,0" lookat="2800,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+ <StaticEntity position = "2800,0,0" mass=10000 collisionType=static >
+ <attached>
+ <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=50 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
+ <BoxCollisionShape position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
+ <BoxCollisionShape position="290,0,480" halfExtents="115,100,245" yaw=-240 />
+ <BoxCollisionShape position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
+ <BoxCollisionShape position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
+ <BoxCollisionShape position="140,0,240" halfExtents="163,50,50" yaw=-240 />
+ <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
+ <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" yaw=-120 />
+ <BoxCollisionShape position="0,530,0" halfExtents="172,52,298" yaw=-240 />
+ <BoxCollisionShape position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
+ <BoxCollisionShape position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
+ <BoxCollisionShape position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
+ <BoxCollisionShape position="100,100,-173" halfExtents="43,50,26" yaw=30 />
+ <BoxCollisionShape position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
+ <BoxCollisionShape position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
+ <BoxCollisionShape position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
+ </collisionShapes>
+ </StaticEntity>
+
+<!-- Docking -->
+ <Dock position="2830,20,50" roll=0 yaw=0 >
+ <animations>
+ <MoveToDockingTarget target="destroyer" />
+ </animations>
+ <effects>
+ <DockToShip target="spaceShip" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event="dockMe" />
+ </execute>
+
+ <undocking>
+ <EventListener event="undockMe" />
+ </undocking>
+
+ <activity>
+ <EventListener event=notGameEnd />
+ </activity>
+ </events>
+ <attached>
+ <!-- Trigger for docking with billboard -->
+
+ <!-- removed -->
+
+ <!-- Trigger for undocking with billboard -->
+ <!-- <Billboard position="-2630,-19970,150" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 /> -->
+ <DistanceTrigger position="-2630,-19970,150" distance="50" target="Pawn"
+ beaconMode="identify" targetname="bcnDestroyer" name="undockMe"
+ />
+ </attached>
+ </Dock>
+
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=100 />
+ <DistanceTrigger position="0,0,0" distance="200" target="Pawn"
+ beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
+ />
+
+
+<!-- Object, which orxouts the message "hello Universe!". EVENT NOT WORKING -->
+ <ScriptController position="0,0,0">
+ <events>
+ <party>
+ <EventListener event="dockMe" />
+ </party>
+
+ </events>
+
+ </ScriptController>
+
+
+<!-- FPS Player as destination of the dock -->
+<FpsPlayer template = "fps" radarname = "First Person Player" position = "0,-19900,0" >
+ <attached>
+ <DockingTarget name="spaceShip" />
+ <DistanceTriggerBeacon name="bcnDestroyer" />
+ <DockingTarget name="destroyer" />
+ </attached>
+</FpsPlayer>
+
+
+<!-- Cube as test SpaceStation
+
+The station can either be hidden outside of the skybox, within the hull of the space station if it is big enough or within a planet.
+Complex spacestations can be placed very far away from the spaceship so it is rendered at low resolution while the player uses the space ship.
+
+-->
+ <StaticEntity position="0,-20000,0" direction="0,-1,0" collisionType=static mass=100000 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
+ </collisionShapes>
+ </StaticEntity>
+
+<!-- Homogenous gravitationfield to simulate local gravity (activating the normal gravity will affect the spaceship terribly) -->
+<ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-500,0" />
+
+
+<!-- Some more stuff -->
+
+ <!-- triple large belt around the planet -->
+ <?lua
+ dofile("includes/asteroidField.lua")
+ asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1)
+ ?>
+ <?lua
+ dofile("includes/asteroidField.lua")
+ asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1)
+ ?>
+ <?lua
+ dofile("includes/asteroidField.lua")
+ asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1)
+ ?>
+
+ <Planet
+ position="15000,0,-1000"
+ scale="5000"
+ collisionType="dynamic"
+ linearDamping="0.8"
+ angularDamping="0"
+ mass="10000000"
+ pitch="0"
+ mesh="planets/ganymede.mesh"
+ atmosphere="atmosphere1"
+ rotationaxis="1,0,0"
+ rotationrate="1.0"
+ atmospheresize="80.0f"
+ imagesize="1024.0f"
+ collisiondamage = 2
+ enablecollisiondamage = true
+ >
+ <attached>
+ <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="5000" position="0,0,0" />
+ </collisionShapes>
+ </Planet>
+
+ </Scene>
+
+</Level>
+
Modified: code/trunk/data/levels/templates/HeavyCruiser.oxt
===================================================================
--- code/trunk/data/levels/templates/HeavyCruiser.oxt 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/data/levels/templates/HeavyCruiser.oxt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -1,16 +1,18 @@
<!-- This template includes HeavyCruiser with all its parts (not individually destructible) -->
<Template name=HeavyCruiser>
- <SpaceShip
+ <ModularSpaceShip
+ name = HeavyCruiser
+
hudtemplate = spaceshiphud
camerapositiontemplate = heavycruisercameras
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
- health = 100
- maxhealth = 200
- initialhealth = 100
+ health = 2000
+ maxhealth = 4000
+ initialhealth = 2000
shieldhealth = 100
initialshieldhealth = 30
@@ -40,31 +42,192 @@
angularDamping = 0.5
>
<engines>
- <MultiStateEngine position="85,0,0" template=HeavyCruiser_body_engine1 />
- <MultiStateEngine position="-85,0,0" template=HeavyCruiser_body_engine1 />
+ <MultiStateEngine position="0,0,0" template=HeavyCruiser_body_engine1 />
<MultiStateEngine position="-140,0,308" template=HeavyCruiser_sidearmL_engine1 />
<MultiStateEngine position="140,0,308" template=HeavyCruiser_sidearmR_engine1 />
</engines>
+
+ <parts>
+ <ShipPart name="frontL" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-76,30,-330">
+ <destructionevents>
+ <PartDestructionEvent targetType="ship" targetParam="shieldhealth" operation="*" value="0.5"/>
+ </destructionevents>
+ </ShipPart>
+ <ShipPart name="frontR" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="76,30,-330">
+ <destructionevents>
+ <PartDestructionEvent targetType="ship" targetParam="shieldhealth" operation="*" value="0.5"/>
+ </destructionevents>
+ </ShipPart>
+ <ShipPart name="partL" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-100,33,-200">
+ <destructionevents>
+ <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="One of your ship's generators was destroyed!"/>
+ <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="speedfront" operation="-" value="50"/>
+ <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="accelerationfront" operation="-" value="3"/>
+ <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="boostfactor" operation="set" value="1"/>
+ </destructionevents>
+ </ShipPart>
+ <ShipPart name="partR" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="100,33,-200">
+ <destructionevents>
+ <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="One of your ship's generators was destroyed!"/>
+ <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="speedfront" operation="-" value="50"/>
+ <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="accelerationfront" operation="-" value="3"/>
+ <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="boostfactor" operation="set" value="1"/>
+ </destructionevents>
+ </ShipPart>
+ <ShipPart name="sidearmL" initialhealth="20" maxhealth="20" damageabsorption="0.2" explosionposition="-140,30,100">
+ <destructionevents>
+ <PartDestructionEvent targetType="engine" targetName="sidearmLengine" operation="destroy" message="The left auxiliary engine was destroyed!"/>
+ <PartDestructionEvent targetType="part" targetName="sidearmLfront" operation="destroy"/>
+ <PartDestructionEvent targetType="ship" targetParam="rotationthrust" operation="-" value="0.04" />
+ </destructionevents>
+ </ShipPart>
+ <ShipPart name="sidearmLfront" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-140,20,-50">
+ <destructionevents>
+ <PartDestructionEvent targetType="engine" targetName="sidearmLengine" targetParam="boostfactor" operation="set" value="1" message="The left auxiliary engine lost it's booster!"/>
+ </destructionevents>
+ </ShipPart>
+ <ShipPart name="sidearmR" initialhealth="20" maxhealth="20" damageabsorption="0.2" explosionposition="140,30,100">
+ <destructionevents>
+ <PartDestructionEvent targetType="engine" targetName="sidearmRengine" operation="destroy" message="The right auxiliary engine was destroyed!"/>
+ <PartDestructionEvent targetType="part" targetName="sidearmRfront" operation="destroy"/>
+ <PartDestructionEvent targetType="ship" targetParam="rotationthrust" operation="-" value="0.04" />
+ </destructionevents>
+ </ShipPart>
+ <ShipPart name="sidearmRfront" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="140,20,-50">
+ <destructionevents>
+ <PartDestructionEvent targetType="engine" targetName="sidearmRengine" targetParam="boostfactor" operation="set" value="1" message="The right auxiliary engine lost it's booster!"/>
+ </destructionevents>
+ </ShipPart>
+ </parts>
+
<attached>
-
<Model mesh="HeavyCruiser_body.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
- <Model mesh="HeavyCruiser_frontL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
- <Model mesh="HeavyCruiser_frontR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
- <Model mesh="HeavyCruiser_partL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
- <Model mesh="HeavyCruiser_partR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
- <Model mesh="HeavyCruiser_sidearmL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
- <Model mesh="HeavyCruiser_sidearmLfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
- <Model mesh="HeavyCruiser_sidearmR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
- <Model mesh="HeavyCruiser_sidearmRfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+
+ <StaticEntity name="frontL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model mesh="HeavyCruiser_frontL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+ <BlinkingBillboard position="-75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
+ <BlinkingBillboard position="-74,30,-402" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.1 frequency=0.3 phase=120 quadratic=1 />
+ <BlinkingBillboard position="-73,30,-388" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.15 frequency=0.3 phase=0 quadratic=1 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="-80,33,-320" halfExtents="7,11,54" info="frontL"/>
+ <BoxCollisionShape position="-79,31,-399" halfExtents="3,6,26" info="frontL"/>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="frontR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model mesh="HeavyCruiser_frontR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+ <BlinkingBillboard position="75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
+ <BlinkingBillboard position="74,30,-402" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.1 frequency=0.3 phase=120 quadratic=1 />
+ <BlinkingBillboard position="73,30,-388" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.15 frequency=0.3 phase=0 quadratic=1 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="80,33,-320" halfExtents="7,11,54" info="frontR"/>
+ <BoxCollisionShape position="79,31,-399" halfExtents="3,6,26" info="frontR"/>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="partL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model mesh="HeavyCruiser_partL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="-94,33,-179" halfExtents="11,13,45" info="partL"/>
+ <BoxCollisionShape position="-96,33,-230" halfExtents="13,17,22" info="partL"/>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="partR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model mesh="HeavyCruiser_partR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="94,33,-179" halfExtents="11,13,45" info="partR"/>
+ <BoxCollisionShape position="96,33,-230" halfExtents="13,17,22" info="partR"/>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="sidearmL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model mesh="HeavyCruiser_sidearmL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="-109,47,87" halfExtents="29,8,26" info="sidearmL, upper connection"/>
+ <BoxCollisionShape position="-99,-1,79" roll="15" halfExtents="40,4,9" info="sidearmL, lower connection"/>
+ <BoxCollisionShape position="-145,21,115" roll="15" halfExtents="19,31,105" info="sidearmL, front"/>
+ <BoxCollisionShape position="-140,12,261" roll="15" halfExtents="22,41,43" info="sidearmL, back"/>
+ <BoxCollisionShape position="-145,25,5" roll="15" halfExtents="10,18,5" info="sidearmL, front break"/>
+ <BoxCollisionShape position="-133,-13,29" roll="15" halfExtents="12,6,17" info="sidearmL, bottom cylinder"/>
+ <BoxCollisionShape position="-165,-4,31" roll="15" halfExtents="7,21,13" info="sidearmL, box"/>
+ <BoxCollisionShape position="-153,59,96" roll="15" halfExtents="6,7,60" info="sidearmL, upper beam"/>
+ <BoxCollisionShape position="-143,57,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper inner beam"/>
+ <BoxCollisionShape position="-142,53,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper inner beam"/>
+ <BoxCollisionShape position="-160,52,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper outer beam"/>
+ <BoxCollisionShape position="-159,48,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper outer beam"/>
+ <BoxCollisionShape position="-152,54,34" pitch="-46" yaw="-14" roll="15" halfExtents="6,7,10" info="sidearmL, upper beam front"/>
+ <BoxCollisionShape position="-152,54,162" pitch="30" yaw="9" roll="15" halfExtents="6,7,12" info="sidearmL, upper beam back"/>
+ <BoxCollisionShape position="-168,21,119" roll="15" halfExtents="3,5,109" info="sidearmL, outer beam"/>
+ <BoxCollisionShape position="-134,-10,169" roll="15" halfExtents="6,4,55" info="sidearmL, lower beam front"/>
+ <BoxCollisionShape position="-131,-20,217" pitch="-20" roll="15" yaw="-5" halfExtents="6,12,3" info="sidearmL, lower beam middle"/>
+ <BoxCollisionShape position="-130,-29,233" roll="15" halfExtents="6,3,15" info="sidearmL, lower beam back"/>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="sidearmLfront" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model mesh="HeavyCruiser_sidearmLfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="-141,15,-53" roll="15" halfExtents="27,44,62" info="sidearmLfront"/>
+ <BoxCollisionShape position="-153,59,-30" roll="15" halfExtents="4,2,38" info="sidearmLfront, top"/>
+ <BoxCollisionShape position="-153,61,-41" roll="15" halfExtents="4,4,11" info="sidearmLfront, top"/>
+ <BoxCollisionShape position="-153,60,-65" roll="15" halfExtents="4,3,4" info="sidearmLfront, top"/>
+ <BoxCollisionShape position="-153,59,-41" roll="15" halfExtents="8,2,11" info="sidearmLfront, top"/>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="sidearmR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model mesh="HeavyCruiser_sidearmR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="109,47,87" halfExtents="29,8,26" info="sidearmR, upper connection"/>
+ <BoxCollisionShape position="99,-1,79" roll="-15" halfExtents="40,4,9" info="sidearmR, lower connection"/>
+ <BoxCollisionShape position="145,21,115" roll="-15" halfExtents="19,31,105" info="sidearmR, front"/>
+ <BoxCollisionShape position="140,12,261" roll="-15" halfExtents="22,41,43" info="sidearmR, back"/>
+ <BoxCollisionShape position="145,25,5" roll="-15" halfExtents="10,18,5" info="sidearmR, front break"/>
+ <BoxCollisionShape position="133,-13,29" roll="-15" halfExtents="12,6,17" info="sidearmR, bottom cylinder"/>
+ <BoxCollisionShape position="165,-4,31" roll="-15" halfExtents="7,21,13" info="sidearmR, box"/>
+ <BoxCollisionShape position="153,59,96" roll="-15" halfExtents="6,7,60" info="sidearmR, upper beam"/>
+ <BoxCollisionShape position="143,57,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper inner beam"/>
+ <BoxCollisionShape position="142,53,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper inner beam"/>
+ <BoxCollisionShape position="160,52,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper outer beam"/>
+ <BoxCollisionShape position="159,48,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper outer beam"/>
+ <BoxCollisionShape position="152,54,34" pitch="-46" yaw="14" roll="-15" halfExtents="6,7,10" info="sidearmR, upper beam front"/>
+ <BoxCollisionShape position="152,54,162" pitch="30" yaw="-9" roll="-15" halfExtents="6,7,12" info="sidearmR, upper beam back"/>
+ <BoxCollisionShape position="168,21,119" roll="-15" halfExtents="3,5,109" info="sidearmR, outer beam"/>
+ <BoxCollisionShape position="134,-10,169" roll="-15" halfExtents="6,4,55" info="sidearmR, lower beam front"/>
+ <BoxCollisionShape position="131,-20,217" pitch="-20" roll="-15" yaw="5" halfExtents="6,12,3" info="sidearmR, lower beam middle"/>
+ <BoxCollisionShape position="130,-29,233" roll="-15" halfExtents="6,3,15" info="sidearmR, lower beam back"/>
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="sidearmRfront" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model mesh="HeavyCruiser_sidearmRfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="141,15,-53" roll="-15" halfExtents="27,44,62" info="sidearmRfront"/>
+ <BoxCollisionShape position="153,59,-30" roll="-15" halfExtents="4,2,38" info="sidearmRfront, top"/>
+ <BoxCollisionShape position="153,61,-41" roll="-15" halfExtents="4,4,11" info="sidearmRfront, top"/>
+ <BoxCollisionShape position="153,60,-65" roll="-15" halfExtents="4,3,4" info="sidearmRfront, top"/>
+ <BoxCollisionShape position="153,59,-41" roll="-15" halfExtents="8,2,11" info="sidearmRfront, top"/>
+ </collisionShapes>
+ </StaticEntity>
- <!-- bay1 lights -->
- <BlinkingBillboard position="75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
- <BlinkingBillboard position="-75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
- <BlinkingBillboard position="74,30,-402" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.1 frequency=0.3 phase=120 quadratic=1 />
- <BlinkingBillboard position="-74,30,-402" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.1 frequency=0.3 phase=120 quadratic=1 />
- <BlinkingBillboard position="73,30,-388" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.15 frequency=0.3 phase=0 quadratic=1 />
- <BlinkingBillboard position="-73,30,-388" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.15 frequency=0.3 phase=0 quadratic=1 />
<!-- front position lights -->
<BlinkingBillboard position="67,-5,-240" material="Examples/Flare" colour="0, 0.7, 0, 0.1" amplitude=0.3 frequency=0.15 phase=0 quadratic=1 />
<BlinkingBillboard position="-67,-5,-240" material="Examples/Flare" colour="0.7, 0, 0, 0.1" amplitude=0.3 frequency=0.15 phase=360 quadratic=1 />
@@ -78,76 +241,6 @@
</attached>
<collisionShapes>
- <BoxCollisionShape position="80,33,-320" halfExtents="7,11,54" info="frontR"/>
- <BoxCollisionShape position="79,31,-399" halfExtents="3,6,26" info="frontR"/>
-
-
- <BoxCollisionShape position="-80,33,-320" halfExtents="7,11,54" info="frontL"/>
- <BoxCollisionShape position="-79,31,-399" halfExtents="3,6,26" info="frontL"/>
-
-
- <BoxCollisionShape position="94,33,-179" halfExtents="11,13,45" info="partR"/>
- <BoxCollisionShape position="96,33,-230" halfExtents="13,17,22" info="partR"/>
-
-
- <BoxCollisionShape position="-94,33,-179" halfExtents="11,13,45" info="partL"/>
- <BoxCollisionShape position="-96,33,-230" halfExtents="13,17,22" info="partL"/>
-
-
- <BoxCollisionShape position="109,47,87" halfExtents="29,8,26" info="sidearmR, upper connection"/>
- <BoxCollisionShape position="99,-1,79" roll="-15" halfExtents="40,4,9" info="sidearmR, lower connection"/>
- <BoxCollisionShape position="145,21,115" roll="-15" halfExtents="19,31,105" info="sidearmR, front"/>
- <BoxCollisionShape position="140,12,261" roll="-15" halfExtents="22,41,43" info="sidearmR, back"/>
- <BoxCollisionShape position="145,25,5" roll="-15" halfExtents="10,18,5" info="sidearmR, front break"/>
- <BoxCollisionShape position="133,-13,29" roll="-15" halfExtents="12,6,17" info="sidearmR, bottom cylinder"/>
- <BoxCollisionShape position="165,-4,31" roll="-15" halfExtents="7,21,13" info="sidearmR, box"/>
- <BoxCollisionShape position="153,59,96" roll="-15" halfExtents="6,7,60" info="sidearmR, upper beam"/>
- <BoxCollisionShape position="143,57,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper inner beam"/>
- <BoxCollisionShape position="142,53,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper inner beam"/>
- <BoxCollisionShape position="160,52,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper outer beam"/>
- <BoxCollisionShape position="159,48,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper outer beam"/>
- <BoxCollisionShape position="152,54,34" pitch="-46" yaw="14" roll="-15" halfExtents="6,7,10" info="sidearmR, upper beam front"/>
- <BoxCollisionShape position="152,54,162" pitch="30" yaw="-9" roll="-15" halfExtents="6,7,12" info="sidearmR, upper beam back"/>
- <BoxCollisionShape position="168,21,119" roll="-15" halfExtents="3,5,109" info="sidearmR, outer beam"/>
- <BoxCollisionShape position="134,-10,169" roll="-15" halfExtents="6,4,55" info="sidearmR, lower beam front"/>
- <BoxCollisionShape position="131,-20,217" pitch="-20" roll="-15" yaw="5" halfExtents="6,12,3" info="sidearmR, lower beam middle"/>
- <BoxCollisionShape position="130,-29,233" roll="-15" halfExtents="6,3,15" info="sidearmR, lower beam back"/>
-
-
- <BoxCollisionShape position="141,15,-53" roll="-15" halfExtents="27,44,62" info="sidearmRfront"/>
- <BoxCollisionShape position="153,59,-30" roll="-15" halfExtents="4,2,38" info="sidearmRfront, top"/>
- <BoxCollisionShape position="153,61,-41" roll="-15" halfExtents="4,4,11" info="sidearmRfront, top"/>
- <BoxCollisionShape position="153,60,-65" roll="-15" halfExtents="4,3,4" info="sidearmRfront, top"/>
- <BoxCollisionShape position="153,59,-41" roll="-15" halfExtents="8,2,11" info="sidearmRfront, top"/>
-
-
- <BoxCollisionShape position="-109,47,87" halfExtents="29,8,26" info="sidearmL, upper connection"/>
- <BoxCollisionShape position="-99,-1,79" roll="15" halfExtents="40,4,9" info="sidearmL, lower connection"/>
- <BoxCollisionShape position="-145,21,115" roll="15" halfExtents="19,31,105" info="sidearmL, front"/>
- <BoxCollisionShape position="-140,12,261" roll="15" halfExtents="22,41,43" info="sidearmL, back"/>
- <BoxCollisionShape position="-145,25,5" roll="15" halfExtents="10,18,5" info="sidearmL, front break"/>
- <BoxCollisionShape position="-133,-13,29" roll="15" halfExtents="12,6,17" info="sidearmL, bottom cylinder"/>
- <BoxCollisionShape position="-165,-4,31" roll="15" halfExtents="7,21,13" info="sidearmL, box"/>
- <BoxCollisionShape position="-153,59,96" roll="15" halfExtents="6,7,60" info="sidearmL, upper beam"/>
- <BoxCollisionShape position="-143,57,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper inner beam"/>
- <BoxCollisionShape position="-142,53,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper inner beam"/>
- <BoxCollisionShape position="-160,52,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper outer beam"/>
- <BoxCollisionShape position="-159,48,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper outer beam"/>
- <BoxCollisionShape position="-152,54,34" pitch="-46" yaw="-14" roll="15" halfExtents="6,7,10" info="sidearmL, upper beam front"/>
- <BoxCollisionShape position="-152,54,162" pitch="30" yaw="9" roll="15" halfExtents="6,7,12" info="sidearmL, upper beam back"/>
- <BoxCollisionShape position="-168,21,119" roll="15" halfExtents="3,5,109" info="sidearmL, outer beam"/>
- <BoxCollisionShape position="-134,-10,169" roll="15" halfExtents="6,4,55" info="sidearmL, lower beam front"/>
- <BoxCollisionShape position="-131,-20,217" pitch="-20" roll="15" yaw="-5" halfExtents="6,12,3" info="sidearmL, lower beam middle"/>
- <BoxCollisionShape position="-130,-29,233" roll="15" halfExtents="6,3,15" info="sidearmL, lower beam back"/>
-
-
- <BoxCollisionShape position="-141,15,-53" roll="15" halfExtents="27,44,62" info="sidearmLfront"/>
- <BoxCollisionShape position="-153,59,-30" roll="15" halfExtents="4,2,38" info="sidearmLfront, top"/>
- <BoxCollisionShape position="-153,61,-41" roll="15" halfExtents="4,4,11" info="sidearmLfront, top"/>
- <BoxCollisionShape position="-153,60,-65" roll="15" halfExtents="4,3,4" info="sidearmLfront, top"/>
- <BoxCollisionShape position="-153,59,-41" roll="15" halfExtents="8,2,11" info="sidearmLfront, top"/>
-
-
<BoxCollisionShape position="60,35,-310" halfExtents="13,28,60" info="body, bay1, Rwall"/>
<BoxCollisionShape position="-60,35,-310" halfExtents="13,28,60" info="body, bay1, Lwall"/>
<BoxCollisionShape position="0,56,-310" halfExtents="65,6,60" info="body, bay1, Twall"/>
@@ -292,7 +385,7 @@
<?lua
include("../includes/weaponSettingsHeavyCruiser.oxi")
?>
- </SpaceShip>
+ </ModularSpaceShip>
</Template>
@@ -317,6 +410,7 @@
<Template name=HeavyCruiser_body_engine1 baseclass=MultiStateEngine>
<MultiStateEngine
+ name = bodyengine
boostfactor = 2
speedfront = 150
@@ -411,6 +505,7 @@
<Template name=HeavyCruiser_sidearmL_engine1 baseclass=MultiStateEngine>
<MultiStateEngine
+ name = sidearmLengine
boostfactor = 2
speedfront = 300
@@ -460,6 +555,7 @@
<Template name=HeavyCruiser_sidearmR_engine1 baseclass=MultiStateEngine>
<MultiStateEngine
+ name = sidearmRengine
boostfactor = 2
speedfront = 300
Copied: code/trunk/data/levels/templates/ModularSpaceShipTest.oxt (from rev 10215, code/branches/presentationFS14/data/levels/templates/ModularSpaceShipTest.oxt)
===================================================================
--- code/trunk/data/levels/templates/ModularSpaceShipTest.oxt (rev 0)
+++ code/trunk/data/levels/templates/ModularSpaceShipTest.oxt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,166 @@
+<Template name=ModularSpaceShipTest>
+ <ModularSpaceShip
+ hudtemplate = spaceshiphud
+ camerapositiontemplate = spaceshipassffcameras
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = 3
+ explosionchunks = 6
+
+ health = 1000
+ maxhealth = 2000
+ initialhealth = 1000
+
+ shieldhealth = 30
+ initialshieldhealth = 30
+ maxshieldhealth = 50
+ shieldabsorption = 0.8
+ reloadrate = 1
+ reloadwaittime = 1
+
+ primaryThrust = 100
+ auxilaryThrust = 30
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 15
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+
+ explosionSound = "sounds/Explosion2.ogg"
+ >
+ <engines>
+ <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
+ <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine />
+ </engines>
+ <attached>
+
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="6,6,6" />
+
+ <StaticEntity name="one" position="0,60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="two" position="0,0,62" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="two_2" position="0,0,124" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="three" position="0,-60,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="four" position="0,0,-59" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <StaticEntity name="four_2" position="0,0,-118" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="30,30,30" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+ </StaticEntity>
+
+ </attached>
+
+ <parts>
+ <ShipPart name="one" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="two" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="two_2" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="three" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="four" initialhealth="20" damageabsorption="1" />
+ <ShipPart name="four_2" initialhealth="20" damageabsorption="1" />
+ </parts>
+
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="30,30,30" />
+ </collisionShapes>
+<?lua
+ include("../includes/weaponSettingsAssff.oxi")
+?>
+ </ModularSpaceShip>
+</Template>
+
+<Template name=spaceshipassffcameras defaults=0>
+ <ModularSpaceShip>
+ <camerapositions>
+ <CameraPosition position="0,10, 40" drag=true mouselook=true />
+ </camerapositions>
+ </ModularSpaceShip>
+</Template>
+
+<Template name=spaceshipassffengine baseclass=MultiStateEngine>
+ <MultiStateEngine
+ boostfactor = 2
+
+ speedfront = 150
+ speedback = 50
+ speedleftright = 50
+ speedupdown = 50
+
+ defEngineSndNormal = "sounds/Engine_low.ogg"
+ defEngineSndBoost = "sounds/Engine_high.ogg"
+
+ accelerationfront = 500
+ accelerationbrake = 500
+ accelerationback = 125
+ accelerationleftright = 125
+ accelerationupdown = 125
+ >
+ <EffectContainer condition="idle">
+
+ </EffectContainer>
+ <EffectContainer condition="not idle">
+
+ </EffectContainer>
+ <EffectContainer condition="normal or brake">
+
+ </EffectContainer>
+ <EffectContainer condition="normal or boost">
+
+ </EffectContainer>
+ <EffectContainer condition="boost">
+
+ </EffectContainer>
+ </MultiStateEngine>
+</Template>
Copied: code/trunk/data/levels/templates/standardTurret.oxt (from rev 10215, code/branches/presentationFS14/data/levels/templates/standardTurret.oxt)
===================================================================
--- code/trunk/data/levels/templates/standardTurret.oxt (rev 0)
+++ code/trunk/data/levels/templates/standardTurret.oxt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,40 @@
+<Template name=standardturret>
+ <Turret>
+ <attached>
+ <Model position="0,0,0" mesh="turretSocketFront.mesh" scale3D="10,10,10" pitch=-90/>
+ <Model position="0,0,0" mesh="turretSocketIn.mesh" scale3D="10,10,10" pitch=-90/>
+ <Model position="0,0,0" mesh="turretSocketTop.mesh" scale3D="10,10,10" pitch=-90/>
+ <Model position="0,0,0" mesh="turretSocketLeft.mesh" scale3D="10,10,10" pitch=-90/>
+ <Model position="0,0,0" mesh="turretSocketRight.mesh" scale3D="10,10,10" pitch=-90/>
+
+ <Turret position="0,0,-10" mass=100 maxPitch=90 maxYaw=90 maxAttackRadius=2000 minAttackRadius=30>
+ <attached>
+ <Model position="0,0,0" pitch="-90" roll="0" mesh="turretHead.mesh" scale3D="10,10,10"/>
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="10" position = "0,0,0"/>
+ </collisionShapes>
+ <controller>
+ <TurretController/>
+ </controller>
+ <?lua
+ include("../includes/weaponSettingsTurret.oxi")
+ ?>
+ </Turret>
+ </attached>
+
+ <controller>
+ <TeamTargetProxy/>
+ </controller>
+ </Turret>
+</Template>
+
+<Template name=spaceshipturretcameras defaults=0>
+ <SpaceShip>
+ <camerapositions>
+ <CameraPosition position="0,10, 40" drag=true mouselook=true />
+ <CameraPosition position="0,20, 80" drag=true mouselook=true />
+ <CameraPosition position="0,30,120" drag=true mouselook=true />
+ </camerapositions>
+ </SpaceShip>
+</Template>
\ No newline at end of file
Modified: code/trunk/data/levels/turretTest.oxw
===================================================================
--- code/trunk/data/levels/turretTest.oxw 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/data/levels/turretTest.oxw 2015-01-31 17:03:17 UTC (rev 10216)
@@ -2,7 +2,7 @@
<LevelInfo
name = "turret Test"
- description = "A level with a turret in it."
+ description = "A level to test turrets with."
tags = "test"
screenshot = "emptylevel.png"
/>
@@ -15,8 +15,7 @@
<?lua
include("templates/spaceshipAssff.oxt")
- include("templates/spaceshipPirate.oxt")
- include("templates/spaceshipTurret.oxt")
+ include("templates/standardTurret.oxt")
?>
<Level>
@@ -32,31 +31,26 @@
<Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
<SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+<SpaceShip position = "0,0,800" collisionType="dynamic" team=10>
+ <controller>
+ <TeamTargetProxy team=10/>
+ </controller>
+ <attached>
+ <Model position="0,0,0" mesh="plane.mesh" scale3D="20,20,20" pitch=-90/>
-<StaticEntity position="0,0,0" yaw=0 pitch=0>
- <attached>
- <Model position="0,0,0" mesh="turretSocketFront.mesh" scale3D="10,10,10" />
- <Model position="0,0,0" mesh="turretSocketIn.mesh" scale3D="10,10,10" />
- <Model position="0,0,0" mesh="turretSocketTop.mesh" scale3D="10,10,10" />
- <Model position="0,0,0" mesh="turretSocketLeft.mesh" scale3D="10,10,10" />
- <Model position="0,0,0" mesh="turretSocketRight.mesh" scale3D="10,10,10" />
- </attached>
-</StaticEntity>
+ <?lua for i = 1, 10, 1 do ?>
+ <Turret position="<?lua print(150-i*30) ?>,<?lua print(150-i*30) ?>,0" pitch="0" yaw="0" roll="0">
+ <templates>
+ <Template link=standardturret />
+ </templates>
+ </Turret>
+ <?lua end ?>
-
-
-<Turret position="0,10,0" pitch="90" yaw="0" roll="0">
- <templates>
- <Template link=spaceshipturret />
- </templates>
- <controller>
- <WaypointPatrolController alertnessradius=100 team=10>
- </WaypointPatrolController>
- </controller>
-</Turret>
-
-
-
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape radius="10" position="0,0,0" halfExtents="200, 200, 0"/>
+ </collisionShapes>
+</SpaceShip>
</Scene>
</Level>
Copied: code/trunk/data/overlays/jumpHUD.oxo (from rev 10215, code/branches/presentationFS14/data/overlays/jumpHUD.oxo)
===================================================================
--- code/trunk/data/overlays/jumpHUD.oxo (rev 0)
+++ code/trunk/data/overlays/jumpHUD.oxo 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,27 @@
+<Template name="JumpHUD">
+ <OverlayGroup name="JumpHUD" scale = "1, 1">
+ <JumpScore
+ position = "0.5, 0.05"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.06
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "center"
+ showScore = true
+ showMessages = false
+ />
+
+ <JumpScore
+ position = "0.5, 0.5"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.2
+ colour = "1.0, 0.0, 0.0, 1.0"
+ align = "center"
+ gameOverText = "GAME OVER"
+ showScore = false
+ showMessages = true
+ />
+
+ </OverlayGroup>
+</Template>
Modified: code/trunk/src/modules/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/CMakeLists.txt 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/CMakeLists.txt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -39,3 +39,4 @@
ADD_SUBDIRECTORY(docking)
ADD_SUBDIRECTORY(towerdefense)
ADD_SUBDIRECTORY(invader)
+ADD_SUBDIRECTORY(jump)
Modified: code/trunk/src/modules/invader/InvaderWeapon.cc
===================================================================
--- code/trunk/src/modules/invader/InvaderWeapon.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/invader/InvaderWeapon.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -56,8 +56,11 @@
RegisterObject(InvaderWeapon);
}
- InvaderWeapon::~InvaderWeapon(){}
+ InvaderWeapon::~InvaderWeapon()
+ {
+ }
+
void InvaderWeapon::shot()
{
assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
Modified: code/trunk/src/modules/objects/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/objects/CMakeLists.txt 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/objects/CMakeLists.txt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -10,6 +10,7 @@
ADD_SUBDIRECTORY(collisionshapes)
ADD_SUBDIRECTORY(eventsystem)
ADD_SUBDIRECTORY(triggers)
+ADD_SUBDIRECTORY(controllers)
ORXONOX_ADD_LIBRARY(objects
MODULE
Modified: code/trunk/src/modules/objects/Turret.cc
===================================================================
--- code/trunk/src/modules/objects/Turret.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/objects/Turret.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Marian Runo
+ * Marian Runo, Martin Mueller
* Co-authors:
* ...
*
@@ -28,58 +28,257 @@
#include "Turret.h"
#include "core/CoreIncludes.h"
-#include "OgreQuaternion.h"
#include "core/XMLPort.h"
-#include "controllers/WaypointPatrolController.h"
+#include "Scene.h"
+#include <OgreSceneManager.h>
+
namespace orxonox
{
RegisterClass(Turret);
+
+
/**
- * @brief Constructor
+ @brief
+ Sets default values for all variables. Also hides the turret from the radar.
+
+ @param context
+ The context
*/
- Turret::Turret(Context* context) : SpaceShip(context)
+ Turret::Turret(Context* context) : Pawn(context)
{
RegisterObject(Turret);
- this->controller_ = new WaypointPatrolController(this->getContext());
+ this->rotationThrust_ = 50;
+ this->startDir_ = Vector3::ZERO;
+ this->localZ_ = Vector3::UNIT_Z;
+ this->localY_ = Vector3::UNIT_Y;
+ this->localX_ = Vector3::UNIT_X;
+ this->maxAttackRadius_ = 200;
+ this->minAttackRadius_ = 0;
+ this->maxPitch_ = 90;
+ this->maxYaw_ = 90;
+ this->once_ = false;
+ this->rotation_ = Quaternion::IDENTITY;
+
+ this->setRadarVisibility(false);
+
+ //this->rayTest_ = this->getScene()->getSceneManager()->createRayQuery(Ogre::Ray());
}
/**
- * @brief Destructor
+ @brief
+ Destructor. Destroys the rayTest_ element (if it was used) .
*/
Turret::~Turret()
{
+ //this->getScene()->getSceneManager()->destroyQuery(this->rayTest_);
+ }
+ /**
+ @brief
+ Checks, if a WorldEntity is inside the turret's range.
+
+ This function is safe to use on turrets that are attached, rotated, etc.
+ The turret's range is determined with the maxPitch, maxYaw, and the two attackRadius.
+
+ @param target
+ The WorldEntity to check
+
+ @return
+ The squared distance to the position. -1, if it's ouside of range
+ */
+ float Turret::isInRange(const WorldEntity* target )
+ {
+ //Check distance
+ Vector3 distance = target->getWorldPosition() - this->getWorldPosition();
+ float distanceVal = distance.squaredLength();
+ if(distanceVal > (this->maxAttackRadius_ * this->maxAttackRadius_) || distanceVal < (this->minAttackRadius_ * this->minAttackRadius_))
+ {
+ return -1.f;
+ }
+
+ //Check pitch
+ Vector3 dir = getTransformedVector(distance, this->localX_, this->localY_, this->localZ_);
+ Vector3 dirProjected = dir;
+ dirProjected.x = 0;
+ Vector3 startDirProjected = this->startDir_;
+ startDirProjected.x = 0;
+ Ogre::Real angle = startDirProjected.angleBetween(dirProjected).valueDegrees();
+ if(angle > this->maxPitch_)
+ {
+ return -1.f;
+ }
+
+ //Check yaw
+ dirProjected = dir;
+ dirProjected.y = 0;
+ startDirProjected = this->startDir_;
+ startDirProjected.y = 0;
+ angle = startDirProjected.angleBetween(dirProjected).valueDegrees();
+ if(angle > this->maxYaw_)
+ {
+ return -1.f;
+ }
+
+ //TODO: Finish this. Find a way to convert objects from Ogre to Orxonox
+ /*Ogre::Ray ray = Ogre::Ray(this->getWorldPosition(), distance);
+ this->rayTest_->setRay(ray);
+ Ogre::RaySceneQueryResult result = this->rayTest_->execute();*/
+
+
+ return distanceVal;
}
+ /**
+ @brief
+ Rotates the turret to make it aim at a certain position.
- void Turret::rotatePitch(const Vector2& value)
+ @note
+ There are no checks, if the position is valid (i.e. if the turret is allowed to aim there).
+ This function must be called again for every tick, or the turret will stop rotating.
+
+ @param position
+ The position to aim at
+ */
+ void Turret::aimAtPosition(const Vector3& position)
{
- orxout()<< "Turret rotate Pitch"<< endl;
+ Vector3 currDir = this->getWorldOrientation() * WorldEntity::FRONT;
+ Vector3 targetDir = position - this->getWorldPosition();
- const Quaternion& orient = this->getOrientation();
- Radian pitch = orient.getPitch();
+ this->rotation_ = currDir.getRotationTo(targetDir);
+ }
- if((value.x > 0 && pitch < Radian(180)) || (value.x < 0 && pitch > Radian(0)))
- SpaceShip::rotatePitch(value);
+ /**
+ @brief
+ Does currently nothing.
+
+ Should rotate the turret with the specified pitch. Contains a failed attempt at limiting said rotation.
+ */
+ void Turret::rotatePitch(const Vector2& value)
+ {
+ //This is a failed attempt at limiting the turret's rotation. It's handled in the controller (for now?)
+ /*
+ Vector3 currentDir = getTransformedVector(this->getOrientation() * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
+ Vector3 currentDirProjected = currentDir;
+ currentDirProjected.x = 0;
+ Vector3 startDirProjected = this->startDir_;
+ startDirProjected.x = 0;
+ Ogre::Real angle = startDirProjected.angleBetween(currentDirProjected).valueDegrees();
+ //orxout() << "Pitch: " << angle << endl;
+ //if(angle < this->maxPitch_ || (currentDirProjected.y <= 0 && value.x > 0) || (currentDirProjected.y > 0 && value.x < 0) )
+ {
+ this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x*0.8f);
+ }
+ */
}
+ /**
+ @brief
+ Does currently nothing.
- void Turret::setAlertnessRadius(float value)
+ Should rotate the turret with the specified yaw. Contains a failed attempt at limiting said rotation.
+ */
+ void Turret::rotateYaw(const Vector2& value)
{
- this->controller_->setAlertnessRadius(value);
+ //This is a failed attempt at limiting the turret's rotation. It's handled in the controller (for now?)
+ /*
+ Vector3 currentDir = getTransformedVector(this->getOrientation() * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
+ Vector3 currentDirProjected = currentDir;
+ currentDirProjected.y = 0;
+ Vector3 startDirProjected = this->startDir_;
+ startDirProjected.y = 0;
+ Ogre::Real angle = startDirProjected.angleBetween(currentDirProjected).valueDegrees();
+ orxout() << "Yaw: " << angle << endl;
+ if(angle < this->maxYaw_ || (currentDirProjected.x <= 0 && value.x < 0) || (currentDirProjected.x > 0 && value.x > 0))
+ {
+ this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x*0.8f);
+ }
+ */
}
- float Turret::getAlertnessRadius()
+
+ /**
+ @brief
+ Does currently nothing.
+
+ May be used to limit turret's rotation in the future.
+ */
+ void Turret::rotateRoll(const Vector2& value)
{
- return this->controller_->getAlertnessRadius();
}
+ /**
+ @brief
+ Loads parameters from xml
+
+ Parameters loaded are: rotationThrust, maxAttackRadius, minAttackRadius, maxYaw, maxPitch
+ */
void Turret::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(Turret, XMLPort, xmlelement, mode);
- XMLPortParam(Turret, "alertnessRadius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues("400");
+
+ XMLPortParamVariable(Turret, "rotationThrust", rotationThrust_, xmlelement, mode);
+ XMLPortParam(Turret, "maxAttackRadius", setMaxAttackRadius, getMaxAttackRadius, xmlelement, mode);
+ XMLPortParam(Turret, "minAttackRadius", setMinAttackRadius, getMinAttackRadius, xmlelement, mode);
+ XMLPortParam(Turret, "maxYaw", setMaxYaw, getMaxYaw, xmlelement, mode);
+ XMLPortParam(Turret, "maxPitch", setMaxPitch, getMaxPitch, xmlelement, mode);
}
+ /**
+ @brief
+ The turret's actions are done here.
-}
+ Every tick, the turret gets rotated if it should, and the local axes get updated with the parent's rotation.
+
+ @param dt
+ Duration of the tick
+ */
+ void Turret::tick(float dt)
+ {
+ SUPER(Turret, tick, dt);
+
+ //Stuff isn't properly initialized in the c'tor, so we have to do it like this
+ if(!this->once_)
+ {
+ //Account for rotations done in xml
+ Quaternion startOrient = this->getOrientation();
+ this->localXStart_ = startOrient * this->localX_;
+ this->localXStart_.normalise();
+ this->localX_ = this->localXStart_;
+ this->localYStart_ = startOrient * this->localY_;
+ this->localYStart_.normalise();
+ this->localY_ = this->localYStart_;
+ this->localZStart_ = startOrient * this->localZ_;
+ this->localZStart_.normalise();
+ this->localZ_ = this->localZStart_;
+
+ //startDir should always be (0,0,-1)
+ this->startDir_ = getTransformedVector(startOrient * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
+
+ this->once_ = true;
+
+ }
+
+ //Adjust local axes to parent's rotation
+ WorldEntity* parent = this->getParent();
+ if(parent)
+ {
+ Quaternion parentrot = parent->getWorldOrientation();
+ this->localX_ = parentrot * this->localXStart_;
+ this->localY_ = parentrot * this->localYStart_;
+ this->localZ_ = parentrot * this->localZStart_;
+ }
+
+ //rotate
+ if(this->rotation_ != Quaternion::IDENTITY)
+ {
+ //Don't make the rotation instantaneous. Use an arbitrary interpolation, not that great...
+ //TODO: make the rotation better (constant velocity etc.). At the moment, the turret rotates
+ //slower the closer it is to the destination
+ Quaternion drot = Quaternion::nlerp(dt*this->rotationThrust_/20.f, Quaternion::IDENTITY, this->rotation_);
+ this->rotate(drot, WorldEntity::World);
+ this->rotation_ = Quaternion::IDENTITY;
+ }
+
+ }
+}
\ No newline at end of file
Modified: code/trunk/src/modules/objects/Turret.h
===================================================================
--- code/trunk/src/modules/objects/Turret.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/objects/Turret.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -20,14 +20,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Marian Runo
+ * Marian Runo, Martin Mueller
* Co-authors:
* ...
*
*/
/**
- @file Turret.h
@brief Definition of the Turret class.
@ingroup Objects
*/
@@ -36,33 +35,93 @@
#define _Turret_H__
#include "objects/ObjectsPrereqs.h"
+#include "worldentities/pawns/Pawn.h"
+#include <OgreSceneQuery.h>
-#include "worldentities/pawns/SpaceShip.h"
-
namespace orxonox
{
- class _ObjectsExport Turret : public SpaceShip
+ /**
+ @brief
+ Creates a turret with limited rotation. The point of this class is to be able to attach
+ a turret to a spaceship or a spacestation which is more or less completely autonomous in
+ it's behaviour.
+
+ This class also contains a custom local coordinate system, which gets initially rotated through xml, and
+ afterwards is updated with the parent's rotation (if there is one). This allows for almost trivialal calculation
+ of pitch, yaw and roll through coordinate transformation. (TODO: Ogre should do something like this already, investigate...)
+
+
+ @note
+ The rotation isn't limited "physically". You have to call isInRange to find out if the turret is allowed to shoot at a target.
+ */
+ class _ObjectsExport Turret : public Pawn
{
public:
Turret(Context* context);
virtual ~Turret();
- //virtual void tick(float dt);
-
virtual void rotatePitch(const Vector2& value);
+ virtual void rotateYaw(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);
+ virtual float isInRange(const WorldEntity* target);
+ virtual void aimAtPosition(const Vector3 &position);
- void setAlertnessRadius(float value);
- float getAlertnessRadius();
-
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+ /** @brief Sets the maximum distance the turret is allowed to shoot. @param radius The distance*/
+ inline void setMaxAttackRadius(float radius)
+ { this->maxAttackRadius_ = radius; }
+ /** @brief Sets the minimum distance the turret is allowed to shoot. @param radius The distance*/
+ inline void setMinAttackRadius(float radius)
+ { this->minAttackRadius_ = radius; }
+
+ /** @brief Sets the maximum pitch the turret can have (in both directions). @param pitch The pitch (in one direction)*/
+ inline void setMaxPitch(float pitch)
+ { this->maxPitch_ = pitch; }
+
+ /** @brief Sets the maximum yaw the turret can have (in both directions). @param yaw The yaw (in one direction)*/
+ inline void setMaxYaw(float yaw)
+ { this->maxYaw_ = yaw; }
+
+ /** @brief Returns the maximum distance the turret is allowed to shoot. @return The distance */
+ inline float getMaxAttackRadius() const
+ { return this->maxAttackRadius_; }
+
+ /** @brief Returns the minimum distance the turret is allowed to shoot. @return The distance */
+ inline float getMinAttackRadius() const
+ { return this->minAttackRadius_; }
+
+ /** @brief Returns the maximum pitch the turret can have. @return The pitch */
+ inline float getMaxPitch() const
+ { return this->maxPitch_; }
+
+ /** @brief Returns the maximum yaw the turret can have. @return The yaw */
+ inline float getMaxYaw() const
+ { return this->maxYaw_; }
+
protected:
- WaypointPatrolController* controller_;
+ Vector3 startDir_; //!< The initial facing direction, in local coordinates.
+ Vector3 localZ_; //!< The local z-axis, includes for the parent's rotation and rotations done in xml.
+ Vector3 localY_; //!< The local y-axis, includes for the parent's rotation and rotations done in xml.
+ Vector3 localX_; //!< The local x-axis, includes for the parent's rotation and rotations done in xml.
+ Quaternion rotation_; //!< The rotation to be done by the turret.
+
private:
+ bool once_; //!< Flag for executing code in the tick function only once.
+ Vector3 localZStart_; //!< The local z-axis, without the parent's rotation.
+ Vector3 localYStart_; //!< The local y-axis, without the parent's rotation.
+ Vector3 localXStart_; //!< The local x-axis, without the parent's rotation.
+ float maxAttackRadius_; //!< The maximum distance the turret is allowed to shoot.
+ float minAttackRadius_; //!< The minimum distance the turret is allowed to shoot.
+ Ogre::Real maxPitch_; //!< The maxmium pitch the turret can have (on one side).
+ Ogre::Real maxYaw_; //!< The maxmium yaw the turret can have (on one side).
+ float rotationThrust_; //!< The velocity the turret rotates with.
+ Ogre::RaySceneQuery* rayTest_; //!< Used to perform a raytest, currently unused @see isInRange
+
};
}
#endif
-
Modified: code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -77,7 +77,7 @@
Returns true if the collision resulted in a successful hit.
@see Pawn.h
*/
- bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs)
{
if (!this->bDestroy_ && GameMode::isMaster())
{
@@ -95,7 +95,7 @@
// If visual effects after destruction cause problems, put this block below the effects code block
if (victim)
{
- victim->hit(this->getShooter(), contactPoint, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
+ victim->hit(this->getShooter(), contactPoint, cs, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
victim->startReloadCountdown();
}
@@ -140,6 +140,7 @@
return false;
}
+
/**
@brief
Check whether the projectile needs to be destroyed and destroys it if so.
Modified: code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -118,7 +118,7 @@
virtual void destroyObject(void);
protected:
- bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs);
void destroyCheck(void);
private:
Modified: code/trunk/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Projectile.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/weapons/projectiles/Projectile.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -87,9 +87,9 @@
this->destroyCheck();
}
- bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ bool Projectile::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
{
- return this->processCollision(otherObject, contactPoint);
+ return this->processCollision(otherObject, contactPoint, cs);
}
}
Modified: code/trunk/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Projectile.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/weapons/projectiles/Projectile.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -63,7 +63,7 @@
void setConfigValues();
virtual void tick(float dt);
- virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
private:
float lifetime_; //!< The time the projectile exists.
Modified: code/trunk/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -190,9 +190,9 @@
this->destroyCheck();
}
- bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ bool Rocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
{
- return this->processCollision(otherObject, contactPoint);
+ return this->processCollision(otherObject, contactPoint, cs);
}
/**
Modified: code/trunk/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -63,7 +63,7 @@
virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
- virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
virtual void destroyObject(void);
void destructionEffect();
Modified: code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -171,9 +171,9 @@
this->player_ = this->getShooter()->getPlayer();
}
- bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
{
- return this->processCollision(otherObject, contactPoint);
+ return this->processCollision(otherObject, contactPoint, cs);
}
/**
Modified: code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -63,7 +63,7 @@
virtual ~SimpleRocket();
virtual void tick(float dt);
- virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
void disableFire(); //!< Method to disable the fire and stop all acceleration
Modified: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/CMakeLists.txt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -30,6 +30,7 @@
MoodManager.cc
PawnManager.cc
PlayerManager.cc
+ ShipPartManager.cc
Radar.cc
# Test.cc
@@ -63,6 +64,7 @@
controllers/HumanController.h
infos/PlayerInfo.h
sound/SoundManager.h
+ controllers/ScriptController.h
PCH_FILE
OrxonoxPrecompiledHeaders.h
LINK_LIBRARIES
Modified: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -141,6 +141,8 @@
class TeamColourable;
// items
+ class ShipPart;
+ class PartDestructionEvent;
class Engine;
class Item;
class MultiStateEngine;
@@ -188,6 +190,7 @@
class Destroyer;
class Pawn;
class SpaceShip;
+ class ModularSpaceShip;
class Spectator;
class TeamBaseMatchBase;
}
Modified: code/trunk/src/orxonox/Scene.cc
===================================================================
--- code/trunk/src/orxonox/Scene.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/Scene.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -362,12 +362,16 @@
SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer());
SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
+ // get the CollisionShape pointers
+ const btCollisionShape* cs0 = colObj0->getCollisionShape();
+ const btCollisionShape* cs1 = colObj1->getCollisionShape();
+
// false means that bullet will assume we didn't modify the contact
bool modified = false;
if (object0->isCollisionCallbackActive())
- modified |= object0->collidesAgainst(object1, cp);
+ modified |= object0->collidesAgainst(object1, cs1, cp);
if (object1->isCollisionCallbackActive())
- modified |= object1->collidesAgainst(object0, cp);
+ modified |= object1->collidesAgainst(object0, cs0, cp);
return modified;
}
Copied: code/trunk/src/orxonox/ShipPartManager.cc (from rev 10215, code/branches/presentationFS14/src/orxonox/ShipPartManager.cc)
===================================================================
--- code/trunk/src/orxonox/ShipPartManager.cc (rev 0)
+++ code/trunk/src/orxonox/ShipPartManager.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,61 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "ShipPartManager.h"
+
+#include "util/ScopedSingletonManager.h"
+#include "core/CoreIncludes.h"
+#include "items/ShipPart.h"
+
+namespace orxonox
+{
+ ManageScopedSingleton(ShipPartManager, ScopeID::Root, false);
+
+ ShipPartManager::ShipPartManager()
+ {
+ RegisterObject(ShipPartManager);
+ }
+
+ ShipPartManager::~ShipPartManager()
+ {
+ // Be sure to delete all the pawns
+ for (ObjectList<ShipPart>::iterator it = ObjectList<ShipPart>::begin(); it != ObjectList<ShipPart>::end(); )
+ (it++)->death();
+ }
+
+ void ShipPartManager::preUpdate(const Clock& time)
+ {
+ for (ObjectList<ShipPart>::iterator it = ObjectList<ShipPart>::begin(); it != ObjectList<ShipPart>::end(); )
+ {
+ if (!it->isAlive())
+ (it++)->death();
+ else
+ ++it;
+ }
+ }
+}
Copied: code/trunk/src/orxonox/ShipPartManager.h (from rev 10215, code/branches/presentationFS14/src/orxonox/ShipPartManager.h)
===================================================================
--- code/trunk/src/orxonox/ShipPartManager.h (rev 0)
+++ code/trunk/src/orxonox/ShipPartManager.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,54 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ShipPartManager_H__
+#define _ShipPartManager_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "util/Singleton.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox
+{
+ class _OrxonoxExport ShipPartManager : public Singleton<ShipPartManager>, public Tickable
+ {
+ friend class Singleton<ShipPartManager>;
+ public:
+ ShipPartManager();
+ virtual ~ShipPartManager();
+
+ virtual void preUpdate(const Clock& time);
+
+ private:
+
+ static ShipPartManager* singletonPtr_s;
+ };
+}
+
+#endif /* _ShipPartManager_H__ */
Modified: code/trunk/src/orxonox/collisionshapes/CollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CollisionShape.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/collisionshapes/CollisionShape.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -120,10 +120,19 @@
// TODO: Why?
WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent);
if (parentWECCS)
+ {
this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID();
- // Else it is set to the objectID of the CompoundCollisionShape.
+
+ // If this shape is not a CompoundCollisionShape (thus an actual physical shape) & the parent is a WorldEntity's CollisionShape,
+ // set it's userPointer to the WorldEntity this CompoundCollisionShape belongs to.
+ if (!orxonox_cast<CompoundCollisionShape*>(this))
+ this->getCollisionShape()->setUserPointer(parentWECCS->getWorldEntityOwner());
+ }
else
+ {
+ // Else it is set to the objectID of the CompoundCollisionShape.
this->parentID_ = newParent->getObjectID();
+ }
return true;
}
Modified: code/trunk/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/controllers/ArtificialController.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -93,7 +93,7 @@
static const float hardcoded_projectile_speed = 1250;
- this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getVelocity());
+ this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(), hardcoded_projectile_speed, this->target_->getWorldPosition(), this->target_->getVelocity());
this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());
Modified: code/trunk/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/controllers/CMakeLists.txt 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/controllers/CMakeLists.txt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -9,4 +9,5 @@
WaypointPatrolController.cc
DroneController.cc
FormationController.cc
+ ControllerDirector.cc
)
Copied: code/trunk/src/orxonox/controllers/ControllerDirector.cc (from rev 10215, code/branches/presentationFS14/src/orxonox/controllers/ControllerDirector.cc)
===================================================================
--- code/trunk/src/orxonox/controllers/ControllerDirector.cc (rev 0)
+++ code/trunk/src/orxonox/controllers/ControllerDirector.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,157 @@
+/*
+ * First try of a ControllerDirector. Target: An event occurs in the levelTry.oxw
+ * file, which is "heard" by an object of the type of this class. It then SHOULD
+ * (because it is not working) execute the party function.
+ */
+
+#include "ControllerDirector.h"
+#include "ScriptController.h"
+#include "core/CoreIncludes.h"
+
+//#include "network/NetworkFunction.h"
+
+#include "infos/HumanPlayer.h"
+#include "interfaces/PlayerTrigger.h"
+#include "worldentities/pawns/Pawn.h"
+#include "core/LuaState.h"
+
+
+namespace orxonox
+{
+ RegisterClass(ControllerDirector);
+
+ ControllerDirector::ControllerDirector(Context* context) : ArtificialController(context)
+ {
+ // Register the object with the framework
+ RegisterObject(ControllerDirector);
+
+ // output a message to ensure we know the constructor was run
+ orxout(verbose)<<"hello universe constructor blablub"<< endl;
+
+
+
+ // Initialize member variables
+ this->player_ = NULL;
+ this->entity_ = NULL;
+ this->pTrigger_ = NULL;
+ this->context_ = context;
+ }
+
+ void ControllerDirector::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ControllerDirector, XMLPort, xmlelement, mode);
+
+ orxout(verbose)<< "ControllerDirector::XMLPort "
+ << "An instance of ControllerDirector has been created." << endl;
+ }
+
+ void ControllerDirector::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ // Call the xmleventport functions of the classes we derive from
+ SUPER(ControllerDirector, XMLEventPort, xmlelement, mode);
+
+ // Add an event sink for a "takeControl" event, which leads to the
+ // function takeControl() being called.
+ XMLPortEventSink(ControllerDirector, BaseObject, "takeControl",
+ takeControl, xmlelement, mode);
+ }
+
+
+
+
+ void ControllerDirector::takeControl(Controller * controller, BaseObject * trigger)
+ {
+ /* Output a message confirming that the function was called */
+ orxout(verbose)<<"test takecontrol."<< endl;
+
+ /* First, we set up a new controller to attach to the unit that
+ * triggered our event.
+ */
+ static int ctrlid = 1;
+ bool prepok = preparationToTakeControl(trigger);
+ if( prepok == true)
+ {
+ /* Create a scriptcontroller object */
+ ScriptController *newctrl = new ScriptController(this->context_);
+
+ /* Make the player we were given its slave */
+ newctrl->setPlayer(this->player_);
+
+ /* Start controlling that object */
+ newctrl->takeControl(ctrlid);
+ }
+ else
+ return;
+
+ /* Set up a luastate to use for running the scripts */
+ LuaState * ls = new LuaState();
+
+ /* Assemble a string to define a controller id variable in lua space */
+ std::stringstream tmp;
+ tmp << "newctrlid = " << ctrlid << endl;
+ std::string todo = tmp.str();
+
+ /* Run the string using the luastate created earlier */
+ ls->doString(todo);
+
+ /* Now run the script on this controller. This will still have the above
+ * variable "newctrlid" defined, which means it can make use of it.
+ */
+
+ ls->doFile("testscript.lua");
+
+ /* Increase the controller ID so we have a different one for
+ * the next time it is triggered */
+ ctrlid += 1;
+ }
+
+ bool ControllerDirector::preparationToTakeControl(BaseObject * trigger)
+ {
+ this->pTrigger_ = orxonox_cast<PlayerTrigger*>(trigger);
+ this->player_ = NULL;
+
+ orxout(verbose) << "Preparation to take Control!" << endl;
+
+ // Check whether it is a player trigger and extract pawn from it
+ if(this->pTrigger_ != NULL)
+ {
+ // Get the object which triggered the event.
+ this->player_ = this->pTrigger_->getTriggeringPlayer();
+
+ // Check if there actually was a player returned.
+ if( this->player_ == NULL) return false;
+ }
+ else
+ {
+ orxout(verbose) << "ControllerDirector::preparationToTakeControl "
+ << "Not a player trigger, can't extract pawn from it.." << endl;
+ return false;
+ }
+
+ this->entity_ = this->player_->getControllableEntity();
+ assert(this->entity_);
+
+ return true;
+ }
+
+ /* // Currently unused
+ void ControllerDirector::setNewController(Controller * controller) {
+
+
+ orxout() << "New Controller is going to be set!" << endl;
+
+ this->entity_->setDestroyWhenPlayerLeft(false);
+ this->player_->pauseControl();
+ this->entity_->setController(controller);
+ this->player_->startControl(this->entity_);
+ //this->setControllableEntity(this->entity_);
+ }
+ */
+
+
+
+}
+
+
+
+
Copied: code/trunk/src/orxonox/controllers/ControllerDirector.h (from rev 10215, code/branches/presentationFS14/src/orxonox/controllers/ControllerDirector.h)
===================================================================
--- code/trunk/src/orxonox/controllers/ControllerDirector.h (rev 0)
+++ code/trunk/src/orxonox/controllers/ControllerDirector.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,65 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ControllerDirector_H__
+#define _ControllerDirector_H__
+
+#include "OrxonoxPrereqs.h"
+#include "ArtificialController.h"
+#include "core/EventIncludes.h"
+
+
+namespace orxonox
+{
+ class _OrxonoxExport ControllerDirector : public ArtificialController
+ {
+ public:
+ ControllerDirector(Context* context);
+ virtual ~ControllerDirector() { }
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ bool party(bool bTriggered, BaseObject* trigger);
+ virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+
+
+ /* Take over control of a given object */
+ void takeControl(Controller * controller, BaseObject * trigger);
+ bool preparationToTakeControl(BaseObject * trigger);
+
+ // currently unused
+ //void setNewController(Controller * controller);
+
+ private:
+ PlayerInfo* player_;
+ ControllableEntity* entity_;
+ PlayerTrigger * pTrigger_;
+ Context* context_;
+ };
+}
+
+#endif /* _ControllerDirector_H__ */
Modified: code/trunk/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/NewHumanController.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/controllers/NewHumanController.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -219,7 +219,7 @@
if (!controlPaused_ )
{
- if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
+ if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
this->showOverlays();
else if (this->getControllableEntity() && this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer")))
{
@@ -497,7 +497,7 @@
{
this->controlMode_ = 0;
this->centerCursor();
- if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
+ if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
{
this->showOverlays_ = true;
if (!this->controlPaused_)
Deleted: code/trunk/src/orxonox/controllers/ScriptController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/controllers/ScriptController.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -1,40 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "ScriptController.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- RegisterClass(ScriptController);
-
- ScriptController::ScriptController(Context* context) : ArtificialController(context)
- {
- RegisterObject(ScriptController);
- }
-}
Copied: code/trunk/src/orxonox/controllers/ScriptController.cc (from rev 10215, code/branches/presentationFS14/src/orxonox/controllers/ScriptController.cc)
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.cc (rev 0)
+++ code/trunk/src/orxonox/controllers/ScriptController.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,262 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "ScriptController.h"
+#include "infos/PlayerInfo.h"
+#include "core/CoreIncludes.h"
+#include "worldentities/ControllableEntity.h"
+#include "core/LuaState.h"
+#include <cmath>
+
+namespace orxonox
+{
+ RegisterClass(ScriptController);
+
+ ScriptController::ScriptController(Context* context) : ArtificialController(context)
+ {
+ RegisterObject(ScriptController);
+
+ /* By default, this controller has ID 0, which means it is not assigned
+ * to anything yet.
+ */
+ this->ctrlid_ = 0;
+
+ /* Set default values for all variables */
+ /* - pointers to zero */
+ this->player_ = NULL;
+ this->entity_ = NULL;
+
+ /* - times */
+ this->scTime = 0.0f;
+ this->eventTime = 0.0f;
+
+ /* - Points in space */
+ this->startpos = Vector3(0,0,0);
+ //this->lookAtPosition = Vector3(0,0,0);
+
+ /* - Processing flag */
+ this->processing = false;
+
+ /* - Counters */
+ this->eventno = 0;
+
+ }
+
+ void ScriptController::takeControl(int ctrlid)
+ {
+ /* Output some debugging information */
+ orxout(verbose) << "ScriptController: Taking control" << endl;
+ orxout(verbose) << "This-pointer: " << this << endl;
+
+ /* Set the controller ID (the argument here should be nonzero) */
+ this->ctrlid_ = ctrlid;
+
+ /* Store the entity pointer in a private variable */
+ this->entity_ = this->player_->getControllableEntity();
+ assert(this->entity_);
+
+ /* Add the controller here to this entity. Apparently this still leaves
+ * any preexisting human controllers in place.
+ */
+ this->entity_->setDestroyWhenPlayerLeft(false);
+ this->player_->pauseControl();
+ this->entity_->setController(this);
+ this->setControllableEntity(this->entity_);
+ this->entity_->mouseLook();
+ this->entity_->setVisible(false);
+ }
+
+ const Vector3& ScriptController::getPosition()
+ {
+ return this->entity_->getPosition();
+ }
+
+ ScriptController* ScriptController::getScriptController()
+ {
+ /* Output a message that confirms this function was called */
+ orxout(verbose) << "Great success!" << std::endl;
+
+ /* Debugging: print all the scriptcontroller object pointers */
+ for(ObjectList<ScriptController>::iterator it =
+ ObjectList<ScriptController>::begin();
+ it != ObjectList<ScriptController>::end(); ++it)
+ { orxout(verbose) << "Have object in list: " << *it << endl; }
+
+ /* Find the first one with a nonzero ID */
+ for(ObjectList<ScriptController>::iterator it =
+ ObjectList<ScriptController>::begin();
+ it != ObjectList<ScriptController>::end(); ++it)
+ {
+ // TODO: do some selection here. Currently just returns the first one
+ if( (*it)->getID() > 0 )
+ { orxout(verbose) << "Controller to return: " << *it << endl;
+ return *it;
+ }
+
+ }
+ return NULL;
+ }
+
+ void ScriptController::execute(event ev)
+ {
+ /* Debugging output */
+ //orxout() << "Executing event " << ev.fctName
+ //<< " with parameters:\n "
+ //<< ev.x1 << " " << ev.y1 << " " << ev.z1 << "\n"
+ //<< ev.x2 << " " << ev.y2 << " " << ev.z2 << "\n"
+ //<< ev.duration << endl;
+
+ /* Event is starting, hence set the time to 0 */
+ this->eventTime = 0.0f;
+ this->processing = true;
+
+ /* Copy the event into the currentEvent holder */
+ this->currentEvent = ev;
+
+ /* Store starting position */
+ this->startpos = this->entity_->getPosition();
+ }
+
+
+ void ScriptController::tick(float dt)
+ {
+ /* Call the tick function of the classes we derive from */
+ SUPER(ScriptController, tick, dt);
+
+ /* If this controller has no entity entry, do nothing */
+ if( !(this->entity_) ) return;
+
+ /* See if time has come for the next event to be run */
+ if(this->eventList.size() > 0 && this->eventList[0].eventTime <= scTime)
+ { /* Execute the next event on the list */
+ this->execute(this->eventList[0]);
+ this->eventList.erase(this->eventList.begin());
+ this->eventno -= 1;
+ }
+
+ /* Update the local timers in this object */
+ scTime += dt; eventTime += dt;
+
+ /* If we've arrived at the target, stop processing */
+ if( eventTime > currentEvent.duration && this->processing == true)
+ { this->processing = false;
+
+ /* If we reached the last event, also reenable the normal movement
+ * and make the model visible again
+ */
+ if( this->eventno == 0 )
+ {
+ this->entity_->mouseLook();
+ this->entity_->setVisible(true);
+ }
+ }
+
+ /* Get a variable that specifies how far along the trajectory
+ * we are
+ */
+ float dl = eventTime / currentEvent.duration;
+
+ /* Depending */
+ /* Do some moving */
+ if( this->processing )
+ {
+ if( this->currentEvent.fctName == "mal" )
+ {
+ /* Set the position to the correct place in the trajectory */
+ this->entity_->setPosition( (1-dl)*startpos + dl * this->currentEvent.v1);
+
+ /* Look at the specified position */
+ this->entity_->lookAt(this->currentEvent.v2);
+
+ /* Update look at position */
+ //this->lookAtPosition = this->currentEvent.v2;
+ }
+ else if( this->currentEvent.fctName == "chl" )
+ {
+ /* Sweep the look from v1 to v2 */
+ this->entity_->lookAt( (1-dl)*this->currentEvent.v1 +
+ dl * this->currentEvent.v2 );
+ }
+
+
+ /* Force mouse look */
+ if( this->entity_->isInMouseLook() == false )
+ this->entity_->mouseLook();
+ }
+ }
+
+ void ScriptController::eventScheduler(std::string instruction,
+ float x1, float y1, float z1,
+ float x2, float y2, float z2,
+ float duration, float executionTime)
+ {
+ /* put data (from LUA) into time-sorted eventList*/
+ /* Nimmt den befehl und die argumente aus luascript und ertellt einen
+ * struct pro event, diese structs werden sortiert nach eventTime
+ */
+ struct event tmp;
+
+ /* Fill the structure with all the provided information */
+ tmp.fctName = instruction;
+ //tmp.x1 = x1; tmp.y1 = y1; tmp.z1 = z1;
+ //tmp.x2 = x2; tmp.y2 = y2; tmp.z2 = z2;
+ tmp.v1 = Vector3(x1,y1,z1);
+ tmp.v2 = Vector3(x2,y2,z2);
+ tmp.duration = duration;
+ tmp.eventTime = executionTime;
+
+ orxout(verbose) << tmp.fctName << endl;
+
+ /* Add the created event to the event list */
+ if(eventList.size()==0)
+ { /* The list is still empty, just add it */
+ orxout(verbose) << "eventList empty (01)" << endl;
+ eventList.insert(eventList.begin(), tmp);
+ this->eventno += 1;
+ return; /* Nothing more to do, the event was added */
+ }
+
+ /* Event was not added yet since the list was not empty. Walk through
+ * the list of events and add it so that the events are correctly in
+ * order.
+ */
+ for (std::vector<event>::iterator it=eventList.begin(); it<eventList.end(); it++)
+ { if(tmp.eventTime < it->eventTime)
+ { eventList.insert(it,tmp);
+ this->eventno += 1;
+ //orxout()<<"new event added"<<endl;
+ return;
+ }
+ }
+
+ /* If the event was still not added here, it belongs in the end of the list */
+ eventList.insert(eventList.end(), tmp);
+ this->eventno += 1;
+
+ }
+}
Deleted: code/trunk/src/orxonox/controllers/ScriptController.h
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/controllers/ScriptController.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -1,47 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _ScriptController_H__
-#define _ScriptController_H__
-
-#include "OrxonoxPrereqs.h"
-#include "ArtificialController.h"
-
-namespace orxonox
-{
- class _OrxonoxExport ScriptController : public ArtificialController
- {
- public:
- ScriptController(Context* context);
- virtual ~ScriptController() { }
-
- private:
- };
-}
-
-#endif /* _ScriptController_H__ */
Copied: code/trunk/src/orxonox/controllers/ScriptController.h (from rev 10215, code/branches/presentationFS14/src/orxonox/controllers/ScriptController.h)
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.h (rev 0)
+++ code/trunk/src/orxonox/controllers/ScriptController.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,124 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ScriptController_H__
+#define _ScriptController_H__
+
+#include "OrxonoxPrereqs.h" /* die ganzen tolua, kopiert aus Dock.h*/
+#include "ArtificialController.h"
+#include "core/EventIncludes.h"
+
+
+
+namespace orxonox // tolua_export
+{ // tolua_export
+
+ /** Structure to describe a single event */
+ struct event
+ {
+ /** Instruction for this event */
+ std::string fctName;
+
+ Vector3 v1;
+ Vector3 v2;
+
+ /** Time span of the event */
+ float duration;
+
+ /** Start point in time of the event */
+ float eventTime;
+ };
+
+ class _OrxonoxExport ScriptController // tolua_export
+ : public ArtificialController, public Tickable
+ { // tolua_export
+ public:
+ ScriptController(Context* context);
+ virtual ~ScriptController() { }
+
+ void takeControl(int ctrlid);
+ void setPlayer(PlayerInfo* player) { this->player_ = player; }
+
+ virtual void tick(float dt);
+
+ // LUA interface
+ // tolua_begin
+ void eventScheduler(std::string instruction,
+ float x1, float y1, float z1,
+ float x2, float y2, float z2,
+ float duration, float executionTime);
+
+ static ScriptController* getScriptController();
+
+ int getID() { return ctrlid_; }
+
+ // tolua_end
+ const Vector3& getPosition();
+
+ void execute(event ev);
+
+ private:
+ /* Information about the player that this ScriptController will
+ * control */
+ /* - Player pointer */
+ PlayerInfo* player_;
+
+ /* - Entity pointer, this is for convenience and will be the same as
+ * player_->getControllableEntity()
+ */
+ ControllableEntity* entity_;
+
+ /* Controller ID, defaults to 0 and is set using takeControl() */
+ int ctrlid_;
+
+ /* List of events to walk through */
+ std::vector<event> eventList;
+ unsigned int eventno;
+
+ /* Time since the creation of this ScriptController object */
+ float scTime;
+
+ /* Boolean that specifies whether we're processing an event right
+ * now */
+ bool processing;
+
+ /* Data about the event currently being processed */
+ /* - The event itself */
+ event currentEvent;
+
+ /* - Time this event has been going on for */
+ float eventTime;
+ Vector3 startpos;
+
+ /* - Position to look at during that transition */
+ //Vector3 lookAtPosition;
+
+ };// tolua_export
+} // tolua_export
+
+#endif /* _ScriptController_H__ */
Copied: code/trunk/src/orxonox/controllers/testscript.lua (from rev 10215, code/branches/presentationFS14/src/orxonox/controllers/testscript.lua)
===================================================================
--- code/trunk/src/orxonox/controllers/testscript.lua (rev 0)
+++ code/trunk/src/orxonox/controllers/testscript.lua 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1 @@
+print ('1: Hello World')
Modified: code/trunk/src/orxonox/items/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/items/CMakeLists.txt 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/items/CMakeLists.txt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -2,4 +2,6 @@
Item.cc
Engine.cc
MultiStateEngine.cc
+ ShipPart.cc
+ PartDestructionEvent.cc
)
Copied: code/trunk/src/orxonox/items/PartDestructionEvent.cc (from rev 10215, code/branches/presentationFS14/src/orxonox/items/PartDestructionEvent.cc)
===================================================================
--- code/trunk/src/orxonox/items/PartDestructionEvent.cc (rev 0)
+++ code/trunk/src/orxonox/items/PartDestructionEvent.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,352 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Noe Pedrazzini
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PartDestructionEvent.h"
+
+#include <algorithm>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "network/NetworkFunction.h"
+#include "Item.h"
+#include "worldentities/pawns/Pawn.h"
+#include "worldentities/pawns/ModularSpaceShip.h"
+#include "items/Engine.h"
+#include "gametypes/Gametype.h"
+#include "chat/ChatManager.h"
+
+
+namespace orxonox
+{
+ RegisterClass(PartDestructionEvent);
+
+ PartDestructionEvent::PartDestructionEvent(Context* context)
+ : Item(context)
+ {
+ RegisterObject(PartDestructionEvent);
+ this->setValid(true);
+ }
+
+ PartDestructionEvent::~PartDestructionEvent()
+ {
+
+ }
+
+ void PartDestructionEvent::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PartDestructionEvent, XMLPort, xmlelement, mode);
+
+ XMLPortParam(PartDestructionEvent, "targetType", setTargetType, getTargetType, xmlelement, mode).defaultValues("NULL");
+ XMLPortParam(PartDestructionEvent, "targetName", setTargetName, getTargetName, xmlelement, mode).defaultValues("NULL");
+ XMLPortParam(PartDestructionEvent, "operation", setOperation, getOperation, xmlelement, mode).defaultValues("NULL");
+ XMLPortParam(PartDestructionEvent, "targetParam", setTargetParam, getTargetParam, xmlelement, mode).defaultValues("NULL");
+ XMLPortParam(PartDestructionEvent, "value", setEventValue, getEventValue, xmlelement, mode).defaultValues(0);
+ XMLPortParam(PartDestructionEvent, "message", setMessage, getMessage, xmlelement, mode).defaultValues("NULL");
+
+ /*
+ XMLPortParam(PartDestructionEvent, "health", setHealth, getHealth, xmlelement, mode).defaultValues(100);
+ XMLPortParam(PartDestructionEvent, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
+ XMLPortParam(PartDestructionEvent, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
+ */
+ }
+
+ /**
+ @brief
+ Executes this event.
+ */
+ void PartDestructionEvent::execute()
+ {
+ // Do not execute if this event is invalid
+ if(!isValid())
+ {
+ orxout(internal_warning) << "Attempted to execute an invalid PartDestructionEvent!" << endl;
+ return;
+ }
+
+ // Output the destruction-message to the chat
+ if(this->message_ != "NULL")
+ ChatManager::message(this->message_);
+
+ // Modify parameters as configured for all cases
+ if (this->targetType_ == "ship")
+ {
+ switch (this->targetParam_) {
+ case shieldhealth:
+ this->parent_->getParent()->setShieldHealth(operate(this->parent_->getParent()->getShieldHealth()));
+ break;
+ case boostpower:
+ this->parent_->getParent()->setInitialBoostPower(operate(this->parent_->getParent()->getInitialBoostPower()));
+ break;
+ case boostpowerrate:
+ this->parent_->getParent()->setBoostPowerRate(operate(this->parent_->getParent()->getBoostPowerRate()));
+ break;
+ case rotationthrust:
+ this->parent_->getParent()->setRotationThrust(operate(this->parent_->getParent()->getRotationThrust()));
+ break;
+ default:
+ break;
+ }
+ this->setValid(false);
+ return;
+ }
+
+ if (this->targetType_ == "engine")
+ {
+ switch (this->targetParam_) {
+ case null:
+ this->parent_->getParent()->getEngineByName(targetName_)->destroy();
+ break;
+ case boostfactor:
+ this->parent_->getParent()->getEngineByName(targetName_)->setBoostFactor(operate(this->parent_->getParent()->getEngineByName(targetName_)->getBoostFactor()));
+ break;
+ case speedfront:
+ this->parent_->getParent()->getEngineByName(targetName_)->setMaxSpeedFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getMaxSpeedFront()));
+ break;
+ case accelerationfront:
+ this->parent_->getParent()->getEngineByName(targetName_)->setAccelerationFront(operate(this->parent_->getParent()->getEngineByName(targetName_)->getAccelerationFront()));
+ break;
+ default:
+ break;
+ }
+ this->setValid(false);
+ return;
+ }
+
+ if (this->targetType_ == "part")
+ {
+ switch (this->targetParam_) {
+ case null:
+ if (!this->parent_->getParent()->getShipPartByName(targetName_))
+ return;
+ this->parent_->getParent()->getShipPartByName(targetName_)->setEventExecution(false);
+ this->parent_->getParent()->killShipPart(targetName_);
+ break;
+ default:
+ break;
+ }
+ this->setValid(false);
+ return;
+ }
+ }
+
+ void PartDestructionEvent::setParent(ShipPart* part)
+ {
+ this->parent_ = part;
+ }
+
+ /**
+ @brief
+ Set type of the target
+ @param param
+ The desired target-type as string. Valid target-types: ship engine weapon
+ */
+ void PartDestructionEvent::setTargetType(std::string type)
+ {
+ if ((type == "ship") || (type == "engine") || (type == "weapon") || (type == "part"))
+ {
+ this->targetType_ = type;
+ return;
+ }
+
+ // Error, if invalid target-type was entered.
+ orxout(internal_warning) << "\"" << type << "\" is not a valid target-type for a PartDestructionEvent. Valid types are: ship engine weapon part" << endl;
+ this->setValid(false);
+ return;
+ }
+
+ void PartDestructionEvent::setTargetName(std::string name)
+ {
+ // Error, if the target-type is "weapon" or "engine", but the name of said target was not defined.
+ if (((this->targetType_ == "weapon") || (this->targetType_ == "engine")) && (name == "NULL"))
+ {
+ orxout(internal_warning) << "The target-name of a PartDestructionEvent with target-type \"" << this->targetType_ << "\" needs to be defined!" << endl;
+ return;
+ }
+
+ this->targetName_ = name;
+ }
+
+ /**
+ @brief
+ Set the operation to be applied.
+ @param param
+ The desired parameter as string. Valid parameters: c.f. @ref orxnox::PartDestructionEvent::TargetParam
+ */
+ void PartDestructionEvent::setTargetParam(std::string param)
+ {
+ // A target-type needs to be defined in order to choose a parameter.
+ if (this->targetType_ == "NULL")
+ {
+ orxout(internal_warning) << "No valid target-type defined. Cannot set target-param for this PartDestructionEvent." << endl;
+ this->setValid(false);
+ return;
+ }
+
+ // engine: NULL boostfactor speedfront accelerationfront
+ if (this->targetType_ == "engine")
+ {
+ if (param == "NULL")
+ {
+ this->targetParam_ = null;
+ return;
+ }
+ if (param == "boostfactor")
+ {
+ this->targetParam_ = boostfactor;
+ return;
+ }
+ if (param == "speedfront")
+ {
+ this->targetParam_ = speedfront;
+ return;
+ }
+ if (param == "accelerationfront")
+ {
+ this->targetParam_ = accelerationfront;
+ return;
+ }
+
+ orxout(internal_warning) << "\"" << param << "\" is not a valid target-param for a PartDestructionEvent with target-type \"engine\". Valid types are: boostfactor speedfront accelerationfront" << endl;
+ return;
+ }
+
+ // weapon:
+
+ // ship: shieldhealth (maxshieldhealth shieldabsorption shieldrechargerate) boostpower boostpowerrate rotationthrust
+ if (this->targetType_ == "ship")
+ {
+ if (param == "shieldhealth")
+ {
+ this->targetParam_ = shieldhealth;
+ return;
+ }
+ if (param == "boostpower")
+ {
+ this->targetParam_ = boostpower;
+ return;
+ }
+ if (param == "boostpowerrate")
+ {
+ this->targetParam_ = boostpowerrate;
+ return;
+ }
+ if (param == "rotationthrust")
+ {
+ this->targetParam_ = rotationthrust;
+ return;
+ }
+
+ orxout(internal_warning) << "\"" << param << "\" is not a valid target-param for a PartDestructionEvent with target-type \"ship\". Valid types are: shieldhealth maxshieldhealth shieldabsorption shieldrechargerate boostpower boostpowerrate rotationthrust" << endl;
+ return;
+ }
+
+ if (this->targetType_ == "part")
+ {
+ if (param == "NULL")
+ {
+ this->targetParam_ = null;
+ return;
+ }
+
+ orxout(internal_warning) << "\"" << param << "\" is not a valid target-param for a PartDestructionEvent with target-type \"part\". Valid types are: NULL (set operation to \"destroy\")" << endl;
+ return;
+ }
+
+ orxout(internal_warning) << "No valid target-param defined. The chosen param is either invalid or not available for this target-type." << endl;
+ this->setValid(false);
+ }
+
+ /**
+ @brief
+ Set the operation to be applied.
+ @param operation
+ The desired operator as string. Valid operators: * + - destroy
+ */
+ void PartDestructionEvent::setOperation(std::string operation)
+ {
+ // * + - destroy
+ if ((operation == "*") || (operation == "+") || (operation == "-") || (operation == "set") || (operation == "destroy"))
+ {
+ this->operation_ = operation;
+ return;
+ }
+ this->operation_ = "NULL";
+ orxout(internal_warning) << "\"" << operation << "\" is not a valid operation for a PartDestructionEvent. Valid operations are: * + - set destroy" << endl;
+ }
+
+ /**
+ @brief
+ Set the message to be shown upon execution of the vent.
+ @param msg
+ The desired message as string.
+ */
+ void PartDestructionEvent::setMessage(std::string msg)
+ {
+ this->message_ = msg;
+ }
+
+
+ /**
+ @brief
+ Apply the configured operation and value to an input.
+ @param input
+ The value which should be modified
+ @return
+ Returns the product / sum / difference of input and configured value,
+ the configured value if the operation is "set",
+ or 0 if the operation is "destroy"
+ */
+ float PartDestructionEvent::operate(float input)
+ {
+ if (this->operation_ == "*")
+ return input * this->value_;
+ if (this->operation_ == "+")
+ return input + this->value_;
+ if (this->operation_ == "-")
+ return input - this->value_;
+ if (this->operation_ == "set")
+ return this->value_;
+ if (this->operation_ == "destroy")
+ {
+ return 0;
+ }
+ return 0;
+ }
+
+ /**
+ @brief
+ Sets the value applied with the chosen operation.
+ @param value
+ The value as float.
+ */
+ void PartDestructionEvent::setEventValue(float value)
+ {
+ this->value_ = value;
+ }
+}
Copied: code/trunk/src/orxonox/items/PartDestructionEvent.h (from rev 10215, code/branches/presentationFS14/src/orxonox/items/PartDestructionEvent.h)
===================================================================
--- code/trunk/src/orxonox/items/PartDestructionEvent.h (rev 0)
+++ code/trunk/src/orxonox/items/PartDestructionEvent.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,160 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Noe Pedrazzini
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PartDestructionEvent_H__
+#define _PartDestructionEvent_H__
+
+#include "OrxonoxPrereqs.h"
+#include "Item.h"
+
+#include <string>
+
+
+namespace orxonox // tolua_export
+{ // tolua_export
+ /**
+ @brief
+ In order to assign attached entities to a ShipPart, a ShipPart with the same name as the corresponding entity needs to be created in the <parts> tag.
+ Here is a (primitive) example of a ModularSpaceShip with ShipParts and PartDestructionEvents defined in XML:
+ @code
+ <ModularSpaceShip
+ ...
+ >
+ <attached>
+ <StaticEntity name="generator" . . . />
+ <StaticEntity name="tail" . . . />
+ </attached>
+ <parts>
+ <ShipPart name="generator" . . . >
+ <destructionevents>
+ <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="Your boost-regeneration is reduced!" />
+ </destructionevents>
+ </ShipPart>
+ <ShipPart name="tail" . . . >
+ <destructionevents>
+ <PartDestructionEvent ... />
+ </destructionevents>
+ </ShipPart>
+ </parts>
+ <engines>
+ <Engine />
+ <Engine />
+ </engines>
+ </ModularSpaceShip>
+ @endcode
+
+ @author
+ Fabian 'x3n' Landau, Noe Pedrazzini
+ */
+ class _OrxonoxExport PartDestructionEvent // tolua_export
+ : public Item
+ { // tolua_export
+
+ public:
+
+ /**
+ @brief
+ List of all allowed parameters.
+ */
+ enum TargetParam
+ {
+ shieldhealth,
+ maxshieldhealth,
+ shieldabsorption,
+ shieldrechargerate,
+ boostpower, // Amount of available boost
+ boostpowerrate, // Recharge-rate of boost
+ rotationthrust,
+ boostfactor,
+ speedfront,
+ accelerationfront,
+ null
+ };
+
+ PartDestructionEvent(Context* context);
+ virtual ~PartDestructionEvent();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void execute();
+
+ inline void setValid(bool valid)
+ { this->valid_ = valid; }
+ inline bool isValid()
+ { return this->valid_; }
+
+ void setParent(ShipPart* parent);
+ inline ShipPart* getParent()
+ { return this->parent_; }
+
+ void setTargetType(std::string type);
+ inline std::string getTargetType()
+ { return this->targetType_; }
+
+ void setTargetName(std::string name);
+ inline std::string getTargetName()
+ { return this->targetName_; }
+
+ void setTargetParam(std::string param);
+ inline std::string getTargetParam()
+ { return this->targetName_; }
+
+ void setOperation(std::string operation);
+ inline std::string getOperation()
+ { return this->operation_; }
+
+ void setMessage(std::string msg);
+ inline std::string getMessage()
+ { return this->message_; }
+
+ float operate(float input);
+
+ void setEventValue(float value);
+ inline float getEventValue()
+ { return this->value_; }
+
+ protected:
+
+ private:
+
+ ShipPart* parent_; //!< Pointer to the ShipPart this event belongs to
+ bool valid_; //!< Whether this event is valid or not.
+
+ std::string targetType_; //!< The type of the target. (ship weapon engine)
+ std::string targetName_; //!< The name of the target.
+ TargetParam targetParam_; //!< The parameter to be modified
+ std::string operation_; //!< The operation to be applied
+ float value_; //!< The value used to do the operation
+ std::string message_; //!< The message which is shown in chat when the event is executed.
+
+
+
+ }; // tolua_export
+} // tolua_export
+
+#endif /* _PartDestructionEvent_H__ */
Copied: code/trunk/src/orxonox/items/ShipPart.cc (from rev 10215, code/branches/presentationFS14/src/orxonox/items/ShipPart.cc)
===================================================================
--- code/trunk/src/orxonox/items/ShipPart.cc (rev 0)
+++ code/trunk/src/orxonox/items/ShipPart.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,291 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Noe Pedrazzini
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "ShipPart.h"
+
+#include <algorithm>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "network/NetworkFunction.h"
+#include "Item.h"
+#include "worldentities/pawns/Pawn.h"
+#include "worldentities/pawns/ModularSpaceShip.h"
+#include "gametypes/Gametype.h"
+#include "worldentities/StaticEntity.h"
+#include "items/PartDestructionEvent.h"
+#include "worldentities/BigExplosion.h"
+#include "chat/ChatManager.h"
+
+
+namespace orxonox
+{
+ RegisterClass(ShipPart);
+
+ ShipPart::ShipPart(Context* context)
+ : Item(context)
+ {
+ RegisterObject(ShipPart);
+ this->setAlive(true);
+ this->setEventExecution(true);
+ this->healthMem_ = 100;
+ }
+
+ ShipPart::~ShipPart()
+ {
+
+ }
+
+ void ShipPart::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ShipPart, XMLPort, xmlelement, mode);
+
+ XMLPortParam(ShipPart, "health", setHealth, getHealth, xmlelement, mode).defaultValues(100);
+ XMLPortParam(ShipPart, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
+ XMLPortParam(ShipPart, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
+
+ XMLPortParam(ShipPart, "damageabsorption", setDamageAbsorption, getDamageAbsorption, xmlelement, mode).defaultValues(0.5);
+
+ XMLPortParamTemplate(ShipPart, "explosionposition", setExplosionPosition, getExplosionPosition, xmlelement, mode, Vector3);
+
+ XMLPortObject(ShipPart, PartDestructionEvent, "destructionevents", addDestructionEvent, getDestructionEvent, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Is called when the ShipPart dies.
+ Executes PartDestructionEvents.
+ Tells the ModularSpaceShip to remove this ShipPart.
+ */
+ void ShipPart::death()
+ {
+ //if (!(this->isAlive()))
+ //return;
+
+ this->explode();
+ this->setAlive(false);
+
+ if(eventExecution_)
+ {
+ // Execute all destruction events
+ for (unsigned int i = 0; i < this->eventList_.size(); i++)
+ {
+ this->getDestructionEvent(i)->execute();
+ }
+ }
+
+ // Remove this ShipPart from the parent.
+ this->parent_->removeShipPart(this);
+ delete this;
+ }
+
+ void ShipPart::explode()
+ {
+ BigExplosion* chunk = new BigExplosion(this->getContext());
+ chunk->setPosition(this->parent_->getPosition() + this->parent_->getOrientation() * (this->explosionPosition_));
+ //chunk->setPosition(this->parent_->getPosition() + this->parent_->getOrientation() * Vector3(this->entityList_[0]->getLocalInertia()));
+ chunk->setVelocity(this->parent_->getVelocity());
+
+ // this->explosionSound_->setPosition(this->parent_->getPosition());
+ // this->explosionSound_->play();
+ }
+
+ /**
+ @brief
+ Add a StaticEntity to the ShipPart.
+ @param engine
+ A pointer to the StaticEntity to be added.
+ */
+ void ShipPart::addEntity(StaticEntity* entity)
+ {
+ OrxAssert(entity != NULL, "The Entity cannot be NULL.");
+ this->entityList_.push_back(entity);
+ }
+
+ /**
+ @brief
+ Get the i-th StaticEntity of the ShipPart.
+ @return
+ Returns a pointer to the i-the StaticEntity. NULL if there is no StaticEntity with that index.
+ */
+ StaticEntity* ShipPart::getEntity(unsigned int index)
+ {
+ if(this->entityList_.size() >= index)
+ return NULL;
+ else
+ return this->entityList_[index];
+ }
+
+ /**
+ @brief
+ Check whether the ShipPart has a particular Entity.
+ @param engine
+ A pointer to the Entity to be checked.
+ */
+ bool ShipPart::hasEntity(StaticEntity* entity) const
+ {
+ for(unsigned int i = 0; i < this->entityList_.size(); i++)
+ {
+ if(this->entityList_[i] == entity)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ @brief
+ Add a PartDestructionEvent to the ShipPart.
+ @param engine
+ A pointer to the PartDestructionEvent to be added.
+ */
+ void ShipPart::addDestructionEvent(PartDestructionEvent* event)
+ {
+ OrxAssert(event != NULL, "The PartDestructionEvent cannot be NULL.");
+ event->setParent(this);
+ this->eventList_.push_back(event);
+ }
+
+ /**
+ @brief
+ Get the i-th PartDestructionEvent of the ShipPart.
+ @return
+ Returns a pointer to the i-the PartDestructionEvent. NULL if there is no PartDestructionEvent with that index.
+ */
+ PartDestructionEvent* ShipPart::getDestructionEvent(unsigned int index)
+ {
+ if(this->eventList_.size() <= index)
+ return NULL;
+ else
+ return this->eventList_[index];
+ }
+
+ void ShipPart::setDamageAbsorption(float value)
+ {
+ this->damageAbsorption_ = value;
+ }
+
+ void ShipPart::setParent(ModularSpaceShip* ship)
+ {
+ this->parent_ = ship;
+ }
+
+ /**
+ @brief
+ Sets the health of the ShipPart.
+ */
+ void ShipPart::setHealth(float health)
+ {
+ this->health_ = health;
+ }
+
+ void ShipPart::setAlive(bool var)
+ {
+ this->alive_ = var;
+ orxout() << "ShipPart " << this->getName() << " alive_: " << this->alive_ << endl;
+ }
+
+ /**
+ @brief
+ Handles a received hit.
+ */
+ void ShipPart::handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ {
+ if (parent_->getGametype() && parent_->getGametype()->allowPawnDamage(parent_, originator))
+ {
+ if (shielddamage >= parent_->getShieldHealth())
+ {
+ parent_->setShieldHealth(0);
+ this->setHealth(this->health_ - (healthdamage + damage) * this->damageAbsorption_);
+ parent_->setHealth(parent_->getHealth() - (healthdamage + damage) * (1 - this->damageAbsorption_));
+ }
+ else
+ {
+ parent_->setShieldHealth(parent_->getShieldHealth() - shielddamage);
+
+ // remove remaining shieldAbsorpton-Part of damage from shield
+ shielddamage = damage * parent_->getShieldAbsorption();
+ shielddamage = std::min(parent_->getShieldHealth(),shielddamage);
+ parent_->setShieldHealth(parent_->getShieldHealth() - shielddamage);
+
+ // set remaining damage to health
+ this->setHealth(this->health_ - ((damage - shielddamage) - healthdamage) * this->damageAbsorption_);
+ parent_->setHealth(parent_->getHealth() - ((damage - shielddamage) - healthdamage) * (1- this->damageAbsorption_));
+ }
+ }
+ if (this->health_ < 0)
+ this->alive_ = false;
+ //this->death();
+
+ // (Ugly) Chatoutput of health, until a GUI for modularspaceships-shipparts is implemented.
+ if ((this->health_ < 0.2 * this->maxHealth_) && (this->healthMem_ == 40))
+ {
+ this->healthMem_ = 20;
+ ChatManager::message("ShipPart " + this->getName() + " remaining health is 20%!");
+ return;
+ }
+ if ((this->health_ < 0.4 * this->maxHealth_) && (this->healthMem_ == 60))
+ {
+ this->healthMem_ = 40;
+ ChatManager::message("ShipPart " + this->getName() + " remaining health is 40%!");
+ return;
+ }
+ if ((this->health_ < 0.6 * this->maxHealth_) && (this->healthMem_ == 80))
+ {
+ this->healthMem_ = 60;
+ ChatManager::message("ShipPart " + this->getName() + " remaining health is 60%!");
+ return;
+ }
+ if ((this->health_ < 0.8 * this->maxHealth_) && (this->healthMem_ == 100))
+ {
+ this->healthMem_ = 80;
+ ChatManager::message("ShipPart " + this->getName() + " remaining health is 80%!");
+ return;
+ }
+ }
+
+
+ /**
+ @brief
+ Adds the ShipPart to the input SpaceShip.
+ @param ship
+ A pointer to the SpaceShip to which the ShipPart is added.
+ */
+ /*void ShipPart::addToSpaceShip(ModularSpaceShip* ship)
+ {
+ this->parent_ = ship;
+
+ if (ship)
+ {
+ this->parentID_ = ship->getObjectID();
+ if (!ship->hasShipPart(this))
+ ship->addShipPart(this);
+ }
+ }*/
+
+}
Copied: code/trunk/src/orxonox/items/ShipPart.h (from rev 10215, code/branches/presentationFS14/src/orxonox/items/ShipPart.h)
===================================================================
--- code/trunk/src/orxonox/items/ShipPart.h (rev 0)
+++ code/trunk/src/orxonox/items/ShipPart.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,134 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Noe Pedrazzini
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _ShipPart_H__
+#define _ShipPart_H__
+
+#include "OrxonoxPrereqs.h"
+#include "Item.h"
+#include "items/PartDestructionEvent.h"
+
+#include <string>
+
+
+namespace orxonox // tolua_export
+{ // tolua_export
+ class _OrxonoxExport ShipPart // tolua_export
+ : public Item
+ { // tolua_export
+
+ public:
+ ShipPart(Context* context);
+ virtual ~ShipPart();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator);
+
+ virtual void death();
+ virtual void explode();
+
+ //virtual void attachTo(Pawn* newParent);
+ //virtual void detach();
+
+ void addEntity(StaticEntity* entity);
+ StaticEntity* getEntity(unsigned int index);
+ bool hasEntity(StaticEntity* entity) const;
+
+ void addDestructionEvent(PartDestructionEvent* event);
+ PartDestructionEvent* getDestructionEvent(unsigned int index);
+
+ virtual void setDamageAbsorption(float value);
+ inline float getDamageAbsorption()
+ { return this->damageAbsorption_; }
+
+ void setParent(ModularSpaceShip* ship);
+ inline ModularSpaceShip* getParent()
+ { return this->parent_; }
+
+ void setAlive(bool var);
+ inline bool isAlive()
+ { return this->alive_; }
+
+ inline void setEventExecution(bool var)
+ { this->eventExecution_ = var; }
+ inline bool isEventExecution()
+ { return this->eventExecution_; }
+
+ virtual void setHealth(float health);
+ inline void addHealth(float health)
+ { this->setHealth(this->health_ + health); }
+ inline void removeHealth(float health)
+ { this->setHealth(this->health_ - health); }
+ inline float getHealth() const
+ { return this->health_; }
+
+ inline void setMaxHealth(float maxhealth)
+ { this->maxHealth_ = maxhealth; this->setHealth(this->health_); }
+ inline float getMaxHealth() const
+ { return this->maxHealth_; }
+
+ inline void setInitialHealth(float initialhealth)
+ { this->initialHealth_ = initialhealth; this->setHealth(initialhealth); }
+ inline float getInitialHealth() const
+ { return this->initialHealth_; }
+
+ inline void setExplosionPosition(Vector3 pos)
+ { this->explosionPosition_ = pos; }
+ inline Vector3 getExplosionPosition()
+ { return this->explosionPosition_; }
+
+
+ // FIXME: (noep) Why doesn't this work? Works fine in Engine.h
+ //void addToSpaceShip(ModularSpaceShip* ship);
+
+ protected:
+ ModularSpaceShip* parent_;
+ unsigned int parentID_; // Object ID of the SpaceShip the Part is mounted on.
+
+ float damageAbsorption_;
+ float health_;
+ float maxHealth_;
+ float initialHealth_;
+
+ private:
+ std::vector<StaticEntity*> entityList_; // List of all entities which belong to this part
+ std::vector<PartDestructionEvent*> eventList_; // The list of all PartDestructionEvent assigned to this ShipPart.
+
+ bool alive_;
+ bool eventExecution_;
+
+ float healthMem_;
+
+ Vector3 explosionPosition_;
+
+
+ }; // tolua_export
+} // tolua_export
+
+#endif /* _ShipPart_H__ */
Modified: code/trunk/src/orxonox/worldentities/MovableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/MovableEntity.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/worldentities/MovableEntity.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -71,7 +71,7 @@
XMLPortParam(MovableEntity, "collisiondamage", setCollisionDamage, getCollisionDamage, xmlelement, mode).defaultValues(1);
}
- bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ bool MovableEntity::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
{
if (GameMode::isMaster() && enableCollisionDamage_)
{
@@ -79,14 +79,13 @@
if (victim)
{
float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
- victim->hit(0, contactPoint, damage);
+ victim->hit(0, contactPoint, ownCollisionShape, damage);
}
}
return false;
}
-
void MovableEntity::registerVariables()
{
registerVariable(this->linearVelocity_, VariableDirection::ToClient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processLinearVelocity));
Modified: code/trunk/src/orxonox/worldentities/MovableEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/MovableEntity.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/worldentities/MovableEntity.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -46,7 +46,7 @@
virtual ~MovableEntity();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
using WorldEntity::setPosition;
using WorldEntity::setOrientation;
Modified: code/trunk/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/WorldEntity.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/worldentities/WorldEntity.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -373,7 +373,7 @@
@note
Condition is that enableCollisionCallback() was called.
*/
- virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
{ return false; } /* With false, Bullet assumes no modification to the collision objects. */
//! Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise!
Modified: code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt 2015-01-31 17:03:17 UTC (rev 10216)
@@ -3,6 +3,7 @@
Spectator.cc
Pawn.cc
SpaceShip.cc
+ ModularSpaceShip.cc
TeamBaseMatchBase.cc
Destroyer.cc
)
Copied: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc (from rev 10215, code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.cc)
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc (rev 0)
+++ code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,308 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * Noe Pedrazzini
+ *
+ */
+
+#include "ModularSpaceShip.h"
+
+#include <BulletDynamics/Dynamics/btRigidBody.h>
+
+#include "core/CoreIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/Template.h"
+#include "core/XMLPort.h"
+#include "util/Math.h"
+#include "gametypes/Gametype.h"
+#include "core/command/ConsoleCommand.h"
+
+#include "items/ShipPart.h"
+#include "items/Engine.h"
+#include "worldentities/StaticEntity.h"
+#include <BulletCollision/CollisionShapes/btCollisionShape.h>
+#include <BulletCollision/CollisionShapes/btCompoundShape.h>
+
+
+
+namespace orxonox
+{
+ SetConsoleCommand("ModularSpaceShip", "killshippart", &ModularSpaceShip::killShipPartStatic);
+
+ RegisterClass(ModularSpaceShip);
+
+ std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = 0;
+
+ ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context)
+ {
+ RegisterObject(ModularSpaceShip);
+
+ this->registerVariables();
+
+ ModularSpaceShip::partMap_s = &(this->partMap_);
+
+ }
+
+ ModularSpaceShip::~ModularSpaceShip()
+ {
+ if (this->isInitialized())
+ {
+
+ }
+ }
+
+ void ModularSpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(ModularSpaceShip, XMLPort, xmlelement, mode);
+ XMLPortObject(ModularSpaceShip, ShipPart, "parts", addShipPart, getShipPart, xmlelement, mode);
+ }
+
+ void ModularSpaceShip::registerVariables()
+ {
+ return;
+ }
+
+ /**
+ @brief
+ Searches for ShipParts matching to StaticEntities.
+ */
+ void ModularSpaceShip::updatePartAssignment()
+ {
+ // iterate through all attached objects
+ for (unsigned int i=0; i < this->getAttachedObjects().size(); i++)
+ {
+ if (this->getAttachedObject(i) == NULL)
+ {
+ break;
+ }
+ // iterate through all attached parts
+ for(unsigned int j = 0; j < this->partList_.size(); j++)
+ {
+ // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done).
+ if((this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))
+ {
+ // The Entity is added to the part's entityList_
+ this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));
+ // An entry in the partMap_ is created, assigning the part to the entity.
+ this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]);
+ }
+ }
+ }
+ }
+
+ /**
+ @brief
+ Creates a new assignment for the given StaticEntity and ShipPart in the partMap_
+ @param entity
+ A pointer to the StaticEntity
+ @param part
+ A pointer to the ShipPart.
+ */
+ void ModularSpaceShip::addPartEntityAssignment(StaticEntity* entity, ShipPart* part)
+ {
+ if (!entity || !part)
+ return;
+
+ if (this->partMap_.find(entity) != this->partMap_.end())
+ {
+ orxout(internal_warning) << "Assigning an Entity to multiple parts is not yet supported." << endl;
+ return;
+ }
+
+ this->partMap_[entity] = part;
+ }
+
+
+ /**
+ @brief
+ Get the ShipPart an attached entity belongs to.
+ @param entity
+ The entity to be searched.
+ @return
+ Returns a pointer to the ShipPart the entity belongs to.
+ */
+ ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const
+ {
+ for (std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)
+ {
+ if (it->first == entity)
+ return it->second;
+ }
+ return NULL;
+ }
+
+ /**
+ @brief
+ If the damage occurred on an attached StaticEntity, the damage is given to the corresponding ShipPart to handle.
+ */
+ void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
+ {
+ if (this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)
+ this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator);
+ else
+ SpaceShip::damage(damage, healthdamage, shielddamage, originator, cs);
+ }
+
+ /**
+ @brief
+ STATIC: Needed for consolecommand. Kills the ShipPart with the given name. Used from the console-command "ModularSpaceShip killshippart [string]".
+ @param name
+ The name of the part to be killed.
+ */
+ void ModularSpaceShip::killShipPartStatic(std::string name)
+ {
+ for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)
+ {
+ if (it->second->getName() == name)
+ {
+ it->second->setAlive(false);
+ return;
+ }
+ }
+ orxout(internal_warning) << "Could not apply damage to ShipPart \"" << name << "\". Part not found." << endl;
+ }
+
+ /**
+ @brief
+ Kills the ShipPart with the given name. Used from the console-command "ModularSpaceShip killshippart [string]".
+ @param name
+ The name of the part to be killed.
+ */
+ void ModularSpaceShip::killShipPart(std::string name)
+ {
+ for (std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)
+ {
+ if (it->second->getName() == name)
+ {
+ it->second->setAlive(false);
+ return;
+ }
+ }
+ orxout(internal_warning) << "Could not apply damage to ShipPart \"" << name << "\". Part not found." << endl;
+ }
+
+ /**
+ @brief
+ Add a ShipPart to the SpaceShip.
+ @param engine
+ A pointer to the ShipPart to be added.
+ */
+ void ModularSpaceShip::addShipPart(ShipPart* part)
+ {
+ OrxAssert(part != NULL, "The ShipPart cannot be NULL.");
+ this->partList_.push_back(part);
+ part->setParent(this);
+ this->updatePartAssignment();
+ }
+
+ /**
+ @brief
+ Get the i-th ShipPart of the SpaceShip.
+ @return
+ Returns a pointer to the i-the ShipPart. NULL if there is no ShipPart with that index.
+ */
+ ShipPart* ModularSpaceShip::getShipPart(unsigned int index)
+ {
+ if(this->partList_.size() <= index)
+ return NULL;
+ else
+ return this->partList_[index];
+ }
+
+ /**
+ @brief
+ Looks for an attached ShipPart with a certain name.
+ @param name
+ The name of the ShipPart to be returned.
+ @return
+ Pointer to the ShipPart with the given name, or NULL if not found.
+ */
+ ShipPart* ModularSpaceShip::getShipPartByName(std::string name)
+ {
+ for(std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)
+ {
+ if(orxonox_cast<ShipPart*>(*it)->getName() == name)
+ {
+ return orxonox_cast<ShipPart*>(*it);
+ }
+ }
+ orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl;
+ return NULL;
+ }
+
+ /**
+ @brief
+ Check whether the SpaceShip has a particular Engine.
+ @param engine
+ A pointer to the Engine to be checked.
+ */
+ bool ModularSpaceShip::hasShipPart(ShipPart* part) const
+ {
+ for(unsigned int i = 0; i < this->partList_.size(); i++)
+ {
+ if(this->partList_[i] == part)
+ return true;
+ }
+ return false;
+ }
+
+
+ /**
+ @brief
+ Removes a ShipPart from the SpaceShip, destroying the corresponding StaticEntity
+ @param part
+ The ShipPart to be removed.
+ */
+ void ModularSpaceShip::removeShipPart(ShipPart* part)
+ {
+ // Remove the part from the partList_
+ std::vector<ShipPart*>::iterator it = this->partList_.begin();
+ for(unsigned int i = 0; i < this->partList_.size(); i++)
+ {
+ if(this->partList_[i] == part)
+ {
+ this->partList_.erase(it);
+ break;
+ }
+ it++;
+ }
+ // Remove the part-entity assignment and detach the Entity of this ShipPart
+ for (std::map<StaticEntity*, ShipPart*>::iterator itt = this->partMap_.begin(); itt != this->partMap_.end(); )
+ {
+ if (itt->second == part)
+ {
+ this->detach(itt->first);
+ itt->first->destroy();
+ //itt->first->setActive(false);
+ //itt->first->setVisible(false);
+ //itt->first->setCollisionResponse(false);
+ //itt->first->setCollisionType(None);
+ //itt->first->deactivatePhysics();
+ this->partMap_.erase(itt++);
+ } else {
+ ++itt;
+ }
+ }
+ }
+}
Copied: code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h (from rev 10215, code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.h)
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h (rev 0)
+++ code/trunk/src/orxonox/worldentities/pawns/ModularSpaceShip.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -0,0 +1,141 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * Noe Pedrazzini
+ *
+ */
+
+#ifndef _ModularSpaceShip_H__
+#define _ModularSpaceShip_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include <LinearMath/btVector3.h>
+
+#include "tools/Timer.h"
+#include "util/Math.h"
+#include "util/OrxAssert.h"
+
+#include "SpaceShip.h"
+#include "items/ShipPart.h"
+#include <map>
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ The SpaceShip is the principal entity through which the player interacts with the game. Its main function is to fly, however many things, such as @ref orxonox::Engine Engines or @ref orxonox::Weapon Weapons, can be attached to it.
+ The ModularSpaceShip is an extension of a @ref orxonox::SpaceShip SpaceShip, which uses @ref orxonox::ShipPart ShipParts to allow entities attached to it to be destroyed individually.
+
+ There are several parameters that define the behavior of the ModularSpaceShip>
+ - The <b>rotationThrust</b>, specifies the force with which the ModularSpaceShip rotates.
+ - The <b>boost</b>, there are quite some parameters pertaining to boosting. The boost is a special move of the ModularSpaceShip, where, for a limited amount of time, it can fly considerably faster than usual. The <b>boostPower</b> is the amount of power available for boosting. The <b>boostPowerRate</b> is the rate at which the boost power is replenished. The <b>boostRate</b> is the rate at which boosting uses power. And the <b>boostCooldownDuration</b> is the time the ModularSpaceShip cannot boost, once all the boost power has been used up. Naturally all of these parameters must be non-negative.
+ - The <b>boost shaking</b>, when the ModularSpaceShip boosts, the camera shakes to create a more immersive effect. Two parameters can be used to adjust the effect. The <b>shakeFrequency</b> is the frequency with which the camera shakes. And the <b>shakeAmplitude</b> is the amount with which the camera shakes. Again these parameters must bee non-negative.
+ - The <b>lift</b> creates a more natural flight feeling through the addition of a lift force. There are again tow parameters that can be specified. The <b>lift</b> which is the lift force that is applied. And the <b>stallSpeed</b> which is the forward speed after which no more lift is generated.
+
+ As mentioned @ref orxonox::Engine Engines can be mounted on the ModularSpaceShip.
+ In order to assign attached entities to a ShipPart, a ShipPart with the same name as the corresponding entity needs to be created in the <parts> tag.
+ Here is a (primitive) example of a ModularSpaceShip defined in XML:
+ @code
+ <ModularSpaceShip
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 15
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+ >
+ <attached>
+ <StaticEntity name="wing" . . . />
+ <StaticEntity name="tail" . . . />
+ </attached>
+ <parts>
+ <ShipPart name="wing" . . . />
+ <ShipPart name="tail" . . . />
+ </parts>
+ <engines>
+ <Engine />
+ <Engine />
+ </engines>
+ </ModularSpaceShip>
+ @endcode
+
+ @author
+ Fabian 'x3n' Landau, Noe Pedrazzini
+ */
+ class _OrxonoxExport ModularSpaceShip : public SpaceShip
+ {
+ public:
+ ModularSpaceShip(Context* context);
+ virtual ~ModularSpaceShip();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void addPartEntityAssignment(StaticEntity* entity, ShipPart* part);
+ ShipPart* getPartOfEntity(StaticEntity* entity) const;
+
+ virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
+
+ static void killShipPartStatic(std::string name);
+ void killShipPart(std::string name);
+
+ void addShipPart(ShipPart* part);
+ ShipPart* getShipPart(unsigned int index);
+ ShipPart* getShipPartByName(std::string name);
+ bool hasShipPart(ShipPart* part) const;
+ void removeShipPart(ShipPart* part);
+
+ inline void setRotationThrust(float val)
+ { this->rotationThrust_ = val; }
+ inline float getRotationThrust()
+ { return this->rotationThrust_; }
+
+ virtual void updatePartAssignment();
+
+ protected:
+
+
+ private:
+ void registerVariables();
+ std::vector<ShipPart*> partList_; // The list of all Parts mounted on this ModularSpaceShip.
+ std::map<StaticEntity*, ShipPart*> partMap_; // Map of Part-Entity-assignments
+ static std::map<StaticEntity*, ShipPart*>* partMap_s;
+
+ };
+}
+
+#endif /* _ModularSpaceShip_H__ */
Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -243,7 +243,7 @@
this->reloadWaitCountdown_ -= dt;
}
- void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
{
// Applies multiplier given by the DamageBoost Pickup.
if (originator)
@@ -278,21 +278,20 @@
Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte)
*/
- void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
+ void Pawn::hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
{
if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
{
- this->damage(damage, healthdamage, shielddamage, originator);
+ this->damage(damage, healthdamage, shielddamage, originator, cs);
this->setVelocity(this->getVelocity() + force);
}
}
-
- void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
+ void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
{
if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
{
- this->damage(damage, healthdamage, shielddamage, originator);
+ this->damage(damage, healthdamage, shielddamage, originator, cs);
if ( this->getController() )
this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
@@ -558,6 +557,4 @@
assert(0);
return BLANKSTRING;
}
-
-
}
Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -125,8 +125,8 @@
//virtual void hit(Pawn* originator, const Vector3& force, float damage);
//virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
- virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
- virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
+ virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
+ virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
virtual void kill();
@@ -195,7 +195,7 @@
virtual void spawneffect();
//virtual void damage(float damage, Pawn* originator = 0);
- virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL);
+ virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
bool bAlive_;
Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc 2015-01-31 17:03:17 UTC (rev 10216)
@@ -341,6 +341,24 @@
/**
@brief
+ Looks for an attached Engine with a certain name.
+ @param name
+ The name of the engine to be returned.
+ @return
+ Pointer to the engine with the given name, or NULL if not found.
+ */
+ Engine* SpaceShip::getEngineByName(const std::string& name)
+ {
+ for(size_t i = 0; i < this->engineList_.size(); ++i)
+ if(this->engineList_[i]->getName() == name)
+ return this->engineList_[i];
+
+ orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
+ return NULL;
+ }
+
+ /**
+ @brief
Remove and destroy all Engines of the SpaceShip.
*/
void SpaceShip::removeAllEngines()
@@ -354,6 +372,8 @@
Remove a particular Engine from the SpaceShip.
@param engine
A pointer to the Engine to be removed.
+ @note
+ Don't forget to reset the Engine's ship pointer after it was removed (or destroy the engine).
*/
void SpaceShip::removeEngine(Engine* engine)
{
Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h 2015-01-31 16:31:23 UTC (rev 10215)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h 2015-01-31 17:03:17 UTC (rev 10216)
@@ -123,6 +123,7 @@
void addEngine(Engine* engine); // Add an Engine to the SpaceShip.
bool hasEngine(Engine* engine) const; // Check whether the SpaceShip has a particular Engine.
Engine* getEngine(unsigned int i); // Get the i-th Engine of the SpaceShip.
+ Engine* getEngineByName(const std::string& name);
/**
@brief Get the list of all Engines that are mounted on the SpaceShip.
@return Returns a vector of all Engines of the SpaceShip.
More information about the Orxonox-commit
mailing list