[Orxonox-commit 7061] r11679 - in code/branches/Presentation_HS17: . data/levels src/modules src/modules/pickup src/orxonox/worldentities/pawns
patricwi at orxonox.net
patricwi at orxonox.net
Sat Dec 16 12:52:32 CET 2017
Author: patricwi
Date: 2017-12-16 12:52:32 +0100 (Sat, 16 Dec 2017)
New Revision: 11679
Added:
code/branches/Presentation_HS17/data/levels/AsteroidFarming.oxw
code/branches/Presentation_HS17/src/modules/asteroidmining/
Modified:
code/branches/Presentation_HS17/
code/branches/Presentation_HS17/src/modules/CMakeLists.txt
code/branches/Presentation_HS17/src/modules/pickup/Pickup.h
code/branches/Presentation_HS17/src/modules/pickup/PickupSpawner.cc
code/branches/Presentation_HS17/src/modules/pickup/PickupSpawner.h
code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.h
Log:
merged AsteroidMining
Index: code/branches/Presentation_HS17
===================================================================
--- code/branches/Presentation_HS17 2017-12-16 11:24:20 UTC (rev 11678)
+++ code/branches/Presentation_HS17 2017-12-16 11:52:32 UTC (rev 11679)
Property changes on: code/branches/Presentation_HS17
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,6 ##
/code/branches/AI_HS15:10640-10832
/code/branches/Alejandro_FS17:11369-11447
+/code/branches/AsteroidMining_HS17:11461-11678
/code/branches/BigShip_HS16:11213-11356
/code/branches/Dialogue_FS17:11360-11450
/code/branches/FlappyOrx_HS17:11460-11677
Copied: code/branches/Presentation_HS17/data/levels/AsteroidFarming.oxw (from rev 11678, code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw)
===================================================================
--- code/branches/Presentation_HS17/data/levels/AsteroidFarming.oxw (rev 0)
+++ code/branches/Presentation_HS17/data/levels/AsteroidFarming.oxw 2017-12-16 11:52:32 UTC (rev 11679)
@@ -0,0 +1,142 @@
+<LevelInfo
+ name = "AsteroidFarming"
+ description = "Testing the Asteroid Mining Project, PPS HS 17"
+ tags = "test, showcase"
+ screenshot = "asteroids.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDPickupTemplate.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/pickupRepresentationTemplates.oxt")
+?>
+
+
+<WorldAmbientSound source="Asteroid_rocks.ogg" looping="true" playOnLoad="true" />
+
+
+<Level>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ hasPhysics = true
+ >
+
+
+ <?lua
+ include("includes/pickups.oxi")
+ ?>
+
+ <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="0,0,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+
+
+ <!-- Asteroid Display: -->
+ <Model position="0, 0,40" yaw="90" pitch="-90" roll="0" scale="3" mesh="ast1.mesh" />
+ <Model position="0, 20,40" yaw="90" pitch="-90" roll="0" scale="3" mesh="ast2.mesh" />
+ <Model position="0, 40,40" yaw="90" pitch="-90" roll="0" scale="3" mesh="ast3.mesh" />
+ <Model position="0, 60,40" yaw="90" pitch="-90" roll="0" scale="3" mesh="ast4.mesh" />
+ <Model position="0,-20,40" yaw="90" pitch="-90" roll="0" scale="4" mesh="ast5.mesh" />
+ <Model position="0,-40,40" yaw="90" pitch="-90" roll="0" scale="4" mesh="ast6.mesh" />
+ <Model position="0,-60,40" yaw="90" pitch="-90" roll="0" scale="5" mesh="asteroid_ice.mesh" />
+ <Model position="0,-80,40" yaw="90" pitch="-90" roll="0" scale="5" mesh="asteroid_UV.mesh" />
+
+ <!-- Display some pickup, 'Meta' -->
+ <PickupSpawner pickup=usemetapickup position="-25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+ <PickupSpawner pickup=dropmetapickup position="0,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+ <PickupSpawner pickup=destroymetapickup position="25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+ <PickupSpawner pickup=destroycarriermetapickup position="50,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" />
+
+ <!-- Drone pickup -->
+ <PickupSpawner pickup=dronepickup position="-25,100,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" />
+
+
+ <!-- @Objects: 4 boxes (uncontrolled pawns) Trying to understand the pickup generation-->
+ <Pawn team=1 health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 4" >
+ <events>
+ <visibility>
+ <EventListener event="flying4" />
+ </visibility>
+ </events>
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+ </collisionShapes>
+
+ </Pawn>
+
+ <!----Just a box with different mesh-->
+ <Pawn team=1 health=50 position="0,1000,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Globi Asteroid" >
+ <events>
+ <visibility>
+ <EventListener event="flying4" />
+
+ </visibility>
+ </events>
+ <attached>
+ <Model position="0,0,0" mesh="ast4.mesh" scale3D="3,3,3" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+ </collisionShapes>
+ </Pawn>
+
+
+ <!-- AsteroidMinable -->
+ <AsteroidMinable size=15 position="0,-500,0" />
+ <AsteroidMinable size=5 position="100,-500,100" />
+ <AsteroidMinable size=50 position="500,-500, 500" />
+ <AsteroidMinable size=30 position="-100, -500, -100" velocity= "0, -30, 0"/>
+
+ <!-- SpicedAsteroidField -->
+ <SpicedAsteroidField count=30 mDensity= 0.5 maxSize=40 minSize=1 position="5000, 0, 0" radius=1000 velocity="0,0,0"/>
+
+
+ <!-- Asteroid Belt with a planet -->
+
+ <SpicedAsteroidBelt position="-15000,0,0" mDensity=0.3 segments=50 minSize=1 maxSize=50 radius0=7190 radius1 = 7800 count=250 tiltBy=0.5 tiltAt=0/>
+ <Planet
+ position="-15000,0,0"
+ scale="5000"
+ collisionType="dynamic"
+ linearDamping="0.8"
+ angularDamping="0"
+ mass="10000000"
+ pitch="0"
+ mesh="planets/muunilinst.mesh"
+ atmosphere="atmosphere1"
+ rotationaxis="1,0,0"
+ rotationrate="1.0"
+ atmospheresize="80.0f"
+ imagesize="1024.0f"
+ collisiondamage = 2
+ enablecollisiondamage = true
+ >
+ <attached>
+ <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="5000" position="0,0,0" />
+ </collisionShapes>
+ </Planet>
+
+
+
+
+ </Scene>
+</Level>
Modified: code/branches/Presentation_HS17/src/modules/CMakeLists.txt
===================================================================
--- code/branches/Presentation_HS17/src/modules/CMakeLists.txt 2017-12-16 11:24:20 UTC (rev 11678)
+++ code/branches/Presentation_HS17/src/modules/CMakeLists.txt 2017-12-16 11:52:32 UTC (rev 11679)
@@ -25,6 +25,7 @@
################ Sub Directories ################
+ADD_SUBDIRECTORY(asteroidmining)
ADD_SUBDIRECTORY(dialogue)
ADD_SUBDIRECTORY(designtools)
ADD_SUBDIRECTORY(gametypes)
Modified: code/branches/Presentation_HS17/src/modules/pickup/Pickup.h
===================================================================
--- code/branches/Presentation_HS17/src/modules/pickup/Pickup.h 2017-12-16 11:24:20 UTC (rev 11678)
+++ code/branches/Presentation_HS17/src/modules/pickup/Pickup.h 2017-12-16 11:52:32 UTC (rev 11679)
@@ -144,9 +144,12 @@
virtual void changedPickedUp(void) override; //!< Should be called when the pickup has transited from picked up to dropped or the other way around.
- protected:
+
virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.
+
+ protected:
+
/**
@brief Sets the representation name which refers to the name of the PickupRepresentation that is used to represent this pickup.
*/
Modified: code/branches/Presentation_HS17/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/branches/Presentation_HS17/src/modules/pickup/PickupSpawner.cc 2017-12-16 11:24:20 UTC (rev 11678)
+++ code/branches/Presentation_HS17/src/modules/pickup/PickupSpawner.cc 2017-12-16 11:52:32 UTC (rev 11679)
@@ -157,9 +157,12 @@
// Iterate trough all Pawns.
for(Pawn* pawn : ObjectList<Pawn>())
{
- if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).
+ // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute). 2nd condition prevents a possible error in isTarget(...) below.
+ if(spawner == nullptr || this->pickup_ == nullptr)
break;
+ if(!(pawn->doesAcceptPickups())){continue;} // skip those pawns, e.g. AsteroidMinables.
+
Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition();
PickupCarrier* carrier = static_cast<PickupCarrier*>(pawn);
// If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked.
Modified: code/branches/Presentation_HS17/src/modules/pickup/PickupSpawner.h
===================================================================
--- code/branches/Presentation_HS17/src/modules/pickup/PickupSpawner.h 2017-12-16 11:24:20 UTC (rev 11678)
+++ code/branches/Presentation_HS17/src/modules/pickup/PickupSpawner.h 2017-12-16 11:52:32 UTC (rev 11679)
@@ -113,6 +113,14 @@
inline Template* getPickupTemplate() const
{return this->pickupTemplate_; }
+
+ void setPickupTemplateName(const std::string& name);
+ void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items.
+
+ inline void setRespawnTime(float time)
+ { this->respawnTime_ = time; }
+
+
private:
void initialize(void);
@@ -140,12 +148,9 @@
@brief Set the time to respawn.
@param time New time after which this gets re-actived.
*/
- inline void setRespawnTime(float time)
- { this->respawnTime_ = time; }
- void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items.
- void setPickupTemplateName(const std::string& name);
+
void setPickupTemplate(Template* temp);
Pickupable* createPickup(void); //!< Creates a new Pickupable.
Modified: code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.cc 2017-12-16 11:24:20 UTC (rev 11678)
+++ code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.cc 2017-12-16 11:52:32 UTC (rev 11679)
@@ -83,6 +83,7 @@
// set damage multiplier to default value 1, meaning nominal damage
this->damageMultiplier_ = 1;
+ this->acceptsPickups_ = true;
this->spawnparticleduration_ = 3.0f;
Modified: code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.h 2017-12-16 11:24:20 UTC (rev 11678)
+++ code/branches/Presentation_HS17/src/orxonox/worldentities/pawns/Pawn.h 2017-12-16 11:52:32 UTC (rev 11679)
@@ -198,6 +198,11 @@
inline float getDamageMultiplier() const
{ return this->damageMultiplier_; }
+ // Some pawns can-t harvest pickups (e.g. AsteroidMinables). Checked in PickupSpawner.
+ inline void setPickupAcceptance(bool b)
+ { this->acceptsPickups_ = b; }
+ inline bool doesAcceptPickups()
+ { return this->acceptsPickups_;}
virtual void startLocalHumanControl() override;
@@ -217,8 +222,10 @@
inline const WeaponSystem* getWeaponSystem() const
{ return this->weaponSystem_; }
- static void consoleCommand_debugDrawWeapons(bool bDraw);
+ static void consoleCommand_debugDrawWeapons(bool bDraw);
+
+
protected:
virtual void preDestroy() override;
@@ -255,6 +262,7 @@
float shieldRechargeWaitCountdown_;
float damageMultiplier_; ///< Used by the Damage Boost Pickup.
+ bool acceptsPickups_; // Added for the asteroidMinable class, avoid that they attempt to grab the resources
WeakPtr<Pawn> lastHitOriginator_;
More information about the Orxonox-commit
mailing list