[Orxonox-commit 6927] r11548 - code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns
remartin at orxonox.net
remartin at orxonox.net
Mon Nov 6 17:11:38 CET 2017
Author: remartin
Date: 2017-11-06 17:11:38 +0100 (Mon, 06 Nov 2017)
New Revision: 11548
Removed:
code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.cc
code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.h
Log:
Deleted: code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.cc 2017-11-06 16:06:16 UTC (rev 11547)
+++ code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.cc 2017-11-06 16:11:38 UTC (rev 11548)
@@ -1,243 +0,0 @@
-/*
- * 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"
-#include "pickup/items/HealthPickup.h"
-#include "pickup/PickupSpawner.h"
-#include "pickup/Pickup.h"
-
-namespace orxonox
-{
- RegisterClass(AsteroidMinable);
-
- AsteroidMinable::AsteroidMinable(Context* context) : Pawn(context)
- {
- RegisterObject(AsteroidMinable);
- this->setRadarObjectColour(ColourValue(1.0f, 1.0f, 0.0f, 1.0f));
- this->setRadarObjectShape(RadarViewable::Shape::Dot);
-
- this->generateSmaller = true;
- this->size = 5;
- this->context = context;
-
-
-
- // <Model position="0,-40,40" yaw="90" pitch="-90" roll="0" scale="4" mesh="ast6.mesh" />
-
-
- }
-
- AsteroidMinable::~AsteroidMinable()
- {
-
- }
-
- void AsteroidMinable::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(AsteroidMinable, XMLPort, xmlelement, mode);
- // XMLPortParam(PickupSpawner, "pickup", setPickupTemplateName, getPickupTemplateName, xmlelement, mode);
- XMLPortParam(AsteroidMinable, "size", setSize,getSize, 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::setSize(float s){
- this->size = s;
- this->health_ = 200*s;
- }
-
- float AsteroidMinable::getSize(){
- return this->size;
- }
-
- void AsteroidMinable::death() //ueberschreiben
- {
- this->setHealth(1);
-
-
-
- // Spawn Pickup
- HealthPickup* hP = new HealthPickup(context);
- //OFFEN: Add custom pickup 'resources'
- PickupSpawner* thingy = new PickupSpawner(context);
- thingy->createDroppedPickup(context, hP, nullptr, 10);
-// /*static*/ PickupSpawner* PickupSpawner::createDroppedPickup(Context* context, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance)
-
-
-
- if(this->generateSmaller){
- this->spawnChildren();
- }
-
-
-
- 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 AsteroidMinable::spawnChildren(){
- // Spawn smaller Children
- int massRem = this->size-1; //some mass is lost
- int num = round(massRem*rand()); // random number of children
- massRem = massRem-num;
- int extra = 0;
- for(int fisch=num; fisch>=1; fisch++){
- // to distribute remaining mass
- if(fisch==1){
- extra = massRem;
- }else{
- extra = round(massRem*rand());
- massRem = massRem-extra;
- }
- //Spawn this child
- AsteroidMinable* child = new AsteroidMinable(context);
- child->setSize(extra + 1);
-
- //OFFEN:Kollision der Kinder verhindern
- //Relativ zu Elternteil automatisch?
- //Typ position:rand()*Vektoriwas?
- // pawn->getWorldPosition() + Vector3(30,0,-30);
- child->setPosition(this->getCarrierPosition());
- }
-}
-
-
-
-
-}
-
-
-
-
-
-/*
- 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
Deleted: code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.h 2017-11-06 16:06:16 UTC (rev 11547)
+++ code/branches/AsteroidMining_HS17/src/orxonox/worldentities/pawns/AsteroidMinable.h 2017-11-06 16:11:38 UTC (rev 11548)
@@ -1,82 +0,0 @@
-/*
- * 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);
- virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
- virtual void tick(float dt) override;
-
- virtual void setSize(float f);
- virtual float getSize();
-
-
- protected:
- // Da neue Argumente reinstellen
- float asteroidVersion; // Bodenstrich-Konvention?,
- // Wert zwischen 1 und 6 (Spezialdinger?), die Mesh-Form
- float size;
- bool generateSmaller;
- virtual void death();
-
-
-
- private:
- void registerVariables();
- virtual void spawnChildren();
-
- Context* context;
-
-
- }; // tolua_export
-} // tolua_export
-
-#endif /* _AsteroidMinable_H__ */
More information about the Orxonox-commit
mailing list