Exemple #1
0
bool IMovable::mainMove()
{
    auto new_owner = owner->GetNeighbour(dMove);
    if (new_owner == owner)
        return false;

    owner->RemoveItem(GetId());
    new_owner->AddItem(GetId());

    if(new_owner->IsVisibleByPlayer())
    {
        Move* eff = EffectFabricOf<Move>::getEffectOf();
        eff->Init(TITLE_SIZE, dMove, pixSpeed, GetId(), true);
        eff->Start();
    }

    if (   GetMob().ret_id() == GetId()
        || Contains(GetMob()))
    {
        GetManager().checkMove(dMove);
        GetManager().UpdateVisible();
    }

    lastMove = static_cast<int>(MAIN_TICK);
    return true;
};
Exemple #2
0
bool Ghost::IsMobGhost()
{
    static size_t mob_id = 0;
    static bool draw = true;
    if (!GetMob())
        return false;
    if (mob_id != GetMob().ret_id())
    {
        if (id_ptr_on<Ghost> g = GetMob())
            draw = true;
        else
            draw = false;
        mob_id = GetMob().ret_id();
    }
    return draw;
}
Exemple #3
0
void IMob::ProcessPhysics()
{
    IMessageReceiver::ProcessPhysics();
    if(GetId() == GetMob().ret_id())
    {
        GetGame().UpdateVisible();
    }
}
Exemple #4
0
void Ghost::Process()
{
    --seconds_until_respawn_;
    if (seconds_until_respawn_ < 0)
    {
        size_t net_id = GetFactory().GetNetId(GetId());
        if (net_id)
        {
            auto login_mob = GetFactory().Create<IMob>(LoginMob::T_ITEM_S());

            GetFactory().SetPlayerId(net_id, login_mob.ret_id());
            if (GetId() == GetMob().ret_id())
            {
                ChangeMob(login_mob);
            }
            delThis();
            //qDebug() << "Ghost deleted: net_id: " << net_id;
        }
    }
}
Exemple #5
0
void Chat::PostTextFor(const std::string& str, id_ptr_on<IOnMapObject> owner)
{
    if (GetMob() == owner)
        PostText(str);
}