[Orxonox-commit 6887] r11508 - in code/branches/AsteroidMining_HS17: data/levels src/orxonox/worldentities/pawns
remartin at orxonox.net
remartin at orxonox.net
Mon Oct 23 16:13:00 CEST 2017
Author: remartin
Date: 2017-10-23 16:13:00 +0200 (Mon, 23 Oct 2017)
New Revision: 11508
Added:
code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.cc
code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.h
Modified:
code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw
code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/CMakeLists.txt
Log:
Started cobbling together the class 'AsteroidMining'. Adapted the mesh of a crate in AsteroidFarming.oxw -> destructible asteroid!
Modified: code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw
===================================================================
--- code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw 2017-10-23 14:12:10 UTC (rev 11507)
+++ code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw 2017-10-23 14:13:00 UTC (rev 11508)
@@ -55,7 +55,39 @@
<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>
+
+ <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>
+
+
+
+
</Scene>
</Level>
-
- <!-- Boxes = Pawns-->
\ No newline at end of file
Added: code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.cc (rev 0)
+++ code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.cc 2017-10-23 14:13:00 UTC (rev 11508)
@@ -0,0 +1,183 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * Simon Miescher
+ *
+ */
+
+/*
+*
+*
+* An asteroid which can be destroyed. Some smaller asteroids are created and a pickup
+* spawns.
+*
+*
+*
+
+*/
+
+
+#include "Pawn.h"
+#include "AsteroidMinable.h"
+
+
+#include <algorithm>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/XMLPort.h"
+#include "core/EventIncludes.h"
+#include "network/NetworkFunction.h"
+
+#include "infos/PlayerInfo.h"
+#include "controllers/Controller.h"
+#include "gametypes/Gametype.h"
+#include "graphics/ParticleSpawner.h"
+#include "worldentities/ExplosionChunk.h"
+#include "worldentities/ExplosionPart.h"
+#include "weaponsystem/WeaponSystem.h"
+#include "weaponsystem/WeaponSlot.h"
+#include "weaponsystem/WeaponPack.h"
+#include "weaponsystem/WeaponSet.h"
+#include "weaponsystem/Munition.h"
+#include "sound/WorldSound.h"
+#include "core/object/ObjectListIterator.h"
+
+#include "controllers/FormationController.h"
+
+namespace orxonox
+{
+ RegisterClass(AsteroidMinable);
+
+ AsteroidMinable::AsteroidMinable(Context* context) : Pawn(context)
+ {
+ RegisterObject(AsteroidMinable);
+
+ this->bAlive_ = true;
+ this->bVulnerable_ = true;
+
+ this->health_ = 0;
+ this->maxHealth_ = 0;
+ this->initialHealth_ = 0;
+
+ this->damageMultiplier_ = 1;
+
+ this->spawnparticleduration_ = 3.0f;
+
+ this->aimPosition_ = Vector3::ZERO;
+
+ this->setRadarObjectColour(ColourValue::Yellow);
+ this->setRadarObjectShape(RadarViewable::Shape::Dot);
+
+ }
+
+ AsteroidMinable::~AsteroidMinable()
+ {
+
+ }
+
+ void AsteroidMinable::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(AsteroidMinable, XMLPort, xmlelement, mode);
+ }
+
+ void AsteroidMinable::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(AsteroidMinable, XMLEventPort, xmlelement, mode);
+
+ XMLPortEventState(AsteroidMinable, BaseObject, "vulnerability", setVulnerable, xmlelement, mode);
+ }
+
+ void AsteroidMinable::registerVariables()
+ {
+ registerVariable(this->bAlive_, VariableDirection::ToClient);
+ registerVariable(this->bVulnerable_, VariableDirection::ToClient);
+ registerVariable(this->health_, VariableDirection::ToClient);
+ registerVariable(this->maxHealth_, VariableDirection::ToClient);
+ }
+
+ void AsteroidMinable::tick(float dt)
+ {
+ SUPER(Pawn, tick, dt);
+
+ }
+
+ void AsteroidMinable::death() //ueberschreiben
+ {
+ this->setHealth(1);
+ if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
+ {
+ // Set bAlive_ to false and wait for destroyLater() to do the destruction
+ this->bAlive_ = false;
+ this->destroyLater();
+
+ this->setDestroyWhenPlayerLeft(false);
+
+ }
+ }
+
+}
+
+
+
+/*
+ void DronePickup::changedUsed(void)
+ {
+ SUPER(DronePickup, changedUsed);
+
+ // If the pickup has transited to used.
+ if(this->isUsed())
+ {
+
+ Pawn* pawn = this->carrierToPawnHelper();
+ if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
+ this->Pickupable::destroy();
+
+ //Attach to pawn
+ Drone* drone = new Drone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
+ drone->addTemplate(this->getDroneTemplate());
+
+ Controller* controller = drone->getController();
+ DroneController* droneController = orxonox_cast<DroneController*>(controller);
+ if(droneController != nullptr)
+ {
+ droneController->setOwner(pawn);
+ }
+
+ Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30);
+ drone->setPosition(spawnPosition);
+
+ // The pickup has been used up.
+ this->setUsed(false);
+ }
+ else
+ {
+ // If either the pickup can only be used once or it is continuous and used up, it is destroyed upon setting it to unused.
+ if(this->isOnce() || (this->isContinuous() ))
+ {
+ this->Pickupable::destroy();
+ }
+ }
+ }
+*/
\ No newline at end of file
Added: code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.h (rev 0)
+++ code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.h 2017-10-23 14:13:00 UTC (rev 11508)
@@ -0,0 +1,69 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _AsteroidMinable_H__
+#define _AsteroidMinable_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <string>
+#include <vector>
+#include "interfaces/PickupCarrier.h"
+#include "interfaces/RadarViewable.h"
+#include "worldentities/ControllableEntity.h"
+#include "worldentities/ExplosionPart.h"
+
+#include "Pawn.h"
+
+namespace orxonox // tolua_export
+{
+
+
+ // tolua_export
+ class _OrxonoxExport AsteroidMinable : public Pawn
+ { // tolua_export
+
+ public:
+ AsteroidMinable(Context* context);
+ virtual ~AsteroidMinable();
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ protected:
+ // Da neue Argumente reinstellen
+ float asteroidVersion; // Bodenstrich-Konvention?,
+ // Wert zwischen 1 und 6 (Spezialdinger?), die Mesh-Form
+ float asteroidSize;
+ bool generateSmaller;
+
+ private:
+
+
+ }; // tolua_export
+} // tolua_export
+
+#endif /* _AsteroidMinable_H__ */
Modified: code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/CMakeLists.txt
===================================================================
--- code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/CMakeLists.txt 2017-10-23 14:12:10 UTC (rev 11507)
+++ code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/CMakeLists.txt 2017-10-23 14:13:00 UTC (rev 11508)
@@ -6,4 +6,5 @@
ModularSpaceShip.cc
TeamBaseMatchBase.cc
Destroyer.cc
+ AsteroidMinable.cc
)
More information about the Orxonox-commit
mailing list