diff --git a/Scripting/Scripting.vcxproj b/Scripting/Scripting.vcxproj
index b708ad9a8..ea27191be 100644
--- a/Scripting/Scripting.vcxproj
+++ b/Scripting/Scripting.vcxproj
@@ -78,9 +78,9 @@
+
-
@@ -116,6 +116,7 @@
+
@@ -128,7 +129,6 @@
-
diff --git a/Scripting/Scripting.vcxproj.filters b/Scripting/Scripting.vcxproj.filters
index 095a9e303..b0134a121 100644
--- a/Scripting/Scripting.vcxproj.filters
+++ b/Scripting/Scripting.vcxproj.filters
@@ -183,9 +183,6 @@
Header Files
-
- Header Files
-
Header Files
@@ -279,6 +276,9 @@
Header Files
+
+ Header Files
+
@@ -293,9 +293,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -359,6 +356,9 @@
Source Files
+
+ Source Files
+
diff --git a/Scripting/src/Flow/FlowHandler.cpp b/Scripting/src/Flow/FlowHandler.cpp
index e5c23d212..b9d3fc0e8 100644
--- a/Scripting/src/Flow/FlowHandler.cpp
+++ b/Scripting/src/Flow/FlowHandler.cpp
@@ -3,7 +3,7 @@
#include "ReservedScriptNames.h"
#include "Sound/sound.h"
#include "Game/savegame.h"
-#include "GameScriptInventoryObject.h"
+#include "Flow/InventoryItem/InventoryItem.h"
#include "InventorySlots.h"
#include "Game/gui.h"
#include "Objects/ScriptInterfaceObjectsHandler.h"
@@ -104,7 +104,7 @@ Specify which translations in the strings table correspond to which languages.
GameScriptLevel::Register(m_lua);
GameScriptSkyLayer::Register(m_lua);
GameScriptMirror::Register(m_lua);
- GameScriptInventoryObject::Register(m_lua);
+ InventoryItem::Register(table_flow);
GameScriptSettings::Register(m_lua);
Animations::Register(table_flow);
GameScriptColor::Register(m_lua);
@@ -244,7 +244,7 @@ bool FlowHandler::DoFlow()
// Prepare inventory objects table
for (size_t i = 0; i < level->InventoryObjects.size(); i++)
{
- GameScriptInventoryObject* obj = &level->InventoryObjects[i];
+ InventoryItem* obj = &level->InventoryObjects[i];
if (obj->slot >= 0 && obj->slot < INVENTORY_TABLE_SIZE)
{
InventoryObject* invObj = &inventry_objects_list[obj->slot];
diff --git a/Scripting/src/Flow/InventoryItem/InventoryItem.cpp b/Scripting/src/Flow/InventoryItem/InventoryItem.cpp
index 52e1efcc9..1b20b432e 100644
--- a/Scripting/src/Flow/InventoryItem/InventoryItem.cpp
+++ b/Scripting/src/Flow/InventoryItem/InventoryItem.cpp
@@ -1,12 +1,12 @@
#include "frameworkandsol.h"
-#include "GameScriptInventoryObject.h"
+#include "InventoryItem.h"
#include "ScriptAssert.h"
#include
/***
Represents the properties of an object as it appears in the inventory.
-@pregameclass InventoryObject
+@tenclass Flow.InventoryItem
@pragma nostrip
*/
@@ -29,7 +29,7 @@ associated getters and setters.
@tparam ItemAction action is this usable, equippable, or examinable?
@return an InventoryObject
*/
-GameScriptInventoryObject::GameScriptInventoryObject(std::string const& a_name, ItemEnumPair a_slot, short a_yOffset, float a_scale, GameScriptRotation const & a_rot, RotationFlags a_rotationFlags, int a_meshBits, ItemOptions a_action) :
+InventoryItem::InventoryItem(std::string const& a_name, ItemEnumPair a_slot, short a_yOffset, float a_scale, GameScriptRotation const & a_rot, RotationFlags a_rotationFlags, int a_meshBits, ItemOptions a_action) :
name{ a_name },
slot{ a_slot.m_pair.second },
yOffset{ a_yOffset },
@@ -41,37 +41,37 @@ GameScriptInventoryObject::GameScriptInventoryObject(std::string const& a_name,
SetAction(a_action);
}
-void GameScriptInventoryObject::Register(sol::state * lua)
+void InventoryItem::Register(sol::table & parent)
{
- lua->new_usertype("InventoryObject",
- sol::constructors(),
+ parent.new_usertype("InventoryObject",
+ sol::constructors(),
/*** (string) string key for the item's (localised) name. Corresponds to an entry in strings.lua.
@mem nameKey
*/
- "nameKey", &GameScriptInventoryObject::name,
+ "nameKey", &InventoryItem::name,
/*** (@{InvItem}) slot of item whose inventory display properties you wish to change
@mem slot
*/
- "slot", sol::property(&GameScriptInventoryObject::SetSlot),
+ "slot", sol::property(&InventoryItem::SetSlot),
/*** (float) y-axis offset (positive values will move the item lower).
A value of about 100 will cause the item to display directly below its usual position.
@mem yOffset
*/
- "yOffset", &GameScriptInventoryObject::yOffset,
+ "yOffset", &InventoryItem::yOffset,
/*** (float) Item's size when displayed in the inventory as a multiple of its "regular" size.
A value of 0.5 will cause the item to render at half the size,
and a value of 2 will cause the item to render at twice the size.
@mem scale
*/
- "scale", &GameScriptInventoryObject::scale,
+ "scale", &InventoryItem::scale,
/*** (@{Rotation}) Item's rotation about its origin when displayed in the inventory.
@mem rot
*/
- "rot", &GameScriptInventoryObject::rot,
+ "rot", &InventoryItem::rot,
/*** (RotationAxis) Axis to rotate about when the item is being looked at in the inventory.
Note that this is entirely separate from the `rot` field described above.
@@ -79,12 +79,12 @@ Must be RotationAxis.X, RotationAxis.Y or RotationAxis.Z.
e.g. `myItem.rotAxisWhenCurrent = RotationAxis.X`
@mem rotAxisWhenCurrent
*/
- "rotAxisWhenCurrent", &GameScriptInventoryObject::rotationFlags,
+ "rotAxisWhenCurrent", &InventoryItem::rotationFlags,
/*** (int) __Not currently implemented__ (will have no effect regardless of what you set it to)
@mem meshBits
*/
- "meshBits", &GameScriptInventoryObject::meshBits,
+ "meshBits", &InventoryItem::meshBits,
/*** (ItemAction) What can the player do with the item?
Must be one of:
@@ -94,12 +94,12 @@ Must be one of:
e.g. `myItem.action = ItemAction.EXAMINE`
@mem action
*/
- "action", sol::property(&GameScriptInventoryObject::SetAction)
+ "action", sol::property(&InventoryItem::SetAction)
);
}
// Add validation so the user can't choose something unimplemented
-void GameScriptInventoryObject::SetAction(ItemOptions a_action)
+void InventoryItem::SetAction(ItemOptions a_action)
{
bool isSupported = (a_action == ItemOptions::OPT_EQUIP) ||
(a_action == ItemOptions::OPT_USE) ||
@@ -117,7 +117,7 @@ void GameScriptInventoryObject::SetAction(ItemOptions a_action)
}
}
-void GameScriptInventoryObject::SetSlot(ItemEnumPair a_slot)
+void InventoryItem::SetSlot(ItemEnumPair a_slot)
{
slot = a_slot.m_pair.second;
}
diff --git a/Scripting/src/Flow/InventoryItem/InventoryItem.h b/Scripting/src/Flow/InventoryItem/InventoryItem.h
index 5a324e02f..9261b692f 100644
--- a/Scripting/src/Flow/InventoryItem/InventoryItem.h
+++ b/Scripting/src/Flow/InventoryItem/InventoryItem.h
@@ -20,7 +20,7 @@ namespace sol {
class state;
}
-struct GameScriptInventoryObject
+struct InventoryItem
{
std::string name{};
InventoryObjectTypes slot{ INV_OBJECT_PISTOLS };
@@ -31,10 +31,10 @@ struct GameScriptInventoryObject
int meshBits{ 0 };
ItemOptions action{ ItemOptions::OPT_USE };
- GameScriptInventoryObject() = default;
- GameScriptInventoryObject(std::string const & a_name, ItemEnumPair a_slot, short a_yOffset, float a_scale, GameScriptRotation const & a_rot, RotationFlags a_rotationFlags, int a_meshBits, ItemOptions a_actions);
+ InventoryItem() = default;
+ InventoryItem(std::string const & a_name, ItemEnumPair a_slot, short a_yOffset, float a_scale, GameScriptRotation const & a_rot, RotationFlags a_rotationFlags, int a_meshBits, ItemOptions a_actions);
- static void Register(sol::state* lua);
+ static void Register(sol::table& lua);
void SetAction(ItemOptions a_action);
void SetSlot(ItemEnumPair a_slot);
diff --git a/Scripting/src/GameScriptLevel.h b/Scripting/src/GameScriptLevel.h
index 826796d8a..f469d3eca 100644
--- a/Scripting/src/GameScriptLevel.h
+++ b/Scripting/src/GameScriptLevel.h
@@ -3,9 +3,9 @@
#include "GameScriptSkyLayer.h"
#include "GameScriptMirror.h"
#include "GameScriptColor.h"
-#include "GameScriptInventoryObject.h"
#include
#include "ScriptInterfaceLevel.h"
+#include "Flow/InventoryItem/InventoryItem.h"
static const std::unordered_map kWeatherTypes
{
@@ -39,7 +39,7 @@ struct GameScriptLevel : public ScriptInterfaceLevel
GameScriptMirror Mirror;
int LevelFarView{ 0 };
bool UnlimitedAir{ false };
- std::vector InventoryObjects;
+ std::vector InventoryObjects;
float GetWeatherStrength() const override;
bool GetSkyLayerEnabled(int index) const override;
diff --git a/Scripting/src/Objects/AIObject/AIObject.cpp b/Scripting/src/Objects/AIObject/AIObject.cpp
index caa9363ca..8fad57d53 100644
--- a/Scripting/src/Objects/AIObject/AIObject.cpp
+++ b/Scripting/src/Objects/AIObject/AIObject.cpp
@@ -4,6 +4,7 @@
#include "ScriptAssert.h"
#include "GameScriptPosition.h"
#include "ScriptUtil.h"
+#include "ReservedScriptNames.h"
/***
AI object
@@ -11,11 +12,8 @@ AI object
@pragma nostrip
*/
-
-constexpr auto LUA_CLASS_NAME{ "AIObject" };
-
-static auto index_error = index_error_maker(AIObject, LUA_CLASS_NAME);
-static auto newindex_error = newindex_error_maker(AIObject, LUA_CLASS_NAME);
+static auto index_error = index_error_maker(AIObject, ScriptReserved_AIObject);
+static auto newindex_error = newindex_error_maker(AIObject, ScriptReserved_AIObject);
AIObject::AIObject(AI_OBJECT & ref, bool temp) : m_aiObject{ref}, m_temporary{ temp }
{};
@@ -29,7 +27,7 @@ AIObject::~AIObject() {
void AIObject::Register(sol::table & parent)
{
- parent.new_usertype(LUA_CLASS_NAME,
+ parent.new_usertype(ScriptReserved_AIObject,
sol::meta_function::index, index_error,
sol::meta_function::new_index, newindex_error,