internal AdjustCompDefTonnageHelper(IIdentifier identifier, ValueChange <float> change)
 {
     this.identifier = identifier;
     this.change     = change;
 }
 internal AdjustCompDefInvSizeHelper(IIdentifier identifier, ValueChange <int> change)
 {
     this.identifier = identifier;
     this.change     = change;
 }
示例#3
0
        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.HasValue)
            {
                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($"set InventorySlots={locationDef.InventorySlots} on location={location}");
        }