diff --git a/addons/GME/Scripts/Game/GME/Helpers/GME_VisibilityHelper.c b/addons/GME/Scripts/Game/GME/Helpers/GME_VisibilityHelper.c index 12738df..2a8ae3d 100644 --- a/addons/GME/Scripts/Game/GME/Helpers/GME_VisibilityHelper.c +++ b/addons/GME/Scripts/Game/GME/Helpers/GME_VisibilityHelper.c @@ -1,9 +1,8 @@ -/** -Helper class with staic functions to enable and disable visiblity of units -*/ - +//------------------------------------------------------------------------------------------------ +//! Helper class with staic functions to enable and disable visiblity of units class GME_VisibilityHelper { + //------------------------------------------------------------------------------------------------ static void SetVisibility(GenericEntity entity, bool visible) { // casting to possible supported types, if not null we found our match and change visibility and return @@ -22,9 +21,9 @@ class GME_VisibilityHelper } } + //------------------------------------------------------------------------------------------------ static bool GetVisibility(IEntity entity) { - int visible = entity.GetFlags() & EntityFlags.VISIBLE; - return visible; + return entity.GetFlags() & EntityFlags.VISIBLE; } } diff --git a/addons/GME/Scripts/GameCode/GME/Character/SCR_ChimeraCharacter.c b/addons/GME/Scripts/GameCode/GME/Character/SCR_ChimeraCharacter.c index c17e843..4183865 100644 --- a/addons/GME/Scripts/GameCode/GME/Character/SCR_ChimeraCharacter.c +++ b/addons/GME/Scripts/GameCode/GME/Character/SCR_ChimeraCharacter.c @@ -29,19 +29,19 @@ modded class SCR_ChimeraCharacter : ChimeraCharacter } //------------------------------------------------------------------------------------------------ - void GME_OnVisibilityValueUpdated() + void GME_SetVisibility(bool visible) { - if (m_bGME_isVisible) - this.SetFlags(EntityFlags.VISIBLE|EntityFlags.TRACEABLE, m_bGME_isVisible); - else - this.ClearFlags(EntityFlags.VISIBLE|EntityFlags.TRACEABLE); + m_bGME_isVisible = visible; + Replication.BumpMe(); + GME_OnVisibilityValueUpdated(); } //------------------------------------------------------------------------------------------------ - void GME_SetVisibility(bool visible) - { - m_bGME_isVisible = visible; - Replication.BumpMe(); - this.GME_OnVisibilityValueUpdated(); + protected void GME_OnVisibilityValueUpdated() + { + if (m_bGME_isVisible) + SetFlags(EntityFlags.VISIBLE | EntityFlags.TRACEABLE); + else + ClearFlags(EntityFlags.VISIBLE | EntityFlags.TRACEABLE); } } diff --git a/addons/GME/Scripts/GameCode/GME/Vehicle/Vehicle.c b/addons/GME/Scripts/GameCode/GME/Vehicle/Vehicle.c index bede9eb..83ac058 100644 --- a/addons/GME/Scripts/GameCode/GME/Vehicle/Vehicle.c +++ b/addons/GME/Scripts/GameCode/GME/Vehicle/Vehicle.c @@ -1,24 +1,23 @@ - - //------------------------------------------------------------------------------------------------ modded class Vehicle : BaseVehicle { [RplProp(onRplName: "GME_OnVisibilityValueUpdated")] protected bool m_bGME_isVisible = true; + //------------------------------------------------------------------------------------------------ void GME_SetVisibility(bool visible) - { + { m_bGME_isVisible = visible; Replication.BumpMe(); - this.GME_OnVisibilityValueUpdated(); + GME_OnVisibilityValueUpdated(); } - - void GME_OnVisibilityValueUpdated() + //------------------------------------------------------------------------------------------------ + protected void GME_OnVisibilityValueUpdated() { if (m_bGME_isVisible) - this.SetFlags(EntityFlags.VISIBLE|EntityFlags.TRACEABLE, m_bGME_isVisible); + SetFlags(EntityFlags.VISIBLE | EntityFlags.TRACEABLE); else - this.ClearFlags(EntityFlags.VISIBLE|EntityFlags.TRACEABLE); + ClearFlags(EntityFlags.VISIBLE | EntityFlags.TRACEABLE); } }; \ No newline at end of file