Ejemplo n.º 1
0
    void Clothing::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
    {
        // TODO: add option somewhere to enable collision for placeable objects

        /*
            Start of tes3mp addition

            Make it possible to enable collision for this object class from a packet
        */
        if (!model.empty())
        {
            mwmp::BaseWorldstate *worldstate = mwmp::Main::get().getNetworking()->getWorldstate();

            if (worldstate->hasPlacedObjectCollision)
            {
                if (worldstate->useActorCollisionForPlacedObjects)
                    physics.addObject(ptr, model, MWPhysics::CollisionType_Actor);
                else
                    physics.addObject(ptr, model, MWPhysics::CollisionType_World);
            }
        }
        /*
            End of tes3mp addition
        */
    }
Ejemplo n.º 2
0
    void Door::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
    {
        if(!model.empty())
            physics.addObject(ptr, model, MWPhysics::CollisionType_Door);

        // Resume the door's opening/closing animation if it wasn't finished
        if (ptr.getRefData().getCustomData())
        {
            const DoorCustomData& customData = ptr.getRefData().getCustomData()->asDoorCustomData();
            if (customData.mDoorState > 0)
            {
                MWBase::Environment::get().getWorld()->activateDoor(ptr, customData.mDoorState);
            }
        }
    }
Ejemplo n.º 3
0
    void Light::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
    {
        MWWorld::LiveCellRef<ESM::Light> *ref =
            ptr.get<ESM::Light>();
        assert (ref->mBase != NULL);

        // TODO: add option somewhere to enable collision for placeable objects
        if (!model.empty() && (ref->mBase->mData.mFlags & ESM::Light::Carry) == 0)
            physics.addObject(ptr, model);

        if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault))
            MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
                                                                      MWBase::SoundManager::Play_TypeSfx,
                                                                      MWBase::SoundManager::Play_Loop);

        MWBase::Environment::get().getMechanicsManager()->add(ptr);
    }
Ejemplo n.º 4
0
void Container::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
{
    if(!model.empty())
        physics.addObject(ptr, model);
    MWBase::Environment::get().getMechanicsManager()->add(ptr);
}
Ejemplo n.º 5
0
 void Static::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
 {
     if(!model.empty())
         physics.addObject(ptr, model);
 }