1- using Sandbox . Game . Entities ;
2- using VRage . Game . Entity ;
3-
4- namespace EssentialsPlugin . EntityManagers
1+ namespace EssentialsPlugin . EntityManagers
52{
63 using System ;
7- using System . Collections ;
84 using System . Collections . Generic ;
95 using System . Linq ;
106 using System . Threading ;
117 using EssentialsPlugin . ProcessHandlers ;
128 using EssentialsPlugin . Utility ;
13- using Sandbox . Common ;
14- using Sandbox . Common . ObjectBuilders ;
159 using Sandbox . ModAPI ;
1610 using Sandbox . ModAPI . Ingame ;
1711 using SEModAPIInternal . API . Common ;
18- using SEModAPIInternal . API . Entity ;
1912 using VRage . ModAPI ;
2013 using VRage . ObjectBuilders ;
2114 using VRageMath ;
22- using IMyFunctionalBlock = Sandbox . ModAPI . Ingame . IMyFunctionalBlock ;
2315 using IMyProductionBlock = Sandbox . ModAPI . Ingame . IMyProductionBlock ;
24- using IMyTerminalBlock = Sandbox . ModAPI . Ingame . IMyTerminalBlock ;
25- using Sandbox . Engine . Multiplayer ;
26- using Sandbox . Game . Replication ;
2716 using Sandbox . Game . Entities ;
28- using Sandbox . Game . Multiplayer ;
2917 using Sandbox . Game . World ;
30- using VRage . Collections ;
3118 using Sandbox . Game . Entities . Blocks ;
32- using Sandbox . Game . Entities . Character ;
3319 using Sandbox . Game . Entities . Cube ;
3420 using SpaceEngineers . Game . ModAPI . Ingame ;
3521 using VRage . Game ;
3622 using VRage . Game . Entity ;
3723 using VRage . Game . ModAPI ;
38-
39- class ConcealItem
40- {
41- public ConcealItem ( IMyEntity _entity , string _reason )
42- {
43- this . entity = _entity ;
44- this . reason = _reason ;
45- }
46- public ConcealItem ( KeyValuePair < IMyEntity , string > kvp )
47- {
48- this . entity = kvp . Key ;
49- this . reason = kvp . Value ;
50- }
51-
52- public IMyEntity entity ;
53- public string reason ;
54- }
55-
24+
5625 public class EntityManagement
5726 {
5827 private static volatile bool _checkReveal ;
@@ -322,7 +291,7 @@ public static void CheckAndRevealEntitiesObsolete()
322291 if ( entity . InScene )
323292 continue ;
324293
325- RevealEntityObsolete ( new KeyValuePair < IMyEntity , string > ( entity , "Obsolete Reveal" ) ) ;
294+ Wrapper . GameAction ( ( ) => RevealEntityObsolete ( new KeyValuePair < IMyEntity , string > ( entity , "Obsolete Reveal" ) ) ) ;
326295 }
327296
328297 DateTime reStart = DateTime . Now ;
@@ -696,8 +665,12 @@ private static void UnregisterHierarchy( MyEntity entity )
696665 childEntity . RemoveFromGamePruningStructure ( ) ;
697666
698667 //child.Container.Entity.InScene = false;
699- //if (child.Container.Entity.Physics != null)
700- // child.Container.Entity.Physics.Enabled = false;
668+
669+ if ( ! PluginSettings . Instance . DynamicConcealPhysics )
670+ continue ;
671+
672+ if ( child . Container . Entity . Physics != null )
673+ child . Container . Entity . Physics . Enabled = false ;
701674 }
702675
703676 UnregisteredEntities . Add ( entity ) ;
@@ -715,14 +688,16 @@ private static void ReregisterHierarchy( MyEntity entity )
715688 MyEntities . RegisterForUpdate ( childEntity ) ;
716689 childEntity . AddToGamePruningStructure ( ) ;
717690
718- //child.Container.Entity.InScene = false;
719- //if (child.Container.Entity.Physics != null)
720- // child.Container.Entity.Physics.Enabled = false;
691+ //child.Container.Entity.InScene = true;
692+
693+ if ( ! PluginSettings . Instance . DynamicConcealPhysics )
694+ continue ;
695+
696+ if ( child . Container . Entity . Physics != null )
697+ child . Container . Entity . Physics . Enabled = true ;
721698 }
722699
723700 UnregisteredEntities . Remove ( entity ) ;
724701 }
725702 }
726- }
727-
728- //TODO: command to remove dead owners from grid
703+ }
0 commit comments