Skip to content

Commit bae6605

Browse files
committed
Ability to set silent level changer mode from scripts (#853)
1 parent 8950cb0 commit bae6605

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/xrGame/level_changer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class CLevelChanger : public CGameObject, public Feel::Touch
4343
virtual bool IsVisibleForZones() { return false; }
4444
void EnableLevelChanger(bool b) { m_b_enabled = b; }
4545
bool IsLevelChangerEnabled() const { return m_b_enabled; }
46+
void EnableSilentMode(bool silent) { m_bSilentMode = silent; }
47+
bool IsSilentModeEnabled() const { return m_bSilentMode; }
4648
void SetLEvelChangerInvitationStr(LPCSTR str) { m_invite_str = str; }
4749
// serialization
4850
virtual bool net_SaveRelevant();

src/xrGame/script_game_object_script3.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "ZoneCampfire.h"
3535
#include "PhysicObject.h"
3636
#include "Artefact.h"
37+
#include "level_changer.h"
3738

3839
/*
3940
New luabind makes incorrect casts in this case. He makes casts only to 'true derived class'.
@@ -403,6 +404,17 @@ luabind::class_<CScriptGameObject>& script_register_game_object2(luabind::class_
403404
.def("actor_look_at_point", &CScriptGameObject::ActorLookAtPoint)
404405
.def("enable_level_changer", &CScriptGameObject::enable_level_changer)
405406
.def("is_level_changer_enabled", &CScriptGameObject::is_level_changer_enabled)
407+
.def("enable_silent_level_changer", [](const CScriptGameObject* self, bool silent)
408+
{
409+
if (auto* lch = smart_cast<CLevelChanger*>(&self->object()))
410+
lch->EnableSilentMode(silent);
411+
})
412+
.def("is_level_changer_silent", [](const CScriptGameObject* self)
413+
{
414+
if (const auto* lch = smart_cast<CLevelChanger*>(&self->object()))
415+
return lch->IsSilentModeEnabled();
416+
return false;
417+
})
406418

407419
.def("set_level_changer_invitation", &CScriptGameObject::set_level_changer_invitation)
408420
.def("start_particles", &CScriptGameObject::start_particles)

0 commit comments

Comments
 (0)