From 9ff6f5b881f6ce37031c6533c2562475ca44b6f1 Mon Sep 17 00:00:00 2001
From: pawnishoovy <54544349+pawnishoovy@users.noreply.github.com>
Date: Sat, 25 Nov 2023 16:07:21 +0200
Subject: [PATCH 1/5] buyablemode stuff, ResetSensorTimer
---
Lua/LuaBindingsEntities.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Lua/LuaBindingsEntities.cpp b/Lua/LuaBindingsEntities.cpp
index 4f13f0cd6..d1c833d05 100644
--- a/Lua/LuaBindingsEntities.cpp
+++ b/Lua/LuaBindingsEntities.cpp
@@ -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")[
@@ -1338,6 +1339,9 @@ namespace RTE {
.property("Team", &SceneObject::GetTeam, &SceneObject::SetTeam)
.property("PlacedByPlayer", &SceneObject::GetPlacedByPlayer, &SceneObject::SetPlacedByPlayer)
.property("IsBuyable", &SceneObject::IsBuyable)
+ .property("IsBuyableInScriptOnly", &SceneObject::IsBuyableInScriptOnly)
+ .property("IsBuyableInObjectPickerOnly", &SceneObject::IsBuyableInObjectPickerOnly)
+ .property("IsBuyableInBuyMenuOnly", &SceneObject::IsBuyableInBuyMenuOnly)
.def("IsOnScenePoint", &SceneObject::IsOnScenePoint)
.def("GetGoldValue", &SceneObject::GetGoldValueOld)
From 850024ec3b751e9df1fc5ef4788a2aad9c277f81 Mon Sep 17 00:00:00 2001
From: pawnishoovy <54544349+pawnishoovy@users.noreply.github.com>
Date: Sat, 25 Nov 2023 16:10:53 +0200
Subject: [PATCH 2/5] better as functions
---
Lua/LuaBindingsEntities.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Lua/LuaBindingsEntities.cpp b/Lua/LuaBindingsEntities.cpp
index d1c833d05..d960e5d76 100644
--- a/Lua/LuaBindingsEntities.cpp
+++ b/Lua/LuaBindingsEntities.cpp
@@ -1338,11 +1338,11 @@ 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("IsBuyableInScriptOnly", &SceneObject::IsBuyableInScriptOnly)
- .property("IsBuyableInObjectPickerOnly", &SceneObject::IsBuyableInObjectPickerOnly)
- .property("IsBuyableInBuyMenuOnly", &SceneObject::IsBuyableInBuyMenuOnly)
-
+
+ .def("IsBuyable", &SceneObject::IsBuyable)
+ .def("IsBuyableInScriptOnly", &SceneObject::IsBuyableInScriptOnly)
+ .def("IsBuyableInObjectPickerOnly", &SceneObject::IsBuyableInObjectPickerOnly)
+ .def("IsBuyableInBuyMenuOnly", &SceneObject::IsBuyableInBuyMenuOnly)
.def("IsOnScenePoint", &SceneObject::IsOnScenePoint)
.def("GetGoldValue", &SceneObject::GetGoldValueOld)
.def("GetGoldValue", &SceneObject::GetGoldValue)
From 290ded5d2f7e37bfa8c4b9afef5526128b91e0a1 Mon Sep 17 00:00:00 2001
From: pawnishoovy <54544349+pawnishoovy@users.noreply.github.com>
Date: Sat, 25 Nov 2023 16:41:27 +0200
Subject: [PATCH 3/5] cleaner, neater, changelog
---
CHANGELOG.md | 6 ++++++
Entities/SceneObject.h | 6 ++++++
Lua/LuaBindingsEntities.cpp | 15 ++++++++++++---
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5747794fa..219d06126 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -101,6 +101,10 @@ 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.
+
+- New `SceneObject` Lua functions `IsBuyableInScriptOnly()`, `IsBuyableInObjectPickerOnly()`, and `IsBuyableInBuyMenuOnly()`.
+
Changed
@@ -141,6 +145,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` is now a function, e.g. `IsBuyable()`.
+
Fixed
diff --git a/Entities/SceneObject.h b/Entities/SceneObject.h
index f3c75cea8..5667c4719 100644
--- a/Entities/SceneObject.h
+++ b/Entities/SceneObject.h
@@ -464,6 +464,12 @@ class SceneObject : public Entity {
bool IsBuyable() const { return m_Buyable; }
+ ///
+ /// Gets the BuyableMode of this SceneObject.
+ ///
+ /// The BuyableMode of this SceneObject
+ BuyableMode GetBuyableMode() const { return m_BuyableMode; }
+
///
/// Gets whether this SceneObject is available only in the BuyMenu list when buyable.
///
diff --git a/Lua/LuaBindingsEntities.cpp b/Lua/LuaBindingsEntities.cpp
index d960e5d76..558704f03 100644
--- a/Lua/LuaBindingsEntities.cpp
+++ b/Lua/LuaBindingsEntities.cpp
@@ -1338,11 +1338,13 @@ namespace RTE {
.property("RotAngle", &SceneObject::GetRotAngle, &SceneObject::SetRotAngle)
.property("Team", &SceneObject::GetTeam, &SceneObject::SetTeam)
.property("PlacedByPlayer", &SceneObject::GetPlacedByPlayer, &SceneObject::SetPlacedByPlayer)
+ .property("Buyable", &SceneObject::IsBuyable)
+ .property("BuyableMode", &SceneObject::GetBuyableMode)
.def("IsBuyable", &SceneObject::IsBuyable)
- .def("IsBuyableInScriptOnly", &SceneObject::IsBuyableInScriptOnly)
- .def("IsBuyableInObjectPickerOnly", &SceneObject::IsBuyableInObjectPickerOnly)
.def("IsBuyableInBuyMenuOnly", &SceneObject::IsBuyableInBuyMenuOnly)
+ .def("IsBuyableInObjectPickerOnly", &SceneObject::IsBuyableInObjectPickerOnly)
+ .def("IsBuyableInScriptOnly", &SceneObject::IsBuyableInScriptOnly)
.def("IsOnScenePoint", &SceneObject::IsOnScenePoint)
.def("GetGoldValue", &SceneObject::GetGoldValueOld)
.def("GetGoldValue", &SceneObject::GetGoldValue)
@@ -1350,7 +1352,14 @@ namespace RTE {
.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)];
+
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
From 892432dbc5bb62dd69f486d695a169fa3eb64dec Mon Sep 17 00:00:00 2001
From: pawnishoovy <54544349+pawnishoovy@users.noreply.github.com>
Date: Sat, 25 Nov 2023 16:46:33 +0200
Subject: [PATCH 4/5] forgot changelog
---
CHANGELOG.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 219d06126..799bff900 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -105,6 +105,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- New `SceneObject` Lua functions `IsBuyableInScriptOnly()`, `IsBuyableInObjectPickerOnly()`, and `IsBuyableInBuyMenuOnly()`.
+- Exposed `SceneObject` property `BuyableMode` to Lua (R).
+
+- `Enum` binding for `SceneObject.BuyableMode`: `NORESTRICTIONS = 0, BUYMENUONLY = 1, OBJECTPICKERONLY = 2, SCRIPTONLY = 2`.
+
Changed
@@ -145,7 +149,7 @@ 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` is now a function, e.g. `IsBuyable()`.
+- The `SceneObject` property `IsBuyable` is now a function, e.g. `IsBuyable()`. `Buyable` replaces it as a property.
From 7b406bf8eaf1f65dc6a2e83de4e48ae666d1ee96 Mon Sep 17 00:00:00 2001
From: pawnishoovy <54544349+pawnishoovy@users.noreply.github.com>
Date: Sat, 25 Nov 2023 16:53:18 +0200
Subject: [PATCH 5/5] yeet the functions keep the properties
---
CHANGELOG.md | 6 ++----
Lua/LuaBindingsEntities.cpp | 4 ----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 799bff900..b4923c700 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -103,11 +103,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- New `ADoor` Lua function `ResetSensorTimer()`. Resets the sensor timer for that door, making it take the full SensorInterval again for it to detect actors.
-- New `SceneObject` Lua functions `IsBuyableInScriptOnly()`, `IsBuyableInObjectPickerOnly()`, and `IsBuyableInBuyMenuOnly()`.
-
- Exposed `SceneObject` property `BuyableMode` to Lua (R).
-- `Enum` binding for `SceneObject.BuyableMode`: `NORESTRICTIONS = 0, BUYMENUONLY = 1, OBJECTPICKERONLY = 2, SCRIPTONLY = 2`.
+- `Enum` binding for `SceneObject.BuyableMode`: `NORESTRICTIONS = 0, BUYMENUONLY = 1, OBJECTPICKERONLY = 2, SCRIPTONLY = 3`.
@@ -149,7 +147,7 @@ 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` is now a function, e.g. `IsBuyable()`. `Buyable` replaces it as a property.
+- The `SceneObject` property `IsBuyable` has been renamed to `Buyable`.
diff --git a/Lua/LuaBindingsEntities.cpp b/Lua/LuaBindingsEntities.cpp
index 558704f03..8b6811019 100644
--- a/Lua/LuaBindingsEntities.cpp
+++ b/Lua/LuaBindingsEntities.cpp
@@ -1341,10 +1341,6 @@ namespace RTE {
.property("Buyable", &SceneObject::IsBuyable)
.property("BuyableMode", &SceneObject::GetBuyableMode)
- .def("IsBuyable", &SceneObject::IsBuyable)
- .def("IsBuyableInBuyMenuOnly", &SceneObject::IsBuyableInBuyMenuOnly)
- .def("IsBuyableInObjectPickerOnly", &SceneObject::IsBuyableInObjectPickerOnly)
- .def("IsBuyableInScriptOnly", &SceneObject::IsBuyableInScriptOnly)
.def("IsOnScenePoint", &SceneObject::IsOnScenePoint)
.def("GetGoldValue", &SceneObject::GetGoldValueOld)
.def("GetGoldValue", &SceneObject::GetGoldValue)