mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-25 14:03:33 -04:00
[Client] Use temporary holding interior when changing current cell record
This commit is contained in:
parent
958be0b114
commit
94dc6f422a
@ -45,6 +45,7 @@
|
|||||||
#include "GUIController.hpp"
|
#include "GUIController.hpp"
|
||||||
#include "CellController.hpp"
|
#include "CellController.hpp"
|
||||||
#include "MechanicsHelper.hpp"
|
#include "MechanicsHelper.hpp"
|
||||||
|
#include "RecordHelper.hpp"
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -162,6 +163,7 @@ void Main::postInit()
|
|||||||
const MWBase::Environment &environment = MWBase::Environment::get();
|
const MWBase::Environment &environment = MWBase::Environment::get();
|
||||||
environment.getStateManager()->newGame(true);
|
environment.getStateManager()->newGame(true);
|
||||||
MWBase::Environment::get().getMechanicsManager()->toggleAI();
|
MWBase::Environment::get().getMechanicsManager()->toggleAI();
|
||||||
|
RecordHelper::createPlaceholderInteriorCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Main::isInitialized()
|
bool Main::isInitialized()
|
||||||
|
@ -363,16 +363,11 @@ void RecordHelper::overrideRecord(const mwmp::CellRecord& record)
|
|||||||
|
|
||||||
if (isCurrentCell)
|
if (isCurrentCell)
|
||||||
{
|
{
|
||||||
// As a temporary solution, move the player to exterior 0, 0, but
|
|
||||||
// fix this once it's possible to override exteriors cells as well
|
|
||||||
ESM::Position tempPos;
|
ESM::Position tempPos;
|
||||||
tempPos.pos[0] = 0;
|
|
||||||
tempPos.pos[1] = 0;
|
|
||||||
tempPos.pos[2] = 0;
|
|
||||||
|
|
||||||
ESM::Position playerPos = playerPtr.getRefData().getPosition();
|
ESM::Position playerPos = playerPtr.getRefData().getPosition();
|
||||||
|
|
||||||
world->changeToExteriorCell(tempPos, true, true);
|
// Move the player to a temporary holding cell
|
||||||
|
world->changeToInteriorCell(getPlaceholderInteriorCellName(), tempPos, true, true);
|
||||||
world->changeToInteriorCell(recordData.mName, playerPos, true, true);
|
world->changeToInteriorCell(recordData.mName, playerPos, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1462,7 +1457,8 @@ void RecordHelper::overrideRecord(const mwmp::WeaponRecord& record)
|
|||||||
world->updatePtrsWithRefId(recordData.mId);
|
world->updatePtrsWithRefId(recordData.mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordHelper::overrideRecord(const mwmp::SoundRecord& record) {
|
void RecordHelper::overrideRecord(const mwmp::SoundRecord& record)
|
||||||
|
{
|
||||||
const ESM::Sound& recordData = record.data;
|
const ESM::Sound& recordData = record.data;
|
||||||
|
|
||||||
if (recordData.mId.empty())
|
if (recordData.mId.empty())
|
||||||
@ -1507,3 +1503,19 @@ void RecordHelper::overrideRecord(const mwmp::SoundRecord& record) {
|
|||||||
if (isExistingId)
|
if (isExistingId)
|
||||||
world->updatePtrsWithRefId(recordData.mId);
|
world->updatePtrsWithRefId(recordData.mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RecordHelper::createPlaceholderInteriorCell()
|
||||||
|
{
|
||||||
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
|
|
||||||
|
ESM::Cell placeholderInterior;
|
||||||
|
placeholderInterior.mData.mFlags |= ESM::Cell::Flags::Interior;
|
||||||
|
placeholderInterior.mName = placeholderInteriorCellName;
|
||||||
|
|
||||||
|
world->getModifiableStore().insert(placeholderInterior);
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string RecordHelper::getPlaceholderInteriorCellName()
|
||||||
|
{
|
||||||
|
return placeholderInteriorCellName;
|
||||||
|
}
|
||||||
|
@ -55,6 +55,11 @@ namespace RecordHelper
|
|||||||
|
|
||||||
return world->getStore().get<RecordType>().search(id);
|
return world->getStore().get<RecordType>().search(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void createPlaceholderInteriorCell();
|
||||||
|
const std::string getPlaceholderInteriorCellName();
|
||||||
|
|
||||||
|
const std::string placeholderInteriorCellName = "$Transitional Void";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user