internal AdjustCompDefInvSizeHelper(IIdentifier identifier, ValueChange <int> change)
 {
     this.identifier = identifier;
     this.change     = change;
 }
        private static void ModifyInventorySlots(ref LocationDef locationDef, ChassisLocations location, ValueChange <int> change)
        {
            if (locationDef.Location != location)
            {
                return;
            }

            var newValue = change.Change(locationDef.InventorySlots);

            if (newValue < 1)
            {
                return;
            }

            var info  = typeof(LocationDef).GetField("InventorySlots");
            var value = Convert.ChangeType(newValue, info.FieldType);
            var box   = (object)locationDef;

            info.SetValue(box, value);
            locationDef = (LocationDef)box;

            //Control.mod.Logger.LogDebug("ModifyInventorySlots InventorySlots=" + locationDef.InventorySlots);
        }
Beispiel #3
0
 internal AdjustCompDefTonnageHelper(IIdentifier identifier, ValueChange <float> change)
 {
     this.identifier = identifier;
     this.change     = change;
 }