I think it's a ripoff system anyway... Committers get 1percent of deposited coins, which means they keep 99pct. So for each project they will always keep the biggest part of the coins :/
(11-14-2013, 06:33 PM)xoft Wrote: [ -> ]It seems that the loop is not working - the BTC is gone from me, but it's not been added to the project. What a black hole! >=[
How strange. There's a forum post on the bitcoin forums where you could complain I think.
Here it is.
I'm trying to make other wolves attack players when a wolf is attacked by a player, but I need to convert an cEntity to an cMonster in order to use GetMobType(). This is the code I use:
class cCallback :
public cEntityCallback
{
virtual bool Item(cEntity * a_Entity) override
{
if (a_Entity->IsMob())
{
if (a_Entity->GetMobType() == cMonster::mtWolf)
{
double Distance = (a_Entity->GetPosition() - ThisWolfPos).Length();
if (Distance < 20)
{
}
}
}
return false;
}
public:
Vector3f ThisWolfPos = GetPosition();
} Callback; Callback;
You missed a * in there, it's a pointer.
Y think you can check mob type directly in cEntity. Use Entity:GetClass(). It returns cPickup and entity tipe but if its a mob it returns cWolf, cCreeper...
(11-15-2013, 05:46 AM)bearbin Wrote: [ -> ]How strange. There's a forum post on the bitcoin forums where you could complain I think.
Here it is.
I tried registering there, but it didn't work - it said my password is too short and when I tried again, it said I'm already registered, but the login didn't work and registering for a different account said I need to wait 45 minutes. Not gonna bother anymore.
(11-15-2013, 04:10 PM)tonibm19 Wrote: [ -> ]Y think you can check mob type directly in cEntity. Use Entity:GetClass(). It returns cPickup and entity tipe but if its a mob it returns cWolf, cCreeper...
Not good - that's comparing strings, which is order of magnitude slower than comparing enums, even with the double step.
Probably the best code to check if an entity is a specific mob type currently is (if a_Entity is a cEntity *):
if (a_Entity->IsMob() && (((cMonster *)a_Entity)->GetMonsterType() == cMonster::mtWolf))
or if a_Entity is a const cEntity &, then:
if (a_Entity.IsMob() && (((const cMonster &)a_Entity).GetMonsterType() == cMonster::mtWolf))
That works,

Now I need to have a variable with the current wolfs coordinates and the Players cEntity object in the callback. Any idea how to do that?
Don't wolves attack *all* players when they are aggravated? So just flipping their "IsAngry" flag should be enough.
I expect a code like this should work (written from the top of my head, may not compile):
function cWolf::DoTakeDamage(TakeDamageInfo & a_TDI)
{
super:DoTakeDamage(a_TDI);
if (m_IsTame)
{
// No aggravating for tame wolves
return;
}
if (a_TDI.DamageType != dtAttack)
{
// Not attacked by a player, bail out
// TODO: projectiles use dtRangedAttack with a projectile entity in the Attacker field, handle that too
return;
}
ASSERT(a_TDI.Attacker != NULL);
class cCallback : public cEntityCallback
{
public:
Vector3f m_AttackerPos;
cCallback(const Vector3f & a_AttackerPos) : m_AttackerPos(a_AttackerPos) {}
virtual bool OnEntity(cEntity & a_Entity) override
{
// AGGRAVATE_RANGE is the range in blocks in which the wolves become angry; define that constant at the top of Wolf.cpp as static const double
if (a_Entity.IsMob() && (((cMonster &)a_Entity).GetMobType() == mtWolf) && ((a_Entity.GetPos() - m_AttackerPos).SqrLength() < AGGRAVATE_RANGE * AGGRAVATE_RANGE))
{
((cWolf &)a_Entity).SetAngry(true);
}
return false;
}
} Callback(a_TDI.Attacker.GetPos());
m_World->ForEachEntity(Callback);
}
A little deviantion from redstone again: I need halp too, this time on saving mobs
// This code crashes:
void cWSSAnvil::LoadSlimeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
int SizeIdx = a_NBT.FindChildByName(a_TagIdx, "Size");
if (SizeIdx < 0) { return; }
int Size = a_NBT.GetInt(SizeIdx);
cMonster * Monster = NULL;
Monster = new cSlime(Size);
if (!LoadEntityBaseFromNBT(((cEntity &)Monster), a_NBT, a_TagIdx))
{
return;
}
a_Entities.push_back(Monster);
}
//////////////////////////
// This code does too (with a deadlock):
void cWSSAnvil::LoadSkeletonFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "SkeletonType");
if (TypeIdx < 0) { return; }
bool Type = ((a_NBT.GetByte(TypeIdx) == 1) ? true : false);
std::auto_ptr<cSkeleton> Monster(new cSkeleton(Type));
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;
}
a_Entities.push_back(Monster.release());
}
What exactly should I do here to make mobs spawn?