mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-05 19:08:09 -05:00
Some tweaks to WIP (#4706)
This commit is contained in:
parent
d725125f9b
commit
69d6631bbc
@ -383,6 +383,15 @@ void Anchor::DrawMenu() {
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui::Button("Request Team State", ImVec2(ImGui::GetContentRegionAvail().x - 25.0f, 0.0f))) {
|
||||
SendPacket_RequestTeamState();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_FA_TRASH)) {
|
||||
SendPacket_ClearTeamState();
|
||||
}
|
||||
UIWidgets::Tooltip("Clear Team State");
|
||||
} else {
|
||||
ImGui::Text("Connecting...");
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ class Anchor : public Network {
|
||||
void SendJsonToRemote(nlohmann::json packet);
|
||||
bool IsSaveLoaded();
|
||||
|
||||
void SendPacket_ClearTeamState();
|
||||
void SendPacket_ConsumeAdultTradeItem(u8 itemId);
|
||||
void SendPacket_DamagePlayer(u32 clientId, u8 damageEffect, u8 damage);
|
||||
void SendPacket_EntranceDiscovered(u16 entranceIndex);
|
||||
|
@ -49,6 +49,8 @@ void AnchorRoomWindow::Draw() {
|
||||
continue;
|
||||
}
|
||||
|
||||
ImGui::PushID(clientId);
|
||||
|
||||
if (client.clientId == Anchor::Instance->roomState.ownerClientId) {
|
||||
ImGui::TextColored(ImVec4(1, 1, 0, 1), "%s", ICON_FA_GAVEL);
|
||||
ImGui::SameLine();
|
||||
@ -58,6 +60,7 @@ void AnchorRoomWindow::Draw() {
|
||||
ImGui::TextColored(ImVec4(0.8f, 1.0f, 0.8f, 1.0f), "%s", CVarGetString(CVAR_REMOTE_ANCHOR("Name"), ""));
|
||||
} else if (!client.online) {
|
||||
ImGui::TextColored(ImVec4(1, 1, 1, 0.3f), "%s - offline", client.name.c_str());
|
||||
ImGui::PopID();
|
||||
continue;
|
||||
} else {
|
||||
ImGui::Text("%s", client.name.c_str());
|
||||
@ -105,6 +108,7 @@ void AnchorRoomWindow::Draw() {
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,14 @@
|
||||
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
static bool isResultOfHandling = false;
|
||||
|
||||
/**
|
||||
* ENTRANCE_DISCOVERED
|
||||
*/
|
||||
|
||||
void Anchor::SendPacket_EntranceDiscovered(u16 entranceIndex) {
|
||||
if (!IsSaveLoaded()) {
|
||||
if (!IsSaveLoaded() || isResultOfHandling) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -30,8 +32,10 @@ void Anchor::HandlePacket_EntranceDiscovered(nlohmann::json payload) {
|
||||
return;
|
||||
}
|
||||
|
||||
isResultOfHandling = true;
|
||||
u16 entranceIndex = payload["entranceIndex"].get<u16>();
|
||||
Entrance_SetEntranceDiscovered(entranceIndex, 1);
|
||||
isResultOfHandling = false;
|
||||
}
|
||||
|
||||
#endif // ENABLE_REMOTE_CONTROL
|
||||
|
@ -19,6 +19,10 @@
|
||||
*/
|
||||
|
||||
void Anchor::SendPacket_RequestTeamState() {
|
||||
if (!IsSaveLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nlohmann::json payload;
|
||||
payload["type"] = REQUEST_TEAM_STATE;
|
||||
payload["targetTeamId"] = CVarGetString(CVAR_REMOTE_ANCHOR("TeamId"), "default");
|
||||
|
@ -13,6 +13,10 @@
|
||||
*/
|
||||
|
||||
void Anchor::SendPacket_SetFlag(s16 sceneNum, s16 flagType, s16 flag) {
|
||||
if (!IsSaveLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nlohmann::json payload;
|
||||
payload["type"] = SET_FLAG;
|
||||
payload["targetTeamId"] = CVarGetString(CVAR_REMOTE_ANCHOR("TeamId"), "default");
|
||||
|
@ -13,6 +13,10 @@
|
||||
*/
|
||||
|
||||
void Anchor::SendPacket_UnsetFlag(s16 sceneNum, s16 flagType, s16 flag) {
|
||||
if (!IsSaveLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nlohmann::json payload;
|
||||
payload["type"] = UNSET_FLAG;
|
||||
payload["targetTeamId"] = CVarGetString(CVAR_REMOTE_ANCHOR("TeamId"), "default");
|
||||
|
@ -105,6 +105,20 @@ void Anchor::SendPacket_UpdateTeamState() {
|
||||
SendJsonToRemote(payload);
|
||||
}
|
||||
|
||||
void Anchor::SendPacket_ClearTeamState() {
|
||||
if (!IsSaveLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
json payload;
|
||||
payload["type"] = UPDATE_TEAM_STATE;
|
||||
payload["targetTeamId"] = CVarGetString(CVAR_REMOTE_ANCHOR("TeamId"), "default");
|
||||
|
||||
payload["queue"] = json::array();
|
||||
payload["state"] = json::object();
|
||||
SendJsonToRemote(payload);
|
||||
}
|
||||
|
||||
void Anchor::HandlePacket_UpdateTeamState(nlohmann::json payload) {
|
||||
isHandlingUpdateTeamState = true;
|
||||
// This can happen in between file select and the game starting, so we cant use this check, but we need to ensure we
|
||||
|
Loading…
Reference in New Issue
Block a user