mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 12:36:45 +03:00
Add default member initialisers, SetSlot function, and default constructor for GameScriptInventoryObject.
Expose default constructor to Lua API. Use SetSlot as a sol::property instead of accessing the member directly. Update documentation.
This commit is contained in:
parent
7a33055ce9
commit
978e61108c
2 changed files with 31 additions and 24 deletions
|
@ -10,21 +10,25 @@ Represents the properties of an object as it appears in the inventory.
|
|||
@pragma nostrip
|
||||
*/
|
||||
|
||||
/*** Create an inventoryObject item. Use this if you want to specify property values later later.
|
||||
The default property values are not disclosed here, since at the time of writing, they are subject to change.
|
||||
@function InventoryObject.new
|
||||
@return an InventoryObject
|
||||
*/
|
||||
|
||||
/*** For more information on each parameter, see the
|
||||
associated getters and setters.
|
||||
takes no arguments.
|
||||
@function InventoryObject.new
|
||||
@tparam string nameKey name key
|
||||
@tparam InvItem slot slot of inventory object to change
|
||||
@tparam int yOffset y-axis offset
|
||||
@tparam int yOffset y-axis offset (positive values move the item down)
|
||||
@tparam float scale item size (1 being standard size)
|
||||
@tparam Rotation rot rotation about x, y, and z axes
|
||||
@tparam RotationAxis rotAxisWhenCurrent axis to rotate around in inventory
|
||||
@tparam int meshBits not currently implemented
|
||||
@tparam ItemAction action is this usable, equippable, or examinable?
|
||||
@return an InventoryObject
|
||||
*/
|
||||
|
||||
*/
|
||||
GameScriptInventoryObject::GameScriptInventoryObject(std::string const& a_name, ItemEnumPair a_slot, float a_yOffset, float a_scale, GameScriptRotation const & a_rot, rotflags a_rotationFlags, int a_meshBits, item_options a_action) :
|
||||
name{ a_name },
|
||||
slot{ a_slot.m_pair.second },
|
||||
|
@ -40,8 +44,7 @@ GameScriptInventoryObject::GameScriptInventoryObject(std::string const& a_name,
|
|||
void GameScriptInventoryObject::Register(sol::state * lua)
|
||||
{
|
||||
lua->new_usertype<GameScriptInventoryObject>("InventoryObject",
|
||||
sol::constructors<GameScriptInventoryObject(std::string const &, ItemEnumPair, float, float, GameScriptRotation const &, rotflags, int, item_options)>(),
|
||||
|
||||
sol::constructors<GameScriptInventoryObject(std::string const &, ItemEnumPair, float, float, GameScriptRotation const &, rotflags, int, item_options), GameScriptInventoryObject()>(),
|
||||
/*** (string) string key for the item's (localised) name. Corresponds to an entry in strings.lua.
|
||||
@mem nameKey
|
||||
*/
|
||||
|
@ -50,10 +53,10 @@ void GameScriptInventoryObject::Register(sol::state * lua)
|
|||
/*** (@{InvItem}) slot of item whose inventory display properties you wish to change
|
||||
@mem slot
|
||||
*/
|
||||
"slot", &GameScriptInventoryObject::slot,
|
||||
"slot", sol::property(&GameScriptInventoryObject::SetSlot),
|
||||
|
||||
/*** (float) y-axis offset.
|
||||
A value of about 100 will cause the item to display directly below its usual position.
|
||||
/*** (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,
|
||||
|
@ -70,23 +73,20 @@ and a value of 2 will cause the item to render at twice the size.
|
|||
*/
|
||||
"rot", &GameScriptInventoryObject::rot,
|
||||
|
||||
/*** (@RotationAxis) Axis to rotate about when the item is being looked at in the inventory.
|
||||
/*** (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.
|
||||
Must be one of:
|
||||
X
|
||||
Y
|
||||
Z
|
||||
Must be RotationAxis.X, RotationAxis.Y or RotationAxis.Z.
|
||||
e.g. `myItem.rotAxisWhenCurrent = RotationAxis.X`
|
||||
@mem rotAxisWhenCurrent
|
||||
*/
|
||||
"rotAxisWhenCurrent", &GameScriptInventoryObject::rotationFlags,
|
||||
|
||||
/*** (@int) __Not currently implemented__ (will have no effect regardless of what you set it to)
|
||||
/*** (int) __Not currently implemented__ (will have no effect regardless of what you set it to)
|
||||
@mem meshBits
|
||||
*/
|
||||
"meshBits", &GameScriptInventoryObject::meshBits,
|
||||
|
||||
/*** (@ItemAction) What can the player do with the item?
|
||||
/*** (ItemAction) What can the player do with the item?
|
||||
Must be one of:
|
||||
EQUIP
|
||||
USE
|
||||
|
@ -116,3 +116,8 @@ void GameScriptInventoryObject::SetAction(item_options a_action)
|
|||
action = a_action;
|
||||
}
|
||||
}
|
||||
|
||||
void GameScriptInventoryObject::SetSlot(ItemEnumPair a_slot)
|
||||
{
|
||||
slot = a_slot.m_pair.second;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue