work for loadout overrides, fixed file deleteion

This commit is contained in:
bucket
2026-04-18 02:13:28 +02:00
parent a691fa28ff
commit 056f24340b
41 changed files with 822 additions and 107 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://bv4mvou68l2sk"]
[ext_resource type="Script" uid="uid://2f384phq5272" path="res://Scripts/Gdscript/AltShowcase.gd" id="1_7tuyd"]
[ext_resource type="Script" uid="uid://2f384phq5272" path="res://Scripts/Gdscript/Ban/AltShowcase.gd" id="1_7tuyd"]
[sub_resource type="LabelSettings" id="LabelSettings_7tuyd"]
font_size = 20
+33 -3
View File
@@ -1,13 +1,15 @@
class_name EditWindow extends Window
@onready var days_edit: SpinBox = $margin/VBoxContainer/ScrollContainer/Container/Ends/DaysEdit
@onready var years_edit: SpinBox = $margin/VBoxContainer/ScrollContainer/Container/Ends/YearsEdit
@onready var reason_edit: LineEdit = $"margin/VBoxContainer/ScrollContainer/Container/Reason/Reason Edit"
@export var reason_edit: LineEdit
@export var reason_option: OptionButton
@onready var uid_edit: LineEdit = $"margin/VBoxContainer/ScrollContainer/Container/UID/UID Edit"
@onready var name_edit: LineEdit = $"margin/VBoxContainer/ScrollContainer/Container/Name/Name Edit"
@onready var donebutton: Button = $margin/VBoxContainer/Done
@onready var delete_check: CheckBox = $margin/VBoxContainer/ScrollContainer/Container/DeleteCheck
@onready var delete_button: Button = $margin/VBoxContainer/ScrollContainer/Container/DeleteButton
@onready var type_button: OptionButton = $margin/VBoxContainer/ScrollContainer/Container/Type/TypeButton
@export var reason_custom: HBoxContainer
@export var opened_from:PunishShowcase
@export var punishment:Punishment
@@ -21,9 +23,13 @@ func _ready() -> void:
close_requested.connect(close)
donebutton.pressed.connect(done)
delete_button.pressed.connect(delete_this)
reason_option.item_selected.connect(should_show_custom)
for type in Punishment.punishment_types:
type_button.add_item(type)
func should_show_custom(_a):
reason_custom.visible = reason_option.selected == 3
func delete_this():
if opened_from:
opened_from.queue_free()
@@ -41,7 +47,19 @@ func update(set_time:bool = false):
return
name_edit.text = punishment.username
uid_edit.text = punishment.uid
reason_edit.text = punishment.punish_reason
reason_edit.text = ""
reason_custom.hide()
match punishment.punish_reason:
"TOXICITY":
reason_option.select(0)
"BAN_EVADING":
reason_option.select(1)
"HARASSMENT":
reason_option.select(2)
_:
reason_custom.show()
reason_option.select(3)
reason_edit.text = punishment.punish_reason
var from_time:int = punishment.punish_end
var from_unix:Dictionary = Time.get_date_dict_from_unix_time(from_time)
@warning_ignore("integer_division")
@@ -74,7 +92,7 @@ func get_punish() -> Punishment:
var new_punishment:Punishment = Punishment.new()
new_punishment.username = name_edit.text
new_punishment.uid = uid_edit.text
new_punishment.punish_reason = reason_edit.text
new_punishment.punish_reason = get_reason()
var time:int = 0
time += years_edit.value * 31536000
time += days_edit.value *86400
@@ -84,3 +102,15 @@ func get_punish() -> Punishment:
new_punishment.what_punishment = type_button.selected
changed.emit()
return new_punishment
func get_reason() -> String:
match reason_option.selected:
0:
return "TOXICITY"
1:
return "BAN_EVADING"
2:
return "HARASSMENT"
3:
return reason_edit.text
return ""
+25 -3
View File
@@ -6,13 +6,16 @@
font_size = 14
font_color = Color(0.7581918, 0.7581918, 0.7581917, 1)
[node name="EditWindow" type="Window" unique_id=1215629639]
[node name="EditWindow" type="Window" unique_id=1215629639 node_paths=PackedStringArray("reason_edit", "reason_option", "reason_custom")]
oversampling_override = 1.0
initial_position = 4
size = Vector2i(680, 395)
visible = false
force_native = true
script = ExtResource("1_827p1")
reason_edit = NodePath("margin/VBoxContainer/ScrollContainer/Container/ReasonCustom/Reason Edit")
reason_option = NodePath("margin/VBoxContainer/ScrollContainer/Container/Reason/ReasonOption")
reason_custom = NodePath("margin/VBoxContainer/ScrollContainer/Container/ReasonCustom")
[node name="ColorRect" type="ColorRect" parent="." unique_id=207830370]
anchors_preset = 15
@@ -20,7 +23,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.32941177, 0.25490198, 0.1764706, 1)
color = Color(0.28235295, 0.27058825, 0.23529412, 1)
[node name="margin" type="MarginContainer" parent="." unique_id=81777967]
anchors_preset = 15
@@ -97,7 +100,26 @@ layout_mode = 2
layout_mode = 2
text = "Reason:"
[node name="Reason Edit" type="LineEdit" parent="margin/VBoxContainer/ScrollContainer/Container/Reason" unique_id=194738986]
[node name="ReasonOption" type="OptionButton" parent="margin/VBoxContainer/ScrollContainer/Container/Reason" unique_id=1290708566]
layout_mode = 2
item_count = 4
popup/item_0/text = "TOXICITY"
popup/item_0/id = 0
popup/item_1/text = "BAN_EVADING"
popup/item_1/id = 1
popup/item_2/text = "HARASSMENT"
popup/item_2/id = 2
popup/item_3/text = "custom"
popup/item_3/id = 3
[node name="ReasonCustom" type="HBoxContainer" parent="margin/VBoxContainer/ScrollContainer/Container" unique_id=2083898750]
layout_mode = 2
[node name="Reason Label" type="Label" parent="margin/VBoxContainer/ScrollContainer/Container/ReasonCustom" unique_id=2075988770]
layout_mode = 2
text = "Custom Reason:"
[node name="Reason Edit" type="LineEdit" parent="margin/VBoxContainer/ScrollContainer/Container/ReasonCustom" unique_id=149222233]
layout_mode = 2
size_flags_horizontal = 3