Prevent texture packs from supporting all games

This commit is contained in:
rubenwardy 2023-06-19 22:22:55 +01:00
parent f2eee008f6
commit bb41ea7dcc
2 changed files with 17 additions and 7 deletions

@ -671,6 +671,8 @@ def game_support(package):
force_game_detection = package.supported_games.filter(and_(
PackageGameSupport.confidence > 1, PackageGameSupport.supports == True)).count() == 0
can_support_all_games = package.type != PackageType.TXP
can_override = can_edit and current_user not in package.maintainers
form = GameSupportForm() if can_edit else None
@ -713,7 +715,8 @@ def game_support(package):
else:
package.supported_games.filter_by(confidence=1).delete()
package.supports_all_games = form.supports_all_games.data
if can_support_all_games:
package.supports_all_games = form.supports_all_games.data
add_audit_log(AuditSeverity.NORMAL, current_user, "Edited game support", package.get_url("packages.game_support"), package)
@ -744,7 +747,8 @@ def game_support(package):
return render_template("packages/game_support.html", package=package, form=form,
mod_conf_lines=mod_conf_lines, force_game_detection=force_game_detection,
tabs=get_package_tabs(current_user, package), current_tab="game_support")
can_support_all_games=can_support_all_games, tabs=get_package_tabs(current_user, package),
current_tab="game_support")
@bp.route("/packages/<author>/<name>/stats/")

@ -90,11 +90,17 @@
</p>
{% endif %}
{{ render_checkbox_field(form.supports_all_games) }}
<p class="text-muted">
{{ _("Unless otherwise stated, this package should work with all games.") }}
{{ _("You can check this and still specify games in supported_games that you've tested.") }}
</p>
{{ render_checkbox_field(form.supports_all_games, disabled=not can_support_all_games) }}
{% if can_support_all_games %}
<p class="text-muted">
{{ _("Unless otherwise stated, this package should work with all games.") }}
{{ _("You can check this and still specify games in supported_games that you've tested.") }}
</p>
{% elif package.type.name == "TXP" %}
<p class="text-muted">
{{ _("It's not possible for texture packs to support all games") }}
</p>
{% endif %}
{% if form.supported and form.unsupported %}
<h3>