Radar improvement, auto party leader pass
This commit is contained in:
parent
8366c9f57f
commit
3097d5de1d
Binary file not shown.
Before Width: | Height: | Size: 372 KiB After Width: | Height: | Size: 390 KiB |
Binary file not shown.
@ -69,6 +69,7 @@ static std::vector<std::vector<textures::sprite>> tx_class{};
|
||||
static std::vector<textures::sprite> tx_teams{};
|
||||
static std::vector<textures::sprite> tx_items{};
|
||||
static std::vector<textures::sprite> tx_buildings{};
|
||||
static std::vector<textures::sprite> tx_sentry{};
|
||||
|
||||
void DrawEntity(int x, int y, CachedEntity *ent)
|
||||
{
|
||||
@ -127,12 +128,16 @@ void DrawEntity(int x, int y, CachedEntity *ent)
|
||||
}
|
||||
case CL_CLASS(CObjectSentrygun):
|
||||
{
|
||||
tx_buildings[1].draw(x + wtr.first, y + wtr.second, *icon_size * 1.5f, *icon_size * 1.5f, colors::white);
|
||||
int level = CE_INT(ent, netvar.iUpgradeLevel);
|
||||
bool IsMini = CE_BYTE(ent, netvar.m_bMiniBuilding);
|
||||
if (IsMini)
|
||||
level = 4;
|
||||
tx_sentry[level - 1].draw(x + wtr.first, y + wtr.second, *icon_size * 1.5f, *icon_size * 1.5f, colors::white);
|
||||
break;
|
||||
}
|
||||
case CL_CLASS(CObjectTeleporter):
|
||||
{
|
||||
tx_buildings[2].draw(x + wtr.first, y + wtr.second, *icon_size * 1.5f, *icon_size * 1.5f, colors::white);
|
||||
tx_buildings[1].draw(x + wtr.first, y + wtr.second, *icon_size * 1.5f, *icon_size * 1.5f, colors::white);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -244,8 +249,10 @@ static InitRoutine init([]() {
|
||||
for (int j = 0; j < 9; ++j)
|
||||
tx_class[i].push_back(textures::atlas().create_sprite(j * 64, 320 + i * 64, 64, 64));
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
tx_buildings.push_back(textures::atlas().create_sprite(576 + i * 64, 320, 64, 64));
|
||||
for (int i = 0; i < 4; i++)
|
||||
tx_sentry.push_back(textures::atlas().create_sprite(640 + i * 64, 256, 64, 64));
|
||||
logging::Info("Radar sprites loaded");
|
||||
EC::Register(EC::Draw, Draw, "radar", EC::average);
|
||||
});
|
||||
|
46
src/irc.cpp
46
src/irc.cpp
@ -18,6 +18,7 @@ static settings::Int port("irc.port", "8080");
|
||||
static settings::String commandandcontrol_channel("irc.cc.channel", "");
|
||||
static settings::String commandandcontrol_password("irc.cc.password", "");
|
||||
|
||||
static settings::Bool transfer_leader_on_kick("irc.cc.leader-transfer", "true");
|
||||
static settings::Bool botonly("irc.cc.command-bot-only", "true");
|
||||
static settings::Bool irc_party{ "irc.cc.party", "false" };
|
||||
static settings::Bool answer_steam{ "irc.cc.respondparty", "false" };
|
||||
@ -314,8 +315,44 @@ int GetMaxParty()
|
||||
return partyable;
|
||||
}
|
||||
CatCommand debug_maxparty("debug_partysize", "Debug party size", []() { logging::Info("%d", GetMaxParty()); });
|
||||
|
||||
CatCommand debug_steamids("debug_steamids", "Debug steamids", []() {
|
||||
for (auto &i : irc.getPeers())
|
||||
logging::Info("%u", i.second.steamid);
|
||||
});
|
||||
static Timer resize_party{};
|
||||
|
||||
void party_leader_pass()
|
||||
{
|
||||
re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
|
||||
re::CTFPartyClient *pc = re::CTFPartyClient::GTFPartyClient();
|
||||
if (gc && !gc->BHaveLiveMatch() && pc->GetNumMembers() > 1)
|
||||
{
|
||||
CSteamID steamid;
|
||||
pc->GetCurrentPartyLeader(steamid);
|
||||
if (steamid.GetAccountID() == g_ISteamUser->GetSteamID().GetAccountID())
|
||||
{
|
||||
std::vector<unsigned> valid_steam_ids = pc->GetPartySteamIDs();
|
||||
bool found = false;
|
||||
for (auto &peer : irc.getPeers())
|
||||
{
|
||||
if (found)
|
||||
break;
|
||||
if (peer.second.is_ingame)
|
||||
{
|
||||
for (auto &id : valid_steam_ids)
|
||||
if (id == peer.second.steamid)
|
||||
{
|
||||
CSteamID steam(id, EUniverse::k_EUniversePublic, EAccountType::k_EAccountTypeIndividual);
|
||||
pc->PromotePlayerToLeader(steam);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void run()
|
||||
{
|
||||
if (!restarting)
|
||||
@ -388,10 +425,13 @@ static void run()
|
||||
size = online_members;
|
||||
else
|
||||
size = -1;
|
||||
state.party_size = size;
|
||||
state.is_ingame = true;
|
||||
state.party_size = size;
|
||||
re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
|
||||
state.is_ingame = gc && gc->BHaveLiveMatch();
|
||||
irc.setState(state);
|
||||
}
|
||||
if (transfer_leader_on_kick)
|
||||
party_leader_pass();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user