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

Commit 970a70f

Browse files
committed
Added setter for soundcontainer top level soundset, useful for changing gun sounds and such
1 parent 0298cb7 commit 970a70f

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
631631

632632
Additionally, `AddSound` and `AddSoundSet` INI properties work for `SoundSets`. They are exactly the same as they are for `SoundContainers`.
633633

634-
- You can get the top level `SoundSet` of a `SoundContainer` with `soundContainer:GetTopLevelSoundSet` and manipulate it as described above. This allows you full interaction with all levels of `SoundSets` in a `SoundContainer`.
634+
- You can get the top level `SoundSet` of a `SoundContainer` with `soundContainer:GetTopLevelSoundSet` and manipulate it as described above. You can also set it to fully overwrite it with `soundContainer:SetTopLevelSoundSet`. This allows you full interaction with all levels of `SoundSets` in a `SoundContainer`.
635635

636636
</details>
637637

Entities/SoundContainer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ namespace RTE {
8888
/// <returns>A reference to the top level SoundSet of this SoundContainer.</returns>
8989
SoundSet & GetTopLevelSoundSet() { return m_TopLevelSoundSet; }
9090

91+
/// <summary>
92+
/// Copies the passed in SoundSet reference into the top level SoundSet of this SoundContainer, effectively making that the new top level SoundSet.
93+
/// </summary>
94+
/// <param name="newTopLevelSoundSet">A reference to the new top level SoundSet for this SoundContainer.</param>
95+
void SetTopLevelSoundSet(SoundSet &newTopLevelSoundSet) { m_TopLevelSoundSet = newTopLevelSoundSet; }
96+
9197
/// <summary>
9298
/// Gets a vector of hashes of the sounds selected to be played next in this SoundContainer.
9399
/// </summary>

Lua/LuaBindingsEntities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ namespace RTE {
11131113

11141114
.def("HasAnySounds", &SoundContainer::HasAnySounds)
11151115
.def("GetTopLevelSoundSet", &SoundContainer::GetTopLevelSoundSet)
1116+
.def("SetTopLevelSoundSet", &SoundContainer::SetTopLevelSoundSet)
11161117
.def("IsBeingPlayed", &SoundContainer::IsBeingPlayed)
11171118
.def("Play", (bool (SoundContainer:: *)()) &SoundContainer::Play)
11181119
.def("Play", (bool (SoundContainer:: *)(const int player)) &SoundContainer::Play)

0 commit comments

Comments
 (0)