Fix spawning under water with quick teleport
This commit is contained in:
parent
62b5c561a8
commit
05a66d5cb0
@ -424,6 +424,8 @@ LocationHint = "Groove Street"
|
||||
LocationRemoved = "Location removed"
|
||||
QuickTeleport = "Quick teleport"
|
||||
QuickTeleportHint = "Open quick teleport using "
|
||||
SpawnUnderwater = "Spawn underwater"
|
||||
SpawnUnderwaterHint = "Spawn under the surface with quick teleport"
|
||||
TeleportMarkerHint = """
|
||||
Teleport to the location of your radar
|
||||
target blip using """
|
||||
|
@ -59,11 +59,24 @@ private:
|
||||
bool m_bHasHeader; // Does the page has a header button
|
||||
std::string m_NameKey; // A key to the page name string
|
||||
|
||||
protected:
|
||||
// Loads data from toml file
|
||||
// virtual void ImportSaveData();
|
||||
|
||||
// // Saves data to toml file
|
||||
// virtual void ExportSaveData();
|
||||
|
||||
public:
|
||||
IPage(ePageID page, const std::string& key, bool header)
|
||||
: m_eID(page), m_NameKey(key), m_bHasHeader(header)
|
||||
{
|
||||
PageHandler::AddPage(reinterpret_cast<PagePtr>(this), static_cast<size_t>(m_eID));
|
||||
// ImportSaveData();
|
||||
}
|
||||
|
||||
~IPage()
|
||||
{
|
||||
// ExportSaveData();
|
||||
}
|
||||
|
||||
// Page drawing code goes here
|
||||
@ -75,16 +88,15 @@ public:
|
||||
return m_eID;
|
||||
}
|
||||
|
||||
// Returns true if the page has a visible header button
|
||||
virtual bool HasHeaderButton() final
|
||||
{
|
||||
return m_bHasHeader;
|
||||
}
|
||||
|
||||
// Returns the page name key
|
||||
virtual std::string GetPageKey() final
|
||||
{
|
||||
return m_NameKey;
|
||||
}
|
||||
|
||||
// Returns true if the page has a visible header button
|
||||
virtual bool HasHeaderButton() final
|
||||
{
|
||||
return m_bHasHeader;
|
||||
}
|
||||
};
|
@ -40,6 +40,8 @@ private:
|
||||
public:
|
||||
|
||||
void Draw();
|
||||
void ImportSaveData();
|
||||
void ExportSaveData();
|
||||
};
|
||||
|
||||
extern PlayerPage &playerPage;
|
||||
|
@ -49,6 +49,7 @@ TeleportPage::TeleportPage()
|
||||
{
|
||||
m_bTeleportMarker = gConfig.Get("Features.TeleportMarker", false);
|
||||
m_bQuickTeleport = gConfig.Get("Features.QuickTeleport", false);
|
||||
m_bSpawnUnderwater = gConfig.Get("Features.SpawnUnderwater", false);
|
||||
m_fMapSize.x = gConfig.Get("Game.MapSizeX", 6000.0f);
|
||||
m_fMapSize.y = gConfig.Get("Game.MapSizeY", 6000.0f);
|
||||
};
|
||||
@ -147,8 +148,20 @@ void TeleportPage::WarpPlayer(CVector pos, int interiorID)
|
||||
|
||||
if (Type == eTeleportType::Marker || Type == eTeleportType::MapPosition)
|
||||
{
|
||||
float ground, water;
|
||||
CEntity* pPlayerEntity = FindPlayerEntity(-1);
|
||||
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &pPlayerEntity) + 1.0f;
|
||||
ground = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &pPlayerEntity) + 1.0f;
|
||||
|
||||
if (m_bSpawnUnderwater)
|
||||
{
|
||||
pos.z = ground;
|
||||
}
|
||||
else
|
||||
{
|
||||
Command<Commands::GET_WATER_HEIGHT_AT_COORDS>(pos.x, pos.y, true, &water);
|
||||
pos.z = ground > water ? ground : water;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (pVeh && pPlayer->m_nPedFlags.bInVehicle)
|
||||
@ -282,6 +295,11 @@ void TeleportPage::Draw()
|
||||
gConfig.Set("Features.QuickTeleport", m_bQuickTeleport);
|
||||
}
|
||||
ImGui::NextColumn();
|
||||
if (Widget::Checkbox(TEXT("Teleport.SpawnUnderwater"), &m_bSpawnUnderwater,
|
||||
TEXT("Teleport.SpawnUnderwaterHint")))
|
||||
{
|
||||
gConfig.Set("Features.SpawnUnderwater", m_bSpawnUnderwater);
|
||||
}
|
||||
if (Widget::Checkbox(TEXT("Teleport.TeleportMarker"), &m_bTeleportMarker,
|
||||
std::string(TEXT_S("Teleport.TeleportMarkerHint")
|
||||
+ teleportMarker.GetNameString()).c_str()))
|
||||
|
@ -16,6 +16,7 @@ private:
|
||||
bool m_bInsertCoord;
|
||||
bool m_bTeleportMarker;
|
||||
bool m_bQuickTeleport;
|
||||
bool m_bSpawnUnderwater;
|
||||
ImVec2 m_fMapSize;
|
||||
#ifdef GTASA
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user