File tree Expand file tree Collapse file tree 3 files changed +22
-24
lines changed Expand file tree Collapse file tree 3 files changed +22
-24
lines changed Original file line number Diff line number Diff line change 1- /**
2- Helper class with staic functions to enable and disable visiblity of units
3- */
4-
1+ //------------------------------------------------------------------------------------------------
2+ //! Helper class with staic functions to enable and disable visiblity of units
53class GME_VisibilityHelper
64{
5+ //------------------------------------------------------------------------------------------------
76 static void SetVisibility (GenericEntity entity , bool visible )
87 {
98 // casting to possible supported types, if not null we found our match and change visibility and return
@@ -22,9 +21,9 @@ class GME_VisibilityHelper
2221 }
2322 }
2423
24+ //------------------------------------------------------------------------------------------------
2525 static bool GetVisibility (IEntity entity )
2626 {
27- int visible = entity .GetFlags () & EntityFlags .VISIBLE ;
28- return visible ;
27+ return entity .GetFlags () & EntityFlags .VISIBLE ;
2928 }
3029}
Original file line number Diff line number Diff line change @@ -29,19 +29,19 @@ modded class SCR_ChimeraCharacter : ChimeraCharacter
2929 }
3030
3131 //------------------------------------------------------------------------------------------------
32- void GME_OnVisibilityValueUpdated ( )
32+ void GME_SetVisibility ( bool visible )
3333 {
34- if (m_bGME_isVisible )
35- this .SetFlags (EntityFlags .VISIBLE |EntityFlags .TRACEABLE , m_bGME_isVisible );
36- else
37- this .ClearFlags (EntityFlags .VISIBLE |EntityFlags .TRACEABLE );
34+ m_bGME_isVisible = visible ;
35+ Replication .BumpMe ();
36+ GME_OnVisibilityValueUpdated ();
3837 }
3938
4039 //------------------------------------------------------------------------------------------------
41- void GME_SetVisibility (bool visible )
42- {
43- m_bGME_isVisible = visible ;
44- Replication .BumpMe ();
45- this .GME_OnVisibilityValueUpdated ();
40+ protected void GME_OnVisibilityValueUpdated ()
41+ {
42+ if (m_bGME_isVisible )
43+ SetFlags (EntityFlags .VISIBLE | EntityFlags .TRACEABLE );
44+ else
45+ ClearFlags (EntityFlags .VISIBLE | EntityFlags .TRACEABLE );
4646 }
4747}
Original file line number Diff line number Diff line change 1-
2-
31//------------------------------------------------------------------------------------------------
42modded class Vehicle : BaseVehicle
53{
64 [RplProp (onRplName : "GME_OnVisibilityValueUpdated" )]
75 protected bool m_bGME_isVisible = true;
86
7+ //------------------------------------------------------------------------------------------------
98 void GME_SetVisibility (bool visible )
10- {
9+ {
1110 m_bGME_isVisible = visible ;
1211 Replication .BumpMe ();
13- this . GME_OnVisibilityValueUpdated ();
12+ GME_OnVisibilityValueUpdated ();
1413 }
1514
16-
17- void GME_OnVisibilityValueUpdated ()
15+ //------------------------------------------------------------------------------------------------
16+ protected void GME_OnVisibilityValueUpdated ()
1817 {
1918 if (m_bGME_isVisible )
20- this . SetFlags (EntityFlags .VISIBLE | EntityFlags .TRACEABLE , m_bGME_isVisible );
19+ SetFlags (EntityFlags .VISIBLE | EntityFlags .TRACEABLE );
2120 else
22- this . ClearFlags (EntityFlags .VISIBLE | EntityFlags .TRACEABLE );
21+ ClearFlags (EntityFlags .VISIBLE | EntityFlags .TRACEABLE );
2322 }
2423};
You can’t perform that action at this time.
0 commit comments