Remove legacy bansystem and add WARN punish type

This commit is contained in:
bucket
2026-04-14 20:34:25 +02:00
parent 33329218cf
commit 3e2d6dd24d
11 changed files with 60 additions and 26 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
<Project Sdk="Godot.NET.Sdk/4.7.0-dev.3">
<Project Sdk="Godot.NET.Sdk/4.7.0-dev.4">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
+1 -1
View File
@@ -7,4 +7,4 @@ class_name Punishment extends Resource
## in unix time, zero means forever
@export var punish_end:int
enum punishment_types{BAN,MUTE}
enum punishment_types{BAN,MUTE,WARN}
+11 -2
View File
@@ -12,14 +12,23 @@ func Export(Punishments:Array[Punishment],file:String) -> void:
continue
content += "NAME: " + punishment.username + "\n"
content += "UID: " + punishment.uid + "\n"
content += "PUNISHMENT: " + ("MUTE" if punishment.what_punishment ==
punishment.punishment_types.MUTE else "BAN") + "\n"
content += "PUNISHMENT: " + (get_punish_type(punishment)) + "\n"
content += "REASON: " + punishment.punish_reason + "\n"
content += "END_DATE: " + str(punishment.punish_end) + "\n"
content += "L!ListEnd\n"
fileaccess.store_string(content)
func get_punish_type(punishment:Punishment):
match punishment.what_punishment:
Punishment.punishment_types.BAN:
return "BAN"
Punishment.punishment_types.MUTE:
return "MUTE"
Punishment.punishment_types.WARN:
return "WARN"
# DEPRECATED
func Exportv1(Punishments:Array[Punishment],file:String) -> void:
var fileaccess:FileAccess = FileAccess.open(file,FileAccess.WRITE)
if !fileaccess:
-5
View File
@@ -39,13 +39,11 @@ func _ready() -> void:
options_window.email_edit.text = save_file.get("EMAIL","")
options_window.name_edit.text = save_file.get("NAME","")
options_window.key_edit.text = save_file.get("KEY","")
options_window.use_old.button_pressed = save_file.get("USE_OLD",false)
options_window.repo_edit.text_changed.connect(unsave.unbind(1))
options_window.email_edit.text_changed.connect(unsave.unbind(1))
options_window.name_edit.text_changed.connect(unsave.unbind(1))
options_window.key_edit.text_changed.connect(unsave.unbind(1))
options_window.use_old.pressed.connect(unsave)
if options_window.repo_edit.text:
if git.has_method("Clone"):
git.Clone()
@@ -136,9 +134,6 @@ func save():
Punishments.append(child.punishment)
update_ban_counter()
save_file_parser.save()
if options_window.use_old.button_pressed:
exporter.Exportv1(Punishments,current_path)
else:
exporter.Export(Punishments,current_path)
unsaved = false
git.Commit_changes()
+2
View File
@@ -46,4 +46,6 @@ func punish_text_to_enum(text) -> Punishment.punishment_types:
punish = Punishment.punishment_types.BAN
"MUTE":
punish = Punishment.punishment_types.MUTE
"WARN":
punish = Punishment.punishment_types.WARN
return punish
-1
View File
@@ -21,6 +21,5 @@ func save() -> void:
"EMAIL":options_window.email_edit.text,
"NAME":options_window.name_edit.text,
"KEY":options_window.key_edit.text,
"USE_OLD":options_window.use_old.button_pressed,
}
file.store_var(Dict)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

+40
View File
@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://w0utose3h2f0"
path="res://.godot/imported/Warn.png-629b03348efcc9976444b6856186645d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Textures/Warn.png"
dest_files=["res://.godot/imported/Warn.png-629b03348efcc9976444b6856186645d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
+3 -2
View File
@@ -16,8 +16,9 @@ func _ready() -> void:
func update() -> void:
name_label.text = punishment.username
uid_label.text = punishment.uid
punishment_type_display.texture = load("res://Textures/door.png") if \
punishment.what_punishment == punishment.punishment_types.BAN else load("res://Textures/speaker.png")
punishment_type_display.texture = (load("res://Textures/door.png") if \
punishment.what_punishment == punishment.punishment_types.BAN else load("res://Textures/speaker.png")) if \
punishment.what_punishment != punishment.punishment_types.WARN else load("res://Textures/Warn.png")
func edit():
Edit.emit(self)
+1 -12
View File
@@ -8,7 +8,7 @@ font_size = 30
[sub_resource type="LabelSettings" id="LabelSettings_gec7h"]
outline_color = Color(1, 0.7764706, 0.7764706, 1)
[node name="OptionsWindow" type="Window" unique_id=1485451151 node_paths=PackedStringArray("use_old", "dupe_clear_button", "save_v_1_button", "repo_edit", "email_edit", "name_edit", "key_edit", "clone_repo_button", "clone_log", "reset_repo_button")]
[node name="OptionsWindow" type="Window" unique_id=1485451151 node_paths=PackedStringArray("dupe_clear_button", "save_v_1_button", "repo_edit", "email_edit", "name_edit", "key_edit", "clone_repo_button", "clone_log", "reset_repo_button")]
oversampling_override = 1.0
position = Vector2i(0, 36)
size = Vector2i(557, 397)
@@ -16,7 +16,6 @@ visible = false
force_native = true
min_size = Vector2i(262, 199)
script = ExtResource("1_5xt3b")
use_old = NodePath("MarginContainer/ScrollContainer/BoxContainer/UseOld")
dupe_clear_button = NodePath("MarginContainer/ScrollContainer/BoxContainer/DupeClearButton")
save_v_1_button = NodePath("MarginContainer/ScrollContainer/BoxContainer/SaveV1Button")
repo_edit = NodePath("MarginContainer/ScrollContainer/BoxContainer/Repo/RepoEdit")
@@ -61,16 +60,6 @@ layout_mode = 2
size_flags_horizontal = 3
vertical = true
[node name="RichTextLabel3" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=418846341]
layout_mode = 2
text = "General"
label_settings = SubResource("LabelSettings_5xt3b")
[node name="UseOld" type="CheckBox" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=1245550112]
layout_mode = 2
text = "Save file with OLD ban file structure(NEEDED before TFVR 4.0)"
autowrap_mode = 2
[node name="RichTextLabel" type="Label" parent="MarginContainer/ScrollContainer/BoxContainer" unique_id=66906023]
layout_mode = 2
text = "Utility"
-1
View File
@@ -1,6 +1,5 @@
class_name MoreOptionsWindow extends Window
@export var use_old: CheckBox
@export var dupe_clear_button: Button
@export var save_v_1_button: Button
@export var repo_edit: LineEdit