1212 BaseOption ,
1313 BoolOption ,
1414 ButtonOption ,
15+ CoopSupport ,
1516 DropdownOption ,
1617 Game ,
1718 GroupedOption ,
@@ -189,6 +190,64 @@ def get_option_header() -> str:
189190 )
190191
191192
193+ def create_description_title (mod : Mod ) -> str :
194+ """
195+ Creates the description title to use for a mod's description option.
196+
197+ Args:
198+ mod: The mod to create the title for.
199+ Returns:
200+ The description title.
201+ """
202+ description_title = ""
203+ if mod .author :
204+ description_title += f"By { mod .author } "
205+ if mod .author and mod .version :
206+ description_title += " - "
207+ if mod .version :
208+ description_title += mod .version
209+ return description_title or "Description"
210+
211+
212+ def create_description_text (mod : Mod ) -> str :
213+ """
214+ Creates the text to use for a mod's description option.
215+
216+ Args:
217+ mod: The mod to create the title for.
218+ Returns:
219+ The description text.
220+ """
221+ blocks : list [str ] = []
222+
223+ if Game .get_current () not in mod .supported_games :
224+ supported = [g .name for g in Game if g in mod .supported_games and g .name is not None ]
225+ blocks .append (
226+ "<font color='#ffff00'>Incompatible Game!</font>\n "
227+ "This mod supports: " + ", " .join (supported ),
228+ )
229+
230+ if mod .description :
231+ blocks .append (mod .description )
232+
233+ match mod .coop_support :
234+ case CoopSupport .Unknown :
235+ blocks .append ("<font color='#e0e0e0'>Coop Support: Unknown</font>" )
236+ case CoopSupport .Incompatible :
237+ blocks .append (
238+ "<font color='#e0e0e0'>Coop Support:</font>"
239+ " <font color='#ffff00'>Incompatible</font>" ,
240+ )
241+ case CoopSupport .RequiresAllPlayers :
242+ blocks .append (
243+ "<font color='#e0e0e0'>Coop Support: Requires All Players</font>" ,
244+ )
245+ case CoopSupport .ClientSide :
246+ blocks .append ("<font color='#e0e0e0'>Coop Support: Client Side</font>" )
247+
248+ return "\n \n " .join (blocks )
249+
250+
192251def get_mod_options (mod : Mod ) -> tuple [BaseOption , ...]:
193252 """
194253 Gets the full list of mod options to display, including our custom header.
@@ -201,27 +260,11 @@ def get_mod_options(mod: Mod) -> tuple[BaseOption, ...]:
201260
202261 def inner () -> Iterator [BaseOption ]:
203262 # Display the author and version in the title, if they're not the empty string
204- description_title = ""
205- if mod .author :
206- description_title += f"By { mod .author } "
207- if mod .author and mod .version :
208- description_title += " - "
209- if mod .version :
210- description_title += mod .version
211- description_title = description_title or "Description"
212-
213- description = mod .description
214- if Game .get_current () not in mod .supported_games :
215- supported = [g .name for g in Game if g in mod .supported_games and g .name is not None ]
216- description = (
217- "<font color='#ffff00'>Incompatible Game!</font>\r "
218- "This mod supports: " + ", " .join (supported ) + "\n \n " + description
219- )
220263
221264 yield ButtonOption (
222265 "Description" ,
223- description = description ,
224- description_title = description_title ,
266+ description = create_description_text ( mod ) ,
267+ description_title = create_description_title ( mod ) ,
225268 )
226269
227270 if not mod .enabling_locked :
0 commit comments