2020-07-22 23:36:52 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
2022-01-23 14:32:20 -05:00
|
|
|
class ScriptExtension : public Component
|
2020-07-22 23:36:52 -04:00
|
|
|
{
|
|
|
|
public:
|
2022-01-23 14:32:20 -05:00
|
|
|
ScriptExtension();
|
2020-07-22 23:36:52 -04:00
|
|
|
|
2022-04-28 08:03:22 -04:00
|
|
|
static void AddEntityField(const char* name, Game::fieldtype_t type, const Game::ScriptCallbackEnt& setter, const Game::ScriptCallbackEnt& getter);
|
|
|
|
static void AddClientField(const char* name, Game::fieldtype_t type, const Game::ScriptCallbackClient& setter, const Game::ScriptCallbackClient& getter);
|
|
|
|
|
2020-07-22 23:36:52 -04:00
|
|
|
private:
|
2022-04-28 08:03:22 -04:00
|
|
|
static std::unordered_map<std::uint16_t, Game::ent_field_t> CustomEntityFields;
|
|
|
|
static std::unordered_map<std::uint16_t, Game::client_fields_s> CustomClientFields;
|
|
|
|
|
|
|
|
static void GScr_AddFieldsForEntityStub();
|
|
|
|
|
|
|
|
// Two hooks because it makes our code cleaner (luckily functions were not inlined)
|
|
|
|
static int Scr_SetObjectFieldStub(unsigned int classnum, int entnum, int offset);
|
|
|
|
static void Scr_SetClientFieldStub(Game::gclient_s* client, int offset);
|
|
|
|
|
|
|
|
// One hook because functions were inlined
|
|
|
|
static void Scr_GetEntityFieldStub(int entnum, int offset);
|
|
|
|
|
2020-07-22 23:36:52 -04:00
|
|
|
static void AddFunctions();
|
|
|
|
static void AddMethods();
|
2022-04-28 08:03:22 -04:00
|
|
|
static void AddEntityFields();
|
|
|
|
static void AddClientFields();
|
2022-03-21 14:55:35 -04:00
|
|
|
static void Scr_TableLookupIStringByRow();
|
2020-07-22 23:36:52 -04:00
|
|
|
};
|
|
|
|
}
|