예제 #1
0
        // only allow one engine core
        internal static void EngineCoreValidateAdd(
            MechComponentDef newComponentDef,
            List <MechLabItemSlotElement> localInventory,
            ref string dropErrorMessage,
            ref bool result)
        {
            try
            {
                if (!newComponentDef.IsEngineCore())
                {
                    return;
                }

                var existingEngine = localInventory.Select(c => c.ComponentRef).GetEngineCoreRef();
                if (existingEngine == null)
                {
                    return;
                }

                dropErrorMessage = string.Format("Cannot add {0}: Engine core is already installed", newComponentDef.Description.Name);
                result           = false;
            }
            catch (Exception e)
            {
                Control.mod.Logger.LogError(e);
            }
        }
예제 #2
0
        internal static EngineCoreDef GetEngineCoreDef(this MechComponentDef @this)
        {
            if (@this == null || [email protected]())
            {
                return(null);
            }

            return(new EngineCoreDef(@this));
        }