Rework shit again

This commit is contained in:
2025-03-16 01:50:22 +01:00
parent 8848b0c06e
commit 197ac61774
2 changed files with 62 additions and 43 deletions

View File

@@ -26,8 +26,7 @@ class Mod {
final List<String> loadAfter; // ModMetaData.loadAfter
final List<String> loadBefore; // ModMetaData.loadBefore
final List<String> incompatabilities; // ModMetaData.incompatibleWith
final bool
enabled; // ConfigFile.mods.firstWhere((mod) => mod.id == id).enabled
bool enabled;
final int size; // Count of files in the mod directory
final bool isBaseGame; // Is this the base RimWorld game
final bool isExpansion; // Is this a RimWorld expansion
@@ -42,10 +41,10 @@ class Mod {
required this.loadAfter,
required this.loadBefore,
required this.incompatabilities,
required this.enabled,
required this.size,
this.isBaseGame = false,
this.isExpansion = false,
this.enabled = false,
});
static Mod fromDirectory(String path, {bool skipFileCount = false}) {
@@ -250,10 +249,41 @@ class Mod {
loadAfter: loadAfter,
loadBefore: loadBefore,
incompatabilities: incompatabilities,
enabled: false,
size: size,
isBaseGame: isBaseGame,
isExpansion: isExpansion,
);
}
Mod copyWith({
String? name,
String? id,
String? path,
List<String>? versions,
String? description,
List<String>? hardDependencies,
List<String>? loadAfter,
List<String>? loadBefore,
List<String>? incompatabilities,
int? size,
bool? isBaseGame,
bool? isExpansion,
bool? enabled,
}) {
return Mod(
name: name ?? this.name,
id: id ?? this.id,
path: path ?? this.path,
versions: versions ?? this.versions,
description: description ?? this.description,
hardDependencies: hardDependencies ?? this.hardDependencies,
loadAfter: loadAfter ?? this.loadAfter,
loadBefore: loadBefore ?? this.loadBefore,
incompatabilities: incompatabilities ?? this.incompatabilities,
size: size ?? this.size,
isBaseGame: isBaseGame ?? this.isBaseGame,
isExpansion: isExpansion ?? this.isExpansion,
enabled: enabled ?? this.enabled,
);
}
}