Beispiel #1
0
            public static void Postfix(DeconstructTool __instance, int cell)
            {
                if (!((FilteredDragTool)__instance).IsActiveLayer(ToolParameterMenu.FILTERLAYERS.BACKWALL))
                {
                    return;
                }
                if (!MyGrid.IsScaffolding(cell))
                {
                    return;
                }

                GameObject gameObject = Grid.Objects[cell, (int)ObjectLayer.AttachableBuilding];

                if (gameObject != null)
                {
                    gameObject.Trigger(-790448070, null);
                    Prioritizable component = gameObject.GetComponent <Prioritizable>();
                    if (component != null)
                    {
                        component.SetMasterPriority(ToolMenu.Instance.PriorityScreen.GetLastSelectedPriority());
                    }
                }
            }
Beispiel #2
0
        private static void Postfix(DeconstructTool __instance, ref Dictionary <string, ToolParameterMenu.ToggleState> filters)
        {
            //Debug.Log("=== DefaultDeconstruct INI ===");
            //filters.Add(ToolParameterMenu.FILTERLAYERS.ALL, ToolParameterMenu.ToggleState.On);
            //filters.Add(ToolParameterMenu.FILTERLAYERS.BUILDINGS, ToolParameterMenu.ToggleState.Off);

            //DeconstructTool (DeconstructTool) - TODO Need to get method execution only when DeconstructTool calls it
            if (__instance.ToString() == "DeconstructTool (DeconstructTool)")
            {
                if (filters.ContainsKey(ToolParameterMenu.FILTERLAYERS.BUILDINGS) && filters.ContainsKey(ToolParameterMenu.FILTERLAYERS.ALL))
                {
                    filters[ToolParameterMenu.FILTERLAYERS.ALL]       = ToolParameterMenu.ToggleState.Off;
                    filters[ToolParameterMenu.FILTERLAYERS.BUILDINGS] = ToolParameterMenu.ToggleState.On;
                    Debug.Log("=== DEFAULT DECONSTRUCT Tool set to BUILDINGS ===");
                }
                else
                {
                    Debug.Log("=== DEFAULT DECONSTRUCT - Could not find Keys");
                };
            }
            ;
            //Debug.Log("=== DefaultDeconstruct CHANGED ===");
        }
 public static void DestroyInstance()
 {
     Instance = null;
 }
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     Instance = this;
 }