Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #567 from cortex-command-community/more-luabindings
Browse files Browse the repository at this point in the history
BuyableMode, Buyable cleanup, ResetSensorTimer lua bindings
  • Loading branch information
Causeless authored Nov 25, 2023
2 parents f71389b + 7b406bf commit 4cd26b0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- New `Scene` Lua functions `AddNavigatableArea(areaName)` and `ClearNavigatableAreas()`. This can be used to restrict pathfinding to only search a set of areas that have been added to the scene before via `Scene:SetArea(area)`.

- New `ADoor` Lua function `ResetSensorTimer()`. Resets the sensor timer for that door, making it take the full SensorInterval again for it to detect actors.

- Exposed `SceneObject` property `BuyableMode` to Lua (R).

- `Enum` binding for `SceneObject.BuyableMode`: `NORESTRICTIONS = 0, BUYMENUONLY = 1, OBJECTPICKERONLY = 2, SCRIPTONLY = 3`.

</details>

<details><summary><b>Changed</b></summary>
Expand Down Expand Up @@ -141,6 +147,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Script values, i.e `GetStringValue`, `RemoveStringValue`, `StringValueExists` and the associated functions for `GetNumberValue`/`GetObjectValue`, have been moved from MOSRotating to MovableObject, so now any object with script support can use these values.

- The `SceneObject` property `IsBuyable` has been renamed to `Buyable`.

</details>

<details><summary><b>Fixed</b></summary>
Expand Down
6 changes: 6 additions & 0 deletions Entities/SceneObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,12 @@ class SceneObject : public Entity {

bool IsBuyable() const { return m_Buyable; }

/// <summary>
/// Gets the BuyableMode of this SceneObject.
/// </summary>
/// <returns>The BuyableMode of this SceneObject</returns>
BuyableMode GetBuyableMode() const { return m_BuyableMode; }

/// <summary>
/// Gets whether this SceneObject is available only in the BuyMenu list when buyable.
/// </summary>
Expand Down
15 changes: 12 additions & 3 deletions Lua/LuaBindingsEntities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ namespace RTE {
.def("OpenDoor", &ADoor::OpenDoor)
.def("CloseDoor", &ADoor::CloseDoor)
.def("StopDoor", &ADoor::StopDoor)
.def("ResetSensorTimer", &ADoor::ResetSensorTimer)
.def("SetClosedByDefault", &ADoor::SetClosedByDefault)

.enum_("DoorState")[
Expand Down Expand Up @@ -1337,16 +1338,24 @@ namespace RTE {
.property("RotAngle", &SceneObject::GetRotAngle, &SceneObject::SetRotAngle)
.property("Team", &SceneObject::GetTeam, &SceneObject::SetTeam)
.property("PlacedByPlayer", &SceneObject::GetPlacedByPlayer, &SceneObject::SetPlacedByPlayer)
.property("IsBuyable", &SceneObject::IsBuyable)

.property("Buyable", &SceneObject::IsBuyable)
.property("BuyableMode", &SceneObject::GetBuyableMode)

.def("IsOnScenePoint", &SceneObject::IsOnScenePoint)
.def("GetGoldValue", &SceneObject::GetGoldValueOld)
.def("GetGoldValue", &SceneObject::GetGoldValue)
.def("SetGoldValue", &SceneObject::SetGoldValue)
.def("GetGoldValueString", &SceneObject::GetGoldValueString)
.def("GetTotalValue", &SceneObject::GetTotalValue)

.def("GetTotalValue", &LuaAdaptersSceneObject::GetTotalValue);
.def("GetTotalValue", &LuaAdaptersSceneObject::GetTotalValue)

.enum_("BuyableMode")[
luabind::value("NORESTRICTIONS", SceneObject::BuyableMode::NoRestrictions),
luabind::value("BUYMENUONLY", SceneObject::BuyableMode::BuyMenuOnly),
luabind::value("OBJECTPICKERONLY", SceneObject::BuyableMode::ObjectPickerOnly),
luabind::value("SCRIPTONLY", SceneObject::BuyableMode::ScriptOnly)];

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 4cd26b0

Please sign in to comment.