iw4x-client/src/Components/Modules/GSC/ScriptExtension.hpp
Diavolo 60f7c7c254
[Script] Re-work stuff (no hidden changes)
*maybe* (Based on a true story and events)
2022-07-06 17:48:40 +02:00

33 lines
1.1 KiB
C++

#pragma once
namespace Components
{
class ScriptExtension : public Component
{
public:
ScriptExtension();
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);
private:
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);
static void AddFunctions();
static void AddMethods();
static void AddEntityFields();
static void AddClientFields();
static void Scr_TableLookupIStringByRow();
};
}