Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10622 for code


Ignore:
Timestamp:
Oct 4, 2015, 3:45:56 PM (9 years ago)
Author:
landauf
Message:

merged branch presentationFS15merge back to trunk

Location:
code/trunk
Files:
5 deleted
59 edited
39 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/data/defaultConfig/keybindings.ini

    r10281 r10622  
    142142KeyWebStop=
    143143KeyX="selectClosest"
    144 KeyY=
     144KeyY="onpress fire 4"
    145145KeyYen=
    146146KeyZ="selectNext"
  • code/trunk/data/gui/scripts/MultiplayerMenu.lua

    r8858 r10622  
    7070    if choice then
    7171        local index = tolua.cast(choice, "CEGUI::ListboxItem"):getID()
    72         destination = P.serverList[index][2]
     72        destination = P.serverList[index][1]
    7373    else
    7474        return
     
    9393        local servername = ""
    9494        local serverip = ""
     95        local serverrtt = ""
     96        local playernumber = ""
    9597        while true do
    9698            servername = discovery:getServerListItemName(index)
     
    102104                break
    103105            end
    104             table.insert(P.serverList, {servername, serverip})
     106            --serverrtt = discovery:getServerListItemRTT(index)
     107            playernumber = discovery:getServerListItemPlayerNumber(index)
     108
     109            table.insert(P.serverList, {serverip, servername, playernumber})
    105110            index = index + 1
    106111        end
    107112        index = 1
    108113        for k,v in pairs(P.serverList) do
    109             local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
     114            local item = CEGUI.createListboxTextItem("IP: " .. v[1] .. " Name: " .. v[2] .. " Players: " .. v[3])
    110115            item:setID(index)
    111116            index = index + 1
     
    125130        local servername = ""
    126131        local serverip = ""
     132        local serverrtt = ""
     133        local playernumber = ""
    127134        while true do
    128135            servername = discovery:getServerListItemName(index)
     
    134141                break
    135142            end
    136             table.insert(P.serverList, {servername, serverip})
     143            --serverrtt = discovery:getServerListItemRTT(index)
     144            playernumber = discovery:getServerListItemPlayerNumber(index)
     145
     146            table.insert(P.serverList, {serverip, servername, playernumber})
    137147            index = index + 1
    138148        end
    139149        index = 1
    140150        for k,v in pairs(P.serverList) do
    141             local item = CEGUI.createListboxTextItem( v[1] .. ": " .. v[2] )
     151            local item = CEGUI.createListboxTextItem("IP: " .. v[1] .. " Name: " .. v[2] .. " Players: " .. v[3])
    142152            item:setID(index)
    143153            index = index + 1
     
    150160
    151161return P
    152 
  • code/trunk/data/gui/scripts/testscript.lua

    r10262 r10622  
    2222-- If it worked, call its "movetoposition" function
    2323if ctrl ~= nil then
    24   -- Move to the starting point at (xl+3000,yl,zl) while looking
    25   -- at xl,yl,zl over the time span of 3 seconds
    26   ctrl:eventScheduler("mal", xl+3000,yl,zl, xl,yl,zl, 1, 0)
    2724
    28   -- From there, perform a rotation around the harvester placed there
    29   -- in 100 steps
    30   dt = math.pi/100
    31   for t = 0,math.pi,dt do
    32     xt = math.cos(t)
    33     yt = math.sin(t)
    34 
    35     ctrl:eventScheduler("mal", xl+3000*xt, yl+3000*yt, zl, xl, yl, zl, dt, t+0.9)
    36   end
    37 
    38 
    39   -- Update absolute time
    40   Tabs = math.pi + 0.9
    41 
    42  
    43 
    44   -- Move away again, still looking at the station
    45   ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3, Tabs+0.4)
    46 
    47 
    48 
    49   -- Update absolute time
    50   Tabs = Tabs + 0.4 + 3
    51 
    52  
    53 
    54  
    55 
    56   -- Transition the look from (xl,yl,zl) to (3500,0,0) in 3 seconds
    57   ctrl:eventScheduler("chl", xl, yl, zl, xr, yr, zr, 2, Tabs+0.2)
    58 
    59   Tabs = Tabs + 2 + 0.2
    60 
    61    ctrl:eventScheduler("mal", xr + 600,yr,zr, xr,yr,zr, 4, Tabs+0)
    62 
    63    Tabs = Tabs + 4
    64 
    65   for t = 0,math.pi,dt do
    66     xt = math.cos(t)
    67     zt = math.sin(t)
    68 
    69     ctrl:eventScheduler("mal", xr+600*xt, yr, zr+600*zt, xr, yr, zr, dt, Tabs+t)
    70   end
    71 
    72   Tabs = Tabs + math.pi
    73 
    74   ctrl:eventScheduler("chl", xr, yr, zr, xl, yl, zl, 3, Tabs+0.2)
    75 
    76   Tabs = Tabs + 3 + 0.2
    77 
    78   ctrl:eventScheduler("mal", xm,ym,zm, xl,yl,zl, 4, Tabs+2.5)
    79 
     25  ctrl:eventScheduler("mal", xl,yl,zl, xl,yl,zl, 2)
     26  ctrl:eventScheduler("idle", 1)
     27  ctrl:eventScheduler("ral", xl, yl, zl, 3, 3000, 0, math.pi)
     28  ctrl:eventScheduler("idle", 1)
     29  ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3)
     30  ctrl:eventScheduler("idle", 1)
     31  ctrl:eventScheduler("chl", xl, yl, zl, xr, yr, zr, 2)
     32  ctrl:eventScheduler("idle", 1)
     33  ctrl:eventScheduler("mal", xr + 600,yr,zr, xr,yr,zr, 4)
     34  ctrl:eventScheduler("idle", 1)
     35  ctrl:eventScheduler("chl", xr, yr, zr, xl, yl, zl, 3)
     36  ctrl:eventScheduler("idle", 1)
     37  ctrl:eventScheduler("spi", xm,ym,zm, 0,0,0, 4)
     38  ctrl:eventScheduler("idle", 1)
    8039
    8140end
    82 
    83 
    84 
    85 -- Output the newctrlid variable we set from the C++ code
    86 if newctrlid ~= nil then
    87   orxonox.execute("orxout message test " .. newctrlid)
    88 end
    89 
    90 --orxonox.execute("setPause 1")
    91 
    92 
  • code/trunk/data/levels/includes/weaponSettingsAssff.oxi

    r8868 r10622  
    2525          </attached>
    2626          <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" />
     27          <EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare" muzzleoffset="2,-0.2,-1" />
    2728          <HsW01 mode=0 munitionpershot=0 delay=0     damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" />
    2829          <LightningGun mode=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20 />
     
    3940        </Weapon>
    4041        <Weapon>
    41           <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=30 shielddamage=20 />
     42          <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=30 healthdamage=50 shielddamage=20 />
    4243          <RocketFire mode=3 muzzleoffset="0,0,0" damage=30 healthdamage=50 shielddamage=20 />
    4344        </Weapon>
  • code/trunk/data/levels/scriptController.oxw

    r10262 r10622  
    11<!-- First levelFile of mkronig and samuezu. It was copied from dockingToASpaceStation.oxw and modified a little bit -->
    22<LevelInfo
    3  name = "Fancy orxout tests"
    4  description = "Docking into a spacestation."
     3 name = "Scriptable Controller"
     4 description = "Showcase for Scriptable Controller"
    55 tags = "showcase"
    66 screenshot = "emptylevel.png"
     
    1111  include("HUDTemplates3.oxo")
    1212  include("templates/lodInformation.oxt")
    13   include("templates/pickupRepresentationTemplates.oxt")
    1413?>
    1514
    1615<?lua
    17   include("templates/spaceshipAssff.oxt")
    18   include("templates/spaceshipPirate.oxt")
    1916  include("templates/spaceshipEscort.oxt")
    20   include("templates/bigship.oxt")
    21   include("templates/spaceshipTurret.oxt")
    22   include("templates/spaceshipCollateralDamage.oxt")
    23   include("templates/FPS.oxt")
    2417?>
    2518
     
    4033  >
    4134
    42     <?lua
    43       include("includes/pickups.oxi")
    44     ?>
     35    <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"/>
    4536
    46     <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"/>
    4737    <SpawnPoint team=0 position="3200,0,0" lookat="2800,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
    4838
    49     <StaticEntity position  = "2800,0,0" mass=10000 collisionType=static >
     39    <Billboard position="2500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
     40    <DistanceTrigger position="2500,0,0" distance="200" target="Pawn"
     41      beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
     42    />
     43
     44    <StaticEntity position  = "2000,500,2000" mass=10000 collisionType=static >
    5045      <attached>
    51         <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=50 />
     46        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=10 />
    5247      </attached>
    53       <collisionShapes>
    54         <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
    55         <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
    56         <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
    57         <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
    58         <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
    59         <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
    60         <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
    61         <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
    62         <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
    63         <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
    64         <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
    65         <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
    66         <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
    67         <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
    68         <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
    69         <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
    70       </collisionShapes>
    7148    </StaticEntity>
    7249
    73 <!-- Docking  -->
    74     <Dock position="2830,20,50" roll=0 yaw=0 >
    75         <animations>
    76             <MoveToDockingTarget target="destroyer" />
    77         </animations>
    78         <effects>
    79             <DockToShip target="spaceShip" />
    80         </effects>
     50    <StaticEntity position  = "-1000,3000,-1000" mass=10000 collisionType=static >
     51      <attached>
     52        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=80 />
     53      </attached>
     54    </StaticEntity>
     55
     56<!-- ControllerDirector waits for the event takeControl to attach a new Controller -->
     57    <ControllerDirector position="0,0,0" scriptname="presentation">
    8158        <events>
    82             <execute>
    83                 <EventListener event="dockMe" />
    84             </execute>
    85 
    86             <undocking>
    87                 <EventListener event="undockMe" />
    88             </undocking>
    89        
    90             <activity>
    91                 <EventListener event=notGameEnd />
    92             </activity>
     59            <takeControl>
     60                <EventListener event="takeControl" />
     61            </takeControl>
    9362        </events>
    94         <attached>
    95         <!-- Trigger for docking with billboard -->
    96 
    97                 <!-- removed -->
    98 
    99         <!-- Trigger for undocking with billboard -->
    100             <!-- <Billboard position="-2630,-19970,150" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 /> -->
    101             <DistanceTrigger position="-2630,-19970,150" distance="50" target="Pawn"
    102                 beaconMode="identify" targetname="bcnDestroyer" name="undockMe"
    103             />
    104         </attached>
    105     </Dock>
    106 
    107     <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=100 />
    108     <DistanceTrigger position="0,0,0" distance="200" target="Pawn"
    109       beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
    110     />
    111 
    112 
    113 <!-- Object, which orxouts the message "hello Universe!". EVENT NOT WORKING  -->
    114     <ScriptController position="0,0,0">
    115         <events>
    116             <party>
    117                 <EventListener event="dockMe" />
    118             </party>
    119 
    120         </events>
    121 
    122     </ScriptController>
    123 
    124 
    125 <!-- FPS Player as destination of the dock -->
    126 <FpsPlayer template = "fps" radarname = "First Person Player" position = "0,-19900,0" >
    127       <attached>
    128         <DockingTarget name="spaceShip" />
    129         <DistanceTriggerBeacon name="bcnDestroyer" />
    130         <DockingTarget name="destroyer" />
    131       </attached>
    132 </FpsPlayer>
    133 
    134 
    135 <!-- Cube as test SpaceStation
    136 
    137 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.
    138 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.
    139 
    140 -->
    141   <StaticEntity position="0,-20000,0" direction="0,-1,0" collisionType=static mass=100000 friction=0.01 >
    142       <attached>
    143         <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
    144       </attached>
    145       <collisionShapes>
    146         <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
    147       </collisionShapes>
    148   </StaticEntity>
    149 
    150 <!-- Homogenous gravitationfield to simulate local gravity (activating the normal gravity will affect the spaceship terribly) -->
    151 <ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-500,0" />
    152 
    153 
    154 <!-- Some more stuff -->
    155 
    156     <!-- triple large belt around the planet  -->
    157     <?lua
    158         dofile("includes/asteroidField.lua")
    159         asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1)
    160     ?>
    161     <?lua
    162         dofile("includes/asteroidField.lua")
    163         asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1)
    164     ?>
    165     <?lua
    166         dofile("includes/asteroidField.lua")
    167         asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1)
    168     ?>
    169 
    170     <Planet
    171       position="15000,0,-1000"
    172       scale="5000"
    173       collisionType="dynamic"
    174       linearDamping="0.8"
    175       angularDamping="0"
    176       mass="10000000"
    177       pitch="0"
    178       mesh="planets/ganymede.mesh"
    179       atmosphere="atmosphere1"
    180       rotationaxis="1,0,0"
    181       rotationrate="1.0"
    182       atmospheresize="80.0f"
    183       imagesize="1024.0f"
    184       collisiondamage = 2
    185       enablecollisiondamage = true
    186     >
    187       <attached>
    188         <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
    189       </attached>
    190       <collisionShapes>
    191         <SphereCollisionShape radius="5000" position="0,0,0" />
    192       </collisionShapes>
    193     </Planet>
     63    </ControllerDirector>
    19464
    19565  </Scene>
    196 
    19766</Level>
    19867
  • code/trunk/data/levels/templates/enemytowerdefense.oxt

    r10262 r10622  
    167167   maxhealth         = 200
    168168   initialhealth     = 100
    169 
     169   
    170170   shieldhealth        = 30
    171171   initialshieldhealth = 30
  • code/trunk/data/levels/towerDefense.oxw

    r10258 r10622  
    2020  include("templates/spaceshipAssff.oxt")
    2121  include("templates/spaceshipPirate.oxt")
    22   include("templates/tower.oxt")
     22  include("templates/towerdefensetower.oxt")
    2323  include("templates/enemytowerdefense.oxt")
    2424  include("templates/standardTurret.oxt")
    2525?>
    2626
    27 <!-- Specify the position of the camera -->
    28 <Template name=centerpointmarkcamera defaults=0>
    29   <Pawn team=1>
     27
     28<Template name=selectercameras defaults=0>
     29  <TowerDefenseSelecter>
    3030    <camerapositions>
    31       <CameraPosition position="0,0,1500"/>
     31      <CameraPosition position="0,0,1400" lookat="0,0,0" absolute=true />
    3232    </camerapositions>
    33   </Pawn>
     33  </TowerDefenseSelecter>
    3434</Template>
    3535
    36 <!-- Loads a mesh to mark the center-->
    37 <Template name=centerpointmark>
    38   <Pawn team=1 camerapositiontemplate=centerpointmarkcamera>
     36<Template name=selectertemplate>
     37  <TowerDefenseSelecter team=0 camerapositiontemplate=selectercameras>
    3938    <attached>
    40       <Model position="0,0,0" mesh="cylinder.mesh" scale3D="1,1,1" /> <!-- the camera is attached to this -->
     39      <Model pitch=90 position="0,0,-30" mesh="TD_Selection.mesh" scale=30 />
    4140    </attached>
    42   </Pawn>
     41  </TowerDefenseSelecter>
    4342</Template>
    44 
    45 
    46 <!-- Template for a tower   EDIT: new towertemplate is included with "templates/tower" -->
    47 <!--Template name=towertemplate>
    48   <Tower>
    49     <attached>
    50       <Model position="0,0,0" scale=0.25 mesh="Tower_ME.mesh" />
    51     </attached>
    52   </Tower>
    53 </Template-->
    54 
    5543
    5644
     
    7260
    7361    <!-- Spawns the camera, attached to a crate -->
    74     <SpawnPoint team=1 position="0,0,0" spawnclass=Pawn pawndesign=centerpointmark />
    75     <!--TeamSpawnPoint team=1 position="-7,7,4" direction="-1,0,0" roll=90 yaw=0 spawnclass=SpaceShip pawndesign=spaceshipassff /-->
    76 
    77     <!--SpawnPoint team=1 position="0,0,10" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff  /-->
    78     <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /-->
    79 
    80 
    81 
    82 
    83     <!--invisible entity to attach towers to, since playfield is static and towers are dynamic-->
    84     <StaticEntity team =1 position=0,0,0>
    85 
    86         <attached>
    87             <Model position="-50,-50,0" mesh="Playfield_ME.mesh" scale=80 />
    88             <!-- Base -->
    89             <Model position="500,700,100" mesh="sphere.mesh" scale=80 />
    90             <!--Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /--> <!-- Only temporary needed to help align the collisionshape -->
    91             <!-- This was used to mark the playfield, let's let it be here for now -->
    92             <!--Model position="-8,8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
    93             <!--Model position="-8,-8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
    94             <!--Model position="8,-8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
    95             <!--Model position="8,8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
    96         </attached>
    97         <collisionShapes> <!-- The collisionshape forbids other worldentities that have a collisionShape to fly through it.
    98 
    99                                TODO: Find correct size for the collisionshape; since a collisionShape is invisible
    100                                I added the crate wich currently has the same dimensions as the collisionshape.
    101                                You have to adjust the crate's scale3D as well as the collisionshape's halfExtens to
    102                                find the proper shape. -->
    103            <BoxCollisionShape position="0,0,0" halfExtents="400,400,100" />
    104         </collisionShapes>
    105     </StaticEntity>
    106 
    107 
    108 
     62    <SpawnPoint team=0 position="0,0,0"/>
    10963
    11064    <!-- PlayField -->
    11165    <TowerDefenseCenterpoint
    11266    name=towerdefensecenter
     67
     68    selecterTemplate=selectertemplate
     69
    11370    width=16
    11471    height=16
    11572    tileScale=100
    116     towerTemplate=tower
    11773    position="0,0,0"
    11874    direction="0,0,0"
    11975    collisionType=dynamic
    12076    mass=100000
    121     team=1
    122     />
     77    >
     78        <attached>
     79            <Model position="-50,-50,0" mesh="Playfield_ME.mesh" scale=80 />
     80            <Model position="500,700,100" mesh="sphere.mesh" scale=80 />
     81        </attached>
     82        <camerapositions>
     83      <CameraPosition position="0,0,1500" lookat="0,0,0" absolute=true/>
     84    </camerapositions>
     85    </TowerDefenseCenterpoint>
    12386
    12487  </Scene>
  • code/trunk/src/libraries/network/GamestateManager.h

    r8402 r10622  
    1 /*
     1  /*
    22 *   ORXONOX - the hottest 3D action shooter ever to exist
    33 *                    > www.orxonox.net <
     
    7878      std::map< uint32_t, packet::Gamestate* > gamestates;
    7979    };
    80    
     80
    8181  public:
    82    
     82
    8383    GamestateManager();
    8484    ~GamestateManager();
     
    8888    virtual uint32_t  getLastReceivedGamestateID( unsigned int peerID );
    8989    virtual uint32_t  getCurrentGamestateID(){ if( currentGamestate_) return currentGamestate_->getID(); else return GAMESTATEID_INITIAL; }
    90    
     90
    9191    bool processGamestates();
    9292    bool sendAck(unsigned int gamestateID, uint32_t peerID);
  • code/trunk/src/libraries/network/LANDiscoverable.cc

    r8858 r10622  
    3535#include "util/Output.h"
    3636#include "packet/ServerInformation.h"
     37#include "core/config/ConfigValueIncludes.h"
     38#include "core/CoreIncludes.h"
     39
    3740
    3841namespace orxonox
     
    4346  LANDiscoverable::LANDiscoverable()
    4447  {
     48    /* register object in orxonox */
     49    RegisterObject(LANDiscoverable);
     50
     51    this->setConfigValues();
     52    //     this->setActivity(true);
    4553    this->host_ = 0;
    4654    this->bActive_ = false;
    47 //     this->setActivity(true);
     55  }
     56
     57  void LANDiscoverable::setConfigValues()
     58  {
     59    /* update ownName string from orxonox.ini config file, if it
     60     * has changed.
     61     */
     62    SetConfigValueExternal(ownName, "Discovery", "ownName", "OrxServer");
    4863  }
    4964
     
    6176    if( bActive == this->bActive_ )        // no change
    6277      return;
    63    
     78
    6479    if( bActive )
    6580    {
     
    8499  {
    85100    ENetEvent event;
    86    
     101
    87102    if( this->bActive_==false )
    88103      return;
    89104    assert(this->host_);
    90    
     105
    91106    while( enet_host_service( this->host_, &event, 0 ) > 0 )
    92107    {
     
    104119            orxout(internal_info, context::network) << "Received LAN discovery message from client " << event.peer->host->receivedAddress << endl;
    105120            packet::ServerInformation info;
    106             info.setServerName("Orxonox Server");
     121            info.setServerName(this->ownName);
     122            info.setClientNumber(this->clientNumber);
    107123            info.send(event.peer);
    108124//             ENetPacket* packet = enet_packet_create( LAN_DISCOVERY_ACK, strlen(LAN_DISCOVERY_ACK)+1, ENET_PACKET_FLAG_RELIABLE );
  • code/trunk/src/libraries/network/LANDiscoverable.h

    r8351 r10622  
    3131
    3232#include "NetworkPrereqs.h"
     33#include "core/config/Configurable.h"
    3334
    3435namespace orxonox
    3536{
    3637
    37   class LANDiscoverable
     38  class LANDiscoverable: public Configurable
    3839  {
    3940    public:
     
    4243      void setActivity( bool bActive );
    4344      void update();
     45      void updateClientNumber(int clientNumber) {this->clientNumber = clientNumber;}
     46;
     47      /** Function used for the configuration file parameter update */
     48      void setConfigValues();
    4449
    4550    private:
    4651      bool            bActive_;
    4752      ENetHost*       host_;
     53      std::string     ownName;
     54      int             clientNumber;
    4855  };
    4956
  • code/trunk/src/libraries/network/LANDiscovery.cc

    r8858 r10622  
    8989          {
    9090            packet::ServerInformation info(&event);
    91             orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", RTT: " << info.getServerRTT() << endl;
     91            std::string payload = info.getServerName();
     92            info.setServerName(payload.substr(0,payload.length()-2));
     93            info.setClientNumber( Ogre::StringConverter::parseInt(payload.substr(payload.length()-1)));
     94            orxout(internal_info, context::network) << "Received LAN discovery server information; Name: " << info.getServerName() << ", Address: " << info.getServerIP() << ", Players: " << info.getClientNumber() << ", RTT: " << info.getServerRTT() << endl;
    9295            std::vector<packet::ServerInformation>::iterator it;
    9396            for( it=this->servers_.begin(); it!=this->servers_.end(); ++it )
     
    124127  }
    125128
     129  std::string LANDiscovery::getServerListItemRTT(unsigned int index)
     130  {
     131    if( index >= this->servers_.size() )
     132      return BLANKSTRING;
     133    else{
     134      uint32_t serverrtt = this->servers_[index].getServerRTT();
     135      return Ogre::StringConverter::toString(serverrtt);
     136    }
     137  }
    126138
     139  std::string LANDiscovery::getServerListItemPlayerNumber(unsigned int index)
     140  {
     141    if( index >= this->servers_.size() )
     142      return BLANKSTRING;
     143    else{
     144      int playerNumber = this->servers_[index].getClientNumber();
     145      return Ogre::StringConverter::toString(playerNumber);
     146    }
     147  }
    127148} // namespace orxonox
  • code/trunk/src/libraries/network/LANDiscovery.h

    r8858 r10622  
    3333#include "packet/ServerInformation.h"
    3434#include "util/Singleton.h"
     35#include <OgreStringConverter.h>
    3536
    3637#include <vector>
     
    5152      std::string getServerListItemName( unsigned int index ); // tolua_export
    5253      std::string getServerListItemIP( unsigned int index ); // tolua_export
     54      std::string getServerListItemRTT( unsigned int index ); // tolua_export
     55      std::string getServerListItemPlayerNumber( unsigned int index ); // tolua_export
    5356      static LANDiscovery& getInstance(){ return Singleton<LANDiscovery>::getInstance(); } // tolua_export
    54      
     57
    5558    private:
    5659      static LANDiscovery* singletonPtr_s;
  • code/trunk/src/libraries/network/MasterServer.cc

    r8952 r10622  
    3434#include "util/Output.h"
    3535
    36 namespace orxonox 
     36namespace orxonox
    3737{
    3838  /*** MACROS ***/
     
    4545  MasterServer *MasterServer::instance = NULL;
    4646
    47 
    48 
    49 
    5047  /* command: list servers */
    51   void 
     48  void
    5249  MasterServer::listServers( void )
    5350  {
     
    5956
    6057    /* loop through list elements */
    61     for( i = MasterServer::getInstance()->mainlist.serverlist.begin(); 
    62       i != MasterServer::getInstance()->mainlist.serverlist.end(); ++i ) 
     58    for( i = MasterServer::getInstance()->mainlist.serverlist.begin();
     59      i != MasterServer::getInstance()->mainlist.serverlist.end(); ++i )
    6360    {
    6461      orxout(user_info) << "  " << (*i).ServerInfo.getServerIP() << std::endl;
     
    7067  }
    7168
    72   void 
     69  void
    7370  MasterServer::delServer( std::string todeladdr )
    7471  {
    7572    /* tell the user we're now removing the entry from the server list */
    76     orxout(user_info) << "MS: Deleting server \"" << todeladdr << "\"..." 
     73    orxout(user_info) << "MS: Deleting server \"" << todeladdr << "\"..."
    7774      << std::endl;
    7875
    7976    /* see if we actually have that server on our list */
    80     ServerListSearchResult shandle = 
     77    ServerListSearchResult shandle =
    8178      MasterServer::getInstance()->mainlist.findServerByAddress(todeladdr);
    8279
     
    8683    }
    8784
    88     /* force-disconnect the server */ 
     85    /* force-disconnect the server */
    8986    enet_peer_disconnect( shandle.result.peer, 0 );
    9087
     
    9895
    9996  /* helpers */
    100   static void 
     97  static void
    10198  helper_output_debug( ENetEvent *event, char *addrconv )
    10299  {
    103100    orxout(verbose, context::master_server)
    104       << "A packet of length" 
     101      << "A packet of length"
    105102      << event->packet->dataLength
    106103      << " containing "
    107104      << (const char*)event->packet->data
    108105      << " was received from "
    109       << addrconv 
     106      << addrconv
    110107      << " on channel "
    111108      << event->channelID << endl;
     
    122119
    123120    /* loop through list elements */
    124     for( i = mainlist.serverlist.begin(); i 
    125         != mainlist.serverlist.end(); ++i ) 
     121    for( i = mainlist.serverlist.begin(); i
     122        != mainlist.serverlist.end(); ++i )
    126123    {
    127124      /* send this particular server */
    128125      /* build reply string */
    129       char *tosend = (char *)calloc( (*i).ServerInfo.getServerIP().length()
    130           + MSPROTO_SERVERLIST_ITEM_LEN + 2,1 );
    131       if( !tosend ) 
     126      int packetlen = MSPROTO_SERVERLIST_ITEM_LEN + 1 + (*i).ServerInfo.getServerIP().length() + 1 + (*i).ServerInfo.getServerName().length() + 1 + sizeof((*i).ServerInfo.getClientNumber()) + 1;
     127      char *tosend = (char *)calloc(packetlen ,1 );
     128      if( !tosend )
    132129      { orxout(internal_warning, context::master_server) << "Masterserver.cc: Memory allocation failed." << endl;
    133130        continue;
    134       } 
    135       sprintf( tosend, "%s %s", MSPROTO_SERVERLIST_ITEM,
    136           (*i).ServerInfo.getServerIP().c_str() );
     131      }
     132      sprintf( tosend, "%s %s %s %u", MSPROTO_SERVERLIST_ITEM,
     133          (*i).ServerInfo.getServerIP().c_str(), (*i).ServerInfo.getServerName().c_str(), (*i).ServerInfo.getClientNumber());
    137134
    138135      /* create packet from it */
    139136      reply = enet_packet_create( tosend,
    140           strlen( tosend ) + 1, 
     137          strlen( tosend ) + 1,
    141138          ENET_PACKET_FLAG_RELIABLE);
    142139
     
    149146      /* free the tosend buffer */
    150147      free( tosend );
    151     } 
     148    }
    152149
    153150    /* create end-of-list packet */
     
    163160  }
    164161
    165   /* maybe the two methods below can be merged into one and 
    166    * made to use ENet's RTT functionality to check for disconnected 
     162  /* maybe the two methods below can be merged into one and
     163   * made to use ENet's RTT functionality to check for disconnected
    167164   * servers.
    168165   */
    169   void 
     166  void
    170167  MasterServer::helper_cleanupServers( void )
    171168  {
    172169    /* get an iterator */
    173170    std::list<ServerListElem>::iterator i;
    174      
     171
    175172    if( mainlist.serverlist.size() == 0 )
    176173      return;
    177174
    178175    /* loop through list elements */
    179     for( i = mainlist.serverlist.begin(); i 
    180         != mainlist.serverlist.end(); ++i ) 
     176    for( i = mainlist.serverlist.begin(); i
     177        != mainlist.serverlist.end(); ++i )
    181178    { /* see if we have a disconnected peer */
    182       if( (*i).peer && 
     179      if( (*i).peer &&
    183180         ((*i).peer->state == ENET_PEER_STATE_DISCONNECTED ||
    184181          (*i).peer->state == ENET_PEER_STATE_ZOMBIE ))
    185       { 
     182      {
    186183        /* Remove it from the list */
    187184        orxout(internal_warning) << (char*)(*i).peer->data << " timed out.\n";
     
    190187        /* stop iterating, we manipulated the list */
    191188        /* TODO note: this only removes one dead server per loop
    192          * iteration. not beautiful, but one iteration is ~100ms, 
     189         * iteration. not beautiful, but one iteration is ~100ms,
    193190         * so not really relevant for the moment.
    194191         */
     
    196193      }
    197194    }
    198  
     195
    199196  }
    200197
     
    204201  /***** EVENTS *****/
    205202  /* connect event */
    206   int 
     203  int
    207204  MasterServer::eventConnect( ENetEvent *event )
    208205  { /* check for bad parameters */
     
    217214
    218215    /* output debug info */
    219     orxout(verbose, context::master_server) << "A new client connected from " 
    220       << addrconv 
    221       << " on port " 
     216    orxout(verbose, context::master_server) << "A new client connected from "
     217      << addrconv
     218      << " on port "
    222219      << event->peer->address.port << endl;
    223220
    224221    /* store string form of address here */
    225     event->peer->data = addrconv; 
     222    event->peer->data = addrconv;
    226223
    227224    /* all fine. */
     
    230227
    231228  /* disconnect event */
    232   int 
     229  int
    233230  MasterServer::eventDisconnect( ENetEvent *event )
    234231  { /* check for bad parameters */
     
    255252
    256253  /* data event */
    257   int 
     254  int
    258255  MasterServer::eventData( ENetEvent *event )
    259256  { /* validate packet */
     
    262259      return -1;
    263260    }
    264      
     261
    265262    /* generate address in readable form */
    266263    char *addrconv = (char *) calloc( 50, 1 );
    267264    enet_address_get_host_ip( &(event->peer->address), addrconv, 49 );
     265    /* convert to string */
     266    std::string ip = std::string( addrconv );
     267    /* delete addrconv */
     268    if( addrconv ) free( addrconv );
     269
     270    /* pointer to full packet data */
     271    char * packetdata = (char *)event->packet->data;
    268272
    269273    /* output debug info about the data that has come */
     
    271275
    272276    /* GAME SERVER OR CLIENT CONNECTION? */
    273     if( !strncmp( (char *)event->packet->data, MSPROTO_GAME_SERVER,
    274       MSPROTO_GAME_SERVER_LEN ) )
     277    if( !strncmp(packetdata, MSPROTO_GAME_SERVER, MSPROTO_GAME_SERVER_LEN ) )
    275278    { /* Game server */
    276279
    277       if( !strncmp( (char *)event->packet->data
    278         + MSPROTO_GAME_SERVER_LEN+1,
    279         MSPROTO_REGISTER_SERVER, MSPROTO_REGISTER_SERVER_LEN ) )
     280      if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_REGISTER_SERVER, MSPROTO_REGISTER_SERVER_LEN ) )
    280281      { /* register new server */
    281         mainlist.addServer( packet::ServerInformation( event ),
    282           event->peer );
    283        
     282        mainlist.addServer( packet::ServerInformation( event ), event->peer );
     283
    284284        /* tell people we did so */
    285         orxout(internal_info, context::master_server) << "Added new server to list: " << 
     285        orxout(internal_info, context::master_server) << "Added new server to list: " <<
    286286          packet::ServerInformation( event ).getServerIP() << endl;
    287287      }
    288288
    289       else if( !strncmp( (char *)event->packet->data
    290         + MSPROTO_GAME_SERVER_LEN+1,
    291         MSPROTO_SERVERDC, MSPROTO_SERVERDC_LEN ) )
    292       {
     289      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SERVERDC, MSPROTO_SERVERDC_LEN ) )
     290      { /* disconnect server */
     291
     292        /* remove the server from the list it belongs to */
     293        this->mainlist.delServerByAddress( ip );
     294
     295        /* tell the user */
     296        orxout(internal_info, context::master_server) << "Removed server " << ip << " from list." << endl;
     297      }
     298      /* TODO add hook for disconnect here */
     299
     300      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SET_NAME, MSPROTO_SET_NAME_LEN ) )
     301      { /* save server name */
    293302        /* create string from peer data */
    294         std::string name = std::string( addrconv );
     303        std::string data (event->packet->data,event->packet->data + event->packet->dataLength );
     304        std::string name = data.substr(MSPROTO_GAME_SERVER_LEN+1 + MSPROTO_SET_NAME_LEN + 1);
    295305
    296306        /* remove the server from the list it belongs to */
    297         this->mainlist.delServerByAddress( name );
     307        this->mainlist.setNameByAddress( ip, name );
    298308
    299309        /* tell the user */
    300         orxout(internal_info, context::master_server) << "Removed server " << name << " from list." << endl;
    301       }
    302 
    303       /* TODO add hook for disconnect here */
    304     }
    305     else if( !strncmp( (char *)event->packet->data, MSPROTO_CLIENT,
    306       MSPROTO_CLIENT_LEN) )
     310        orxout(internal_info, context::master_server) << "Updated server " << ip << " with new name " << name << endl;
     311      }
     312
     313      else if( !strncmp( packetdata + MSPROTO_GAME_SERVER_LEN+1, MSPROTO_SET_CLIENTS, MSPROTO_SET_CLIENTS_LEN ) )
     314      { /* save client count from server */
     315        /* create string from peer data */
     316        std::string data (event->packet->data,event->packet->data + event->packet->dataLength );
     317        std::string textform= data.substr(MSPROTO_GAME_SERVER_LEN + 1 + MSPROTO_SET_CLIENTS_LEN + 1);
     318        int clientNumber = Ogre::StringConverter::parseInt(textform);
     319
     320        this->mainlist.setClientsByAddress( ip, clientNumber);
     321
     322        /* tell the user */
     323        orxout(internal_info, context::master_server) << "Updated server " << ip << " with new client number " << clientNumber << endl;
     324      }
     325    }
     326    else if( !strncmp( packetdata, MSPROTO_CLIENT, MSPROTO_CLIENT_LEN) )
    307327    { /* client */
    308       if( !strncmp( (char *)event->packet->data + MSPROTO_CLIENT_LEN+1,
    309         MSPROTO_REQ_LIST, MSPROTO_REQ_LIST_LEN ) )
     328      if( !strncmp( packetdata + MSPROTO_CLIENT_LEN+1, MSPROTO_REQ_LIST, MSPROTO_REQ_LIST_LEN ) )
    310329        /* send server list */
    311330        helper_sendlist( event );
    312331    }
    313332    else
    314     { /* bad message, don't do anything. */ }
    315 
    316     /* delete addrconv */
    317     if( addrconv ) free( addrconv );
     333    { /* bad message, don't do anything. */ }
    318334
    319335    /* Clean up the packet now that we're done using it. */
     
    324340
    325341  /**** MAIN ROUTINE *****/
    326   int 
     342  int
    327343  MasterServer::run()
    328344  {
     
    330346    ENetEvent *event = (ENetEvent *)calloc(sizeof(ENetEvent), sizeof(char));
    331347    if( event == NULL )
    332     { 
     348    {
    333349      orxout(user_error, context::master_server) << "Could not create ENetEvent structure, exiting." << endl;
    334350      exit( EXIT_FAILURE );
     
    345361    switch (event->type)
    346362    { /* new connection */
    347       case ENET_EVENT_TYPE_CONNECT: 
     363      case ENET_EVENT_TYPE_CONNECT:
    348364        eventConnect( event ); break;
    349365
    350366        /* disconnect */
    351       case ENET_EVENT_TYPE_DISCONNECT: 
     367      case ENET_EVENT_TYPE_DISCONNECT:
    352368        eventDisconnect( event ); break;
    353369
     
    358374
    359375    /* done */
     376    free(event);
    360377    return 0;
    361   } 
     378  }
    362379
    363380  /* constructor */
     
    380397    this->address.port = ORX_MSERVER_PORT;
    381398
    382     /* create a host with the above settings (the last two 0 mean: accept 
     399    /* create a host with the above settings (the last two 0 mean: accept
    383400     * any input/output bandwidth */
    384     this->server = enet_host_create( &this->address, ORX_MSERVER_MAXCONNS, 
     401    this->server = enet_host_create( &this->address, ORX_MSERVER_MAXCONNS,
    385402        ORX_MSERVER_MAXCHANS, 0, 0 );
    386403    assert(this->server);
     
    388405    /* see if creation worked */
    389406    if( !this->server )
    390     { orxout(user_error, context::master_server) << 
     407    { orxout(user_error, context::master_server) <<
    391408        "An error occurred while trying to create an ENet server host." << endl;
    392409      exit( EXIT_FAILURE );
  • code/trunk/src/libraries/network/MasterServer.h

    r8937 r10622  
    4949#include <cstdio>
    5050
    51 namespace orxonox
     51#include <OgreStringConverter.h>
     52
     53
     54namespace orxonox
    5255{
    5356  /* singleton */
     
    6366      /* static pointer for commands */
    6467      static MasterServer *instance;
    65       static MasterServer *getInstance() 
     68      static MasterServer *getInstance()
    6669        { return instance; }
    67       static void setInstance( MasterServer *setto ) 
     70      static void setInstance( MasterServer *setto )
    6871        { instance = setto;  }
    69      
     72
    7073      /* functions for commands */
    7174      static void listServers( void );
  • code/trunk/src/libraries/network/MasterServerProtocol.h

    r8351 r10622  
    3737/* Client token (shows that the party sending data is a client */
    3838#define MSPROTO_CLIENT "CL"
    39 #define MSPROTO_CLIENT_LEN 2 
     39#define MSPROTO_CLIENT_LEN 2
    4040
    4141/* Request: Serverlist (requiest made from client to master server */
    4242#define MSPROTO_REQ_LIST "REQ:LIST"
    4343#define MSPROTO_REQ_LIST_LEN 8
    44 
    45 
    4644
    4745
     
    6765/* ping request from server */
    6866#define MSPROTO_PING_GAMESERVER "PING"
    69 #define MSPROTO_PING_GAMESERVER_LEN 4 
     67#define MSPROTO_PING_GAMESERVER_LEN 4
    7068
    7169/* server disconnect */
     
    7573/* ping reply */
    7674#define MSPROTO_ACK "ACK"
    77 #define MSPROTO_ACK_LEN 3 
     75#define MSPROTO_ACK_LEN 3
    7876
     77/* server name */
     78#define MSPROTO_SET_NAME "NAM"
     79#define MSPROTO_SET_NAME_LEN 3
    7980
     81/* server number of clients */
     82#define MSPROTO_SET_CLIENTS "CLI"
     83#define MSPROTO_SET_CLIENTS_LEN 3
     84
     85#define SERVER_NAME_MAXLEN 7
    8086
    8187/* default master server port */
  • code/trunk/src/libraries/network/PeerList.cc

    r8858 r10622  
    3838  PeerList::~PeerList() { }
    3939
    40   int 
     40  int
    4141  PeerList::addPeer( ENetPeer *toadd )
    4242  { /* error correction */
    43     if( toadd == NULL ) 
     43    if( toadd == NULL )
    4444    { orxout(internal_error, context::master_server) << "PeerList::addPeer: empty peer given." << endl;
    4545      return -1;
     
    5252
    5353  bool sub_compAddr( ENetAddress addr1, ENetAddress addr2 )
    54   { 
     54  {
    5555    for( int i = 0; i < 16; ++i )
    5656      if( addr1.host.addr[i] < addr2.host.addr[i] )
     
    6161    return 0;
    6262  }
    63    
     63
    6464
    6565  bool
     
    6969
    7070    /* loop through list elements */
    71     for( i = peerlist.begin(); i != peerlist.end(); ++i ) 
     71    for( i = peerlist.begin(); i != peerlist.end(); ++i )
    7272      if( !sub_compAddr((*i)->address, addr ) )
    7373      { /* found this name, remove and quit */
     
    8686
    8787    /* loop through list elements */
    88     for( i = peerlist.begin(); i != peerlist.end(); ++i ) 
     88    for( i = peerlist.begin(); i != peerlist.end(); ++i )
    8989      if( !sub_compAddr((*i)->address, addr ) )
    9090        /* found this name, remove and quit */
     
    9595  }
    9696
     97  int
     98  PeerList::count(){
     99    return this->peerlist.size();
     100  }
     101
    97102}
    98 
  • code/trunk/src/libraries/network/PeerList.h

    r8351 r10622  
    3535
    3636/* peer list */
    37 namespace orxonox 
     37namespace orxonox
    3838{
    39   /** This class keeps a list of open connections 
     39  /** This class keeps a list of open connections
    4040   * and some info about them.
    4141   */
    42   class PeerList 
     42  class PeerList
    4343  { public:
    4444      /** constructor */
     
    5050      /** \param toadd The peer to add
    5151       * \return 0 for success, -1 for error.
    52        * 
    53        * Add new peer to list 
     52       *
     53       * Add new peer to list
    5454       */
    5555      int addPeer( ENetPeer *toadd );
     
    5757      /** \param addr Address to look for
    5858       * \return if the peer was found or not
    59        * 
    60        * Remove peer from list by address 
     59       *
     60       * Remove peer from list by address
    6161       */
    6262      bool remPeerByAddr( ENetAddress addr );
    6363
    6464      /** \param addr The address to find by
    65        *
    66        * Find a connection by address */
     65       *
     66       * Find a connection by address
     67       */
    6768      ENetPeer *findPeerByAddr( ENetAddress addr );
    6869
    69       /* NOTE: making this list public so it can easily
     70      /**
     71       * Count current peers
     72       */
     73       int count();
     74
     75      /* NOTE: making this list public so it can easily
    7076       * be iterated. This makes sense since iterating it
    7177       * will happen all the time, and using getter methods
  • code/trunk/src/libraries/network/Server.cc

    r9667 r10622  
    7777    this->timeSinceLastUpdate_=0;
    7878  }
    79 
     79/*
     80  Server::Server(int port, const std::string name)
     81  {
     82    this->setPort( port );
     83    this->timeSinceLastUpdate_=0;
     84    this->serverName_=name;
     85  }*/
    8086  /**
    8187  * Constructor
     
    108114    /* make discoverable on LAN */
    109115    LANDiscoverable::setActivity(true);
     116    LANDiscoverable::updateClientNumber(0);
    110117
    111118    /* make discoverable on WAN */
    112119    WANDiscoverable::setActivity(true);
     120    WANDiscoverable::updateClientNumber(0);
    113121
    114122    /* done */
     
    283291    // inform all the listeners
    284292    this->clientIDs_.push_back(peerID);
     293    WANDiscoverable::updateClientNumber(this->clientIDs_.size());
     294    LANDiscoverable::updateClientNumber(this->clientIDs_.size());
     295
    285296    ClientConnectionListener::broadcastClientConnected(peerID);
    286297    GamestateManager::addPeer(peerID);
     
    289300
    290301    orxout(internal_info, context::network) << "Server: added client id: " << peerID << endl;
     302
    291303    createClient(peerID);
    292304}
     
    309321    }
    310322  }
     323  WANDiscoverable::updateClientNumber(this->clientIDs_.size());
     324  LANDiscoverable::updateClientNumber(this->clientIDs_.size());
     325
    311326  ClientConnectionListener::broadcastClientDisconnected(peerID);
    312327  GamestateManager::removePeer(peerID);
  • code/trunk/src/libraries/network/Server.h

    r8858 r10622  
    6767    virtual void printRTT();
    6868    float getPacketLoss(unsigned int clientID);
     69    int getClientCount() { return this->clientIDs_.size();}
     70    std::string getServerName() { return this->serverName_;}
     71
    6972  protected:
    7073    void updateGamestate();
     
    8992    std::deque<packet::Packet*> packetQueue_;
    9093    std::vector<uint32_t>       clientIDs_;
     94    std::string                 serverName_;
    9195  };
    9296
  • code/trunk/src/libraries/network/ServerList.cc

    r8937 r10622  
    3030
    3131namespace orxonox
    32 { 
     32{
    3333  ServerList::ServerList()
    3434  { /* create a new list */ }
     
    3939  }
    4040
    41   int 
     41  int
    4242  ServerList::addServer( packet::ServerInformation toadd,
    4343    ENetPeer *peer )
    44   { 
     44  {
    4545    ServerListElem toAdd;
    4646    toAdd.ServerInfo = toadd;
    4747    toAdd.peer = peer;
    4848
    49     this->serverlist.push_back( toAdd ); 
     49    this->serverlist.push_back( toAdd );
    5050    return 0;
    5151  }
    5252
    53   bool 
     53  bool
    5454  ServerList::delServerByName( std::string name )
    55   { 
     55  {
    5656    /* get an iterator */
    5757    std::list<ServerListElem>::iterator i;
    5858
    5959    /* loop through list elements */
    60     for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
     60    for( i = serverlist.begin(); i != serverlist.end(); ++i )
    6161      if( (*i).ServerInfo.getServerName() == name )
    6262      { /* found this name, remove and quit */
     
    6868
    6969  bool ServerList::delServerByAddress( std::string address )
    70   { 
     70  {
    7171    /* get an iterator */
    7272    std::list<ServerListElem>::iterator i;
    7373
    7474    /* loop through list elements */
    75     for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
     75    for( i = serverlist.begin(); i != serverlist.end(); ++i )
    7676      if( (*i).ServerInfo.getServerIP() == address )
    7777      { /* found this name, remove and quit */
     
    9090
    9191    /* loop through list elements */
    92     for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
     92    for( i = serverlist.begin(); i != serverlist.end(); ++i )
    9393      if( (*i).ServerInfo.getServerIP() == address )
    9494      { /* found the target, return it */
     
    110110    /* iterate, return when name found */
    111111    /* loop through list elements */
    112     for( i = serverlist.begin(); i != serverlist.end(); ++i ) 
     112    for( i = serverlist.begin(); i != serverlist.end(); ++i )
    113113      if( (*i).ServerInfo.getServerName() == name )
    114       { 
     114      {
    115115        ServerListSearchResult res = { (*i), true };
    116116        return res;
     
    124124  /* SORTING */
    125125  /* sort by name */
    126   bool sub_compare_names( ServerListElem no1, 
     126  bool sub_compare_names( ServerListElem no1,
    127127    ServerListElem no2 )
    128128  { return no1.ServerInfo.getServerName() > no2.ServerInfo.getServerName(); }
    129129
    130130  void ServerList::sortByName()
    131   { 
    132     this->serverlist.sort( sub_compare_names ); 
     131  {
     132    this->serverlist.sort( sub_compare_names );
    133133  }
    134  
     134
    135135  /* sort by ping */
    136   bool sub_compare_pings( ServerListElem no1, 
     136  bool sub_compare_pings( ServerListElem no1,
    137137    ServerListElem no2 )
    138   { 
    139     return no1.ServerInfo.getServerName() > no2.ServerInfo.getServerName();
     138  {
     139    return no1.ServerInfo.getServerRTT() > no2.ServerInfo.getServerRTT();
    140140  }
    141141
    142142  void ServerList::sortByPing()
    143143  {
    144     this->serverlist.sort( sub_compare_pings ); 
     144    this->serverlist.sort( sub_compare_pings );
    145145  }
    146146
     147  bool ServerList::setNameByAddress( std::string address, std::string name  ){
     148    /* get an iterator */
     149    std::list<ServerListElem>::iterator i;
     150
     151    /* loop through list elements */
     152    for( i = serverlist.begin(); i != serverlist.end(); ++i )
     153      if( (*i).ServerInfo.getServerIP() == address )
     154      { /* found this adress, rename and quit */
     155        (*i).ServerInfo.setServerName( name );
     156        return true;
     157      }
     158    return false;
     159  };
     160
     161  bool ServerList::setClientsByAddress( std::string address, int clientNumber ){
     162    /* get an iterator */
     163    std::list<ServerListElem>::iterator i;
     164
     165    /* loop through list elements */
     166    for( i = serverlist.begin(); i != serverlist.end(); ++i )
     167      if( (*i).ServerInfo.getServerIP() == address )
     168      { /* found this adress, rename and quit */
     169        (*i).ServerInfo.setClientNumber( clientNumber );
     170        return true;
     171      }
     172    return false;
     173  };
     174
    147175}
  • code/trunk/src/libraries/network/ServerList.h

    r8937 r10622  
    3535
    3636/* methods necessary */
    37 namespace orxonox 
    38 { 
     37namespace orxonox
     38{
    3939  /* HELPER STRUCTURES */
    40   struct ServerListElem 
     40  struct ServerListElem
    4141  {
    4242    /* server information (name, IP, etc) */
     
    6363   * and some info about them.
    6464   */
    65   class ServerList 
     65  class ServerList
    6666  { public:
    6767      /** constructor */
     
    7474      /* BASIC MANIPULATION */
    7575      /** \param toadd the server to add.
    76        * 
     76       *
    7777       * Add server to the game server list
    7878       */
     
    8181
    8282      /** \param name Name of the server to remove
    83        * 
    84        * Remove server by name 
     83       *
     84       * Remove server by name
    8585       */
    8686      bool delServerByName( std::string name );
    8787
    8888      /** \param address IP address of the server to remove
    89        * 
     89       *
    9090       * Remove server by address
    9191       */
    9292      bool delServerByAddress( std::string address );
    9393
     94      bool setNameByAddress( std::string address, std::string name  );
    9495
    95 
     96      bool setClientsByAddress( std::string address, int clientNumber );
    9697
    9798      /* SEARCHING */
    98       /* \param address The address of the server that is to be 
     99      /* \param address The address of the server that is to be
    99100       *  found
    100101       * \return A struct containing a result of the search and a boolean
    101102       *  that is only true if the search was successful
    102        * 
     103       *
    103104       * Find and return the list handle of a given address.
    104105       */
     
    107108
    108109
    109       /* \param name The name of the server that is to be 
     110      /* \param name The name of the server that is to be
    110111       *  found
    111112       * \return The struct containing the list entry of the server
    112        * 
     113       *
    113114       * Find and return the list handle of a given name.
    114115       */
     
    120121      /** sort by name  */
    121122      void sortByName();
    122      
     123
    123124      /** sort by ping */
    124125      void sortByPing();
  • code/trunk/src/libraries/network/WANDiscoverable.cc

    r9667 r10622  
    4444    /* debugging output */
    4545    orxout(verbose, context::master_server) << "Creating WANDiscoverable." << endl;
    46  
     46
    4747    /* register object in orxonox */
    4848    RegisterObject(WANDiscoverable);
     
    5050    /* check for the masterserver address option in orxonox.ini */
    5151    this->setConfigValues();
    52    
     52
    5353  }
    5454
    5555  void WANDiscoverable::setConfigValues()
    5656  {
    57     /* update msaddress string from orxonox.ini config file, if it 
    58      * has changed. 
     57    /* update msaddress string from orxonox.ini config file, if it
     58     * has changed.
    5959     */
    60     SetConfigValueExternal(msaddress, "WANDiscovery", "msaddress", "orxonox.net");
    61 //     SetConfigValue( msaddress, "orxonox.net");
    62   } 
     60    SetConfigValueExternal(msaddress, "Discovery", "msaddress", "orxonox.net");
     61    SetConfigValueExternal(ownName, "Discovery", "ownName", "OrxServer");
     62  }
    6363
    6464  WANDiscoverable::~WANDiscoverable()
     
    6767      this->disconnect();
    6868  }
    69  
     69
    7070  void WANDiscoverable::setActivity(bool bActive)
    7171  {
    7272    if( bActive==this->bActive_ )
    7373      return;
    74    
     74
    7575    if( bActive )
    7676    {
     
    8484    }
    8585  }
    86  
     86
    8787  bool WANDiscoverable::connect()
    8888  {
     
    9393      return false;
    9494    }
    95    
     95
    9696    /* connect and see if it worked */
    9797    if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
    9898    {
    99       orxout(internal_error, context::master_server) << "Could not connect to master server at " 
     99      orxout(internal_error, context::master_server) << "Could not connect to master server at "
    100100                 << this->msaddress << endl;
    101101      return false;
    102102    }
    103                  
     103
    104104    /* debugging output */
    105105    orxout(verbose, context::master_server) << "Initialization of WANDiscoverable complete." << endl;
    106    
    107    
     106
    108107    // Now register the server at the master server
    109108    this->msc.sendRequest( MSPROTO_GAME_SERVER " " MSPROTO_REGISTER_SERVER );
    110    
     109
     110    std::string request = MSPROTO_GAME_SERVER " " MSPROTO_SET_NAME " ";
     111    request += this->ownName;
     112    this->msc.sendRequest( request );
     113
    111114    return true;
    112115  }
     
    118121  }
    119122
     123  void WANDiscoverable::updateClientNumber(int clientNumber)
     124  {
     125    orxout(verbose, context::master_server) << "Sending new number of clients: " << clientNumber << endl;
     126    std::string request = MSPROTO_GAME_SERVER " " MSPROTO_SET_CLIENTS " ";
     127    request += Ogre::StringConverter::toString(clientNumber);
     128
     129    this->msc.sendRequest( request );
     130  }
    120131
    121132
    122  
     133
     134
    123135} // namespace orxonox
  • code/trunk/src/libraries/network/WANDiscoverable.h

    r9667 r10622  
    3232#include "core/config/Configurable.h"
    3333#include "MasterServerComm.h"
     34#include <OgreStringConverter.h>
    3435
    3536namespace orxonox
     
    4647
    4748      /** \return Address of the master server
    48        * 
    49        * Get the master server address 
     49       *
     50       * Get the master server address
    5051       */
    5152      std::string getMSAddress()
     
    5455      /** Function used for the configuration file parameter update */
    5556      void setConfigValues();
    56      
     57
    5758      /** Function used to set the activity/discoverability */
    5859      void setActivity( bool bActive );
    5960
     61      void updateClientNumber(int clientNumber);
     62
    6063      /** Master server communications object */
    6164      MasterServerComm msc;
    62      
     65
    6366    private:
    6467      /** Function used to connect to the master server */
    6568      bool connect();
    66      
     69
    6770      /** Function used to disconnect from the master server */
    6871      void disconnect();
    69      
     72
    7073      /** master server address */
    7174      std::string msaddress;
     75      std::string ownName;
    7276      bool        bActive_;
    7377
  • code/trunk/src/libraries/network/WANDiscovery.cc

    r8858 r10622  
    4141    /* debugging output */
    4242    orxout(verbose, context::master_server) << "Creating WANDiscovery." << endl;
    43  
     43
    4444    /* register object in orxonox */
    4545    RegisterObject(WANDiscovery);
     
    5454    /* connect and see if it worked */
    5555    if( msc.connect( this->msaddress.c_str(), ORX_MSERVER_PORT ) )
    56       orxout(internal_error, context::master_server) << "Could not connect to master server at " 
     56      orxout(internal_error, context::master_server) << "Could not connect to master server at "
    5757        << this->msaddress << endl;
    5858
     
    6363  void WANDiscovery::setConfigValues()
    6464  {
    65     /* update msaddress string from orxonox.ini config file, if it 
    66      * has changed. 
     65    /* update msaddress string from orxonox.ini config file, if it
     66     * has changed.
    6767     */
    6868    SetConfigValue( msaddress, "master.orxonox.net");
    69   } 
     69  }
    7070
    7171  WANDiscovery::~WANDiscovery()
    72   { 
     72  {
    7373    /* clear server list */
    74     this->servers_.clear(); 
     74    this->servers_.clear();
    7575  }
    7676
    7777  /* callback for the network reply poller */
    7878  int WANDiscovery::rhandler( char *addr, ENetEvent *ev )
    79   { 
     79  {
    8080    /* error recognition */
    8181    if( !ev || !ev->packet || !ev->packet->data )
     
    8888    if( !strncmp( (char*)ev->packet->data, MSPROTO_SERVERLIST_ITEM,
    8989      MSPROTO_SERVERLIST_ITEM_LEN ) )
    90     { 
     90    {
    9191      /* create server structure from that item */
    9292      packet::ServerInformation toadd;
    9393
    9494      /* fill in data, -1 for the index: index should be length -1 */
    95       toadd.setServerName( std::string((char*)ev->packet->data +
    96         MSPROTO_SERVERLIST_ITEM_LEN+1) );
    97       toadd.setServerIP( std::string((char*)ev->packet->data +
    98         MSPROTO_SERVERLIST_ITEM_LEN+1) );
     95      std::string datastr = std::string((char*)ev->packet->data + MSPROTO_SERVERLIST_ITEM_LEN+1);
     96      int separator = datastr.find(" ");
     97      toadd.setServerIP(datastr.substr(0,separator));
     98      int secondsep = datastr.find(" ", separator + 1);
     99      toadd.setServerName(datastr.substr(separator + 1, secondsep - separator - 1));
     100      toadd.setClientNumber(Ogre::StringConverter::parseInt(datastr.substr(secondsep+1)));
     101
     102      orxout(internal_info, context::network) << "Received WAN discovery server information; Name: " << toadd.getServerName() << ", Address: " << toadd.getServerIP() << ", Players: " << toadd.getClientNumber() << ", RTT: " << toadd.getServerRTT() << endl;
    99103
    100104      /* add to list */
     
    103107    else if( !strncmp( (char*)ev->packet->data, MSPROTO_SERVERLIST_END,
    104108      MSPROTO_SERVERLIST_END_LEN ) )
    105     { 
     109    {
    106110      /* this is the only case where 2 should be returned,
    107111       * as 1 is used to signal that we're done receiving
    108112       * the list
    109113       */
    110       return 2; 
     114      return 2;
    111115    }
    112116
     
    114118    return 1;
    115119  }
    116  
     120
    117121  void WANDiscovery::discover()
    118122  {
     
    131135      { case 0: /* no event occured, decrease timeout */
    132136          --i; break;
    133         case 1: /* got a list element, continue */ 
     137        case 1: /* got a list element, continue */
    134138          break;
    135139        case 2: /* done. */
     
    159163  }
    160164
     165  std::string WANDiscovery::getServerListItemRTT(unsigned int index)
     166  {
     167    if( index >= this->servers_.size() )
     168      return BLANKSTRING;
     169    else{
     170      uint32_t serverrtt = this->servers_[index].getServerRTT();
     171      return Ogre::StringConverter::toString(serverrtt);
     172    }
     173
     174  }
     175  std::string WANDiscovery::getServerListItemPlayerNumber(unsigned int index)
     176  {
     177    if( index >= this->servers_.size() )
     178      return BLANKSTRING;
     179    else{
     180      int playerNumber = this->servers_[index].getClientNumber();
     181      return Ogre::StringConverter::toString(playerNumber);
     182    }
     183  }
    161184
    162185} // namespace orxonox
  • code/trunk/src/libraries/network/WANDiscovery.h

    r9667 r10622  
    3535#include "MasterServerComm.h"
    3636#include "MasterServerProtocol.h"
     37#include <OgreStringConverter.h>
    3738
    3839#include <vector>
     
    5657
    5758      /** \return Address of the master server
    58        * 
    59        * Get the master server address 
     59       *
     60       * Get the master server address
    6061       */
    6162      std::string getMSAddress()
     
    6566      void discover(); // tolua_export
    6667
    67       /** \param index Index to get the name of 
     68      /** \param index Index to get the name of
    6869       * \return The name of the server
    69        * 
    70        * Get the name of the server at index index. 
     70       *
     71       * Get the name of the server at index index.
    7172       */
    7273      std::string getServerListItemName( unsigned int index ); // tolua_export
    7374
    74       /** \param index Index to get the IP of 
     75      /** \param index Index to get the IP of
    7576       * \return The IP of the server
    76        * 
    77        * Get the IP of the server at index index. 
     77       *
     78       * Get the IP of the server at index index.
    7879       */
    7980      std::string getServerListItemIP( unsigned int index ); // tolua_export
    8081
     82      /** \param index Index to get the RTT of
     83       * \return The RTT of the server
     84       *
     85       * Get the RTT of the server at index index.
     86       */
     87      std::string getServerListItemRTT( unsigned int index ); // tolua_export
     88
     89      /** \param index Index to get the RTT of
     90       * \return The number of players on the server
     91       *
     92       * Get the number of players on the server
     93       */
     94      std::string getServerListItemPlayerNumber( unsigned int index ); // tolua_export
     95
    8196      /* todo: might make this private and use getter/setter methods
    82        * at some later time. 
     97       * at some later time.
    8398       */
    8499      /** game server list */
     
    92107
    93108      int rhandler( char *addr, ENetEvent *ev );
    94      
     109
    95110    private:
    96111      /** master server address */
  • code/trunk/src/libraries/network/packet/ServerInformation.cc

    r8351 r10622  
    3939  namespace packet
    4040  {
    41    
     41
    4242    ServerInformation::ServerInformation()
    4343    {
    44      
    4544    }
    46    
     45
    4746    ServerInformation::ServerInformation(ENetEvent* event)
    4847    {
     
    6968    ServerInformation::~ServerInformation()
    7069    {
    71      
     70
    7271    }
    7372
    7473    void ServerInformation::send(ENetPeer* peer)
    7574    {
    76       uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(this->serverName_);
     75      std::string payload = this->serverName_ + Ogre::StringConverter::toString(this->clientNumber_);
     76      uint32_t size = returnSize((char*&)LAN_DISCOVERY_ACK) + returnSize(payload);
    7777      uint8_t* temp = new uint8_t[size];
    7878      uint8_t* temp2 = temp;
    7979      saveAndIncrease((char*&)LAN_DISCOVERY_ACK, temp2);
    80       saveAndIncrease(this->serverName_, temp2);
     80      saveAndIncrease(payload, temp2);
    8181      ENetPacket* packet = enet_packet_create( temp, size, 0 );
    8282      enet_peer_send(peer, 0, packet);
    83      
     83
    8484      delete[] temp;
    8585    }
    86  
     86
    8787  } // namespace packet
    8888
     
    9595  }
    9696} // namespace orxonox
    97 
  • code/trunk/src/libraries/network/packet/ServerInformation.h

    r8351 r10622  
    3030
    3131#include <string>
     32#include <OgreStringConverter.h>
     33
    3234
    3335#ifndef SERVERINFORMATION_H
     
    4547        ServerInformation(ENetEvent* event);
    4648        ~ServerInformation();
    47        
     49
    4850        void          send( ENetPeer* peer );
     51        void          setServerName(std::string name) { this->serverName_ = name; }
     52        std::string   getServerName() { return this->serverName_; }
     53        void          setServerIP( std::string IP ) { this->serverIP_ = IP; }
    4954        std::string   getServerIP() { return this->serverIP_; }
    50         std::string   getServerName() { return this->serverName_; }
    51         void          setServerName(std::string name) { this->serverName_ = name; }
    52         void          setServerIP( std::string IP ) { this->serverIP_ = IP; }
     55        void          setClientNumber( int clientNumber ) { this->clientNumber_ = clientNumber; }
     56        int           getClientNumber() { return this->clientNumber_; }
    5357        uint32_t      getServerRTT() { return this->serverRTT_; }
    54        
     58
    5559      private:
    5660        std::string   serverName_;
     61        int           clientNumber_;
    5762        std::string   serverIP_;
    5863        uint32_t      serverRTT_;
  • code/trunk/src/modules/objects/ForceField.h

    r9939 r10622  
    160160            const std::string& getMode(void); //!< Get the mode of the ForceField.
    161161
    162         private:
    163162            //! Strings to represent the modes.
    164163            static const std::string modeTube_s;
     
    166165            static const std::string modeInvertedSphere_s;
    167166            static const std::string modeNewtonianGravity_s;
    168 
    169167            static const std::string modeHomogen_s;
    170168
     169        private:
    171170            float velocity_; //!< The velocity of the ForceField.
    172171            float radius_; //!< The radius of the ForceField.
  • code/trunk/src/modules/objects/Turret.cc

    r10262 r10622  
    223223        XMLPortParam(Turret, "maxYaw", setMaxYaw, getMaxYaw, xmlelement, mode);
    224224        XMLPortParam(Turret, "maxPitch", setMaxPitch, getMaxPitch, xmlelement, mode);
     225        XMLPortParam(Turret, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
    225226    }
    226227
  • code/trunk/src/modules/objects/Turret.h

    r10262 r10622  
    102102                { return this->maxYaw_; }
    103103
     104            inline void setRotationThrust(float rotationthrust)
     105                { this->rotationThrust_ = rotationthrust; }
     106
     107            inline float getRotationThrust()
     108                { return this->rotationThrust_; }
     109
    104110        protected:
    105111            Vector3 startDir_; //!< The initial facing direction, in local coordinates.
  • code/trunk/src/modules/objects/controllers/TurretController.cc

    r10262 r10622  
    104104        {
    105105            Pawn* entity = orxonox_cast<Pawn*>(*it);
    106             if (!entity || FormationController::sameTeam(this->getControllableEntity(), entity, this->getGametype()))
     106            if (!entity || FormationController::sameTeam(turret, entity, this->getGametype()))
    107107                continue;
    108108            tempScore = turret->isInRange(entity);
     
    196196            if(this->isLookingAtTargetNew(Degree(5).valueRadians()))
    197197            {
     198
    198199                this->getControllableEntity()->fire(0);
    199200            }
  • code/trunk/src/modules/tetris/Tetris.h

    r9833 r10622  
    9090            void clearRow(unsigned int row);
    9191
    92 
    9392            PlayerInfo* player_;
    9493
  • code/trunk/src/modules/towerdefense/CMakeLists.txt

    r10258 r10622  
    22  TowerDefense.cc
    33  TowerDefenseTower.cc
    4   TowerTurret.cc
    54  TowerDefenseCenterpoint.cc
    65  TowerDefenseHUDController.cc
     
    87  TDCoordinate.cc
    98  TowerDefenseEnemy.cc
    10 
     9  TowerDefenseSelecter.cc
    1110)
    1211
     
    1716    orxonox
    1817    overlays
     18    objects
    1919  SOURCE_FILES ${TOWERDEFENSE_SRC_FILES}
    2020)
  • code/trunk/src/modules/towerdefense/TDCoordinate.cc

    r10258 r10622  
    1717    {
    1818        //RegisterObject(TDCoordinate);
    19         x=0;
    20         y=0;
     19        Set(0,0);
    2120
    2221    }
    2322
    2423    TDCoordinate::TDCoordinate(int x, int y)
    25     {
    26         this->x=x;
    27         this->y=y;
     24    {       
     25        Set(x,y);
     26    }
     27
     28    void TDCoordinate::Set(int x, int y)
     29    {       
     30        if (x < 0)
     31        {
     32            _x = 0;
     33        }
     34        else if (x > 15)
     35        {
     36            _x = 15;
     37        }
     38        else
     39        {
     40            _x = x;
     41        }
     42
     43        if (y < 0)
     44        {
     45            _y = 0;
     46        }
     47        else if (y > 15)
     48        {
     49            _y = 15;
     50        }
     51        else
     52        {
     53            _y = y;
     54        }
     55    }
     56
     57    int TDCoordinate::GetX()
     58    {       
     59        return _x;
     60    }
     61
     62    int TDCoordinate::GetY()
     63    {       
     64        return _y;
    2865    }
    2966
     
    3471
    3572        Vector3 *coord = new Vector3();
    36         coord->x= (x-8) * tileScale;
    37         coord->y= (y-8) * tileScale;
     73        coord->x= (_x-8) * tileScale;
     74        coord->y= (_y-8) * tileScale;
    3875        coord->z=100;
    3976
  • code/trunk/src/modules/towerdefense/TDCoordinate.h

    r10258 r10622  
    1616    {
    1717        public:
    18             int x;
    19             int y;
     18            TDCoordinate();
     19            TDCoordinate(int x, int y);
     20            virtual ~TDCoordinate() {};
     21            virtual void Set(int x, int y);
     22            virtual int GetX();
     23            virtual int GetY();
     24            virtual Vector3 get3dcoordinate();
    2025
    21             TDCoordinate();
    22 
    23             Vector3 get3dcoordinate();
    24 
    25             virtual ~TDCoordinate() {};
    26 
    27             TDCoordinate(int x, int y);
     26        private:
     27            int _x;
     28            int _y;
    2829    };
    2930
  • code/trunk/src/modules/towerdefense/TowerDefense.cc

    r10258 r10622  
    3737 *
    3838 *
    39  *
    4039 *TIPP: Eclipse hilft euch schnell auf bereits vorhanden Funktionen zuzugreifen:
    4140 * einfach "this->" eingeben und kurz warten. Dann tauch eine Liste mit Vorschlägen auf. Wenn ihr jetzt weiter
     
    7776#include "TowerDefenseCenterpoint.h"
    7877//#include "TDCoordinate.h"
    79 #include "TowerTurret.h"
    8078#include "worldentities/SpawnPoint.h"
    8179#include "worldentities/pawns/Pawn.h"
     
    8886/* Part of a temporary hack to allow the player to add towers */
    8987#include "core/command/ConsoleCommand.h"
     88#include <cmath>
     89
    9090
    9191namespace orxonox
    9292{
     93    static const std::string __CC_addTower_name  = "addTower";
     94    static const std::string __CC_upgradeTower_name = "upgradeTower";
     95    static const int upgradeCost = 20;
     96    static const int towerCost = 20;
     97    unsigned int maxspaceships = 30;
     98    int maxspaceshipsstandard = 30;
     99
     100
     101
     102    SetConsoleCommand("TowerDefense", __CC_addTower_name,  &TowerDefense::addTower ).addShortcut().defaultValues(1);
     103    SetConsoleCommand("TowerDefense", __CC_upgradeTower_name, &TowerDefense::upgradeTower).addShortcut().defaultValues(0);
     104
    93105    RegisterUnloadableClass(TowerDefense);
    94106
    95     TowerDefense::TowerDefense(Context* context) : Deathmatch(context)
     107    TowerDefense::TowerDefense(Context* context) : TeamDeathmatch(context)
    96108    {
    97109        RegisterObject(TowerDefense);
     
    103115        }*/
    104116
     117        //Timer for the waves (10 seconds between the waves)
     118        selecter = NULL;
     119        this->player_ = NULL;       
    105120        this->setHUDTemplate("TowerDefenseHUD");
    106 
    107         //this->stats_ = new TowerDefensePlayerStats();
    108 
    109         /* Temporary hack to allow the player to add towers and upgrade them */
    110         this->dedicatedAddTower_ = createConsoleCommand( "addTower", createExecutor( createFunctor(&TowerDefense::addTower, this) ) );
    111         this->dedicatedUpgradeTower_ = createConsoleCommand( "upgradeTower", createExecutor( createFunctor(&TowerDefense::upgradeTower, this) ) );
     121        this->nextwaveTimer_.setTimer(10, false, createExecutor(createFunctor(&TowerDefense::nextwave, this)));
     122        this->nextwaveTimer_.stopTimer();
     123        this->waves_ = 0;
     124        this->time = 0;
     125        this->credit_ = 0;
     126        this->lifes_ = 0;
     127        this->timeSetTower_ = 0;
     128        spaceships =15;
     129        eggs=3;
     130        ufos=7;
     131        randomships=5;
     132
     133
     134        ModifyConsoleCommand(__CC_addTower_name).setObject(this);
     135        ModifyConsoleCommand(__CC_upgradeTower_name).setObject(this);
    112136    }
    113137
     
    117141        if (this->isInitialized())
    118142        {
    119             if( this->dedicatedAddTower_ )
    120                 delete this->dedicatedAddTower_;
     143            ModifyConsoleCommand(__CC_addTower_name).setObject(NULL);
     144            ModifyConsoleCommand(__CC_upgradeTower_name).setObject(NULL);
    121145        }
    122146    }
     
    131155    void TowerDefense::start()
    132156    {
    133 
    134         Deathmatch::start();
    135 
    136 // Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path
    137         for (int i=0; i < 16 ; i++){
    138             for (int j = 0; j< 16 ; j++){
    139                 towermatrix[i][j] = false;
     157        if (center_ != NULL) // There needs to be a TowerDefenseCenterpoint, i.e. the area the game takes place.
     158        {
     159            if (selecter == NULL)
     160            {
     161                selecter = new TowerDefenseSelecter(this->center_->getContext());               
    140162            }
    141         }
    142 
     163            selecter->addTemplate(center_->getSelecterTemplate());
     164            center_->attach(selecter);
     165        }
     166        else // If no centerpoint was specified, an error is thrown and the level is exited.
     167        {
     168            orxout(internal_error) << "Jump: No Centerpoint specified." << endl;
     169            return;
     170        }
     171
     172        TeamDeathmatch::start();
     173
     174        // Waypoints: [1,3] [10,3] [10,11] [13,11] -> add the points to a matrix so the player cant place towers on the path
     175        for (int i=0; i < 16 ; i++)
     176        {
     177            for (int j = 0; j< 16 ; j++)
     178            {
     179                towerModelMatrix[i][j] = NULL;
     180                towerTurretMatrix[i][j] = NULL;
     181            }
     182        }
     183
     184       
     185
     186        if (player_ != NULL)
     187        {
     188            //this->player_->startControl(selecter);
     189        }
     190        else
     191        {
     192            orxout() << "player=NULL" << endl;
     193        }
     194
     195
     196        Model* dummyModel = new Model(this->center_->getContext());
     197
     198        //the path of the spacehips has to be blocked, so that no towers can be build there
    143199        for (int k=0; k<3; k++)
    144             towermatrix[1][k]=true;
     200            towerModelMatrix[1][k]=dummyModel;
    145201        for (int l=1; l<11; l++)
    146             towermatrix[l][3]=true;
     202                towerModelMatrix[l][3]=dummyModel;
    147203        for (int m=3; m<12; m++)
    148             towermatrix[10][m]=true;
     204                towerModelMatrix[10][m]=dummyModel;
    149205        for (int n=10; n<14; n++)
    150             towermatrix[n][11]=true;
     206                towerModelMatrix[n][11]=dummyModel;
    151207        for (int o=13; o<16; o++)
    152             towermatrix[13][o]=true;
     208                towerModelMatrix[13][o]=dummyModel;
     209
    153210
    154211        //set initial credits, lifes and WaveNumber
    155         this->setCredit(200);
    156         this->setLifes(50);
     212        this->setCredit(100);
     213        this->setLifes(100);
    157214        this->setWaveNumber(0);
    158215        time=0.0;
    159216
     217        /*
    160218        //adds initial towers
    161219        for (int i=0; i <7; i++){
    162220            addTower(i+3,4);
    163         }/*
    164         for (int j=0; j < 7; j++){
    165             addTower(9,j+5);
    166         }*/
     221        }
     222                */
    167223    }
    168224
     
    178234            en1->addTemplate("enemytowerdefense1");
    179235            en1->setScale(3);
    180             en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
     236            en1->lookAt(Vector3(0,0,100000));
     237            en1->setHealth(en1->getHealth() +50 + this->getWaveNumber()*4);
    181238            break;
    182239
     
    184241            en1->addTemplate("enemytowerdefense2");
    185242            en1->setScale(2);
    186             en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
     243            en1->lookAt(Vector3(0,0,100000));
     244            en1->roll(Degree(120));
     245            en1->setHealth(en1->getHealth() -30 + this->getWaveNumber()*4);
    187246            //  en1->setShieldHealth(en1->getShield() = this->getWaveNumber()*2))
    188247            break;
     
    191250            en1->addTemplate("enemytowerdefense3");
    192251            en1->setScale(1);
    193             en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);
     252            en1->lookAt(Vector3(0,0,100000));
     253            en1->roll(Degree(120));
     254            en1->setHealth(en1->getHealth() -10 + this->getWaveNumber()*4);
    194255            break;
    195256        }
    196257
     258        en1->setTeam(2);
    197259        en1->getController();
    198         en1->setPosition(path.at(0)->get3dcoordinate());
     260        en1->setPosition(path.at(0)->get3dcoordinate());       
    199261        TowerDefenseEnemyvector.push_back(en1);
    200262
     
    209271    {
    210272
    211         Deathmatch::end();
     273        TeamDeathmatch::end();
    212274        ChatManager::message("Match is over! Gameover!");
    213275
     276    }
     277
     278    void TowerDefense::spawnPlayer(PlayerInfo* player)
     279    {
     280        assert(player);
     281        this->player_ = player;
     282
     283        if (selecter->getPlayer() == NULL)
     284        {
     285            this->player_ = player;
     286            player->startControl(selecter);
     287            players_[player].state_ = PlayerState::Alive;
     288        }
     289    }
     290
     291    /**
     292    @brief
     293        Get the player.
     294    @return
     295        Returns a pointer to the player. If there is no player, NULL is returned.
     296    */
     297    PlayerInfo* TowerDefense::getPlayer(void) const
     298    {
     299        return this->player_;
    214300    }
    215301
    216302    //not working yet
    217303    void TowerDefense::upgradeTower(int x,int y)
    218     {/*
    219         const int upgradeCost = 20;
     304    {
     305        TDCoordinate* coord = new TDCoordinate(x,y);
     306        x = coord->GetX();
     307        y = coord->GetY();
     308       
    220309
    221310        if (!this->hasEnoughCreditForTower(upgradeCost))
     
    225314        }
    226315
    227         if (towermatrix [x][y] == NULL)
     316
     317        Model* dummyModel2 = new Model(this->center_->getContext());
     318
     319        if (towerModelMatrix [x][y] == NULL || (towerModelMatrix [x][y])->getMeshSource() == dummyModel2->getMeshSource())
    228320        {
    229321            orxout() << "no tower on this position" << endl;
     
    233325        else
    234326        {
    235             (towermatrix [x][y])->upgradeTower();
    236         }*/
     327            (towerTurretMatrix [x][y])->upgradeTower();
     328            switch(towerTurretMatrix[x][y]->upgrade)
     329                   {
     330                   case 1 :
     331                           towerModelMatrix[x][y]->setMeshSource("TD_T2.mesh");
     332                           break;
     333
     334                   case 2 :
     335                           towerModelMatrix[x][y]->setMeshSource("TD_T3.mesh");
     336                           break;
     337                   case 3 :
     338                           towerModelMatrix[x][y]->setMeshSource("TD_T4.mesh");
     339                           break;
     340                   case 4 :
     341                           towerModelMatrix[x][y]->setMeshSource("TD_T5.mesh");
     342                           break;
     343
     344                   }
     345
     346            this->buyTower(upgradeCost);
     347        }
    237348    }
    238349
    239350    /*adds Tower at Position (x,y) and reduces credit and adds the point to the towermatrix. template ("towerturret")
    240351    so towers have ability if the turrets
    241 
    242352    */
     353
    243354    void TowerDefense::addTower(int x, int y)
    244     {
    245         const int towerCost = 20;
     355    {       
     356        TDCoordinate* coord = new TDCoordinate(x,y);
     357        x = coord->GetX();
     358        y = coord->GetY();
     359
    246360
    247361        if (!this->hasEnoughCreditForTower(towerCost))
     
    251365        }
    252366
    253         if (towermatrix [x][y]==true)
     367        if (towerModelMatrix [x][y]!=NULL)
    254368        {
    255369            orxout() << "not possible to put tower here!!" << endl;
     
    264378        int tileScale = (int) this->center_->getTileScale();
    265379
    266         if (x > 15 || y > 15 || x < 0 || y < 0)
     380        /*if (x > 15 || y > 15 || x < 0 || y < 0)
    267381        {
    268382            //Hard coded: TODO: let this depend on the centerpoint's height, width and fieldsize (fieldsize doesn't exist yet)
    269383            orxout() << "Can not add Tower: x and y should be between 0 and 15" << endl;
    270384            return;
    271         }
    272 
    273         orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
    274 
    275        //Reduce credit
    276         this->buyTower(towerCost);
    277         towermatrix [x][y]=true;
     385        }*/
     386
     387        //orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl;
     388        orxout() << "Will add tower at (" << x << "," << y << ")" << endl;
     389
     390
     391        //Create Model
     392        Model* newTowerModel = new Model(this->center_->getContext());
     393        newTowerModel->setMeshSource("TD_T1.mesh");
     394        newTowerModel->setScale(30);
     395        newTowerModel->pitch(Degree(90));
     396        newTowerModel->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 80);
    278397
    279398        //Creates tower
    280399        TowerDefenseTower* towernew = new TowerDefenseTower(this->center_->getContext());
    281         towernew->addTemplate("towerturret");
    282         towernew->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
     400        towernew->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 275);
    283401        towernew->setGame(this);
    284     }
     402        towernew->setTeam(1);
     403
     404        //Reduce credit
     405         this->buyTower(towerCost);
     406         towerModelMatrix [x][y]= newTowerModel;
     407         towerTurretMatrix [x][y]= towernew;
     408    }   
    285409
    286410    bool TowerDefense::hasEnoughCreditForTower(int towerCost)
     
    296420
    297421 
     422    void TowerDefense::nextwave()
     423    {
     424
     425        orxout() << "newwave" << endl;
     426        TowerDefenseEnemyvector.clear();
     427        waves_++;
     428        //maxspaceships = round(maxspaceshipsstandard + 0.25*(waves_));
     429        time=0;
     430
     431        int helpnumber = 40 -(waves_);
     432        if(helpnumber <= 0) {helpnumber =1;}
     433        float numSpaceships = std::abs((rand() % 100)*5.0f*(helpnumber));
     434        float numEggs = std::abs((rand() % 100)*1.0f*(waves_));
     435        float numUfos = std::abs((rand() % 100)*1.5f*(0.5f*(waves_))) ;
     436
     437        float totalnumber = (numSpaceships + numEggs + numUfos)*1.3f;
     438
     439        int newspaceships = (int)(maxspaceships* numSpaceships / totalnumber);
     440        int neweggs = (int)(maxspaceships*numEggs / totalnumber);
     441        int newufos = (int)(maxspaceships*numUfos / totalnumber);
     442        int newrandomships = maxspaceships -newspaceships - neweggs - newufos;
     443        spaceships =newspaceships;
     444        eggs=neweggs;
     445        ufos=newufos;
     446        randomships=newrandomships;
     447
     448        orxout() << spaceships << endl;
     449        orxout() << eggs << endl;
     450        orxout() << ufos << endl;
     451        orxout() << randomships << endl;
     452
     453
     454
     455
     456
     457    }
     458
    298459    void TowerDefense::tick(float dt)
    299460    {
    300461        SUPER(TowerDefense, tick, dt);
    301462        time +=dt;
     463        timeSetTower_ +=dt;
     464
     465        //Check if tower has to be set (because TowerDefenseSelecter asks for it)
     466        if(timeSetTower_ >= 0.25)
     467        {
     468                timeSetTower_ =0;
     469                        if(selecter != NULL && selecter->firePressed_)
     470                        {
     471
     472                                int x = selecter->selectedPos_->GetX();
     473                                int y = selecter->selectedPos_->GetY();
     474                                Model* dummyModel2 = new Model(this->center_->getContext());
     475
     476
     477
     478                                if(towerModelMatrix[x][y] == NULL)
     479                                {
     480                                        addTower(x,y);
     481                                }
     482                                else
     483                                {
     484                                        if(!((towerModelMatrix [x][y])->getMeshSource() == dummyModel2->getMeshSource()))
     485                                        {
     486                                                towerTurretMatrix[x][y]->upgradeTower();
     487                                        if(towerTurretMatrix[x][y]->upgrade < towerTurretMatrix[x][y]->upgradeMax)
     488                                        {
     489                                                int specificupgradecost = (int)(upgradeCost*(std::pow(1.5,towerTurretMatrix[x][y]->upgrade)));
     490                                                if(this->credit_ >= specificupgradecost)
     491                                                {
     492                                                        this->buyTower(specificupgradecost);
     493                                                                switch(towerTurretMatrix[x][y]->upgrade)
     494                                                           {
     495                                                                   case 1 :
     496                                                                           towerModelMatrix[x][y]->setMeshSource("TD_T2.mesh");
     497                                                                           break;
     498
     499                                                                   case 2 :
     500                                                                           towerModelMatrix[x][y]->setMeshSource("TD_T3.mesh");
     501                                                                           break;
     502                                                   case 3 :
     503                                                           towerModelMatrix[x][y]->setMeshSource("TD_T4.mesh");
     504                                                           break;
     505                                                   case 4 :
     506                                                           towerModelMatrix[x][y]->setMeshSource("TD_T5.mesh");
     507                                                           break;
     508
     509                                                           }
     510                                                }
     511
     512
     513                                        }
     514                                        }
     515                                }
     516                                selecter->firePressed_ = false;
     517                        }
     518        }
    302519
    303520        TDCoordinate* coord1 = new TDCoordinate(1,1);
    304521        std::vector<TDCoordinate*> path;
    305522        path.push_back(coord1);
    306         if(time>1 && TowerDefenseEnemyvector.size() < 30)
    307         {
    308             //adds different types of enemys depending on the WaveNumber
    309             addTowerDefenseEnemy(path, this->getWaveNumber() % 3 +1 );
    310             time = time-1;
    311         }
     523
     524
     525
     526
     527
     528        if(time>=TowerDefenseEnemyvector.size() && TowerDefenseEnemyvector.size() < maxspaceships)
     529                {
     530
     531                //adds different types of enemys depending on the WaveNumber progressively making the combination of enemys more difficult
     532                if(spaceships>0)
     533                {
     534                        addTowerDefenseEnemy(path, 1);
     535                        spaceships--;
     536
     537                }else if(ufos>0)
     538                {
     539                        addTowerDefenseEnemy(path, 3);
     540                        ufos--;
     541                }else if(eggs>0)
     542                {
     543                        addTowerDefenseEnemy(path, 2);
     544                        eggs--;
     545                }else if(randomships>0)
     546                {
     547                        addTowerDefenseEnemy(path, rand() % 3 +1);
     548                        randomships--;
     549
     550                }
     551
     552                }
     553
    312554
    313555        Vector3* endpoint = new Vector3(500, 700, 150);
     
    317559            if(TowerDefenseEnemyvector.at(i) != NULL && TowerDefenseEnemyvector.at(i)->isAlive())
    318560            {
    319                 //destroys enemys at the end of teh path and reduces the life by 1. no credits gifted
     561                //destroys enemys at the end of the path and reduces the life by 1. no credits gifted
    320562
    321563                Vector3 ship = TowerDefenseEnemyvector.at(i)->getRVWorldPosition();
     
    333575            }
    334576        }
     577
    335578        //goes thorugh vector to see if an enemy is still alive. if not next wave is launched
    336579        int count= 0;
     
    343586        }
    344587
     588        if (count == 0 && !this->nextwaveTimer_.isActive())
     589            this->nextwaveTimer_.startTimer();
     590
     591/*            time2 +=dt;
    345592        if(count== 0)
    346593        {
    347             time2 +=dt;
    348594            if(time2 > 10)
    349595            {
     
    354600            }
    355601        }
    356 
    357 
    358     }
     602*/
     603
     604    }
     605
    359606
    360607    // Function to test if we can add waypoints using code only. Doesn't work yet
     
    399646    void TowerDefense::playerEntered(PlayerInfo* player)
    400647    {
    401         Deathmatch::playerEntered(player);
     648        TeamDeathmatch::playerEntered(player);
    402649
    403650        const std::string& message = player->getName() + " entered the game";
     
    407654    bool TowerDefense::playerLeft(PlayerInfo* player)
    408655    {
    409         bool valid_player = Deathmatch::playerLeft(player);
     656        bool valid_player = TeamDeathmatch::playerLeft(player);
    410657
    411658        if (valid_player)
     
    437684        }
    438685
    439         Deathmatch::pawnKilled(victim, killer);
     686        TeamDeathmatch::pawnKilled(victim, killer);
    440687    }
    441688
  • code/trunk/src/modules/towerdefense/TowerDefense.h

    r10258 r10622  
    3838#define _TowerDefense_H__
    3939#include "TDCoordinate.h"
     40#include "TowerDefenseSelecter.h"
    4041#include "towerdefense/TowerDefensePrereqs.h"
    41 #include "gametypes/Deathmatch.h"
     42#include "gametypes/TeamDeathmatch.h"
    4243#include "TowerDefenseEnemy.h"
    4344#include "util/Output.h"
    4445#include "core/object/WeakPtr.h"
     46#include "TowerDefenseSelecter.h"
     47#include "graphics/Camera.h"   
     48
    4549
    4650namespace orxonox
    4751{
    48     class _TowerDefenseExport TowerDefense : public Deathmatch
     52    class _TowerDefenseExport TowerDefense : public TeamDeathmatch
    4953    {
    5054    public:
     
    5357
    5458        std::vector<orxonox::WeakPtr<TowerDefenseEnemy> > TowerDefenseEnemyvector;
    55         bool towermatrix[16][16];
     59        Model* towerModelMatrix[16][16];
     60        TowerDefenseTower* towerTurretMatrix[16][16];
    5661        void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr);
    5762        virtual void start(); //<! The function is called when the gametype starts
    5863        virtual void end();
    5964        virtual void tick(float dt);
    60         //virtual void playerEntered(PlayerInfo* player);
    61         //virtual bool playerLeft(PlayerInfo* player);
    62         //Player Stats (set,get, reduce)
     65        virtual void spawnPlayer(PlayerInfo* player);
     66        PlayerInfo* getPlayer(void) const;
    6367        int getCredit(){ return this->credit_; }
    6468        int getLifes(){ return this->lifes_; }
     
    6973        void buyTower(int cost){ credit_ -= cost;}
    7074        void addCredit(int credit) { credit_+=credit; }
    71         void nextwave(){ waves_++;}
     75        void nextwave();
    7276        int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; }
     77        TowerDefenseSelecter* selecter;
     78        int spaceships;
     79        int eggs;
     80        int ufos;
     81        int randomships;
     82
    7383
    7484        //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
     
    8393        /* Adds a tower at x, y in the playfield */
    8494        void addTower(int x, int y);
    85 
    8695        void upgradeTower(int x, int y);
    87         /* Part of a temporary hack to allow the player to add towers */
    88         ConsoleCommand* dedicatedAddTower_;
    89         ConsoleCommand* dedicatedUpgradeTower_;
    9096
    9197        //TODO: void spawnNewWave()
     
    96102    private:
    97103        TowerDefenseCenterpoint *center_;
     104        PlayerInfo* player_;
    98105        float time;
    99         float time2;
     106        float timeSetTower_;
     107//        float time2;
    100108        int credit_;
    101109        int waves_;
    102110        int lifes_;
     111        Timer nextwaveTimer_;
    103112
    104113        /* handles stats */
    105114        bool hasEnoughCreditForTower(int towerCost);
    106115        bool hasEnoughCreditForUpgrade();
    107 
    108 
    109 
    110         std::vector<TowerTurret*> towers_;
    111116    };
    112117}
  • code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc

    r9667 r10622  
    5353        this->width_ = 15;
    5454        this->height_ = 15;
    55         this->towerTemplate_ = "";
    5655
    5756        //this->setCollisionType(Static);
     
    7271        XMLPortParam(TowerDefenseCenterpoint, "height", setHeight, getHeight, xmlelement, mode);
    7372        XMLPortParam(TowerDefenseCenterpoint, "tileScale", setTileScale, getTileScale, xmlelement, mode);
    74         XMLPortParam(TowerDefenseCenterpoint, "towerTemplate", setTowerTemplate, getTowerTemplate, xmlelement, mode);
     73        XMLPortParam(TowerDefenseCenterpoint, "selecterTemplate", setSelecterTemplate, getSelecterTemplate, xmlelement, mode);
    7574
    7675        //TODO: add XMLPortObject(TowerDefenseCenterpoint, WorldEntity, "waypoints", addWaypoint, getWaypoint,  xmlelement, mode);
  • code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h

    r9667 r10622  
    6060            void setWidth(unsigned int width)
    6161                { this->width_ = width; }
    62 
    6362            unsigned int getWidth(void) const
    6463                { return this->width_; }
    65 
    6664            void setHeight(unsigned int height)
    6765                { this->height_ = height; }
    68 
    6966            unsigned int getHeight(void) const
    7067                { return this->height_; }
    71 
     68            void setSelecterTemplate(const std::string& newTemplate)
     69                { this->selecterTemplate_ = newTemplate; }
     70            const std::string& getSelecterTemplate() const
     71                { return this->selecterTemplate_; }   
    7272            /**
    7373                @brief How to convert to world coordinates, e.g. that 0,15 is not at -8,-8 but at -80,-80 (if scale would be 10)
     
    7979                { return this->tileScale_; }
    8080
    81             /**
    82             @brief Set the template for the towers.
    83             @param template The template name to be applied to each tower.
    84             */
    85             void setTowerTemplate(const std::string& templateName)
    86                 { this->towerTemplate_ = templateName; }
    87 
    88             const std::string& getTowerTemplate(void) const
    89                 { return this->towerTemplate_; }
    90 
    9181        private:
    9282            void checkGametype();
    9383
     84            std::string selecterTemplate_;
    9485            unsigned int width_;
    9586            unsigned int height_;
    9687            unsigned int tileScale_;
    97 
    98             std::string towerTemplate_;
    9988    };
    10089}
  • code/trunk/src/modules/towerdefense/TowerDefenseEnemy.cc

    r10258 r10622  
    3535    //add credit if enemy is destroyed
    3636    TowerDefenseEnemy::~TowerDefenseEnemy(){
    37         //this->td->addCredit(1);
     37
     38        if (this->isInitialized())
     39        {
     40                getGame()->addCredit(1);
     41        }
    3842    }
    3943
     
    6468        if (getGame() && once_ == false && getHealth() <= 0)
    6569        {
     70                orxout() << "damagefunctionIF" << endl;
    6671            getGame()->addCredit(1);
    6772            once_ = true;
    6873        }
     74        orxout() << "damagefunction" << endl;
     75
    6976    }
     77
    7078/*
    7179    void TowerDefenseEnemy::popWaypoint()
  • code/trunk/src/modules/towerdefense/TowerDefenseTower.cc

    r10258 r10622  
    2222        Constructor. Registers and initializes the object.
    2323    */
    24     TowerDefenseTower::TowerDefenseTower(Context* context) : Pawn(context)
     24    TowerDefenseTower::TowerDefenseTower(Context* context) : Turret(context)
    2525    {
    2626        RegisterObject(TowerDefenseTower);
     27        game_ =NULL;
     28        this->setCollisionType(WorldEntity::None);
     29        upgrade = 0;
     30        this->addTemplate("towerdefensetower");
    2731
    28         this->setCollisionType(WorldEntity::Dynamic);
    29         upgrade = 0;
     32        upgradeMax = 5;
     33
    3034
    3135        //this->removeAllEngines();
     
    3842    }
    3943
     44    /*
    4045    void TowerDefenseTower::setOrientation(const Quaternion& orientation)
    4146    {
     
    5358    {
    5459    }
     60    */
    5561
    5662    bool TowerDefenseTower::upgradeTower()
    5763    {
    58         if(upgrade < 3)
     64        if(upgrade < upgradeMax)
    5965        {
    6066            upgrade++;
    6167            float reloadrate = getReloadRate();
    6268            float reloadwaittime = getReloadWaitTime();
    63             this->setDamageMultiplier(5000);
    64 
    65             reloadrate = 0.5f*reloadrate;
    66             reloadwaittime = 0.5f*reloadwaittime;
     69            this->setDamageMultiplier((upgrade+1)*1.5f);
     70            this->setRotationThrust(2*this->getRotationThrust());
     71            reloadrate = 0.7f*reloadrate;
     72            reloadwaittime = 0.7f*reloadwaittime;
    6773            setReloadRate(reloadrate);
    6874            setReloadWaitTime(reloadwaittime);
    69             this->addTemplate("towerturret1");
     75            //this->addTemplate("towerturret1");
    7076        }
    7177        else
  • code/trunk/src/modules/towerdefense/TowerDefenseTower.h

    r10258 r10622  
    2020#include "towerdefense/TowerDefensePrereqs.h"
    2121#include "worldentities/pawns/SpaceShip.h"
     22#include "objects/Turret.h"
    2223
    2324
    2425namespace orxonox
    2526{
    26     class _TowerDefenseExport TowerDefenseTower : public Pawn
     27    class _TowerDefenseExport TowerDefenseTower : public Turret
    2728    {
    2829    public:
     
    3738
    3839        // Overriding these to stop TowerDefenseTowers from spasing out
     40        /*
    3941        void setOrientation(const Quaternion& orientation);
    4042        virtual void rotateYaw(const Vector2& value);
    4143        virtual void rotatePitch(const Vector2& value);
    4244        virtual void rotateRoll(const Vector2& value);
     45        */
    4346        virtual bool upgradeTower();
    4447
     
    4649        void setGame(TowerDefense* Towerdefense)
    4750        { assert(Towerdefense); game_ = Towerdefense; }
     51        int upgrade;
     52        int upgradeMax;
    4853    private:
    4954        TowerDefense* game_;
    50         int upgrade;
     55
    5156    };
    5257}
  • code/trunk/src/modules/weapons/WeaponsPrereqs.h

    r8855 r10622  
    7575    class ReplenishingMunition;
    7676    class RocketMunition;
     77    class GravityBombMuntion;
    7778
    7879    // projectiles
     
    8283    class Projectile;
    8384    class Rocket;
     85    class RocketOld;
    8486    class SimpleRocket;
     87    class GravityBomb;
    8588
    8689    // weaponmodes
     
    9194    class LightningGun;
    9295    class RocketFire;
     96    class RocketFireOld;
    9397    class SimpleRocketFire;
     98    class GravityBombFire;
    9499}
    95100
  • code/trunk/src/modules/weapons/munitions/CMakeLists.txt

    r7846 r10622  
    44  FusionMunition.cc
    55  RocketMunition.cc
     6  GravityBombMunition.cc
    67)
  • code/trunk/src/modules/weapons/projectiles/CMakeLists.txt

    r8855 r10622  
    66  LightningGunProjectile.cc
    77  Rocket.cc
     8  RocketOld.cc
    89  SimpleRocket.cc
     10  GravityBomb.cc
     11  GravityBombField.cc
    912)
  • code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc

    r9667 r10622  
    4747
    4848        this->textureIndex_ = 1;
     49        this->setMass(2);
     50        this->setCollisionType(Dynamic);
    4951        this->maxTextureIndex_ = 8;
    5052        this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this)));
  • code/trunk/src/modules/weapons/projectiles/Rocket.cc

    r10216 r10622  
    4848#include "worldentities/CameraPosition.h"
    4949#include "worldentities/pawns/Pawn.h"
     50//#include "particleuniverse/include/ParticleUniverseSystemManager.h"
    5051
    5152namespace orxonox
     
    8384            fire->setOrientation(this->getOrientation());
    8485            fire->setSource("Orxonox/rocketfire");
     86           
     87            // Add Particle Universe Effects
     88            //ParticleUniverse::ParticleSystemManager* pManager = ParticleUniverse::ParticleSystemManager::getSingletonPtr();
     89            //ParticleUniverse::ParticleSystem* pSys1 = pManager->createParticleSystem("pSys1", "bubbles", this->getScene()->getSceneManager());
     90            //this->attachOgreObject(pSys1);
    8591
    8692            this->enableCollisionCallback();
     
    223229    void Rocket::destructionEffect()
    224230    {
    225         ParticleSpawner *effect1, *effect2;
     231        ParticleSpawner *effect1, *effect2, *effect3, *effect4, *effect5;
    226232        if(this->getShooter())
    227233        {
    228234            effect1 = new ParticleSpawner(this->getShooter()->getContext());
    229235            effect2 = new ParticleSpawner(this->getShooter()->getContext());
     236            effect3 = new ParticleSpawner(this->getShooter()->getContext());
     237            effect4 = new ParticleSpawner(this->getShooter()->getContext());
     238            effect5 = new ParticleSpawner(this->getShooter()->getContext());
    230239        }
    231240        else
     
    233242            effect1 = new ParticleSpawner(this->getContext());
    234243            effect2 = new ParticleSpawner(this->getContext());
     244            effect3 = new ParticleSpawner(this->getContext());
     245            effect4 = new ParticleSpawner(this->getContext());
     246            effect5 = new ParticleSpawner(this->getContext());
    235247        }
    236248
     
    238250        effect1->setOrientation(this->getOrientation());
    239251        effect1->setDestroyAfterLife(true);
    240         effect1->setSource("Orxonox/explosion4");
     252        effect1->setSource("orxonox/explosion_flash");
    241253        effect1->setLifetime(2.0f);
    242254
     
    244256        effect2->setOrientation(this->getOrientation());
    245257        effect2->setDestroyAfterLife(true);
    246         effect2->setSource("Orxonox/smoke4");
     258        effect2->setSource("orxonox/explosion_flame");
    247259        effect2->setLifetime(3.0f);
     260
     261        effect3->setPosition(this->getPosition());
     262        effect3->setOrientation(this->getOrientation());
     263        effect3->setDestroyAfterLife(true);
     264        effect3->setSource("orxonox/explosion_shockwave");
     265        effect3->setLifetime(3.0f);
     266
     267        effect4->setPosition(this->getPosition());
     268        effect4->setOrientation(this->getOrientation());
     269        effect4->setDestroyAfterLife(true);
     270        effect4->setSource("orxonox/explosion_sparks");
     271        effect4->setLifetime(3.0f);
     272
     273        effect5->setPosition(this->getPosition());
     274        effect5->setOrientation(this->getOrientation());
     275        effect5->setDestroyAfterLife(true);
     276        effect5->setSource("orxonox/explosion_streak1");
     277        effect5->setLifetime(3.0f);
    248278    }
    249279
  • code/trunk/src/modules/weapons/weaponmodes/CMakeLists.txt

    r7163 r10622  
    66  LightningGun.cc
    77  RocketFire.cc
     8  RocketFireOld.cc
    89  SimpleRocketFire.cc
     10  GravityBombFire.cc
    911)
  • code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc

    r10296 r10622  
    108108        model->setScale(5);
    109109
     110        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    110111        projectile->setOrientation(this->getMuzzleOrientation());
    111112        projectile->setPosition(this->getMuzzlePosition());
  • code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc

    r10296 r10622  
    6868        BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
    6969
     70        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    7071        projectile->setOrientation(this->getMuzzleOrientation());
    7172        projectile->setPosition(this->getMuzzlePosition());
  • code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc

    r10296 r10622  
    6666        ParticleProjectile* projectile = new ParticleProjectile(this->getContext());
    6767
     68        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    6869        projectile->setOrientation(this->getMuzzleOrientation());
    6970        projectile->setPosition(this->getMuzzlePosition());
  • code/trunk/src/orxonox/controllers/ControllerDirector.cc

    r10262 r10622  
    4141    {
    4242        SUPER(ControllerDirector, XMLPort, xmlelement, mode);
     43        XMLPortParam(ControllerDirector, "scriptname", setScriptName, getScriptName, xmlelement, mode).defaultValues("testscript");
    4344
    4445        orxout(verbose)<< "ControllerDirector::XMLPort "
     
    8384       else
    8485         return;
    85        
     86
    8687       /* Set up a luastate to use for running the scripts */
    8788       LuaState * ls = new LuaState();
     
    9899        * variable "newctrlid" defined, which means it can make use of it.
    99100        */
    100 
    101        ls->doFile("testscript.lua");
     101       std::string scr = this->scriptname_ + ".lua";
     102       ls->doFile(scr);
    102103
    103104       /* Increase the controller ID so we have a different one for
  • code/trunk/src/orxonox/controllers/ControllerDirector.h

    r10262 r10622  
    4747            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    4848
     49            inline void setScriptName(const std::string& name) { this->scriptname_ = name; }
     50            inline const std::string& getScriptName() const { return this->scriptname_; }
     51
    4952
    5053            /* Take over control of a given object */
     
    5558            //void setNewController(Controller * controller);
    5659
    57         private:
     60        protected:
     61            std::string scriptname_;   
    5862            PlayerInfo* player_;
    5963            ControllableEntity* entity_;
  • code/trunk/src/orxonox/controllers/FormationController.cc

    r10290 r10622  
    955955    bool FormationController::sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype)
    956956    {
     957
     958
    957959        if (entity1 == entity2)
    958960            return true;
     
    984986        }
    985987
    986         TeamDeathmatch* tdm = orxonox_cast<TeamDeathmatch*>(gametype);
     988        TeamGametype* tdm = orxonox_cast<TeamGametype*>(gametype);
    987989        if (tdm)
    988990        {
     
    992994            if (entity2->getPlayer())
    993995                team2 = tdm->getTeam(entity2->getPlayer());
    994         }
    995 
    996         Mission* miss = orxonox_cast<Mission*>(gametype);
    997         if (miss)
    998         {
    999             if (entity1->getPlayer())
    1000                 team1 = miss->getTeam(entity1->getPlayer());
    1001 
    1002             if (entity2->getPlayer())
    1003                 team2 = miss->getTeam(entity2->getPlayer());
    1004996        }
    1005997
  • code/trunk/src/orxonox/controllers/ScriptController.cc

    r10262 r10622  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      ...
    2424 *   Co-authors:
    2525 *      ...
    2626 *
    2727 */
     28
     29 /*
     30  * Currently available lua commands:
     31  *
     32  * IMPORTANT: ALL COMMANDS DO REQUIRE 7 PARAMETERS TO BE PROVIDED. FILL UP WITH ZEROES IN UNIMPORTANT PLACES.
     33  *
     34  * Command             | Abbreviation | Parameter 1          | '' 2     | '' 3    | '' 4                 | '' 5     | '' 6     | '' 7
     35  *
     36  * "Move And Look"     | mal          | GoTo X Coordinate    | '' Y ''  | '' Z '' | LookAt X Coordinate  |  '' Y '' |  '' Y '' | Duration
     37  * "Rotate And Look"   | ral          | GoTo X Coordinate    | '' Y ''  | '' Z '' | Axis (1=x, 2=z, 3=z) |     -    |     -    | Duration
     38  * "Spiral"            | spi          | GoTo X Coordinate    | '' Y ''  | '' Z '' |          -           |     -    |     -    | Duration
     39  * "Transition Look"   | chl          | From X Coordinate    | '' Y ''  | '' Z '' | To X Coordinate      |  '' Y '' |  '' Y '' | Duration
     40  * "Idle (Do nothing)" | idle         | Duration
     41  */
    2842
    2943#include "ScriptController.h"
     
    3246#include "worldentities/ControllableEntity.h"
    3347#include "core/LuaState.h"
    34 #include <cmath>
     48#include "core/LuaState.h"
     49#include "util/Math.h"
    3550
    3651namespace orxonox
     
    6681        this->eventno = 0;
    6782
     83        /* - First "previous event" scheduled at t=0 */
     84        /* - Needed for automatically updating event times */
     85        this->prevEventTime = 0;
    6886    }
    6987
     
    178196
    179197        /* Get a variable that specifies how far along the trajectory
    180          * we are
     198         * we are currently.
    181199         */
    182200        float dl = eventTime / currentEvent.duration;
    183201
    184         /* Depending */
     202        /* Depending on command */
    185203        /* Do some moving */
    186204        if( this->processing )
    187         {
    188           if( this->currentEvent.fctName == "mal" )
     205        {
     206          // Abbreviation for "spiral" (rotation + translation)
     207          if (this->currentEvent.fctName == "spi") {
     208
     209            // Need to know a perpendicular basis to the translation vector:
     210            // Given (a, b, c) we chose (b, -a, 0)norm and (0, c, -b)norm
     211            // Currently we set a fix rotational radius of 400
     212            // TODO: Add an option to adjust radius of spiral movement
     213            Vector3 direction = this->currentEvent.v1 - startpos;
     214
     215            Vector3* ortho1 = new Vector3(direction.y, -direction.x, 0);
     216            float absOrtho1 = sqrt(direction.y * direction.y + direction.x * direction.x);
     217            *ortho1 = 400 * cos(2 * math::pi * dl) * (*ortho1)/absOrtho1;
     218
     219            Vector3* ortho2 = new Vector3(0, direction.z, -direction.y);
     220            float absOrtho2 = sqrt(direction.y * direction.y + direction.z * direction.z);
     221            *ortho2 = 400 * sin(2 * math::pi * dl) * (*ortho2)/absOrtho2;
     222
     223            this->entity_->setPosition( (1-dl)*startpos + dl * this->currentEvent.v1 + *ortho1 + *ortho2);
     224
     225            delete ortho1;
     226            delete ortho2;
     227          }
     228
     229          // Abbreviation for "rotate and look"
     230          if (this->currentEvent.fctName == "ral")
     231          {
     232            // Specify the axis
     233            Vector3* a;
     234              switch ((int) currentEvent.d) {
     235                case 3:
     236                  a = new Vector3(this->currentEvent.v1.x + this->currentEvent.e*cos(2*math::pi*dl),
     237                                  this->currentEvent.v1.y + this->currentEvent.e*sin(2*math::pi*dl),
     238                                  this->currentEvent.v1.z);
     239                break;
     240                case 2:
     241                  a = new Vector3(this->currentEvent.v1.x + this->currentEvent.e*sin(2*math::pi*dl),
     242                                  this->currentEvent.v1.y,
     243                                  this->currentEvent.v1.z + this->currentEvent.e*cos(2*math::pi*dl));
     244                break;
     245                case 1:
     246                  a = new Vector3(this->currentEvent.v1.x,
     247                                  this->currentEvent.v1.y + this->currentEvent.e*sin(2*math::pi*dl),
     248                                  this->currentEvent.v1.z + this->currentEvent.e*cos(2*math::pi*dl));
     249                break;
     250              }
     251
     252            this->entity_->setPosition(*a);
     253
     254            /* Look at the specified position */
     255            this->entity_->lookAt(this->currentEvent.v1);
     256          }
     257          else if( this->currentEvent.fctName == "mal" )
    189258          {
    190259            /* Set the position to the correct place in the trajectory */
     
    193262            /* Look at the specified position */
    194263            this->entity_->lookAt(this->currentEvent.v2);
    195 
    196             /* Update look at position */
    197             //this->lookAtPosition = this->currentEvent.v2;
    198264          }
    199265          else if( this->currentEvent.fctName == "chl" )
     
    224290      /* Fill the structure with all the provided information */
    225291      tmp.fctName = instruction;
     292
    226293      //tmp.x1 = x1; tmp.y1 = y1; tmp.z1 = z1;
    227294      //tmp.x2 = x2; tmp.y2 = y2; tmp.z2 = z2;
    228295      tmp.v1 = Vector3(x1,y1,z1);
    229296      tmp.v2 = Vector3(x2,y2,z2);
     297
     298      // the parameters are not required to be vector coordinates!
     299      // for convenience they are however stored twice if they have some kind of different meaning
     300      tmp.a = x1;
     301      tmp.b = y1;
     302      tmp.c = z1;
     303      tmp.d = x2;
     304      tmp.e = y2;
     305      tmp.f = z2;
     306
    230307      tmp.duration = duration;
    231       tmp.eventTime = executionTime;
    232 
    233       orxout(verbose) << tmp.fctName << endl;
     308
     309      /* This is kind of a hack. If we hit the function idle all we want to do is
     310         advance event execution time, not schedule anything */
     311      if (instruction == "idle") {
     312        tmp.eventTime = this->prevEventTime;
     313        this->prevEventTime += x1;
     314        return;
     315      } else {
     316        tmp.eventTime = this->prevEventTime;
     317        this->prevEventTime += duration;
     318      }
    234319
    235320      /* Add the created event to the event list */
  • code/trunk/src/orxonox/controllers/ScriptController.h

    r10262 r10622  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      ...
    2424 *   Co-authors:
    2525 *      ...
     
    4545        std::string fctName;
    4646
     47        /** Final position we want to be at **/
    4748        Vector3 v1;
     49
     50        /** Where we are looking **/
    4851        Vector3 v2;
     52
     53        /** The parameters are additionally stored as a set of 6 numerical values **/
     54        float a, b, c, d, e, f;
    4955
    5056        /** Time span of the event */
     
    6975            // LUA interface
    7076            // tolua_begin
    71             void eventScheduler(std::string instruction,
    72               float x1, float y1, float z1,
    73               float x2, float y2, float z2,
    74               float duration, float executionTime);
     77            void eventScheduler(std::string instruction = "",
     78              float x1 = 0, float y1 = 0, float z1 = 0,
     79              float x2 = 0, float y2 = 0, float z2 = 0,
     80              float duration = 0, float executionTime = 0);
    7581
    7682            static ScriptController* getScriptController();
     
    116122            Vector3 startpos;
    117123
     124            /* Time of the previously scheduled event */
     125            float prevEventTime;
     126
    118127            /* - Position to look at during that transition */
    119128            //Vector3 lookAtPosition;
  • code/trunk/src/orxonox/controllers/testscript.lua

    r10262 r10622  
    1 print   ('1: Hello World')
     1print ('1: Hello World')
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r10216 r10622  
    367367            if (GameMode::isMaster())
    368368            {
    369 //                this->deathEffect();
     369                this->deatheffect();
    370370                this->goWithStyle();
    371371            }
     
    387387    {
    388388        // play death effect
    389         {
     389        /*{
    390390            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
    391391            effect->setPosition(this->getPosition());
     
    410410            effect->setSource("Orxonox/sparks");
    411411            effect->setLifetime(4.0f);
    412         }
     412        }*/
     413       
     414       
     415        {
     416            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     417            effect->setPosition(this->getPosition());
     418            effect->setOrientation(this->getOrientation());
     419            effect->setDestroyAfterLife(true);
     420            effect->setSource("orxonox/explosion_flash2");
     421            effect->setLifetime(5.0f);
     422        }
     423        {
     424            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     425            effect->setPosition(this->getPosition());
     426            effect->setOrientation(this->getOrientation());
     427            effect->setDestroyAfterLife(true);
     428            effect->setSource("orxonox/explosion_flame2");
     429            effect->setLifetime(5.0f);
     430        }
     431        {
     432            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     433            effect->setPosition(this->getPosition());
     434            effect->setOrientation(this->getOrientation());
     435            effect->setDestroyAfterLife(true);
     436            effect->setSource("orxonox/explosion_shockwave2");
     437            effect->scale(20);
     438            effect->setLifetime(5.0f);
     439        }{
     440            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     441            effect->setPosition(this->getPosition());
     442            effect->setOrientation(this->getOrientation());
     443            effect->setDestroyAfterLife(true);
     444            effect->setSource("orxonox/explosion_sparks2");
     445            effect->setLifetime(5.0f);
     446        }
     447        {
     448            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     449            effect->setPosition(this->getPosition());
     450            effect->setOrientation(this->getOrientation());
     451            effect->setDestroyAfterLife(true);
     452            effect->setSource("orxonox/explosion_streak2");
     453            effect->setLifetime(5.0f);
     454        }
     455        {
     456            ParticleSpawner* effect = new ParticleSpawner(this->getContext());
     457            effect->setPosition(this->getPosition());
     458            effect->setOrientation(this->getOrientation());
     459            effect->setDestroyAfterLife(true);
     460            effect->setSource("orxonox/explosion_afterglow");
     461            effect->scale(20);
     462            effect->setLifetime(5.0f);
     463        }
     464       
     465       
    413466        for (unsigned int i = 0; i < this->numexplosionchunks_; ++i)
    414467        {
Note: See TracChangeset for help on using the changeset viewer.