public MyDebugRenderCompomentDrawDrillBase(MyDrillBase drillBase) : base(null) { m_drillBase = drillBase; }
// public static bool TestPatchMethod2(MyDrillBase __instance, MyDrillSensorBase.DetectionInfo entry, //bool collectOre, //bool performCutout, //bool assignDamagedMaterial, //ref MyStringHash targetMaterial) // { // // return false; // if (__instance.OutputInventory.Owner.GetBaseEntity() is MyShipDrill drill) // { // MyVoxelBase entity = entry.Entity as MyVoxelBase; // Vector3D worldPosition = entry.DetectionPoint; // bool flag1 = false; // int count = 0; // CrunchUtilitiesPlugin.Log.Info(count + ""); // count++; // CrunchUtilitiesPlugin.Log.Info(count + ""); // count++; // MyVoxelMaterialDefinition material = (MyVoxelMaterialDefinition)null; // Vector3D center = __instance.CutOut.Sphere.Center; // MatrixD worldMatrix = drill.WorldMatrix; // Vector3D forward = worldMatrix.Forward; // Vector3D from = center - forward; // worldMatrix = drill.WorldMatrix; // CrunchUtilitiesPlugin.Log.Info(count + ""); // count++; // MyPhysics.CastRay(from, from + worldMatrix.Forward * (__instance.CutOut.Sphere.Center + 1.0), m_castList, 28); // CrunchUtilitiesPlugin.Log.Info(count + ""); // count++; // bool flag2 = false; // CrunchUtilitiesPlugin.Log.Info(count + ""); // count++; // foreach (MyPhysics.HitInfo cast in m_castList) // { // CrunchUtilitiesPlugin.Log.Info(count + ""); // count++; // if (cast.HkHitInfo.GetHitEntity() is MyVoxelBase) // { // worldPosition = cast.Position; // MyVoxelMaterialDefinition material2; // material2 = entity.GetMaterialAt(ref worldPosition); // if (material2 == null) // { // } // MyObjectBuilder_Ore newObject = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_Ore>(material2.MinedOre); // if (!newObject.SubtypeName.ToLower().Contains("stone")) // { // material = material2; // flag2 = true; // break; // } // } // } // if (material == null) // { // return false; // } // CrunchUtilitiesPlugin.Log.Info(count + ""); // count++; // MyObjectBuilder_Ore newObject2 = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_Ore>(material.MinedOre); // if (newObject2.SubtypeName.ToLower().Contains("stone")) // { // CrunchUtilitiesPlugin.Log.Info("It be stone"); // return false; // } // return true; // } // return true; // } public static bool TestPatchMethod(MyDrillBase __instance, MyVoxelMaterialDefinition material, Vector3 hitPosition) { if (file != null && !file.DeleteStoneAuto) { return(true); } if (string.IsNullOrEmpty(material.MinedOre)) { return(false); } List <IMyEntity> l = new List <IMyEntity>(); if (__instance.OutputInventory == null || __instance.OutputInventory.Owner == null || __instance.OutputInventory.Owner.GetBaseEntity() == null) { return(true); } if (__instance.OutputInventory != null && __instance.OutputInventory.Owner != null) { if (__instance.OutputInventory.Owner.GetBaseEntity() is MyShipDrill drill) { if (drill == null) { return(true); } if (drill.DisplayNameText != null && containsName(drill.DisplayNameText)) { MyObjectBuilder_Ore newObject = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_Ore>(material.MinedOre); if (newObject.SubtypeName.ToLower().Contains("stone")) { //if (file.UsingDraconisEliteDrills) //{ // if (!drill.BlockDefinition.BlockPairName.Equals("Drill8x")) // { // return true; // } //} return(false); } } if (ids.Contains(drill.OwnerId)) { MyObjectBuilder_Ore newObject = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_Ore>(material.MinedOre); if (newObject.SubtypeName.ToLower().Contains("stone")) { //if (file.UsingDraconisEliteDrills) //{ // if (!drill.BlockDefinition.BlockPairName.Equals("Drill8x")) // { // return true; // } //} return(false); } } else { return(true); } } } return(true); }
public static void TestPatchMethod(MyDrillBase __instance, MyVoxelMaterialDefinition material, VRageMath.Vector3 hitPosition, int removedAmount, bool onlyCheck) { if (__instance.OutputInventory != null && __instance.OutputInventory.Owner != null) { if (__instance.OutputInventory.Owner.GetBaseEntity() is MyShipDrill shipDrill) { if (drill == null) { drill = __instance.GetType(); } if (string.IsNullOrEmpty(material.MinedOre)) { return; } if (!onlyCheck) { long playerId = 0; bool HasContract = false; foreach (IMyCockpit cockpit in shipDrill.CubeGrid.GetFatBlocks().OfType <IMyCockpit>()) { if (cockpit.Pilot != null) { MyCharacter pilot = cockpit.Pilot as MyCharacter; if (playerWithContract.ContainsKey(pilot.GetPlayerIdentityId())) { PlayerStorage storage = playerWithContract[pilot.GetPlayerIdentityId()]; if (storage.CheckIfInMiningArea(hitPosition, material.MinedOre)) { playerId = pilot.GetPlayerIdentityId(); HasContract = true; break; } } } } if (!HasContract) { return; } MyObjectBuilder_Ore newObject = MyObjectBuilderSerializer.CreateNewObject <MyObjectBuilder_Ore>(material.MinedOre); newObject.MaterialTypeName = new MyStringHash?(material.Id.SubtypeId); float num = (float)((double)removedAmount / (double)byte.MaxValue * 1.0) * __instance.VoxelHarvestRatio * material.MinedOreRatio; if (!MySession.Static.AmountMined.ContainsKey(material.MinedOre)) { MySession.Static.AmountMined[material.MinedOre] = (MyFixedPoint)0; } MySession.Static.AmountMined[material.MinedOre] += (MyFixedPoint)num; MyPhysicalItemDefinition physicalItemDefinition = MyDefinitionManager.Static.GetPhysicalItemDefinition((MyObjectBuilder_Base)newObject); MyFixedPoint amountItems1 = (MyFixedPoint)(num / physicalItemDefinition.Volume); MyFixedPoint maxAmountPerDrop = (MyFixedPoint)(float)(0.150000005960464 / (double)physicalItemDefinition.Volume); MyFixedPoint collectionRatio = (MyFixedPoint)drill.GetField("m_inventoryCollectionRatio", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); MyFixedPoint b = amountItems1 * ((MyFixedPoint)1 - collectionRatio); MyFixedPoint amountItems2 = MyFixedPoint.Min(maxAmountPerDrop * 10 - (MyFixedPoint)0.001, b); MyFixedPoint totalAmount = amountItems1 * collectionRatio - amountItems2; if (playerWithContract[playerId].AddToContractAmount(material.MinedOre, totalAmount.ToIntSafe())) { foreach (ContractHolder contractHolder in playerWithContract[playerId].MiningContracts.Values) { if (contractHolder.contract.subTypeId.Equals(material.MinedOre)) { ShipyardCommands.SendMessage("Big Boss Dave", "Contract progress :" + material.MinedOre + " " + contractHolder.minedAmount + " / " + contractHolder.amountToMine, Color.Gold, (long)MySession.Static.Players.TryGetSteamId(playerId)); } } } } } else { return; } } }