// get heat dissipation rate of the engine by inventory and rating
 public static void Postfix(Mech __instance, ref float __result)
 {
     try
     {
         __result += EngineHeat.GetEngineHeatDissipation(__instance.MechDef.Inventory);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
コード例 #2
0
 public static void Validate(MechDef mechDef, ref Dictionary <MechValidationType, List <string> > errorMessages)
 {
     UniqueController.ValidationRulesCheck(mechDef, ref errorMessages);
     Armor.ValidationRulesCheck(mechDef, ref errorMessages);
     Structure.ValidationRulesCheck(mechDef, ref errorMessages);
     ReservedSlots.ValidationRulesCheck(mechDef, ref errorMessages);
     EngineHeat.ValidationRulesCheck(mechDef, ref errorMessages);
     EngineMisc.ValidationRulesCheck(mechDef, ref errorMessages);
     Gyro.ValidationRulesCheck(mechDef, ref errorMessages);
     Cockpit.ValidationRulesCheck(mechDef, ref errorMessages);
 }
コード例 #3
0
 public static float DissipationCapacity(this HeatSinkDef @this)
 {
     try
     {
         if (@this.IsEngineCore())
         {
             return(EngineHeat.GetEngineHeatDissipation(mechDef.Inventory));
         }
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
     return(@this.DissipationCapacity);
 }
コード例 #4
0
        // only allow one engine part per specific location
        public static bool Prefix(
            MechLabLocationWidget __instance,
            PointerEventData eventData,
            MechLabDropTargetType addToType,
            MechLabPanel ___mechLab,
            List <MechLabItemSlotElement> ___localInventory,
            ref string ___dropErrorMessage)
        {
            try
            {
                if (___mechLab == null)
                {
                    return(false);
                }

                var dragItem = ___mechLab.DragItem as MechLabItemSlotElement;
                if (dragItem == null)
                {
                    return(false);
                }

                var result = EngineHeat.DropCheck(__instance, ___mechLab, dragItem, ___localInventory);
                var error  = result as ErrorResult;
                var remove = result as RemoveItemResult;
                if (error != null)
                {
                    ___dropErrorMessage = error.errorMessage;
                    ___mechLab.ShowDropErrorMessage(___dropErrorMessage);
                    ___mechLab.OnDrop(eventData);
                    return(false);
                }
                else if (remove != null)
                {
                    // remove item and delete it
                    dragItem.thisCanvasGroup.blocksRaycasts = true;
                    dragItem.MountedLocation = ChassisLocations.None;
                    ___mechLab.dataManager.PoolGameObject(MechLabPanel.MECHCOMPONENT_ITEM_PREFAB, dragItem.gameObject);
                    ___mechLab.ClearDragItem(true);
                    return(false);
                }
            }
            catch (Exception e)
            {
                Control.mod.Logger.LogError(e);
            }

            return(true);
        }
コード例 #5
0
        public static float OverrideDissipationCapacity(this HeatSinkDef @this)
        {
            try
            {
                if (def != null && @this.Is <EngineCoreDef>())
                {
                    return(EngineHeat.GetEngineHeatDissipation(def.Inventory));
                }
            }
            catch (Exception e)
            {
                Control.mod.Logger.LogError(e);
            }

            return(@this.DissipationCapacity);
        }