mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-08-20 09:57:09 +00:00
Merge remote-tracking branch 'origin/main' into experimental
Some checks are pending
Nightly Release / Build Client (push) Waiting to run
Nightly Release / Build Server (push) Waiting to run
Nightly Release / Release Server (push) Blocked by required conditions
Nightly Release / Release Client (push) Blocked by required conditions
Nightly Release / cleanup (push) Blocked by required conditions
Some checks are pending
Nightly Release / Build Client (push) Waiting to run
Nightly Release / Build Server (push) Waiting to run
Nightly Release / Release Server (push) Blocked by required conditions
Nightly Release / Release Client (push) Blocked by required conditions
Nightly Release / cleanup (push) Blocked by required conditions
This commit is contained in:
commit
157fdbefde
|
|
@ -26,6 +26,7 @@ void Creeper::_init()
|
||||||
oldSwell = 0;
|
oldSwell = 0;
|
||||||
maxSwell = 30;
|
maxSwell = 30;
|
||||||
explosionRadius = 3;
|
explosionRadius = 3;
|
||||||
|
ignited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creeper::Creeper(Level *level) : Monster( level )
|
Creeper::Creeper(Level *level) : Monster( level )
|
||||||
|
|
@ -190,3 +191,38 @@ void Creeper::thunderHit(const LightningBolt *lightningBolt)
|
||||||
Monster::thunderHit(lightningBolt);
|
Monster::thunderHit(lightningBolt);
|
||||||
entityData->set(DATA_IS_POWERED, static_cast<byte>(1));
|
entityData->set(DATA_IS_POWERED, static_cast<byte>(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Creeper::Ignite()
|
||||||
|
{
|
||||||
|
setSwellDir(1);
|
||||||
|
ignited = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Creeper::isIgnited()
|
||||||
|
{
|
||||||
|
return ignited;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Creeper::mobInteract(shared_ptr<Player> player)
|
||||||
|
{
|
||||||
|
shared_ptr<ItemInstance> item = player->inventory->getSelected();
|
||||||
|
|
||||||
|
if (item == nullptr || item->id != Item::flintAndSteel_Id)
|
||||||
|
return Mob::mobInteract(player);
|
||||||
|
|
||||||
|
playSound(eSoundType_FIRE_NEWIGNITE, 1, random->nextFloat() * 0.4f + 0.8f);
|
||||||
|
player->swing();
|
||||||
|
|
||||||
|
if (!level->isClientSide)
|
||||||
|
{
|
||||||
|
if (!isIgnited())
|
||||||
|
{
|
||||||
|
Ignite();
|
||||||
|
item->hurtAndBreak(1, player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return Mob::mobInteract(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ private:
|
||||||
int maxSwell;
|
int maxSwell;
|
||||||
int explosionRadius;
|
int explosionRadius;
|
||||||
|
|
||||||
|
bool ignited;
|
||||||
|
|
||||||
void _init();
|
void _init();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -34,6 +36,8 @@ public:
|
||||||
|
|
||||||
virtual int getMaxFallDistance();
|
virtual int getMaxFallDistance();
|
||||||
|
|
||||||
|
virtual bool mobInteract(shared_ptr<Player> player);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void causeFallDamage(float distance);
|
virtual void causeFallDamage(float distance);
|
||||||
virtual void defineSynchedData();
|
virtual void defineSynchedData();
|
||||||
|
|
@ -61,5 +65,9 @@ protected:
|
||||||
public:
|
public:
|
||||||
int getSwellDir();
|
int getSwellDir();
|
||||||
void setSwellDir(int dir);
|
void setSwellDir(int dir);
|
||||||
void thunderHit(const LightningBolt *lightningBolt) ;
|
void thunderHit(const LightningBolt *lightningBolt);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Ignite();
|
||||||
|
bool isIgnited();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,12 @@ void SwellGoal::stop()
|
||||||
|
|
||||||
void SwellGoal::tick()
|
void SwellGoal::tick()
|
||||||
{
|
{
|
||||||
|
if(creeper->isIgnited())
|
||||||
|
{
|
||||||
|
creeper->setSwellDir(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (target.lock() == nullptr)
|
if (target.lock() == nullptr)
|
||||||
{
|
{
|
||||||
creeper->setSwellDir(-1);
|
creeper->setSwellDir(-1);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue