Exemple #1
0
 public static bool IsHacker(IMyCubeBlock block)
 {
     if (!(block is IMyLandingGear))
         return false;
     string descr = block.GetCubeBlockDefinition().DescriptionString;
     return descr != null && descr.ToLower().Contains("hacker");
 }
 public static WeaponDescription GetFor(IMyCubeBlock block)
 {
     WeaponDescription descr;
     if (!KnownDescriptions.TryGetValue(block.BlockDefinition, out descr))
     {
         descr = CreateFrom(block.GetCubeBlockDefinition());
         KnownDescriptions.Add(block.BlockDefinition, descr);
     }
     return descr;
 }
Exemple #3
0
        //private static float allowedBreakForce = 1f;

        public static bool IsHacker(IMyCubeBlock block)
        {
            if (!(block is IMyLandingGear))
            {
                return(false);
            }
            string descr = block.GetCubeBlockDefinition().DescriptionString;

            return(descr != null && descr.ToLower().Contains("hacker"));
        }
Exemple #4
0
        public static WeaponDescription GetFor(IMyCubeBlock block)
        {
            WeaponDescription descr;

            if (!KnownDescriptions.TryGetValue(block.BlockDefinition, out descr))
            {
                descr = CreateFrom(block.GetCubeBlockDefinition());
                KnownDescriptions.Add(block.BlockDefinition, descr);
            }
            return(descr);
        }
Exemple #5
0
        private static Definition GetDefinition(IMyCubeBlock block)
        {
            Definition result;
            SerializableDefinitionId ID = block.BlockDefinition;

            if (AllDefinitions.TryGetValue(ID, out result))
            {
                staticLogger.debugLog("definition already loaded for " + ID);
                return(result);
            }

            staticLogger.debugLog("creating new definition for " + ID);
            result = new Definition();

            MyCubeBlockDefinition def = block.GetCubeBlockDefinition();

            if (def == null)
            {
                throw new NullReferenceException("no block definition found for " + block.getBestName());
            }

            if (string.IsNullOrWhiteSpace(def.DescriptionString))
            {
                staticLogger.debugLog("No description, using defaults for " + ID, Logger.severity.WARNING);
                result.Radar = true;
                AllDefinitions.Add(ID, result);
                return(result);
            }

            XML_Amendments <Definition> ammend = new XML_Amendments <Definition>(result);

            ammend.AmendAll(def.DescriptionString, true);
            result = ammend.Deserialize();

            //staticLogger.debugLog("new definition:\n" + MyAPIGateway.Utilities.SerializeToXML<Definition>(result), "GetDefinition()");
            AllDefinitions.Add(ID, result);
            return(result);
        }
Exemple #6
0
 protected override float BlockCost(IMyCubeBlock block)
 {
     return((block.GetCubeBlockDefinition() as MyPowerProducerDefinition).MaxPowerOutput * 1000f);
 }
Exemple #7
0
 protected override float BlockCost(IMyCubeBlock block)
 {
     return ((block.GetCubeBlockDefinition() as MyPowerProducerDefinition).MaxPowerOutput * 1000f);
 }
Exemple #8
0
		private int MaxPowerOutput(IMyCubeBlock block)
		{
			var definition = block.GetCubeBlockDefinition() as MyPowerProducerDefinition;
			return (int)(definition.MaxPowerOutput * 1000f);
		}