Change InventoryAdd/Remove/GetCount/SetCount and GameScriptInventoryObject to use ItemEnumPair.

This commit is contained in:
hispidence 2021-08-09 00:01:40 +01:00
parent 05054a05fe
commit 61d9e00e63
3 changed files with 14 additions and 25 deletions

View file

@ -1,24 +1,13 @@
#include "framework.h"
#include "GameScriptInventoryObject.h"
GameScriptInventoryObject::GameScriptInventoryObject(std::string name, short slot, float yOffset, float scale, float xRot, float yRot, float zRot, short rotationFlags, int meshBits, __int64 operation)
{
this->name = name;
this->slot = slot;
this->yOffset = yOffset;
this->scale = scale;
this->xRot = xRot;
this->yRot = yRot;
this->zRot = zRot;
this->rotationFlags = rotationFlags;
this->meshBits = meshBits;
this->operation = operation;
}
GameScriptInventoryObject::GameScriptInventoryObject(std::string const& name, ItemEnumPair slot, float yOffset, float scale, float xRot, float yRot, float zRot, short rotationFlags, int meshBits, __int64 operation) : name{ name }, slot{ slot.m_pair.second }, yOffset{ yOffset }, scale{ scale }, xRot{ xRot }, yRot{ yRot }, zRot{ zRot }, rotationFlags{ rotationFlags }, meshBits{ meshBits }, operation{ operation }
{}
void GameScriptInventoryObject::Register(sol::state * lua)
{
lua->new_usertype<GameScriptInventoryObject>("InventoryObject",
sol::constructors<GameScriptInventoryObject(std::string, short, float, float, float, float, float, short, int, __int64)>(),
sol::constructors<GameScriptInventoryObject(std::string const &, ItemEnumPair, float, float, float, float, float, short, int, __int64)>(),
"name", &GameScriptInventoryObject::name,
"yOffset", &GameScriptInventoryObject::yOffset,
"scale", &GameScriptInventoryObject::scale,