* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a4399472.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#include "stdafx.h"
|
|
|
|
#include "AbstractProjectileDispenseBehavior.h"
|
|
#include "DispenserTile.h"
|
|
#include "Projectile.h"
|
|
#include "Level.h"
|
|
#include "LevelEvent.h"
|
|
#include "ItemInstance.h"
|
|
|
|
shared_ptr<ItemInstance> AbstractProjectileDispenseBehavior::execute(BlockSource *source, shared_ptr<ItemInstance> dispensed, eOUTCOME &outcome)
|
|
{
|
|
Level *world = source->getWorld();
|
|
if ( world->countInstanceOf(eTYPE_PROJECTILE, false) >= Level::MAX_DISPENSABLE_PROJECTILES )
|
|
{
|
|
return DefaultDispenseItemBehavior::execute(source, dispensed, outcome);
|
|
}
|
|
|
|
Position *position = DispenserTile::getDispensePosition(source);
|
|
FacingEnum *facing = DispenserTile::getFacing(source->getData());
|
|
|
|
shared_ptr<Projectile> projectile = getProjectile(world, position);
|
|
|
|
delete position;
|
|
|
|
projectile->shoot(facing->getStepX(), facing->getStepY() + .1f, facing->getStepZ(), getPower(), getUncertainty());
|
|
world->addEntity(dynamic_pointer_cast<Entity>(projectile));
|
|
|
|
dispensed->remove(1);
|
|
return dispensed;
|
|
}
|
|
|
|
void AbstractProjectileDispenseBehavior::playSound(BlockSource *source, eOUTCOME outcome)
|
|
{
|
|
if (outcome != LEFT_ITEM)
|
|
{
|
|
source->getWorld()->levelEvent(LevelEvent::SOUND_LAUNCH, source->getBlockX(), source->getBlockY(), source->getBlockZ(), 0);
|
|
}
|
|
}
|
|
|
|
float AbstractProjectileDispenseBehavior::getUncertainty()
|
|
{
|
|
return 6.0f;
|
|
}
|
|
|
|
float AbstractProjectileDispenseBehavior::getPower()
|
|
{
|
|
return 1.1f;
|
|
}
|