[Orxonox-commit 7147] r11764 - in code/branches/Presentation_HS17_merge: . data/levels src/orxonox/controllers src/orxonox/worldentities/pawns

landauf at orxonox.net landauf at orxonox.net
Sun Feb 18 01:17:48 CET 2018


Author: landauf
Date: 2018-02-18 01:17:48 +0100 (Sun, 18 Feb 2018)
New Revision: 11764

Added:
   code/branches/Presentation_HS17_merge/data/levels/ProtectBoss.oxw
   code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/ShootableObstacle.cc
   code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/ShootableObstacle.h
Modified:
   code/branches/Presentation_HS17_merge/
   code/branches/Presentation_HS17_merge/data/levels/emptyLevel.oxw
   code/branches/Presentation_HS17_merge/src/orxonox/controllers/DroneController.cc
   code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/CMakeLists.txt
Log:
merged ProtectBoss_HS17

Index: code/branches/Presentation_HS17_merge
===================================================================
--- code/branches/Presentation_HS17_merge	2018-02-18 00:13:20 UTC (rev 11763)
+++ code/branches/Presentation_HS17_merge	2018-02-18 00:17:48 UTC (rev 11764)

Property changes on: code/branches/Presentation_HS17_merge
___________________________________________________________________
Modified: svn:mergeinfo
## -10,6 +10,7 ##
 /code/branches/HUD_HS16:11212-11390,11392-11699
 /code/branches/Highscore_HS16:11226-11355
 /code/branches/ParticleEffectsFS15:10309-10612
+/code/branches/ProtectBoss_HS17:11457-11763
 /code/branches/Racingbot:9388-9513
 /code/branches/SciptableControllerFS15:10308-10613
 /code/branches/ScriptableController:9999-10075
Copied: code/branches/Presentation_HS17_merge/data/levels/ProtectBoss.oxw (from rev 11763, code/branches/ProtectBoss_HS17/data/levels/ProtectBoss.oxw)
===================================================================
--- code/branches/Presentation_HS17_merge/data/levels/ProtectBoss.oxw	                        (rev 0)
+++ code/branches/Presentation_HS17_merge/data/levels/ProtectBoss.oxw	2018-02-18 00:17:48 UTC (rev 11764)
@@ -0,0 +1,363 @@
+<LevelInfo
+ name = "ProtectBoss"
+ description = "Protect a disabled cargo ship!"
+ tags = "mission"
+ screenshot = "emptylevel.png"
+/>
+
+
+<?lua
+  include("stats.oxo")
+  include("HUDTemplates3.oxo")
+  include("templates/lodInformation.oxt")
+  include("templates/HeavyCruiser.oxt")
+  include("HUDPickupTemplate.oxo")
+  include("templates/pickupRepresentationTemplates.oxt")
+?>
+
+<?lua
+  include("templates/spaceshipEscort.oxt")
+  include("templates/spaceshipAssff.oxt")
+  include("templates/endurancetest_template.oxt")
+  include("templates/spaceshipPirate.oxt")
+?>
+
+<Level gametype="Mission">
+  <templates>
+    <Template link=lodtemplate_default />
+  </templates>
+  <?lua include("includes/notifications.oxi") ?>
+
+  <NotificationQueueCEGUI
+    name="narrative"
+    targets="simpleNotification"
+    size=3
+    displayTime=7
+    position="0.2, 0, 0.1, 0"
+    fontSize="16"
+    fontColor="0.3, 1, 0.2, 0.8"
+    alignment="HorzCentred"
+    displaySize="0.6, 0, 0, 0"
+  />
+
+  <Scene
+    ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/Starbox"
+  >
+
+    <?lua
+      include("includes/pickups.oxi")
+    ?>
+
+    <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" /> <!-- AlphaCentauri.ogg, Mars.ogg-->
+
+    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+
+    <EventMultiTrigger name=spawntrigger>
+      <events>
+        <trigger>
+          <SpawnPoint team=0 position="0,0,1" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+        </trigger>
+      </events>
+    </EventMultiTrigger>
+    
+    <Pawn
+        team      = 0
+        collisionType = kinematic
+        enablecollisiondamage=true
+        collisiondamage = 5
+        position  = "0,0,-2500"
+        mass      = 100000
+        health    = 2500 initialhealth=2500 maxhealth="2500"
+        direction = "1,0,0"
+        rotationaxis="0,0,1" rotationrate="4.5" velocity="0,0,30"
+        vulnerable=true
+        name      = "CargoShip"
+        radarname = "Cargo Ship" >
+      <attached>
+        <DistanceTriggerBeacon name="CargoShip" />
+        <Model mesh="escortShip.mesh" mass=10000 position="0,0,0" scale=100 />
+      </attached>
+      <collisionShapes>
+        <BoxCollisionShape position="0,0,0" halfExtents="300,100,200" /> <!-- laenge  ,   dicke    , breite -->
+        <BoxCollisionShape position="-100,-50,-280" halfExtents="220,70,100" />
+        <BoxCollisionShape position="-100,-50,280" halfExtents="220,70,100" />
+      </collisionShapes>
+      <explosion>
+        <ExplosionPart scale = 12 minspeed=0 maxspeed=0 effect1="orxonox/explosion_flash2" effect2="orxonox/explosion_flame2" />
+        <ExplosionPart scale = 12 minspeed=0 maxspeed=0 effect1="orxonox/explosion_shockwave2" effect2="orxonox/explosion_sparks2" />
+        <ExplosionPart scale = 12 minspeed=0 maxspeed=0 effect1="orxonox/explosion_streak2" effect2="orxonox/explosion_afterglow" />
+        <ExplosionPart offset="94,33,-50" delay=1 minspeed=0 maxspeed=0 effect1="orxonox/explosion_flash2" effect2="orxonox/explosion_flame2" />
+        <ExplosionPart offset="94,33,-50" delay=1 minspeed=0 maxspeed=0 effect1="orxonox/explosion_shockwave2" effect2="orxonox/explosion_sparks2" />
+        <ExplosionPart offset="94,33,-50" delay=1 minspeed=0 maxspeed=0 effect1="orxonox/explosion_streak2" effect2="orxonox/explosion_afterglow" />
+   
+        <ExplosionPart scale = 5 mesh="CockpitDebris.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart scale = 5 mesh="BodyDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart scale = 5 mesh="WingDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart scale = 5 mesh="WingDebris2.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart scale = 5 mesh="CockpitDebris.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart scale = 5 mesh="BodyDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart scale = 5 mesh="WingDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart scale = 5 mesh="WingDebris2.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart delay=0.8 scale = 2.5 mesh="CockpitDebris.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart delay=0.8 scale = 2.5 mesh="BodyDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart delay=0.8 scale = 2.5 mesh="WingDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+        <ExplosionPart delay=0.8 scale = 2.5 mesh="WingDebris2.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
+       
+        <ExplosionPart offset="20,13,-15" scale=7 delay=1.3 minspeed=0 maxspeed=0 effect1="orxonox/explosion_flash2" effect2="orxonox/explosion_flame2" />
+        <ExplosionPart offset="30,13,-15" scale=7 delay=1.3 minspeed=0 maxspeed=0 effect1="orxonox/explosion_shockwave2" effect2="orxonox/explosion_sparks2" />
+        <ExplosionPart offset="20,13,-15" scale=7 delay=1.3 minspeed=0 maxspeed=0 effect1="orxonox/explosion_streak2" effect2="orxonox/explosion_afterglow" />
+        <ExplosionPart offset="-20,-13,-15" scale=5 delay=1.8 minspeed=0 maxspeed=0 effect1="orxonox/explosion_flash2" effect2="orxonox/explosion_flame2" />
+        <ExplosionPart offset="-20,-13,-15" scale=5 delay=1.8 minspeed=0 maxspeed=0 effect1="orxonox/explosion_shockwave2" effect2="orxonox/explosion_sparks2" />
+        <ExplosionPart offset="-20,-13,-15" scale=5 delay=1.8 minspeed=0 maxspeed=0 effect1="orxonox/explosion_streak2" effect2="orxonox/explosion_afterglow" />
+      </explosion>
+    </Pawn>
+
+    <!-- triggers some time after start -->
+    <DistanceTrigger name="someTimeAfterStart" beaconMode=identify position="0,0,1000" distance=1000 target="Pawn" targetname="CargoShip" />
+
+    <!-- triggers when first quest is completed -->
+    <DistanceTrigger name="passedAsteroidFieldOne" beaconMode=identify position="0,0,3000" distance=1000 target="Pawn" targetname="CargoShip" />
+
+    <!-- triggers when first pirate wave is defeated -->
+
+    <Trigger name="firstPirateWaveKilled" mode="and">
+      <?lua
+        for n = 1, 3, 1 do
+          print("<EventTrigger activations=1 stayactive=true><events><trigger><EventListener event=p" .. n .. "/></trigger></events></EventTrigger>")
+        end
+      ?>
+    </Trigger>
+
+    <!-- triggers when second pirate wave is defeated -->
+    <Trigger name="secondPirateWaveKilled" mode="and">
+      <?lua
+        for n = 1, 6, 1 do
+          print("<EventTrigger activations=1 stayactive=true><events><trigger><EventListener event=p1" .. n .. "/></trigger></events></EventTrigger>")
+        end
+      ?>
+    </Trigger>
+
+    <!-- triggers some time after the second pirate wave was defeated -->
+    <Trigger name="thirdPirateWaveStarting" delay=15>
+      <EventTrigger activations="1" stayactive="true" >
+        <events>
+          <trigger>
+             <EventListener event="secondPirateWaveKilled" />
+          </trigger>
+        </events>
+      </EventTrigger>
+    </Trigger>
+
+    <!-- triggers when third pirate wave is defeated -->
+    <Trigger name="thirdPirateWaveKilled" mode="and">
+      <?lua
+        for n = 1, 7, 1 do
+          print("<EventTrigger activations=1 stayactive=true><events><trigger><EventListener event=p2" .. n .. "/></trigger></events></EventTrigger>")
+        end
+      ?>
+    </Trigger>
+
+    <Trigger name="succeedMission" mode=and delay=1>
+      <EventTrigger activations="1" stayactive="true" >
+        <events>
+          <trigger>
+             <EventListener event="thirdPirateWaveKilled" />
+          </trigger>
+        </events>
+      </EventTrigger>
+      <EventTrigger activations="1" stayactive="false" name="cargoShipStillAlive" invert=true>
+        <events>
+          <trigger>
+             <EventListener event="CargoShip" />
+          </trigger>
+        </events>
+      </EventTrigger>
+    </Trigger>
+
+    <EventTrigger activations="1" stayactive="true" name="failMission" delay=0.1>
+      <events>
+        <trigger>
+           <EventListener event="CargoShip" />
+        </trigger>
+      </events>
+    </EventTrigger>
+
+    <!-- create asteroids and pickups -->
+    <?lua
+      function asteroidMesh()
+        x = math.random(8)
+        if x < 7 then
+          return "ast" .. x .. ".mesh"
+        elseif x == 7 then
+          return "asteroid_ice.mesh"
+        else
+          return "asteroid_UV.mesh"
+        end
+      end
+
+      for count = 1, 60, 1 do
+        x = math.random(-1000, 1000)
+        y = math.random(-1000, 1000)
+        z = 125 * count + math.random(-250, 250)
+        vmax = 7
+        if count > 30 then
+          vmax = 2
+        end
+        rx = math.random(-vmax, vmax)
+        ry = math.random(-vmax, vmax)
+        rz = math.random(-vmax, vmax)
+        vx = math.random(-vmax, vmax)
+        vy = math.random(-vmax, vmax)
+        vz = math.random(-vmax, vmax)
+        rr = math.random() * 10
+        print("<ShootableObstacle team=1 enablecollisiondamage=true collisiondamage=10 health=100 maxhealth=100 initialhealth=100 position=\"" .. x .. "," .. y .. "," .. z .. "\" direction=\"0,0,-1\" velocity=\"" .. vx .. "," .. vy .. "," .. vz .. "\"rotationaxis=\"" .. rx .. "," .. ry .. "," .. rz .. "\" rotationrate=" .. rr .. " collisionType=dynamic mass=1 name=asteroid radarname=Asteroid> <attached> <Model position=\"0,0,0\" mesh=\"" .. asteroidMesh() .. "\" scale3D=\"10,10,10\" /> </attached> <collisionShapes> <SphereCollisionShape position=\"0,0,0\" radius=5 /> </collisionShapes> <controller> <WaypointController team=1> </WaypointController> </controller> <explosion> <ExplosionPart minspeed=0 maxspeed=0 effect1=\"orxonox/explosion_flash2\" effect2=\"orxonox/explosion_flame2\" /> <ExplosionPart minspeed=0 maxspeed=0 effect1=\"orxonox/explosion_shockwave2\" effect2=\"orxonox/explosion_sparks2\" /> <ExplosionPart minspeed=0 maxspeed=0 effect1=\"orxonox/explosion_streak2\" effect2=\"orxonox/explosion_afterglow\" /> </explosion> </ShootableObstacle>")
+      end
+
+      for count = 1, 60, 1 do
+        x = math.random(-1000, 1000)
+        y = math.random(-1000, 1000)
+        z = 3000 + 125 * count + math.random(-250, 250)
+        typenum = math.random(11)
+        type = ""
+        if typenum == 1 then
+          type = "smallmunition"
+        elseif typenum == 2 then
+          type = "mediummunition"
+        elseif typenum == 3 then
+          type = "hugemunition"
+        elseif typenum == 4 then
+          type = "smallhealth"
+        elseif typenum == 5 then
+          type = "mediumhealth"
+        elseif typenum == 6 then
+          type = "hugehealth"
+        elseif typenum == 7 then
+          type = "crazyhealth"
+        elseif typenum == 8 then
+          type = "smallshield"
+        elseif typenum == 9 then
+          type = "mediumshield"
+        elseif typenum == 10 then
+          type = "hugeshield"
+        else
+          type = "drone"
+        end
+        type = type .. "pickup"
+        print("<PickupSpawner pickup=\"" .. type .. "\" position=\"" .. x .. "," .. y .. "," .. z .. "\" triggerDistance=10 respawnTime=5 maxSpawnedItems=1 />")
+      end
+    ?>
+
+    <!-- start first quest -->
+    <QuestEffectBeacon times=1>
+      <effects>
+        <AddQuest questId="ProtectBoss.AsteroidField" />
+      </effects>
+      <events>
+        <execute>
+          <EventListener event=spawntrigger />
+        </execute>
+      </events>
+    </QuestEffectBeacon>
+
+    <!-- start second quest (doesn't work yet) -->
+    <QuestEffectBeacon times=1>
+      <effects>
+        <CompleteQuest questId="ProtectBoss.AsteroidField" />
+        <!--AddQuest questId="ProtectBoss.PirateAttack" /-->
+      </effects>
+      <events>
+        <execute>
+          <EventListener event=passedAsteroidFieldOne />
+        </execute>
+      </events>
+    </QuestEffectBeacon>
+
+    <SimpleNotification message="Protect the cargo ship! (Info: F3)" broadcast="true">
+        <events>
+            <trigger>
+                <EventListener event=spawntrigger />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <LocalQuest id="ProtectBoss.AsteroidField">
+        <QuestDescription title="Protect the Cargo Ship" description="The cargo ship in front of you is disabled and is drifting uncontrolled! Shoot the asteroids out of the way to protect it!" failmessage="The cargo ship has been hit!" completeMessage="" />
+        <complete-effects>
+            <AddQuest questId="ProtectBoss.PirateAttack" />
+        </complete-effects>
+    </LocalQuest>
+
+    <LocalQuest id="ProtectBoss.PirateAttack">
+      <QuestDescription title="Pirate Attack" description="Protect the cargo ship from the attacking pirates!" failmessage="The pirates boarded the cargo ship!" completeMessage="" />
+    </LocalQuest>
+
+    <SimpleNotification message="There are pirates around!" broadcast="true" >
+        <events>
+            <trigger>
+                <EventListener event="someTimeAfterStart" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification message="The cargo ship got destroyed! Game over!" broadcast=true >
+      <events>
+            <trigger>
+                <EventListener event="CargoShip" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification message="A second pirate wave is approaching!" broadcast=true >
+      <events>
+            <trigger>
+                <EventListener event="firstPirateWaveKilled" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification message="The third and last pirate wave is near!" broadcast=true >
+      <events>
+            <trigger>
+                <EventListener event="secondPirateWaveKilled" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <SimpleNotification message="The cargo ship is out of danger. You made it!" broadcast=true >
+      <events>
+            <trigger>
+                <EventListener event="succeedMission" />
+            </trigger>
+        </events>
+    </SimpleNotification>
+
+    <!-- A function to put pirates to a certain location -->
+    <?lua
+      function placePirate(posX, posY, posZ, name, trigger)
+        print("<SpaceShip mass=10 health=25 initialhealth=25 maxhealth=25 shieldhealth=10 maxshieldhealth=10 initialshieldhealth=10 shieldabsorption=0.3 shieldrechargerate=1 shieldrechargewaittime=1 primaryThrust=20 auxiliaryThrust=5 rotationThrust=5 boostpower=2 boostrate=1 boostCooldownDuration = 50 accuracy=1 position=\"" .. posX .. "," .. posY .. "," .. posZ .. "\" name=\"" .. name .. "\" radarname=Pirate><!--events><visibility><EventListener event=\"" .. trigger .. "\"/></visibility><activity><EventListener event=\"" .. trigger .. "\"/></activity></events--><templates><Template link=spaceshippirate /></templates><controller><WaypointPatrolController alertnessradius=2700 attackradius=1850 team=1 active=true><waypoints><StaticEntity position=\"" .. posX .. "," .. posY .. "," .. posZ .. "\"/><StaticEntity position=\"" .. (posX + 100) .. "," .. posY .. "," .. posZ .. "\"/><!--Model mesh=\"cube.mesh\" scale=0 position=\"-1300,-600,900\" /><Model mesh=\"cube.mesh\" scale=0 position=\"0,0,0\" /--></waypoints><events><activity><EventListener event=attack /></activity></events></WaypointPatrolController></controller></SpaceShip>")
+      end
+    ?>
+
+    <?lua
+      placePirate(0, 0, 4800, "p1", "passedAsteroidFieldOne")
+      placePirate(50, 0, 4900, "p2", "passedAsteroidFieldOne")
+      placePirate(0, 50, 5000, "p3", "passedAsteroidFieldOne")
+      placePirate(0, 0, 6500, "p11", "firstPirateWaveKilled")
+      placePirate(50, 0, 6600, "p12", "firstPirateWaveKilled")
+      placePirate(-50, 0, 6700, "p13", "firstPirateWaveKilled")
+      placePirate(0, 50, 6800, "p14", "firstPirateWaveKilled")
+      placePirate(0, -50, 6900, "p15", "firstPirateWaveKilled")
+      placePirate(0, 0, 7000, "p16", "firstPirateWaveKilled")
+      placePirate(0, 0, 8000, "p21", "thirdPirateWaveStarting")
+      placePirate(50, 0, 8100, "p22", "thirdPirateWaveStarting")
+      placePirate(-50, 0, 8200, "p23", "thirdPirateWaveStarting")
+      placePirate(0, 50, 8300, "p24", "thirdPirateWaveStarting")
+      placePirate(0, -50, 8400, "p25", "thirdPirateWaveStarting")
+      placePirate(50, 50, 8500, "p26", "thirdPirateWaveStarting")
+      placePirate(-50, -50, 8600, "p27", "thirdPirateWaveStarting")
+    ?>
+
+  </Scene>
+</Level>
+

Modified: code/branches/Presentation_HS17_merge/data/levels/emptyLevel.oxw
===================================================================
--- code/branches/Presentation_HS17_merge/data/levels/emptyLevel.oxw	2018-02-18 00:13:20 UTC (rev 11763)
+++ code/branches/Presentation_HS17_merge/data/levels/emptyLevel.oxw	2018-02-18 00:17:48 UTC (rev 11764)
@@ -28,6 +28,25 @@
 
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
     <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+    <Model position="0,0,0" mesh="ast1.mesh" scale="20"/>
+    <Model position="100,0,0" mesh="ast2.mesh" scale="20"/>
+    <Model position="200,0,0" mesh="ast3.mesh" scale="20"/>
+    <Model position="300,0,0" mesh="ast4.mesh" scale="20"/>
+    <Model position="400,0,0" mesh="ast5.mesh" scale="20"/>
+    <Model position="500,0,0" mesh="ast6.mesh" scale="20"/>
+    <Model position="600,0,0" mesh="asteroid_ice.mesh" scale="20"/>
+    <Model position="700,0,0" mesh="asteroid_UV.mesh" scale="20"/>
+    <Model position="900,0,0" mesh="drone.mesh" scale="20"/>
+    <Model position="1000,0,0" mesh="Fahne.mesh" scale="20"/>
+    <Model position="1100,0,0" mesh="GravityBomb.mesh" scale="20"/>
+    <Model position="1200,0,0" mesh="GravityBombRocket.mesh" scale="20"/>
+    <Model position="1300,0,0" mesh="hovership_body.mesh" scale="20"/>
+    <Model position="1400,0,0" mesh="hovership_engine.mesh" scale="20"/>
+    <Model position="1500,0,0" mesh="satellite.mesh" scale="20"/>
+    <Model position="1800,0,0" mesh="Spacebomb.mesh" scale="20"/>
+    <Model position="2100,0,0" mesh="Transporter.mesh" scale="20"/>
+    <Model position="2400,0,0" mesh="Transporterspaceship.mesh" scale="20"/>
     
   </Scene>
 </Level>

Modified: code/branches/Presentation_HS17_merge/src/orxonox/controllers/DroneController.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/controllers/DroneController.cc	2018-02-18 00:13:20 UTC (rev 11763)
+++ code/branches/Presentation_HS17_merge/src/orxonox/controllers/DroneController.cc	2018-02-18 00:17:48 UTC (rev 11764)
@@ -48,6 +48,7 @@
     {
         RegisterObject(DroneController);
 
+        this->setTeam(0);
         this->owner_ = nullptr;
         this->drone_ = nullptr;
         this->isShooting_ = false;
@@ -163,6 +164,7 @@
                 this->isShooting_ = false;
             }
         }
+        
         SUPER(AIController, tick, dt);
     }
 

Modified: code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/CMakeLists.txt
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/CMakeLists.txt	2018-02-18 00:13:20 UTC (rev 11763)
+++ code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/CMakeLists.txt	2018-02-18 00:17:48 UTC (rev 11764)
@@ -7,4 +7,5 @@
   TeamBaseMatchBase.cc
   Destroyer.cc
   StoryModePawn.cc
+  ShootableObstacle.cc
 )

Copied: code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/ShootableObstacle.cc (from rev 11763, code/branches/ProtectBoss_HS17/src/orxonox/worldentities/pawns/ShootableObstacle.cc)
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/ShootableObstacle.cc	                        (rev 0)
+++ code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/ShootableObstacle.cc	2018-02-18 00:17:48 UTC (rev 11764)
@@ -0,0 +1,63 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Leon Rigoni
+ *
+ */
+
+#include "ShootableObstacle.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    RegisterClass(ShootableObstacle);
+
+    ShootableObstacle::ShootableObstacle(Context* context) : Pawn(context)
+    {
+        RegisterObject(ShootableObstacle);
+        this->enableCollisionCallback();
+    }
+
+    bool ShootableObstacle::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
+    {
+        if (GameMode::isMaster() && enableCollisionDamage_)
+        {
+            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
+            if (victim)
+            {
+                float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
+                victim->hit(nullptr, contactPoint, ownCollisionShape, damage);
+            }
+        }
+
+        return false;
+    }
+
+    void ShootableObstacle::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ShootableObstacle, XMLPort, xmlelement, mode);
+
+        XMLPortParam(ShootableObstacle, "enablecollisiondamage", setEnableCollisionDamage, getEnableCollisionDamage, xmlelement, mode).defaultValues(false);
+        XMLPortParam(ShootableObstacle, "collisiondamage", setCollisionDamage, getCollisionDamage, xmlelement, mode).defaultValues(1);
+    }
+
+}
\ No newline at end of file

Copied: code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/ShootableObstacle.h (from rev 11763, code/branches/ProtectBoss_HS17/src/orxonox/worldentities/pawns/ShootableObstacle.h)
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/ShootableObstacle.h	                        (rev 0)
+++ code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/ShootableObstacle.h	2018-02-18 00:17:48 UTC (rev 11764)
@@ -0,0 +1,66 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Leon Rigoni
+ *
+ */
+#ifndef _ShootableObstacle_H__
+#define _ShootableObstacle_H__
+#include "worldentities/pawns/Pawn.h"
+
+namespace orxonox // tolua_export
+{
+    /**
+    @brief
+        This class encapsulates a pawn (so an object with health) with the addition, that it damages other objects when it hits them.
+    */
+
+    class _OrxonoxExport ShootableObstacle
+        : public Pawn
+    {
+	    public:
+	    	ShootableObstacle(Context* context);
+	        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+	        virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override;
+
+	        inline void setCollisionDamage(float c)
+	                { this->collisionDamage_ = c; }
+
+	        inline float getCollisionDamage()
+	            { return this->collisionDamage_; }
+
+	        inline void setEnableCollisionDamage(bool c)
+	        {
+	            this->enableCollisionDamage_ = c;
+	            this->enableCollisionCallback();
+	        }
+
+	        inline bool getEnableCollisionDamage()
+	            { return this->enableCollisionDamage_; }
+
+	    private:
+	    	float collisionDamage_;
+	        bool enableCollisionDamage_;
+    };
+}
+
+#endif
\ No newline at end of file



More information about the Orxonox-commit mailing list