Ejemplo n.º 1
0
        void RunDisassemblerStuff()
        {
            disassemblers.ForEach(disAss =>
            {
                disAss.Mode      = MyAssemblerMode.Disassembly;
                disAss.Repeating = true;
            });

            IMyInventory testInv = disassemblers[0].GetInventory(1);

            List <IMyTerminalBlock> connectedBlocks = new List <IMyTerminalBlock>();

            GridTerminalSystem.GetBlocksOfType(connectedBlocks, block =>
                                               block.HasInventory &&
                                               block.IsWorking &&
                                               block.GetInventory(0).IsConnectedTo(testInv)
                                               );

            StringBuilder msg = new StringBuilder();

            connectedBlocks.ForEach(block =>
            {
                List <MyInventoryItem> items = new List <MyInventoryItem>();
                block.GetInventory(0).GetItems(items, item =>
                                               item.Type == MyItemType.MakeTool("WelderItem") ||
                                               item.Type == MyItemType.MakeTool("AngleGrinderItem") ||
                                               item.Type == MyItemType.MakeTool("HandDrillItem") ||
                                               item.Type == MyItemType.MakeTool("AutomaticRifleItem")
                                               );

                //block.GetInventory(0).GetItems(items);

                if (items.Count > 0)
                {
                    items.ForEach(item =>
                    {
                        block.GetInventory(0).TransferItemTo(testInv, item);
                    });
                }
            });
        }
Ejemplo n.º 2
0
        public static int CalculatePlayerThreat(IMyCharacter character, Vector3D requesterPosition)
        {
            if (character.IsDead)
            {
                return(0);
            }
            float threat   = 0;
            float distance = (float)Vector3D.Distance(requesterPosition, character.GetPosition());

            threat += distance < 175 ? distance < 125 ? distance < 75 ? 5000 : 2500 : 1500 : 500;
            if (character.EquippedTool is IMyAngleGrinder)
            {
                threat *= 5;
            }
            IMyInventory           myInventory = character.GetInventory();
            List <MyInventoryItem> items       = new List <MyInventoryItem>();

            myInventory.GetItems(items);
            foreach (MyInventoryItem item in items)
            {
                if (item.Type == MyItemType.MakeTool("AngleGrinder4Item"))
                {
                    threat += 1000;
                    continue;
                }
                if (item.Type == MyItemType.MakeTool("AngleGrinder3Item"))
                {
                    threat += 750;
                    continue;
                }
                if (item.Type == MyItemType.MakeTool("AngleGrinder2Item"))
                {
                    threat += 500;
                    continue;
                }
                if (item.Type == MyItemType.MakeTool("AngleGrinderItem"))
                {
                    threat += 250;
                    continue;
                }
                if (item.Type == MyItemType.MakeTool("UltimateAutomaticRifleItem"))
                {
                    threat += 100;
                    continue;
                }
                if (item.Type == MyItemType.MakeTool("RapidFireAutomaticRifleItem"))
                {
                    threat += 80;
                    continue;
                }
                if (item.Type == MyItemType.MakeTool("PreciseAutomaticRifleItem"))
                {
                    threat += 60;
                    continue;
                }
                if (item.Type == MyItemType.MakeTool("AutomaticRifleItem"))
                {
                    threat += 40;
                    continue;
                }
                if (item.Type == MyItemType.MakeAmmo("NATO_5p56x45mm"))
                {
                    threat += 20;
                    continue;
                }
            }

            return((int)threat);
        }
Ejemplo n.º 3
0
 public static MyInventoryItem MockTool(String subType, float amount = 1)
 {
     return(new MyInventoryItem(MyItemType.MakeTool(subType), 0, (MyFixedPoint)amount));
 }