Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10216


Ignore:
Timestamp:
Jan 31, 2015, 6:03:17 PM (5 years ago)
Author:
landauf
Message:

merged branch presentationFS14 back to trunk

Location:
code/trunk
Files:
33 edited
25 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/data/levels/includes/weaponSettingsTurret.oxi

    r9664 r10216  
    1111        </links>
    1212        <Weapon>
    13           <attached>
    14             <Model mesh="sphere.mesh" position="3,3,-2.2" scale=0.6 />
    15           </attached>
    16           <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 3, 3,-2.2" />
    17           <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 3,-3,-2.2" />
    18           <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-3, 3,-2.2" />
    19           <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-3,-3,-2.2" />
     13          <!-- <attached>
     14            <Model mesh="sphere.mesh" position="1.7,1.7,-24.5" scale=0.6 />
     15          </attached> -->
     16          <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="1.7, 1.7,-30" />
     17          <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="1.7, -1.7,-30" />
     18          <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="-1.7, 1.7,-30" />
     19          <HsW01 mode=0 munitionpershot=0 delay=0 damage=1 material="Flares/point_lensflare" muzzleoffset="-1.7, -1.7,-30" />
    2020        </Weapon>
    2121      </WeaponPack>
  • code/trunk/data/levels/templates/HeavyCruiser.oxt

    r9943 r10216  
    22
    33<Template name=HeavyCruiser>
    4   <SpaceShip
     4  <ModularSpaceShip
     5   name = HeavyCruiser
     6   
    57   hudtemplate            = spaceshiphud
    68   camerapositiontemplate = heavycruisercameras
     
    911   explosionchunks        = 6
    1012
    11    health            = 100
    12    maxhealth         = 200
    13    initialhealth     = 100
     13   health            = 2000
     14   maxhealth         = 4000
     15   initialhealth     = 2000
    1416
    1517   shieldhealth        = 100
     
    4143  >
    4244    <engines>
    43       <MultiStateEngine position="85,0,0" template=HeavyCruiser_body_engine1 />
    44       <MultiStateEngine position="-85,0,0" template=HeavyCruiser_body_engine1 />
     45      <MultiStateEngine position="0,0,0" template=HeavyCruiser_body_engine1 />
    4546
    4647      <MultiStateEngine position="-140,0,308" template=HeavyCruiser_sidearmL_engine1 />
    4748      <MultiStateEngine position="140,0,308" template=HeavyCruiser_sidearmR_engine1 />
    4849    </engines>
     50   
     51    <parts>
     52        <ShipPart name="frontL" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-76,30,-330">
     53            <destructionevents>
     54                <PartDestructionEvent targetType="ship" targetParam="shieldhealth" operation="*" value="0.5"/>
     55            </destructionevents>
     56        </ShipPart>
     57        <ShipPart name="frontR" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="76,30,-330">
     58            <destructionevents>
     59                <PartDestructionEvent targetType="ship" targetParam="shieldhealth" operation="*" value="0.5"/>
     60            </destructionevents>
     61        </ShipPart>
     62        <ShipPart name="partL" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-100,33,-200">
     63            <destructionevents>
     64                <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="One of your ship's generators was destroyed!"/>
     65                <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="speedfront" operation="-" value="50"/>
     66                <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="accelerationfront" operation="-" value="3"/>
     67                <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="boostfactor" operation="set" value="1"/>
     68            </destructionevents>
     69        </ShipPart>
     70        <ShipPart name="partR" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="100,33,-200">
     71            <destructionevents>
     72                <PartDestructionEvent targetType="ship" targetParam="boostpowerrate" operation="-" value="0.5" message="One of your ship's generators was destroyed!"/>
     73                <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="speedfront" operation="-" value="50"/>
     74                <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="accelerationfront" operation="-" value="3"/>
     75                <PartDestructionEvent targetType="engine" targetName="bodyengine" targetParam="boostfactor" operation="set" value="1"/>
     76            </destructionevents>
     77        </ShipPart>
     78        <ShipPart name="sidearmL" initialhealth="20" maxhealth="20" damageabsorption="0.2" explosionposition="-140,30,100">
     79            <destructionevents>
     80                <PartDestructionEvent targetType="engine" targetName="sidearmLengine" operation="destroy" message="The left auxiliary engine was destroyed!"/>
     81                <PartDestructionEvent targetType="part" targetName="sidearmLfront" operation="destroy"/>
     82                <PartDestructionEvent targetType="ship" targetParam="rotationthrust" operation="-" value="0.04" />
     83            </destructionevents>
     84        </ShipPart>
     85        <ShipPart name="sidearmLfront" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="-140,20,-50">
     86            <destructionevents>
     87                <PartDestructionEvent targetType="engine" targetName="sidearmLengine" targetParam="boostfactor" operation="set" value="1" message="The left auxiliary engine lost it's booster!"/>
     88            </destructionevents>
     89        </ShipPart>
     90        <ShipPart name="sidearmR" initialhealth="20" maxhealth="20" damageabsorption="0.2" explosionposition="140,30,100">
     91            <destructionevents>
     92                <PartDestructionEvent targetType="engine" targetName="sidearmRengine" operation="destroy" message="The right auxiliary engine was destroyed!"/>
     93                <PartDestructionEvent targetType="part" targetName="sidearmRfront" operation="destroy"/>
     94                <PartDestructionEvent targetType="ship" targetParam="rotationthrust" operation="-" value="0.04" />           
     95            </destructionevents>
     96        </ShipPart>
     97        <ShipPart name="sidearmRfront" initialhealth="10" maxhealth="10" damageabsorption="0.5" explosionposition="140,20,-50">
     98            <destructionevents>
     99                <PartDestructionEvent targetType="engine" targetName="sidearmRengine" targetParam="boostfactor" operation="set" value="1" message="The right auxiliary engine lost it's booster!"/>
     100            </destructionevents>
     101        </ShipPart>
     102    </parts>
     103   
    49104    <attached>
    50 
    51105        <Model mesh="HeavyCruiser_body.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
    52         <Model mesh="HeavyCruiser_frontL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
    53         <Model mesh="HeavyCruiser_frontR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
    54         <Model mesh="HeavyCruiser_partL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
    55         <Model mesh="HeavyCruiser_partR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
    56         <Model mesh="HeavyCruiser_sidearmL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
    57         <Model mesh="HeavyCruiser_sidearmLfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
    58         <Model mesh="HeavyCruiser_sidearmR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
    59         <Model mesh="HeavyCruiser_sidearmRfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>       
    60 
    61             <!-- bay1 lights -->
    62         <BlinkingBillboard position="75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
    63         <BlinkingBillboard position="-75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
    64         <BlinkingBillboard position="74,30,-402" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.1 frequency=0.3 phase=120 quadratic=1 />
    65         <BlinkingBillboard position="-74,30,-402" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.1 frequency=0.3 phase=120 quadratic=1 />
    66         <BlinkingBillboard position="73,30,-388" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.15 frequency=0.3 phase=0 quadratic=1 />
    67         <BlinkingBillboard position="-73,30,-388" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.15 frequency=0.3 phase=0 quadratic=1 />
     106       
     107        <StaticEntity name="frontL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     108            <attached>
     109                <Model mesh="HeavyCruiser_frontL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
     110                <BlinkingBillboard position="-75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
     111                <BlinkingBillboard position="-74,30,-402" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.1 frequency=0.3 phase=120 quadratic=1 />
     112                <BlinkingBillboard position="-73,30,-388" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.15 frequency=0.3 phase=0 quadratic=1 />
     113            </attached>
     114            <collisionShapes>
     115                <BoxCollisionShape position="-80,33,-320" halfExtents="7,11,54" info="frontL"/>
     116                <BoxCollisionShape position="-79,31,-399" halfExtents="3,6,26" info="frontL"/>
     117            </collisionShapes>
     118        </StaticEntity>
     119       
     120        <StaticEntity name="frontR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     121            <attached>
     122                <Model mesh="HeavyCruiser_frontR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
     123                <BlinkingBillboard position="75,30,-416" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.05 frequency=0.3 phase=240 quadratic=1 />
     124                <BlinkingBillboard position="74,30,-402" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.1 frequency=0.3 phase=120 quadratic=1 />
     125                <BlinkingBillboard position="73,30,-388" material="Examples/Flare" colour="0.8, 0.8, 0, 0.1" amplitude=0.15 frequency=0.3 phase=0 quadratic=1 />
     126            </attached>
     127            <collisionShapes>
     128                <BoxCollisionShape position="80,33,-320" halfExtents="7,11,54" info="frontR"/>
     129                <BoxCollisionShape position="79,31,-399" halfExtents="3,6,26" info="frontR"/>
     130            </collisionShapes>
     131        </StaticEntity>
     132       
     133        <StaticEntity name="partL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     134            <attached>
     135                <Model mesh="HeavyCruiser_partL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
     136            </attached>
     137            <collisionShapes>
     138                <BoxCollisionShape position="-94,33,-179" halfExtents="11,13,45" info="partL"/>
     139                <BoxCollisionShape position="-96,33,-230" halfExtents="13,17,22" info="partL"/>
     140            </collisionShapes>
     141        </StaticEntity>
     142       
     143        <StaticEntity name="partR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     144            <attached>
     145                <Model mesh="HeavyCruiser_partR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
     146            </attached>
     147            <collisionShapes>
     148                <BoxCollisionShape position="94,33,-179" halfExtents="11,13,45" info="partR"/>
     149                <BoxCollisionShape position="96,33,-230" halfExtents="13,17,22" info="partR"/>
     150            </collisionShapes>
     151        </StaticEntity>
     152       
     153                <StaticEntity name="sidearmL" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     154            <attached>
     155                <Model mesh="HeavyCruiser_sidearmL.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
     156            </attached>
     157            <collisionShapes>
     158                <BoxCollisionShape position="-109,47,87" halfExtents="29,8,26" info="sidearmL, upper connection"/>
     159                <BoxCollisionShape position="-99,-1,79" roll="15" halfExtents="40,4,9" info="sidearmL, lower connection"/>
     160                <BoxCollisionShape position="-145,21,115" roll="15" halfExtents="19,31,105" info="sidearmL, front"/>
     161                <BoxCollisionShape position="-140,12,261" roll="15" halfExtents="22,41,43" info="sidearmL, back"/>
     162                <BoxCollisionShape position="-145,25,5" roll="15" halfExtents="10,18,5" info="sidearmL, front break"/>
     163                <BoxCollisionShape position="-133,-13,29" roll="15" halfExtents="12,6,17" info="sidearmL, bottom cylinder"/>
     164                <BoxCollisionShape position="-165,-4,31" roll="15" halfExtents="7,21,13" info="sidearmL, box"/>
     165                <BoxCollisionShape position="-153,59,96" roll="15" halfExtents="6,7,60" info="sidearmL, upper beam"/>
     166                <BoxCollisionShape position="-143,57,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper inner beam"/>
     167                <BoxCollisionShape position="-142,53,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper inner beam"/>
     168                <BoxCollisionShape position="-160,52,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper outer beam"/>
     169                <BoxCollisionShape position="-159,48,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper outer beam"/>
     170                <BoxCollisionShape position="-152,54,34" pitch="-46" yaw="-14" roll="15" halfExtents="6,7,10" info="sidearmL, upper beam front"/>
     171                <BoxCollisionShape position="-152,54,162" pitch="30" yaw="9" roll="15" halfExtents="6,7,12" info="sidearmL, upper beam back"/>
     172                <BoxCollisionShape position="-168,21,119" roll="15" halfExtents="3,5,109" info="sidearmL, outer beam"/>
     173                <BoxCollisionShape position="-134,-10,169" roll="15" halfExtents="6,4,55" info="sidearmL, lower beam front"/>
     174                <BoxCollisionShape position="-131,-20,217" pitch="-20" roll="15" yaw="-5" halfExtents="6,12,3" info="sidearmL, lower beam middle"/>
     175                <BoxCollisionShape position="-130,-29,233" roll="15" halfExtents="6,3,15" info="sidearmL, lower beam back"/>
     176            </collisionShapes>
     177        </StaticEntity>
     178       
     179        <StaticEntity name="sidearmLfront" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     180            <attached>
     181                <Model mesh="HeavyCruiser_sidearmLfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
     182            </attached>
     183            <collisionShapes>
     184                <BoxCollisionShape position="-141,15,-53" roll="15" halfExtents="27,44,62" info="sidearmLfront"/>
     185                <BoxCollisionShape position="-153,59,-30" roll="15" halfExtents="4,2,38" info="sidearmLfront, top"/>
     186                <BoxCollisionShape position="-153,61,-41" roll="15" halfExtents="4,4,11" info="sidearmLfront, top"/>
     187                <BoxCollisionShape position="-153,60,-65" roll="15" halfExtents="4,3,4" info="sidearmLfront, top"/>
     188                <BoxCollisionShape position="-153,59,-41" roll="15" halfExtents="8,2,11" info="sidearmLfront, top"/>
     189            </collisionShapes>
     190        </StaticEntity>
     191       
     192        <StaticEntity name="sidearmR" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     193            <attached>
     194                <Model mesh="HeavyCruiser_sidearmR.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
     195            </attached>
     196            <collisionShapes>
     197                <BoxCollisionShape position="109,47,87" halfExtents="29,8,26" info="sidearmR, upper connection"/>
     198                <BoxCollisionShape position="99,-1,79" roll="-15" halfExtents="40,4,9" info="sidearmR, lower connection"/>
     199                <BoxCollisionShape position="145,21,115" roll="-15" halfExtents="19,31,105" info="sidearmR, front"/>
     200                <BoxCollisionShape position="140,12,261" roll="-15" halfExtents="22,41,43" info="sidearmR, back"/>
     201                <BoxCollisionShape position="145,25,5" roll="-15" halfExtents="10,18,5" info="sidearmR, front break"/>
     202                <BoxCollisionShape position="133,-13,29" roll="-15" halfExtents="12,6,17" info="sidearmR, bottom cylinder"/>
     203                <BoxCollisionShape position="165,-4,31" roll="-15" halfExtents="7,21,13" info="sidearmR, box"/>
     204                <BoxCollisionShape position="153,59,96" roll="-15" halfExtents="6,7,60" info="sidearmR, upper beam"/>
     205                <BoxCollisionShape position="143,57,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper inner beam"/>
     206                <BoxCollisionShape position="142,53,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper inner beam"/>
     207                <BoxCollisionShape position="160,52,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper outer beam"/>
     208                <BoxCollisionShape position="159,48,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper outer beam"/>
     209                <BoxCollisionShape position="152,54,34" pitch="-46" yaw="14" roll="-15" halfExtents="6,7,10" info="sidearmR, upper beam front"/>
     210                <BoxCollisionShape position="152,54,162" pitch="30" yaw="-9" roll="-15" halfExtents="6,7,12" info="sidearmR, upper beam back"/>
     211                <BoxCollisionShape position="168,21,119" roll="-15" halfExtents="3,5,109" info="sidearmR, outer beam"/>
     212                <BoxCollisionShape position="134,-10,169" roll="-15" halfExtents="6,4,55" info="sidearmR, lower beam front"/>
     213                <BoxCollisionShape position="131,-20,217" pitch="-20" roll="-15" yaw="5" halfExtents="6,12,3" info="sidearmR, lower beam middle"/>
     214                <BoxCollisionShape position="130,-29,233" roll="-15" halfExtents="6,3,15" info="sidearmR, lower beam back"/>
     215            </collisionShapes>
     216        </StaticEntity>
     217       
     218        <StaticEntity name="sidearmRfront" position="0,0,0" direction="0,0,0" collisionType=static mass=100 friction=0.01 >
     219            <attached>
     220                <Model mesh="HeavyCruiser_sidearmRfront.mesh" direction="-1,0,0" position="0,0,0" scale="40"/>
     221            </attached>
     222            <collisionShapes>
     223                <BoxCollisionShape position="141,15,-53" roll="-15" halfExtents="27,44,62" info="sidearmRfront"/>
     224                <BoxCollisionShape position="153,59,-30" roll="-15" halfExtents="4,2,38" info="sidearmRfront, top"/>
     225                <BoxCollisionShape position="153,61,-41" roll="-15" halfExtents="4,4,11" info="sidearmRfront, top"/>
     226                <BoxCollisionShape position="153,60,-65" roll="-15" halfExtents="4,3,4" info="sidearmRfront, top"/>
     227                <BoxCollisionShape position="153,59,-41" roll="-15" halfExtents="8,2,11" info="sidearmRfront, top"/>
     228            </collisionShapes>
     229        </StaticEntity>   
     230
    68231            <!-- front position lights -->
    69232        <BlinkingBillboard position="67,-5,-240" material="Examples/Flare" colour="0, 0.7, 0, 0.1" amplitude=0.3 frequency=0.15 phase=0 quadratic=1 />
     
    79242    </attached>
    80243    <collisionShapes>
    81         <BoxCollisionShape position="80,33,-320" halfExtents="7,11,54" info="frontR"/>
    82         <BoxCollisionShape position="79,31,-399" halfExtents="3,6,26" info="frontR"/>
    83 
    84 
    85         <BoxCollisionShape position="-80,33,-320" halfExtents="7,11,54" info="frontL"/>
    86         <BoxCollisionShape position="-79,31,-399" halfExtents="3,6,26" info="frontL"/>
    87 
    88 
    89         <BoxCollisionShape position="94,33,-179" halfExtents="11,13,45" info="partR"/>
    90         <BoxCollisionShape position="96,33,-230" halfExtents="13,17,22" info="partR"/>
    91 
    92 
    93         <BoxCollisionShape position="-94,33,-179" halfExtents="11,13,45" info="partL"/>
    94         <BoxCollisionShape position="-96,33,-230" halfExtents="13,17,22" info="partL"/>
    95 
    96 
    97         <BoxCollisionShape position="109,47,87" halfExtents="29,8,26" info="sidearmR, upper connection"/>
    98         <BoxCollisionShape position="99,-1,79" roll="-15" halfExtents="40,4,9" info="sidearmR, lower connection"/>
    99         <BoxCollisionShape position="145,21,115" roll="-15" halfExtents="19,31,105" info="sidearmR, front"/>
    100         <BoxCollisionShape position="140,12,261" roll="-15" halfExtents="22,41,43" info="sidearmR, back"/>
    101         <BoxCollisionShape position="145,25,5" roll="-15" halfExtents="10,18,5" info="sidearmR, front break"/>
    102         <BoxCollisionShape position="133,-13,29" roll="-15" halfExtents="12,6,17" info="sidearmR, bottom cylinder"/>
    103         <BoxCollisionShape position="165,-4,31" roll="-15" halfExtents="7,21,13" info="sidearmR, box"/>
    104         <BoxCollisionShape position="153,59,96" roll="-15" halfExtents="6,7,60" info="sidearmR, upper beam"/>
    105         <BoxCollisionShape position="143,57,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper inner beam"/>
    106         <BoxCollisionShape position="142,53,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper inner beam"/>
    107         <BoxCollisionShape position="160,52,119" roll="-15" halfExtents="3,4,85" info="sidearmR, upper outer beam"/>
    108         <BoxCollisionShape position="159,48,212" pitch="21" yaw="-5" roll="-15" halfExtents="3,4,10" info="sidearmR, upper outer beam"/>
    109         <BoxCollisionShape position="152,54,34" pitch="-46" yaw="14" roll="-15" halfExtents="6,7,10" info="sidearmR, upper beam front"/>
    110         <BoxCollisionShape position="152,54,162" pitch="30" yaw="-9" roll="-15" halfExtents="6,7,12" info="sidearmR, upper beam back"/>
    111         <BoxCollisionShape position="168,21,119" roll="-15" halfExtents="3,5,109" info="sidearmR, outer beam"/>
    112         <BoxCollisionShape position="134,-10,169" roll="-15" halfExtents="6,4,55" info="sidearmR, lower beam front"/>
    113         <BoxCollisionShape position="131,-20,217" pitch="-20" roll="-15" yaw="5" halfExtents="6,12,3" info="sidearmR, lower beam middle"/>
    114         <BoxCollisionShape position="130,-29,233" roll="-15" halfExtents="6,3,15" info="sidearmR, lower beam back"/>
    115 
    116 
    117         <BoxCollisionShape position="141,15,-53" roll="-15" halfExtents="27,44,62" info="sidearmRfront"/>
    118         <BoxCollisionShape position="153,59,-30" roll="-15" halfExtents="4,2,38" info="sidearmRfront, top"/>
    119         <BoxCollisionShape position="153,61,-41" roll="-15" halfExtents="4,4,11" info="sidearmRfront, top"/>
    120         <BoxCollisionShape position="153,60,-65" roll="-15" halfExtents="4,3,4" info="sidearmRfront, top"/>
    121         <BoxCollisionShape position="153,59,-41" roll="-15" halfExtents="8,2,11" info="sidearmRfront, top"/>
    122 
    123 
    124         <BoxCollisionShape position="-109,47,87" halfExtents="29,8,26" info="sidearmL, upper connection"/>
    125         <BoxCollisionShape position="-99,-1,79" roll="15" halfExtents="40,4,9" info="sidearmL, lower connection"/>
    126         <BoxCollisionShape position="-145,21,115" roll="15" halfExtents="19,31,105" info="sidearmL, front"/>
    127         <BoxCollisionShape position="-140,12,261" roll="15" halfExtents="22,41,43" info="sidearmL, back"/>
    128         <BoxCollisionShape position="-145,25,5" roll="15" halfExtents="10,18,5" info="sidearmL, front break"/>
    129         <BoxCollisionShape position="-133,-13,29" roll="15" halfExtents="12,6,17" info="sidearmL, bottom cylinder"/>
    130         <BoxCollisionShape position="-165,-4,31" roll="15" halfExtents="7,21,13" info="sidearmL, box"/>
    131         <BoxCollisionShape position="-153,59,96" roll="15" halfExtents="6,7,60" info="sidearmL, upper beam"/>
    132         <BoxCollisionShape position="-143,57,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper inner beam"/>
    133         <BoxCollisionShape position="-142,53,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper inner beam"/>
    134         <BoxCollisionShape position="-160,52,119" roll="15" halfExtents="3,4,85" info="sidearmL, upper outer beam"/>
    135         <BoxCollisionShape position="-159,48,212" pitch="21" yaw="5" roll="15" halfExtents="3,4,10" info="sidearmL, upper outer beam"/>
    136         <BoxCollisionShape position="-152,54,34" pitch="-46" yaw="-14" roll="15" halfExtents="6,7,10" info="sidearmL, upper beam front"/>
    137         <BoxCollisionShape position="-152,54,162" pitch="30" yaw="9" roll="15" halfExtents="6,7,12" info="sidearmL, upper beam back"/>
    138         <BoxCollisionShape position="-168,21,119" roll="15" halfExtents="3,5,109" info="sidearmL, outer beam"/>
    139         <BoxCollisionShape position="-134,-10,169" roll="15" halfExtents="6,4,55" info="sidearmL, lower beam front"/>
    140         <BoxCollisionShape position="-131,-20,217" pitch="-20" roll="15" yaw="-5" halfExtents="6,12,3" info="sidearmL, lower beam middle"/>
    141         <BoxCollisionShape position="-130,-29,233" roll="15" halfExtents="6,3,15" info="sidearmL, lower beam back"/>
    142 
    143 
    144         <BoxCollisionShape position="-141,15,-53" roll="15" halfExtents="27,44,62" info="sidearmLfront"/>
    145         <BoxCollisionShape position="-153,59,-30" roll="15" halfExtents="4,2,38" info="sidearmLfront, top"/>
    146         <BoxCollisionShape position="-153,61,-41" roll="15" halfExtents="4,4,11" info="sidearmLfront, top"/>
    147         <BoxCollisionShape position="-153,60,-65" roll="15" halfExtents="4,3,4" info="sidearmLfront, top"/>
    148         <BoxCollisionShape position="-153,59,-41" roll="15" halfExtents="8,2,11" info="sidearmLfront, top"/>
    149 
    150 
    151244        <BoxCollisionShape position="60,35,-310" halfExtents="13,28,60" info="body, bay1, Rwall"/>
    152245        <BoxCollisionShape position="-60,35,-310" halfExtents="13,28,60" info="body, bay1, Lwall"/>
     
    293386  include("../includes/weaponSettingsHeavyCruiser.oxi")
    294387?>
    295   </SpaceShip>
     388  </ModularSpaceShip>
    296389
    297390</Template>
     
    318411<Template name=HeavyCruiser_body_engine1 baseclass=MultiStateEngine>
    319412  <MultiStateEngine
     413   name           = bodyengine
    320414   boostfactor    = 2
    321415
     
    412506<Template name=HeavyCruiser_sidearmL_engine1 baseclass=MultiStateEngine>
    413507  <MultiStateEngine
     508   name           = sidearmLengine
    414509   boostfactor    = 2
    415510
     
    461556<Template name=HeavyCruiser_sidearmR_engine1 baseclass=MultiStateEngine>
    462557  <MultiStateEngine
     558   name           = sidearmRengine
    463559   boostfactor    = 2
    464560
  • code/trunk/data/levels/turretTest.oxw

    r9939 r10216  
    33<LevelInfo
    44 name = "turret Test"
    5  description = "A level with a turret in it."
     5 description = "A level to test turrets with."
    66 tags = "test"
    77 screenshot = "emptylevel.png"
     
    1616<?lua
    1717  include("templates/spaceshipAssff.oxt")
    18   include("templates/spaceshipPirate.oxt")
    19   include("templates/spaceshipTurret.oxt")
     18  include("templates/standardTurret.oxt")
    2019?>
    2120
     
    3332    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
    3433
     34<SpaceShip position = "0,0,800" collisionType="dynamic" team=10>
     35  <controller>
     36    <TeamTargetProxy team=10/>
     37  </controller>
     38  <attached>
     39    <Model position="0,0,0" mesh="plane.mesh" scale3D="20,20,20" pitch=-90/>
    3540
    36 <StaticEntity position="0,0,0" yaw=0 pitch=0>
    37     <attached>
    38         <Model position="0,0,0" mesh="turretSocketFront.mesh" scale3D="10,10,10" />
    39         <Model position="0,0,0" mesh="turretSocketIn.mesh" scale3D="10,10,10" />
    40         <Model position="0,0,0" mesh="turretSocketTop.mesh" scale3D="10,10,10" />
    41         <Model position="0,0,0" mesh="turretSocketLeft.mesh" scale3D="10,10,10" />
    42         <Model position="0,0,0" mesh="turretSocketRight.mesh" scale3D="10,10,10" />
    43     </attached>
    44 </StaticEntity>
     41    <?lua for i = 1, 10, 1 do ?>
     42      <Turret position="<?lua print(150-i*30) ?>,<?lua print(150-i*30) ?>,0" pitch="0" yaw="0" roll="0">
     43        <templates>
     44          <Template link=standardturret />
     45        </templates>
     46      </Turret>
     47    <?lua end ?>
    4548
    46 
    47 
    48 <Turret position="0,10,0" pitch="90" yaw="0" roll="0">
    49     <templates>
    50         <Template link=spaceshipturret />
    51     </templates>
    52     <controller>
    53         <WaypointPatrolController alertnessradius=100 team=10>
    54         </WaypointPatrolController>
    55      </controller>
    56 </Turret>
    57 
    58 
    59 
     49  </attached>
     50  <collisionShapes>
     51    <BoxCollisionShape radius="10"   position="0,0,0" halfExtents="200, 200, 0"/>
     52  </collisionShapes>
     53</SpaceShip>
    6054   
    6155  </Scene>
  • code/trunk/src/modules/CMakeLists.txt

    r9939 r10216  
    4040ADD_SUBDIRECTORY(towerdefense)
    4141ADD_SUBDIRECTORY(invader)
     42ADD_SUBDIRECTORY(jump)
  • code/trunk/src/modules/invader/InvaderWeapon.cc

    r9961 r10216  
    5757    }
    5858
    59     InvaderWeapon::~InvaderWeapon(){}
     59    InvaderWeapon::~InvaderWeapon()
     60    {
     61
     62    }
    6063
    6164    void InvaderWeapon::shot()
  • code/trunk/src/modules/objects/CMakeLists.txt

    r9526 r10216  
    1111ADD_SUBDIRECTORY(eventsystem)
    1212ADD_SUBDIRECTORY(triggers)
     13ADD_SUBDIRECTORY(controllers)
    1314
    1415ORXONOX_ADD_LIBRARY(objects
  • code/trunk/src/modules/objects/Turret.cc

    r9945 r10216  
    2121 *
    2222 *   Author:
    23  *      Marian Runo
     23 *      Marian Runo, Martin Mueller
    2424 *   Co-authors:
    2525 *      ...
     
    2929#include "Turret.h"
    3030#include "core/CoreIncludes.h"
    31 #include "OgreQuaternion.h"
    3231#include "core/XMLPort.h"
    33 #include "controllers/WaypointPatrolController.h"
     32#include "Scene.h"
     33#include <OgreSceneManager.h>
     34
    3435
    3536namespace orxonox
     
    3738    RegisterClass(Turret);
    3839
    39     /**
    40      * @brief Constructor
     40
     41
     42    /**
     43        @brief
     44        Sets default values for all variables. Also hides the turret from the radar.
     45
     46        @param context
     47        The context
    4148     */
    42     Turret::Turret(Context* context) : SpaceShip(context)
     49    Turret::Turret(Context* context) : Pawn(context)
    4350    {
    4451        RegisterObject(Turret);
    45         this->controller_ = new WaypointPatrolController(this->getContext());
    46     }
    47 
    48     /**
    49      * @brief Destructor
     52        this->rotationThrust_ = 50;
     53        this->startDir_ = Vector3::ZERO;
     54        this->localZ_ = Vector3::UNIT_Z;
     55        this->localY_ = Vector3::UNIT_Y;
     56        this->localX_ = Vector3::UNIT_X;
     57        this->maxAttackRadius_ = 200;
     58        this->minAttackRadius_ = 0;
     59        this->maxPitch_ = 90;
     60        this->maxYaw_ = 90;
     61        this->once_ = false;
     62        this->rotation_ = Quaternion::IDENTITY;
     63
     64        this->setRadarVisibility(false);
     65
     66        //this->rayTest_ = this->getScene()->getSceneManager()->createRayQuery(Ogre::Ray());
     67    }
     68
     69    /**
     70        @brief
     71        Destructor. Destroys the rayTest_ element (if it was used)  .
    5072     */
    5173    Turret::~Turret()
    5274    {
    53 
    54     }
    55 
    56 
     75        //this->getScene()->getSceneManager()->destroyQuery(this->rayTest_);
     76    }
     77
     78    /**
     79        @brief
     80        Checks, if a WorldEntity is inside the turret's range.
     81
     82        This function is safe to use on turrets that are attached, rotated, etc.
     83        The turret's range is determined with the maxPitch, maxYaw, and the two attackRadius.
     84
     85        @param target
     86        The WorldEntity to check
     87
     88        @return
     89        The squared distance to the position. -1, if it's ouside of range
     90    */
     91    float Turret::isInRange(const WorldEntity* target )
     92    {
     93        //Check distance
     94        Vector3 distance = target->getWorldPosition() - this->getWorldPosition();
     95        float distanceVal = distance.squaredLength();
     96        if(distanceVal > (this->maxAttackRadius_ * this->maxAttackRadius_) || distanceVal < (this->minAttackRadius_ * this->minAttackRadius_))
     97        {
     98            return -1.f;
     99        }
     100
     101        //Check pitch
     102        Vector3 dir = getTransformedVector(distance, this->localX_, this->localY_, this->localZ_);
     103        Vector3 dirProjected = dir;
     104        dirProjected.x = 0;
     105        Vector3 startDirProjected = this->startDir_;
     106        startDirProjected.x = 0;
     107        Ogre::Real angle = startDirProjected.angleBetween(dirProjected).valueDegrees();
     108        if(angle > this->maxPitch_)
     109        {
     110            return -1.f;
     111        }
     112
     113        //Check yaw
     114        dirProjected = dir;
     115        dirProjected.y = 0;
     116        startDirProjected = this->startDir_;
     117        startDirProjected.y = 0;
     118        angle = startDirProjected.angleBetween(dirProjected).valueDegrees();
     119        if(angle > this->maxYaw_)
     120        {
     121            return -1.f;
     122        }
     123
     124        //TODO: Finish this. Find a way to convert objects from Ogre to Orxonox
     125        /*Ogre::Ray ray = Ogre::Ray(this->getWorldPosition(), distance);
     126        this->rayTest_->setRay(ray);
     127        Ogre::RaySceneQueryResult result = this->rayTest_->execute();*/
     128
     129
     130        return distanceVal;
     131    }
     132
     133    /**
     134        @brief
     135        Rotates the turret to make it aim at a certain position.
     136
     137        @note
     138        There are no checks, if the position is valid (i.e. if the turret is allowed to aim there).
     139        This function must be called again for every tick, or the turret will stop rotating.
     140
     141        @param position
     142        The position to aim at
     143    */
     144    void Turret::aimAtPosition(const Vector3& position)
     145    {
     146        Vector3 currDir = this->getWorldOrientation() * WorldEntity::FRONT;
     147        Vector3 targetDir = position - this->getWorldPosition();
     148
     149        this->rotation_ = currDir.getRotationTo(targetDir);
     150    }
     151
     152    /**
     153        @brief
     154        Does currently nothing.
     155
     156        Should rotate the turret with the specified pitch. Contains a failed attempt at limiting said rotation.
     157    */
    57158    void Turret::rotatePitch(const Vector2& value)
    58     {
    59         orxout()<< "Turret rotate Pitch"<< endl;
    60 
    61         const Quaternion& orient = this->getOrientation();
    62         Radian pitch = orient.getPitch();
    63 
    64         if((value.x > 0 && pitch < Radian(180)) || (value.x < 0 && pitch > Radian(0)))
    65             SpaceShip::rotatePitch(value);
    66     }
    67 
    68 
    69     void Turret::setAlertnessRadius(float value)
    70     {
    71         this->controller_->setAlertnessRadius(value);
    72     }
    73     float Turret::getAlertnessRadius()
    74     {
    75         return this->controller_->getAlertnessRadius();
    76     }
    77 
     159    {   
     160        //This is a failed attempt at limiting the turret's rotation. It's handled in the controller (for now?)
     161        /*
     162        Vector3 currentDir = getTransformedVector(this->getOrientation() * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
     163        Vector3 currentDirProjected = currentDir;
     164        currentDirProjected.x = 0;
     165        Vector3 startDirProjected = this->startDir_;
     166        startDirProjected.x = 0;     
     167        Ogre::Real angle = startDirProjected.angleBetween(currentDirProjected).valueDegrees();
     168        //orxout() << "Pitch: " << angle << endl;   
     169        //if(angle < this->maxPitch_ || (currentDirProjected.y <= 0 && value.x > 0) || (currentDirProjected.y > 0 && value.x < 0) )
     170        {
     171            this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x*0.8f);
     172        }
     173        */
     174    }
     175
     176    /**
     177        @brief
     178        Does currently nothing.
     179
     180        Should rotate the turret with the specified yaw. Contains a failed attempt at limiting said rotation.
     181    */
     182    void Turret::rotateYaw(const Vector2& value)
     183    {
     184        //This is a failed attempt at limiting the turret's rotation. It's handled in the controller (for now?)
     185        /*
     186        Vector3 currentDir = getTransformedVector(this->getOrientation() * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
     187        Vector3 currentDirProjected = currentDir;
     188        currentDirProjected.y = 0;
     189        Vector3 startDirProjected = this->startDir_;
     190        startDirProjected.y = 0;
     191        Ogre::Real angle = startDirProjected.angleBetween(currentDirProjected).valueDegrees();
     192        orxout() << "Yaw: " << angle << endl;
     193        if(angle < this->maxYaw_ || (currentDirProjected.x <= 0 && value.x < 0) || (currentDirProjected.x > 0 && value.x > 0))
     194        {
     195            this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x*0.8f);
     196        }
     197        */
     198    }
     199
     200    /**
     201        @brief
     202        Does currently nothing.
     203
     204        May be used to limit turret's rotation in the future.
     205    */
     206    void Turret::rotateRoll(const Vector2& value)
     207    {
     208    }
     209
     210    /**
     211        @brief
     212        Loads parameters from xml
     213
     214        Parameters loaded are: rotationThrust, maxAttackRadius, minAttackRadius, maxYaw, maxPitch
     215    */
    78216    void Turret::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    79217    {
    80218        SUPER(Turret, XMLPort, xmlelement, mode);
    81         XMLPortParam(Turret, "alertnessRadius", setAlertnessRadius, getAlertnessRadius, xmlelement, mode).defaultValues("400");
    82     }
    83 
    84 
     219       
     220        XMLPortParamVariable(Turret, "rotationThrust", rotationThrust_, xmlelement, mode);
     221        XMLPortParam(Turret, "maxAttackRadius", setMaxAttackRadius, getMaxAttackRadius, xmlelement, mode);
     222        XMLPortParam(Turret, "minAttackRadius", setMinAttackRadius, getMinAttackRadius, xmlelement, mode);
     223        XMLPortParam(Turret, "maxYaw", setMaxYaw, getMaxYaw, xmlelement, mode);
     224        XMLPortParam(Turret, "maxPitch", setMaxPitch, getMaxPitch, xmlelement, mode);
     225    }
     226
     227    /**
     228        @brief
     229        The turret's actions are done here.
     230
     231        Every tick, the turret gets rotated if it should, and the local axes get updated with the parent's rotation.
     232   
     233        @param dt
     234        Duration of the tick
     235    */
     236    void Turret::tick(float dt)
     237    {
     238        SUPER(Turret, tick, dt);
     239
     240        //Stuff isn't properly initialized in the c'tor, so we have to do it like this
     241        if(!this->once_)
     242        {
     243            //Account for rotations done in xml
     244            Quaternion startOrient = this->getOrientation();
     245            this->localXStart_ = startOrient * this->localX_;
     246            this->localXStart_.normalise();
     247            this->localX_ = this->localXStart_;
     248            this->localYStart_ = startOrient * this->localY_;
     249            this->localYStart_.normalise();
     250            this->localY_ = this->localYStart_;
     251            this->localZStart_ = startOrient * this->localZ_;
     252            this->localZStart_.normalise();
     253            this->localZ_ = this->localZStart_;
     254
     255            //startDir should always be (0,0,-1)
     256            this->startDir_ = getTransformedVector(startOrient * WorldEntity::FRONT, this->localX_, this->localY_, this->localZ_);
     257
     258            this->once_ = true;
     259
     260        }
     261
     262        //Adjust local axes to parent's rotation
     263        WorldEntity* parent = this->getParent();
     264        if(parent)
     265        {
     266            Quaternion parentrot = parent->getWorldOrientation();
     267            this->localX_ = parentrot * this->localXStart_;
     268            this->localY_ = parentrot * this->localYStart_;
     269            this->localZ_ = parentrot * this->localZStart_;
     270        }
     271
     272        //rotate
     273        if(this->rotation_ != Quaternion::IDENTITY)
     274        {
     275            //Don't make the rotation instantaneous. Use an arbitrary interpolation, not that great...
     276            //TODO: make the rotation better (constant velocity etc.). At the moment, the turret rotates
     277            //slower the closer it is to the destination
     278            Quaternion drot = Quaternion::nlerp(dt*this->rotationThrust_/20.f, Quaternion::IDENTITY, this->rotation_);
     279            this->rotate(drot, WorldEntity::World);
     280            this->rotation_ = Quaternion::IDENTITY;
     281        }
     282
     283    }
    85284}
  • code/trunk/src/modules/objects/Turret.h

    r9667 r10216  
    2121 *
    2222 *   Author:
    23  *      Marian Runo
     23 *      Marian Runo, Martin Mueller
    2424 *   Co-authors:
    2525 *      ...
     
    2828
    2929/**
    30     @file Turret.h
    3130    @brief Definition of the Turret class.
    3231    @ingroup Objects
     
    3736
    3837#include "objects/ObjectsPrereqs.h"
    39 
    40 #include "worldentities/pawns/SpaceShip.h"
     38#include "worldentities/pawns/Pawn.h"
     39#include <OgreSceneQuery.h>
    4140
    4241namespace orxonox
    4342{
    44     class _ObjectsExport Turret : public SpaceShip
     43    /**
     44    @brief
     45        Creates a turret with limited rotation. The point of this class is to be able to attach
     46        a turret to a spaceship or a spacestation which is more or less completely autonomous in
     47        it's behaviour.
     48
     49        This class also contains a custom local coordinate system, which gets initially rotated through xml, and
     50        afterwards is updated with the parent's rotation (if there is one). This allows for almost trivialal calculation
     51        of pitch, yaw and roll through coordinate transformation. (TODO: Ogre should do something like this already, investigate...)
     52       
     53
     54    @note
     55        The rotation isn't limited "physically". You have to call isInRange to find out if the turret is allowed to shoot at a target.
     56    */
     57    class _ObjectsExport Turret : public Pawn
    4558    {
    4659        public:
     
    4861            virtual ~Turret();
    4962
    50             //virtual void tick(float dt);
    51 
    5263            virtual void rotatePitch(const Vector2& value);
    53 
    54             void setAlertnessRadius(float value);
    55             float getAlertnessRadius();
     64            virtual void rotateYaw(const Vector2& value);
     65            virtual void rotateRoll(const Vector2& value);
     66            virtual float isInRange(const WorldEntity* target);
     67            virtual void aimAtPosition(const Vector3 &position);
    5668
    5769            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     70            virtual void tick(float dt);
    5871
     72            /** @brief Sets the maximum distance the turret is allowed to shoot. @param radius The distance*/
     73            inline void setMaxAttackRadius(float radius)
     74                { this->maxAttackRadius_ = radius; }
     75
     76            /** @brief Sets the minimum distance the turret is allowed to shoot. @param radius The distance*/
     77            inline void setMinAttackRadius(float radius)
     78                { this->minAttackRadius_ = radius; }
     79
     80            /** @brief Sets the maximum pitch the turret can have (in both directions). @param pitch The pitch (in one direction)*/
     81            inline void setMaxPitch(float pitch)
     82                { this->maxPitch_ = pitch; }
     83
     84            /** @brief Sets the maximum yaw the turret can have (in both directions). @param yaw The yaw (in one direction)*/
     85            inline void setMaxYaw(float yaw)
     86                { this->maxYaw_ = yaw; }
     87
     88            /** @brief Returns the maximum distance the turret is allowed to shoot. @return The distance */
     89            inline float getMaxAttackRadius() const
     90                { return this->maxAttackRadius_; }               
     91
     92            /** @brief Returns the minimum distance the turret is allowed to shoot. @return The distance */
     93            inline float getMinAttackRadius() const
     94                { return this->minAttackRadius_; }   
     95
     96            /** @brief Returns the maximum pitch the turret can have. @return The pitch */
     97            inline float getMaxPitch() const
     98                { return this->maxPitch_; }
     99
     100            /** @brief Returns the maximum yaw the turret can have. @return The yaw */
     101            inline float getMaxYaw() const
     102                { return this->maxYaw_; }
    59103
    60104        protected:
    61             WaypointPatrolController* controller_;
     105            Vector3 startDir_; //!< The initial facing direction, in local coordinates.
     106            Vector3 localZ_; //!< The local z-axis, includes for the parent's rotation and rotations done in xml.
     107            Vector3 localY_; //!< The local y-axis, includes for the parent's rotation and rotations done in xml.
     108            Vector3 localX_; //!< The local x-axis, includes for the parent's rotation and rotations done in xml.     
     109            Quaternion rotation_; //!< The rotation to be done by the turret.
     110
    62111        private:
     112            bool once_; //!< Flag for executing code in the tick function only once.
     113
     114            Vector3 localZStart_; //!< The local z-axis, without the parent's rotation.
     115            Vector3 localYStart_; //!< The local y-axis, without the parent's rotation.
     116            Vector3 localXStart_; //!< The local x-axis, without the parent's rotation.
     117            float maxAttackRadius_; //!< The maximum distance the turret is allowed to shoot.
     118            float minAttackRadius_; //!< The minimum distance the turret is allowed to shoot.
     119            Ogre::Real maxPitch_; //!< The maxmium pitch the turret can have (on one side).
     120            Ogre::Real maxYaw_; //!< The maxmium yaw the turret can have (on one side).
     121            float rotationThrust_;  //!< The velocity the turret rotates with.
     122            Ogre::RaySceneQuery* rayTest_; //!< Used to perform a raytest, currently unused @see isInRange
    63123
    64124    };
     
    66126
    67127#endif
    68 
  • code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc

    r9667 r10216  
    7878    @see Pawn.h
    7979    */
    80     bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     80    bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs)
    8181    {
    8282        if (!this->bDestroy_ && GameMode::isMaster())
     
    9696            if (victim)
    9797            {
    98                 victim->hit(this->getShooter(), contactPoint, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
     98                victim->hit(this->getShooter(), contactPoint, cs, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());
    9999                victim->startReloadCountdown();
    100100            }
     
    141141    }
    142142
     143
    143144    /**
    144145    @brief
  • code/trunk/src/modules/weapons/projectiles/BasicProjectile.h

    r9667 r10216  
    119119
    120120        protected:
    121             bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     121            bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs);
    122122            void destroyCheck(void);
    123123
  • code/trunk/src/modules/weapons/projectiles/Projectile.cc

    r9667 r10216  
    8888    }
    8989
    90     bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     90    bool Projectile::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
    9191    {
    92         return this->processCollision(otherObject, contactPoint);
     92        return this->processCollision(otherObject, contactPoint, cs);
    9393    }
    9494
  • code/trunk/src/modules/weapons/projectiles/Projectile.h

    r9667 r10216  
    6464
    6565            virtual void tick(float dt);
    66             virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     66            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
    6767
    6868        private:
  • code/trunk/src/modules/weapons/projectiles/Rocket.cc

    r9667 r10216  
    191191    }
    192192
    193     bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    194     {
    195         return this->processCollision(otherObject, contactPoint);
     193    bool Rocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
     194    {
     195        return this->processCollision(otherObject, contactPoint, cs);
    196196    }
    197197
  • code/trunk/src/modules/weapons/projectiles/Rocket.h

    r9667 r10216  
    6464            virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
    6565
    66             virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     66            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
    6767            virtual void destroyObject(void);
    6868            void destructionEffect();
  • code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc

    r9667 r10216  
    172172    }
    173173
    174     bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    175     {
    176         return this->processCollision(otherObject, contactPoint);
     174    bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
     175    {
     176        return this->processCollision(otherObject, contactPoint, cs);
    177177    }
    178178
  • code/trunk/src/modules/weapons/projectiles/SimpleRocket.h

    r9667 r10216  
    6464            virtual void tick(float dt);
    6565
    66             virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     66            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
    6767
    6868            void disableFire(); //!< Method to disable the fire and stop all acceleration
  • code/trunk/src/orxonox/CMakeLists.txt

    r9348 r10216  
    3131  PawnManager.cc
    3232  PlayerManager.cc
     33  ShipPartManager.cc
    3334  Radar.cc
    3435#  Test.cc
     
    6465    infos/PlayerInfo.h
    6566    sound/SoundManager.h
     67    controllers/ScriptController.h
    6668  PCH_FILE
    6769    OrxonoxPrecompiledHeaders.h
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r9348 r10216  
    142142
    143143    // items
     144    class ShipPart;
     145    class PartDestructionEvent;
    144146    class Engine;
    145147    class Item;
     
    189191    class Pawn;
    190192    class SpaceShip;
     193    class ModularSpaceShip;
    191194    class Spectator;
    192195    class TeamBaseMatchBase;
  • code/trunk/src/orxonox/Scene.cc

    r10196 r10216  
    363363        SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
    364364
     365        // get the CollisionShape pointers
     366        const btCollisionShape* cs0 = colObj0->getCollisionShape();
     367        const btCollisionShape* cs1 = colObj1->getCollisionShape();
     368
    365369        // false means that bullet will assume we didn't modify the contact
    366370        bool modified = false;
    367371        if (object0->isCollisionCallbackActive())
    368             modified |= object0->collidesAgainst(object1, cp);
     372            modified |= object0->collidesAgainst(object1, cs1, cp);
    369373        if (object1->isCollisionCallbackActive())
    370             modified |= object1->collidesAgainst(object0, cp);
     374            modified |= object1->collidesAgainst(object0, cs0, cp);
    371375
    372376        return modified;
  • code/trunk/src/orxonox/collisionshapes/CollisionShape.cc

    r9667 r10216  
    121121        WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent);
    122122        if (parentWECCS)
     123        {
    123124            this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID();
    124         // Else it is set to the objectID of the CompoundCollisionShape.
     125
     126            // If this shape is not a CompoundCollisionShape (thus an actual physical shape) & the parent is a WorldEntity's CollisionShape,
     127            // set it's userPointer to the WorldEntity this CompoundCollisionShape belongs to.
     128            if (!orxonox_cast<CompoundCollisionShape*>(this))
     129                this->getCollisionShape()->setUserPointer(parentWECCS->getWorldEntityOwner());
     130        }
    125131        else
     132        {
     133            // Else it is set to the objectID of the CompoundCollisionShape.
    126134            this->parentID_ = newParent->getObjectID();
     135        }
    127136
    128137        return true;
  • code/trunk/src/orxonox/controllers/ArtificialController.cc

    r9667 r10216  
    9494        static const float hardcoded_projectile_speed = 1250;
    9595
    96         this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getVelocity());
     96        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(), hardcoded_projectile_speed, this->target_->getWorldPosition(), this->target_->getVelocity());
    9797        this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
    9898
  • code/trunk/src/orxonox/controllers/CMakeLists.txt

    r9016 r10216  
    1010  DroneController.cc
    1111  FormationController.cc
     12  ControllerDirector.cc
    1213)
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r9939 r10216  
    220220                if (!controlPaused_ )
    221221                {
    222                     if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
     222                    if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
    223223                        this->showOverlays();
    224224                    else if (this->getControllableEntity() &&  this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer")))
     
    498498        this->controlMode_ = 0;
    499499        this->centerCursor();
    500         if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
     500        if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
    501501        {
    502502            this->showOverlays_ = true;
  • code/trunk/src/orxonox/items/CMakeLists.txt

    r5781 r10216  
    33  Engine.cc
    44  MultiStateEngine.cc
     5  ShipPart.cc
     6  PartDestructionEvent.cc
    57)
  • code/trunk/src/orxonox/worldentities/MovableEntity.cc

    r9667 r10216  
    7272    }
    7373
    74     bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     74    bool MovableEntity::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    7575    {
    7676        if (GameMode::isMaster() && enableCollisionDamage_)
     
    8080            {
    8181                float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
    82                 victim->hit(0, contactPoint, damage);
     82                victim->hit(0, contactPoint, ownCollisionShape, damage);
    8383            }
    8484        }
     
    8686        return false;
    8787    }
    88 
    8988
    9089    void MovableEntity::registerVariables()
  • code/trunk/src/orxonox/worldentities/MovableEntity.h

    r9667 r10216  
    4747
    4848            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    49             virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     49            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
    5050
    5151            using WorldEntity::setPosition;
  • code/trunk/src/orxonox/worldentities/WorldEntity.h

    r9667 r10216  
    374374                Condition is that enableCollisionCallback() was called.
    375375            */
    376             virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     376            virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    377377                { return false; } /* With false, Bullet assumes no modification to the collision objects. */
    378378
  • code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt

    r7163 r10216  
    44  Pawn.cc
    55  SpaceShip.cc
     6  ModularSpaceShip.cc
    67  TeamBaseMatchBase.cc
    78  Destroyer.cc
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r9950 r10216  
    244244    }
    245245
    246     void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
     246    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
    247247    {
    248248        // Applies multiplier given by the DamageBoost Pickup.
     
    279279
    280280*/
    281     void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
     281    void Pawn::hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
    282282    {
    283283        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    284284        {
    285             this->damage(damage, healthdamage, shielddamage, originator);
     285            this->damage(damage, healthdamage, shielddamage, originator, cs);
    286286            this->setVelocity(this->getVelocity() + force);
    287287        }
    288288    }
    289289
    290 
    291     void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
     290    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
    292291    {
    293292        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    294293        {
    295             this->damage(damage, healthdamage, shielddamage, originator);
     294            this->damage(damage, healthdamage, shielddamage, originator, cs);
    296295
    297296            if ( this->getController() )
     
    559558        return BLANKSTRING;
    560559    }
    561 
    562 
    563560}
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r9948 r10216  
    126126            //virtual void hit(Pawn* originator, const Vector3& force, float damage);
    127127            //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    128             virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
    129             virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
     128            virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
     129            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
    130130
    131131            virtual void kill();
     
    196196
    197197            //virtual void damage(float damage, Pawn* originator = 0);
    198             virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL);
     198            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
    199199
    200200            bool bAlive_;
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc

    r9667 r10216  
    342342    /**
    343343    @brief
     344        Looks for an attached Engine with a certain name.
     345    @param name
     346        The name of the engine to be returned.
     347    @return
     348        Pointer to the engine with the given name, or NULL if not found.
     349    */
     350    Engine* SpaceShip::getEngineByName(const std::string& name)
     351    {
     352        for(size_t i = 0; i < this->engineList_.size(); ++i)
     353            if(this->engineList_[i]->getName() == name)
     354                return this->engineList_[i];
     355
     356        orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
     357        return NULL;
     358    }
     359
     360    /**
     361    @brief
    344362        Remove and destroy all Engines of the SpaceShip.
    345363    */
     
    355373    @param engine
    356374        A pointer to the Engine to be removed.
     375    @note
     376        Don't forget to reset the Engine's ship pointer after it was removed (or destroy the engine).
    357377    */
    358378    void SpaceShip::removeEngine(Engine* engine)
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h

    r9667 r10216  
    124124            bool hasEngine(Engine* engine) const; // Check whether the SpaceShip has a particular Engine.
    125125            Engine* getEngine(unsigned int i); // Get the i-th Engine of the SpaceShip.
     126            Engine* getEngineByName(const std::string& name);
    126127            /**
    127128            @brief Get the list of all Engines that are mounted on the SpaceShip.
Note: See TracChangeset for help on using the changeset viewer.