mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-07 10:28:34 +00:00
Compare commits
7 Commits
a49bdd105a
...
16ead392eb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16ead392eb | ||
|
|
1819f491b5 | ||
|
|
3a68eeba42 | ||
|
|
b70243f469 | ||
|
|
a3411df89b | ||
|
|
1121cb6ef0 | ||
|
|
5333aa07cc |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
|||||||
MYSQL_VERSION: '5.7'
|
MYSQL_VERSION: '5.7'
|
||||||
MMSOURCE_VERSION: '1.12'
|
MMSOURCE_VERSION: '1.12'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
path: sourcemod
|
path: sourcemod
|
||||||
|
|||||||
6
.github/workflows/mocktest.yml
vendored
6
.github/workflows/mocktest.yml
vendored
@ -12,20 +12,20 @@ jobs:
|
|||||||
mock:
|
mock:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
name: Clone sourcemod
|
name: Clone sourcemod
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
path: sourcemod
|
path: sourcemod
|
||||||
|
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
name: Clone metamod-source
|
name: Clone metamod-source
|
||||||
with:
|
with:
|
||||||
repository: alliedmodders/metamod-source
|
repository: alliedmodders/metamod-source
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
path: metamod-source
|
path: metamod-source
|
||||||
|
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
name: Clone hl2sdk-mock
|
name: Clone hl2sdk-mock
|
||||||
with:
|
with:
|
||||||
repository: alliedmodders/hl2sdk-mock
|
repository: alliedmodders/hl2sdk-mock
|
||||||
|
|||||||
2
.github/workflows/scripting.yml
vendored
2
.github/workflows/scripting.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ARCH: x86,x86_64
|
ARCH: x86,x86_64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/translations.yml
vendored
2
.github/workflows/translations.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
|||||||
update_translations:
|
update_translations:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ jobs:
|
|||||||
check_translations:
|
check_translations:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- uses: actions/setup-python@v6
|
- uses: actions/setup-python@v6
|
||||||
name: Setup Python 3.10
|
name: Setup Python 3.10
|
||||||
|
|||||||
@ -1244,6 +1244,18 @@ unsigned int TopMenu::FindCategory(const char *name)
|
|||||||
return obj->object_id;
|
return obj->object_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int TopMenu::FindItem(const char *name)
|
||||||
|
{
|
||||||
|
topmenu_object_t *obj;
|
||||||
|
if (!m_ObjLookup.retrieve(name, &obj))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (obj->type != TopMenuObject_Item)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return obj->object_id;
|
||||||
|
}
|
||||||
|
|
||||||
void TopMenu::OnMaxPlayersChanged( int newvalue )
|
void TopMenu::OnMaxPlayersChanged( int newvalue )
|
||||||
{
|
{
|
||||||
m_max_clients = newvalue;
|
m_max_clients = newvalue;
|
||||||
|
|||||||
@ -142,6 +142,7 @@ public: //ITopMenu
|
|||||||
TopMenuPosition position);
|
TopMenuPosition position);
|
||||||
virtual bool LoadConfiguration(const char *file, char *error, size_t maxlength);
|
virtual bool LoadConfiguration(const char *file, char *error, size_t maxlength);
|
||||||
virtual unsigned int FindCategory(const char *name);
|
virtual unsigned int FindCategory(const char *name);
|
||||||
|
virtual unsigned int FindItem(const char *name);
|
||||||
const char *GetObjectInfoString(unsigned int object_id);
|
const char *GetObjectInfoString(unsigned int object_id);
|
||||||
const char *GetObjectName(unsigned int object_id);
|
const char *GetObjectName(unsigned int object_id);
|
||||||
public: //IMenuHandler
|
public: //IMenuHandler
|
||||||
|
|||||||
@ -300,6 +300,24 @@ static cell_t FindTopMenuCategory(IPluginContext *pContext, const cell_t *params
|
|||||||
return pMenu->FindCategory(name);
|
return pMenu->FindCategory(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t FindTopMenuItem(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
HandleError err;
|
||||||
|
ITopMenu *pMenu;
|
||||||
|
HandleSecurity sec(pContext->GetIdentity(), myself->GetIdentity());
|
||||||
|
|
||||||
|
if ((err = handlesys->ReadHandle(params[1], hTopMenuType, &sec, (void **)&pMenu))
|
||||||
|
!= HandleError_None)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Invalid Handle %x (error: %d)", params[1], err);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *name;
|
||||||
|
pContext->LocalToString(params[2], &name);
|
||||||
|
|
||||||
|
return pMenu->FindItem(name);
|
||||||
|
}
|
||||||
|
|
||||||
static cell_t DisplayTopMenu(IPluginContext *pContext, const cell_t *params)
|
static cell_t DisplayTopMenu(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
HandleError err;
|
HandleError err;
|
||||||
@ -486,6 +504,7 @@ sp_nativeinfo_t g_TopMenuNatives[] =
|
|||||||
{"TopMenu.LoadConfig", LoadTopMenuConfig},
|
{"TopMenu.LoadConfig", LoadTopMenuConfig},
|
||||||
{"TopMenu.Remove", RemoveFromTopMenu},
|
{"TopMenu.Remove", RemoveFromTopMenu},
|
||||||
{"TopMenu.FindCategory", FindTopMenuCategory},
|
{"TopMenu.FindCategory", FindTopMenuCategory},
|
||||||
|
{"TopMenu.FindItem", FindTopMenuItem},
|
||||||
{"TopMenu.GetInfoString", GetTopMenuInfoString},
|
{"TopMenu.GetInfoString", GetTopMenuInfoString},
|
||||||
{"TopMenu.GetObjName", GetTopMenuName},
|
{"TopMenu.GetObjName", GetTopMenuName},
|
||||||
{"TopMenu.CacheTitles.set", SetTopMenuTitleCaching},
|
{"TopMenu.CacheTitles.set", SetTopMenuTitleCaching},
|
||||||
|
|||||||
@ -244,7 +244,14 @@ methodmap TopMenu < Handle
|
|||||||
// @return TopMenuObject ID on success, or
|
// @return TopMenuObject ID on success, or
|
||||||
// INVALID_TOPMENUOBJECT on failure.
|
// INVALID_TOPMENUOBJECT on failure.
|
||||||
public native TopMenuObject FindCategory(const char[] name);
|
public native TopMenuObject FindCategory(const char[] name);
|
||||||
|
|
||||||
|
// Finds an item's topobj ID in a TopMenu.
|
||||||
|
//
|
||||||
|
// @param name Object's unique name.
|
||||||
|
// @return TopMenuObject ID on success, or
|
||||||
|
// INVALID_TOPMENUOBJECT on failure.
|
||||||
|
public native TopMenuObject FindItem(const char[] name);
|
||||||
|
|
||||||
// Set the menu title caching behavior of the TopMenu. By default titles
|
// Set the menu title caching behavior of the TopMenu. By default titles
|
||||||
// are cached to reduce overhead. If you need dynamic menu titles which
|
// are cached to reduce overhead. If you need dynamic menu titles which
|
||||||
// change each time the menu is displayed to a user, set this to false.
|
// change each time the menu is displayed to a user, set this to false.
|
||||||
@ -441,6 +448,7 @@ public void __ext_topmenus_SetNTVOptional()
|
|||||||
MarkNativeAsOptional("TopMenu.Display");
|
MarkNativeAsOptional("TopMenu.Display");
|
||||||
MarkNativeAsOptional("TopMenu.DisplayCategory");
|
MarkNativeAsOptional("TopMenu.DisplayCategory");
|
||||||
MarkNativeAsOptional("TopMenu.FindCategory");
|
MarkNativeAsOptional("TopMenu.FindCategory");
|
||||||
|
MarkNativeAsOptional("TopMenu.FindItem");
|
||||||
MarkNativeAsOptional("TopMenu.CacheTitles.set");
|
MarkNativeAsOptional("TopMenu.CacheTitles.set");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user