Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 11, 2018, 10:31:46 PM (7 years ago)
Author:
landauf
Message:

[AsteroidMining_HS17] some cleanup - Field and Belt should not depend on Pawn, should not be synchronized either (server-side logic). also removed additional constructors and replaced with regular setters.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Presentation_HS17_merge/src/modules/asteroidmining/SpicedAsteroidField.cc

    r11735 r11736  
    4040
    4141
    42 #include "../../orxonox/worldentities/pawns/Pawn.h"
    43 #include "../../orxonox/worldentities/WorldEntity.h"
    44 
    4542#include "SpicedAsteroidField.h"
    4643#include "AsteroidMinable.h"
     
    4946
    5047#include "core/CoreIncludes.h"
    51 #include "core/GameMode.h"
    5248#include "core/XMLPort.h"
    53 #include "core/EventIncludes.h"
    54 #include "network/NetworkFunction.h"
    5549#include "util/Math.h"
    5650
    57 #include "../../orxonox/graphics/Billboard.h"
     51#include "graphics/Billboard.h"
    5852
    5953
     
    6256    RegisterClass(SpicedAsteroidField);
    6357
    64     SpicedAsteroidField::SpicedAsteroidField(Context* context) : Pawn(context) {
     58    SpicedAsteroidField::SpicedAsteroidField(Context* context) : BaseObject(context) {
    6559
    6660        RegisterObject(SpicedAsteroidField);
    67         this->context = context;
    6861
    6962        // Default Values:
     
    7669        this->foggy = true;
    7770        this->fogDensity = 0.5;
    78 
    79         this->registerVariables();
    8071    }
    81 
    82     SpicedAsteroidField::SpicedAsteroidField(Context* c, Vector3 p, int minS, int maxS, int w, int count, bool f, float mD, float fD): Pawn(c){
    83 
    84         this->context = c;
    85         this->position = p;
    86         this->minSize = minS;
    87         this->maxSize = maxS;
    88         this->radius = w;
    89         this->count = count;
    90         this->foggy = f;
    91 
    92         this->mDensity = mD;
    93         this->fogDensity = fD;
    94 
    95     }
    96 
    9772
    9873    SpicedAsteroidField::~SpicedAsteroidField(){
     
    10984        for(int gertrud = 0; gertrud<count; ++gertrud){
    11085
    111             AsteroidMinable* a = new AsteroidMinable(this->context);
     86            AsteroidMinable* a = new AsteroidMinable(this->getContext());
    11287
    11388            size = round(rnd()*(this->maxSize - this->minSize)) + this->minSize;
     
    12196
    12297            bool spiced = (rnd() < (this->mDensity)); // Whether the asteroid does drop pickups etc.
    123             a->toggleDropStuff(spiced);
    124            
    125             a->setVelocity(this->getVelocity());
     98            a->setDropStuff(spiced);
    12699           
    127100            // Fog is iplemented with billboards (as in asteroidField.lua, that bloke had the idea)
    128101            if(this->foggy && mod(gertrud, 5) == 0){
    129                 Billboard* bb = new Billboard(this->context);
     102                Billboard* bb = new Billboard(this->getContext());
    130103                bb->setPosition(this->position + relPos);
    131104                bb->setMaterial("Smoke/Smoke");
     
    151124    }
    152125
    153 
    154     void SpicedAsteroidField::XMLEventPort(Element& xmlelement, XMLPort::Mode mode){
    155 
    156     }
    157 
    158     void SpicedAsteroidField::registerVariables(){
    159 
    160         registerVariable(this->count, VariableDirection::ToClient);
    161         registerVariable(this->mDensity, VariableDirection::ToClient);
    162         registerVariable(this->position, VariableDirection::ToClient);
    163         registerVariable(this->maxSize, VariableDirection::ToClient);
    164         registerVariable(this->minSize, VariableDirection::ToClient);
    165         registerVariable(this->radius, VariableDirection::ToClient);
    166         registerVariable(this->foggy, VariableDirection::ToClient);
    167         registerVariable(this->fogDensity, VariableDirection::ToClient);
    168 
    169     }
    170 
    171126    void SpicedAsteroidField::tick(float dt){
    172127
    173128        this->create();
    174         this->bAlive_ = false;
    175129        this->destroyLater();
    176130    }
Note: See TracChangeset for help on using the changeset viewer.