Skip to content

Commit 0c5d32b

Browse files
authored
Merge pull request #104 from cortex-command-community/luasetglow
Added Get- and SetScreenEffectPath to MovableObject
2 parents b3a2d72 + af78bbb commit 0c5d32b

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1414

1515
- Added `HDFirearm` lua bindings `EjectionOffset` (R/W) and `EjectionPos` (R). Work similarly to their Muzzle variants.
1616

17+
- New `MovableObject` Lua functions `GetScreenEffectPath()` and `SetScreenEffectPath(string pathToFile)`, which get and set the file path to the object's screen effect.
18+
1719
</details>
1820

1921
<details><summary><b>Changed</b></summary>
@@ -2500,4 +2502,4 @@ Note: For a log of changes made prior to the commencement of the open source com
25002502
[Release v5.0.0]: https://github.com/cortex-command-community/Cortex-Command-Community-Project-Source/releases/tag/v0.1.0-pre5.2
25012503
[Release v6.0.0]: https://github.com/cortex-command-community/Cortex-Command-Community-Project/releases/tag/v6.0.0
25022504
[Release v6.1.0]: https://github.com/cortex-command-community/Cortex-Command-Community-Project/releases/tag/v6.1.0
2503-
[Unreleased]: https://github.com/cortex-command-community/Cortex-Command-Community-Project-Source/compare/master...cortex-command-community:development
2505+
[Unreleased]: https://github.com/cortex-command-community/Cortex-Command-Community-Project-Source/compare/master...cortex-command-community:development

Source/Entities/MovableObject.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,18 @@ namespace RTE {
385385
/// @param newAngle The new absolute angle in radians.
386386
void SetEffectRotAngle(float newAngle) { m_EffectRotAngle = newAngle; }
387387

388+
/// Gets the file path of this MovableObject's current screen effect.
389+
/// @return A string containing the file path of the screen effect.
390+
std::string GetScreenEffectPath() const { return m_ScreenEffectFile.GetDataPath(); }
391+
392+
/// Gets the file path of this MovableObject's current screen effect.
393+
/// @param pathToFile A string containing the file path of the new screen effect.
394+
void SetScreenEffectPath(std::string pathToFile) {
395+
m_ScreenEffectFile.SetDataPath(pathToFile);
396+
m_pScreenEffect = m_ScreenEffectFile.GetAsBitmap();
397+
m_ScreenEffectHash = m_ScreenEffectFile.GetHash();
398+
}
399+
388400
/// Gets the current absolute angle of rotation of this MovableObject's effect.
389401
/// @return The absolute angle in radians.
390402
float GetEffectRotAngle() const { return m_EffectRotAngle; }

Source/Lua/LuaBindingsEntities.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,9 @@ LuaBindingRegisterFunctionDefinitionForType(EntityLuaBindings, MovableObject) {
988988
.def("RotateOffset", &MovableObject::RotateOffset)
989989
.def("SendMessage", &LuaAdaptersMovableObject::SendMessage1)
990990
.def("SendMessage", &LuaAdaptersMovableObject::SendMessage2)
991-
.def("RequestSyncedUpdate", &MovableObject::RequestSyncedUpdate);
991+
.def("RequestSyncedUpdate", &MovableObject::RequestSyncedUpdate)
992+
.def("GetScreenEffectPath", &MovableObject::GetScreenEffectPath)
993+
.def("SetScreenEffectPath", &MovableObject::SetScreenEffectPath);
992994
}
993995

994996
LuaBindingRegisterFunctionDefinitionForType(EntityLuaBindings, PEmitter) {

0 commit comments

Comments
 (0)