mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-13 07:17:57 +03:00
Vgui screens now try to pass panel commands to the entity that created them
This commit is contained in:
parent
eb46739ab5
commit
9f34a64e63
@ -869,7 +869,9 @@ public:
|
|||||||
bool IsAIWalkable( void );
|
bool IsAIWalkable( void );
|
||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
virtual void HandleEntityCommand(CBasePlayer* pClient, KeyValues* pKeyValues) {}
|
// Handle a potentially complex command from a client.
|
||||||
|
// Returns true if the command was handled successfully.
|
||||||
|
virtual bool HandleEntityCommand(CBasePlayer* pClient, KeyValues* pKeyValues) { return false; }
|
||||||
#endif // MAPBASE
|
#endif // MAPBASE
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -224,15 +224,30 @@ int CVGuiScreen::Restore(IRestore& restore)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVGuiScreen::HandleEntityCommand(CBasePlayer* pClient, KeyValues* pKeyValues)
|
// Handle a command from the client-side vgui panel.
|
||||||
|
bool CVGuiScreen::HandleEntityCommand(CBasePlayer* pClient, KeyValues* pKeyValues)
|
||||||
{
|
{
|
||||||
|
#if defined(HL2MP) // Enable this in multiplayer.
|
||||||
|
// Restrict to commands from our owning player.
|
||||||
|
if ((m_fScreenFlags & VGUI_SCREEN_ONLY_USABLE_BY_OWNER) && pClient != m_hPlayerOwner.Get())
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Give the owning entity a chance to handle the command.
|
||||||
|
if (GetOwnerEntity() && GetOwnerEntity()->HandleEntityCommand(pClient, pKeyValues))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// See if we have an output for this command.
|
||||||
const int i = m_PanelOutputs.Find(pKeyValues->GetString());
|
const int i = m_PanelOutputs.Find(pKeyValues->GetString());
|
||||||
if (m_PanelOutputs.IsValidIndex(i))
|
if (m_PanelOutputs.IsValidIndex(i))
|
||||||
{
|
{
|
||||||
variant_t Val;
|
variant_t Val;
|
||||||
Val.Set(FIELD_VOID, NULL);
|
Val.Set(FIELD_VOID, NULL);
|
||||||
m_PanelOutputs[i]->FireOutput(Val, pClient, this);
|
m_PanelOutputs[i]->FireOutput(Val, pClient, this);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CBaseEntityOutput* CVGuiScreen::FindNamedOutput(const char* pszOutput)
|
CBaseEntityOutput* CVGuiScreen::FindNamedOutput(const char* pszOutput)
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
virtual int Save(ISave& save);
|
virtual int Save(ISave& save);
|
||||||
virtual int Restore(IRestore& restore);
|
virtual int Restore(IRestore& restore);
|
||||||
|
|
||||||
virtual void HandleEntityCommand(CBasePlayer* pClient, KeyValues* pKeyValues);
|
virtual bool HandleEntityCommand(CBasePlayer* pClient, KeyValues* pKeyValues);
|
||||||
virtual CBaseEntityOutput* FindNamedOutput(const char* pszOutput);
|
virtual CBaseEntityOutput* FindNamedOutput(const char* pszOutput);
|
||||||
#endif // MAPBASE
|
#endif // MAPBASE
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user