void DroidStimpackModuleDataComponent::addToStack(BaseDroidModuleComponent* other) {
    DroidStimpackModuleDataComponent* otherModule = cast<DroidStimpackModuleDataComponent*>(other);
    if(otherModule == NULL)
        return;
    speed = speed + otherModule->speed;
    capacity = capacity + otherModule->capacity;
    DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
    if (droidComponent != NULL) {
        droidComponent->changeAttributeValue("stimpack_capacity",(float)capacity);
        droidComponent->changeAttributeValue("stimpack_speed",(float)speed);
    }
}
void DroidDetonationModuleDataComponent::addToStack(BaseDroidModuleComponent* other) {
	DroidDetonationModuleDataComponent* otherModule = cast<DroidDetonationModuleDataComponent*>(other);
	if (otherModule == NULL)
		return;

	rating = rating + otherModule->rating;
	moduleCount += 1;

	DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
	if (droidComponent != NULL) {
		droidComponent->changeAttributeValue("bomb_level", (float)rating);
		droidComponent->changeAttributeValue("module_count", (float)moduleCount);
	}
}
void DroidMaintenanceModuleDataComponent::addToStack(BaseDroidModuleComponent* other){

	DroidMaintenanceModuleDataComponent* otherModule = cast<DroidMaintenanceModuleDataComponent*>(other);
	if( otherModule == NULL )
		return;

	// Maintenance modules do not stack.  Just keep the highest rated module
	if( otherModule->moduleRating > moduleRating )
		moduleRating = otherModule->moduleRating;

	// Save stat in parent sceno
	DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
	if (droidComponent == NULL)
		return;

	// Attribute should have already been created in copy method
	if( !droidComponent->changeAttributeValue( "struct_module", moduleRating) ){
		info( "addToStack updateAttributeValue failed");
		return;
	}

	if (moduleRating < 6) {
		maxStructures = 3;
	} else if (moduleRating < 12) {
		maxStructures = 6;
	} else if (moduleRating < 15) {
		maxStructures = 9;
	} else {
		maxStructures = 10;
	}

}
void DroidHarvestModuleDataComponent::addToStack(BaseDroidModuleComponent* other){

	DroidHarvestModuleDataComponent* otherModule = cast<DroidHarvestModuleDataComponent*>(other);
	if( otherModule == NULL )
		return;

	harvestBonus = harvestBonus + otherModule->harvestBonus;

	// Save stat in parent sceno
	DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
	if (droidComponent == NULL)
		return;
	droidComponent->changeAttributeValue( "harvest_power", harvestBonus);

}
void DroidArmorModuleDataComponent::addToStack(BaseDroidModuleComponent* other) {

	DroidArmorModuleDataComponent* otherModule = cast<DroidArmorModuleDataComponent*>(other);
	if (otherModule == NULL)
		return;

	armorModule = armorModule + otherModule->armorModule;

	// Save stat in parent sceno
	DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
	if (droidComponent == NULL)
		return;

	// Attribute should have already been created in copy method
	if (!droidComponent->changeAttributeValue( "armor_module", armorModule)) {
		info( "addToStack updateAttributeValue failed");
		return;
	}
}
void DroidDetonationModuleDataComponent::initialize(DroidObject* droid) {
	if (droid->getSpecies() == DroidObject::MSE) {
		mseDroid = true;
	}

	// ensure state on init
	started = false;
	initialized = false;

	DroidComponent* droidComponent = cast<DroidComponent*>(getParent());
	if (droidComponent == NULL) {
		info("droidComponent was null");
		return;
	}

	if (droidComponent->hasKey("module_init")) {
		droidComponent->changeAttributeValue("module_init", (float)0);
	} else {
		droidComponent->addProperty("module_init", 0, 0, "hidden", true);
	}
}