ISource2ModSchemaMethods

The SDK's schema helpers, served by the core.

The code behind CBaseEntity::Teleport, CCSPlayerController::TakeDamage, CPlayer_ItemServices::GiveNamedItem, the schema offset lookups, the nav areas, ... lives in the core (the SDK's src/impl). A plugin carries only forwarders, generated by tools/schemamethods/generate.py, that call the core's copy through this interface -- so a fix in a helper ships with a core update, and plugins keep running unchanged.

What still needs a plugin rebuild: a changed schema class member (its type), a changed helper signature, the header-only templates and inlines.

Each function is found by its signature ("CBaseEntity::Teleport(const Vector*,const QAngle*,const Vector*,HookChain)"). A plugin built against a newer SDK than the core gets a warning for a function the core does not have, and the call does nothing (the return value is value-initialised).

Interface id ISource2ModSchemaMethods001 (SOURCE2MOD_SCHEMAMETHODS_INTERFACE) · Global g_pSource2ModSchemaMethods · Header source2mod/ISource2ModSchemaMethods.h

Methods

Find

virtual void* Find(const char* key) = 0;

The core's thunk for a function by its signature key; null when this core does not have it.

ParameterType
keyconst char*

GetCount

virtual int GetCount() = 0;

GetKey

virtual const char* GetKey(int index) = 0;
ParameterType
indexint

Source2ModSchemaMethodEntry

Fields

FieldType
keyconst char*
functionvoid*

Functions

Source2ModSchemaMethod

void* Source2ModSchemaMethod(const char* key, bool& resolved);

Plugin side: Find() through g_pSource2ModSchemaMethods (src/forward). @p resolved becomes true once the answer is final -- the interface is there, whether or not it has the key (a missing one is warned about then); before SOURCE2MOD_SAVEVARS() it stays false and the caller asks again.

ParameterType
keyconst char*
resolvedbool&

Source2ModSchemaMissing

template <typename R> inline R Source2ModSchemaMissing();

What a forwarder returns when the core does not have the function.

Source2ModSchemaMethodsImpl

ISource2ModSchemaMethods* Source2ModSchemaMethodsImpl();

The core's instance (src/impl/schema_methods.cpp).

On this page