0.6 features

This commit is contained in:
Lucia Ceionia 2024-11-08 03:54:34 -06:00
parent 0460ca99d6
commit 65f66921a9
3 changed files with 503 additions and 203 deletions

View File

@ -8,17 +8,23 @@ func setup():
get_node("%lucy_servername").text = MANAGER.custom_server_name get_node("%lucy_servername").text = MANAGER.custom_server_name
get_node("%lucy_servername_preview").bbcode_text = MANAGER.custom_server_name get_node("%lucy_servername_preview").bbcode_text = MANAGER.custom_server_name
get_node("%lucy_servermsg").text = MANAGER.server_join_message get_node("%lucy_servermsg").text = MANAGER.server_join_message
get_node("%lucy_servermsg_preview").bbcode_text = MANAGER.server_join_message var srv_m_bb = MANAGER.bbcode_process(MANAGER.server_join_message, 512)
var srv_m_bb = MANAGER.bbcode_process(MANAGER.server_join_message) get_node("%lucy_servermsg_preview").bbcode_text = srv_m_bb.fin
get_node("%lucy_servermsg_preview2").bbcode_text = srv_m_bb.stripped get_node("%lucy_servermsg_preview2").bbcode_text = srv_m_bb.stripped
get_node("%lucy_intbbcode").pressed = MANAGER.allow_intrusive_bbcode get_node("%lucy_intbbcode").pressed = MANAGER.allow_intrusive_bbcode
get_node("%lucy_chatcolor_bool").pressed = MANAGER.custom_color_enabled get_node("%lucy_chatcolor_bool").pressed = MANAGER.custom_color_enabled
get_node("%lucy_chatcolor").color = Color(MANAGER.custom_color) get_node("%lucy_chatcolor").color = Color(MANAGER.custom_color)
get_node("%lucy_chatcolor_bool2").pressed = MANAGER.custom_text_color_enabled
get_node("%lucy_chatcolor2").color = Color(MANAGER.custom_text_color)
get_node("%lucy_name").text = MANAGER.custom_name get_node("%lucy_name").text = MANAGER.custom_name
get_node("%lucy_bug_bb").pressed = MANAGER.bug_bbcode
get_node("%lucy_srv_bbcode").pressed = MANAGER.srv_bbcode
update() update()
@ -27,10 +33,7 @@ func update():
func _on_lucy_name_text_changed(new_text): func _on_lucy_name_text_changed(new_text):
var result = MANAGER.bbcode_process(new_text) var result = MANAGER.bbcode_process(new_text, 512)
#print("[fin] ", result.fin)
#print("[tags] ", result.tags)
#print("[stripped] ", result.stripped)
var lol_steam_username = Network.STEAM_USERNAME.replace("[", "").replace("]", "") var lol_steam_username = Network.STEAM_USERNAME.replace("[", "").replace("]", "")
var good = result.stripped == lol_steam_username var good = result.stripped == lol_steam_username
@ -55,6 +58,8 @@ func _ready():
get_node("%lucy_clearrain").disabled = not can_spawn get_node("%lucy_clearrain").disabled = not can_spawn
get_node("%lucy_clearmeteor").disabled = not can_spawn get_node("%lucy_clearmeteor").disabled = not can_spawn
get_node("%lucy_srv_bbcode").disabled = not (Network.GAME_MASTER or Network.PLAYING_OFFLINE)
func _input(event): func _input(event):
if event is InputEventKey and event.scancode == KEY_F5 && event.pressed: if event is InputEventKey and event.scancode == KEY_F5 && event.pressed:
visible = !visible visible = !visible
@ -79,7 +84,7 @@ func _on_lucy_servername_text_changed(new_text):
get_node("%lucy_servername_preview").bbcode_text = new_text get_node("%lucy_servername_preview").bbcode_text = new_text
MANAGER.custom_server_name = new_text MANAGER.custom_server_name = new_text
func _on_lucy_servermsg_text_changed(new_text): func _on_lucy_servermsg_text_changed(new_text):
var result = MANAGER.bbcode_process(new_text) var result = MANAGER.bbcode_process(new_text, 512)
get_node("%lucy_servermsg_preview").bbcode_text = result.fin get_node("%lucy_servermsg_preview").bbcode_text = result.fin
get_node("%lucy_servermsg_preview2").bbcode_text = result.stripped get_node("%lucy_servermsg_preview2").bbcode_text = result.stripped
MANAGER.server_join_message = new_text MANAGER.server_join_message = new_text
@ -87,11 +92,20 @@ func _on_lucy_chatcolor_bool_toggled(button_pressed):
MANAGER.custom_color_enabled = button_pressed MANAGER.custom_color_enabled = button_pressed
func _on_lucy_chatcolor_color_changed(color): func _on_lucy_chatcolor_color_changed(color):
MANAGER.custom_color = color MANAGER.custom_color = color
func _on_lucy_chatcolor_bool2_toggled(button_pressed):
MANAGER.custom_text_color_enabled = button_pressed
func _on_lucy_chatcolor2_color_changed(color):
MANAGER.custom_text_color = color
func _on_lucy_intbbcode_toggled(button_pressed): func _on_lucy_intbbcode_toggled(button_pressed):
MANAGER.allow_intrusive_bbcode = button_pressed MANAGER.allow_intrusive_bbcode = button_pressed
func _on_lucy_bug_bb_toggled(button_pressed):
MANAGER.bug_bbcode = button_pressed
func _on_lucy_srv_bbcode_toggled(button_pressed):
if (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
MANAGER.srv_bbcode = button_pressed
func _on_lucy_raincloud_pressed(): func _on_lucy_raincloud_pressed():
if not MANAGER.ingame: return if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
print("[LUCY] Spawning raincloud") print("[LUCY] Spawning raincloud")
var player = MANAGER.get_player() var player = MANAGER.get_player()
var pos = Vector3(player.global_transform.origin.x, 42, player.global_transform.origin.z) var pos = Vector3(player.global_transform.origin.x, 42, player.global_transform.origin.z)
@ -99,7 +113,7 @@ func _on_lucy_raincloud_pressed():
Network._sync_create_actor("raincloud", pos, zone, - 1, Network.STEAM_ID) Network._sync_create_actor("raincloud", pos, zone, - 1, Network.STEAM_ID)
func _on_lucy_meteor_pressed(): func _on_lucy_meteor_pressed():
if not MANAGER.ingame: return if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
if get_tree().get_nodes_in_group("meteor").size() > 10: return if get_tree().get_nodes_in_group("meteor").size() > 10: return
print("[LUCY] Spawning meteor") print("[LUCY] Spawning meteor")
var player_pos = MANAGER.get_player().global_transform.origin var player_pos = MANAGER.get_player().global_transform.origin
@ -115,7 +129,7 @@ func _on_lucy_meteor_pressed():
Network._sync_create_actor("fish_spawn_alien", pos, zone, - 1, Network.STEAM_ID) Network._sync_create_actor("fish_spawn_alien", pos, zone, - 1, Network.STEAM_ID)
func _on_lucy_freezerain_pressed(): func _on_lucy_freezerain_pressed():
if not MANAGER.ingame or not Network.GAME_MASTER: return if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
print("[LUCY] Freezing rain") print("[LUCY] Freezing rain")
for cloud in get_tree().get_nodes_in_group("raincloud"): for cloud in get_tree().get_nodes_in_group("raincloud"):
if cloud.controlled == true: if cloud.controlled == true:
@ -123,7 +137,7 @@ func _on_lucy_freezerain_pressed():
cloud.decay = false cloud.decay = false
func _on_lucy_clearrain_pressed(): func _on_lucy_clearrain_pressed():
if not MANAGER.ingame or not Network.GAME_MASTER: return if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
print("[LUCY] Clearing rain") print("[LUCY] Clearing rain")
for cloud in get_tree().get_nodes_in_group("raincloud"): for cloud in get_tree().get_nodes_in_group("raincloud"):
cloud._deinstantiate(true) cloud._deinstantiate(true)
@ -133,7 +147,7 @@ func _on_lucy_clearchat_pressed():
Network.emit_signal("_chat_update") Network.emit_signal("_chat_update")
func _on_lucy_clearmeteor_pressed(): func _on_lucy_clearmeteor_pressed():
if not MANAGER.ingame or not Network.GAME_MASTER: return if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
print("[LUCY] Clearing meteor") print("[LUCY] Clearing meteor")
for meteor in get_tree().get_nodes_in_group("meteor"): for meteor in get_tree().get_nodes_in_group("meteor"):
meteor._deinstantiate(true) meteor._deinstantiate(true)

View File

@ -4,24 +4,24 @@
[node name="lucys_menu" type="Control"] [node name="lucys_menu" type="Control"]
margin_right = 800.0 margin_right = 800.0
margin_bottom = 329.0 margin_bottom = 400.0
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="PanelContainer" type="PanelContainer" parent="."] [node name="PanelContainer" type="PanelContainer" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_bottom = 71.0 margin_bottom = 100.0
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
margin_left = 7.0 margin_left = 7.0
margin_top = 7.0 margin_top = 7.0
margin_right = 793.0 margin_right = 793.0
margin_bottom = 393.0 margin_bottom = 493.0
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer"]
margin_right = 786.0 margin_right = 786.0
margin_bottom = 14.0 margin_bottom = 14.0
text = "Lucy's Options 0.5.0 - F5 to Toggle Menu" text = "Lucy's Options 0.6.0 - F5 to Toggle Menu"
[node name="HSeparator" type="HSeparator" parent="PanelContainer/VBoxContainer"] [node name="HSeparator" type="HSeparator" parent="PanelContainer/VBoxContainer"]
margin_top = 18.0 margin_top = 18.0
@ -32,7 +32,7 @@ margin_bottom = 22.0
margin_top = 26.0 margin_top = 26.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 40.0 margin_bottom = 40.0
text = "BBCode is only visible to LucysTools-compatible users" text = "BBCode is only visible to LucysTools-compatible users, unless Bug BBCode is enabled"
[node name="HFlowContainer" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 44.0 margin_top = 44.0
@ -55,44 +55,81 @@ margin_bottom = 40.0
[node name="Label3" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"] [node name="Label3" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"]
margin_left = 173.0 margin_left = 173.0
margin_top = 13.0 margin_top = 13.0
margin_right = 323.0 margin_right = 372.0
margin_bottom = 27.0 margin_bottom = 27.0
text = "Allow Intrusive BBCode" text = "Allow Intrusive BBCode (Client)"
[node name="lucy_intbbcode" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer"] [node name="lucy_intbbcode" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 327.0 margin_left = 376.0
margin_right = 403.0 margin_right = 452.0
margin_bottom = 40.0 margin_bottom = 40.0
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"] [node name="Label5" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"]
margin_left = 407.0 margin_left = 456.0
margin_top = 13.0 margin_top = 13.0
margin_right = 542.0 margin_right = 591.0
margin_bottom = 27.0 margin_bottom = 27.0
text = "Punch back on Punch" text = "Punch back on Punch"
[node name="lucy_punchback" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer"] [node name="lucy_punchback" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 546.0 margin_left = 595.0
margin_right = 622.0 margin_right = 671.0
margin_bottom = 40.0 margin_bottom = 40.0
[node name="HSeparator3" type="HSeparator" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer3" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 88.0 margin_top = 88.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 92.0 margin_bottom = 128.0
[node name="Label5" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
margin_top = 13.0
margin_right = 202.0
margin_bottom = 27.0
text = "Allow Intrusive BBCode (Server)"
[node name="lucy_srv_bbcode" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
unique_name_in_owner = true
margin_left = 206.0
margin_right = 282.0
margin_bottom = 40.0
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
margin_left = 286.0
margin_top = 13.0
margin_right = 397.0
margin_bottom = 27.0
text = "Use Bug BBCode:"
[node name="lucy_bug_bb" type="CheckBox" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
unique_name_in_owner = true
margin_left = 401.0
margin_right = 425.0
margin_bottom = 40.0
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
margin_left = 429.0
margin_top = 13.0
margin_right = 520.0
margin_bottom = 27.0
text = "May be buggy!"
[node name="HSeparator3" type="HSeparator" parent="PanelContainer/VBoxContainer"]
margin_top = 132.0
margin_right = 786.0
margin_bottom = 136.0
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer"] [node name="Label2" type="Label" parent="PanelContainer/VBoxContainer"]
margin_top = 96.0 margin_top = 140.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 110.0 margin_bottom = 154.0
text = "Custom Server Name - Only shown for LucysTools users (base game field for others)" text = "Custom Server Name - Only shown for LucysTools users (base game field for others)"
[node name="HFlowContainer4" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer4" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 114.0 margin_top = 158.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 138.0 margin_bottom = 182.0
rect_pivot_offset = Vector2( -141, -49 ) rect_pivot_offset = Vector2( -141, -49 )
[node name="lucy_servername" type="LineEdit" parent="PanelContainer/VBoxContainer/HFlowContainer4"] [node name="lucy_servername" type="LineEdit" parent="PanelContainer/VBoxContainer/HFlowContainer4"]
@ -104,9 +141,9 @@ expand_to_text_length = true
placeholder_text = "Name" placeholder_text = "Name"
[node name="HFlowContainer6" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer6" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 142.0 margin_top = 186.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 156.0 margin_bottom = 200.0
rect_pivot_offset = Vector2( -141, -49 ) rect_pivot_offset = Vector2( -141, -49 )
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer6"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer6"]
@ -126,20 +163,20 @@ text = "'s Lobby"
scroll_active = false scroll_active = false
[node name="HSeparator4" type="HSeparator" parent="PanelContainer/VBoxContainer"] [node name="HSeparator4" type="HSeparator" parent="PanelContainer/VBoxContainer"]
margin_top = 160.0 margin_top = 204.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 164.0 margin_bottom = 208.0
[node name="Label3" type="Label" parent="PanelContainer/VBoxContainer"] [node name="Label3" type="Label" parent="PanelContainer/VBoxContainer"]
margin_top = 168.0 margin_top = 212.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 182.0 margin_bottom = 226.0
text = "Server Join Message - Will be shown without BBCode for people without LucysTools" text = "Server Join Message - Will be shown without BBCode for people without LucysTools (without bug enabled)"
[node name="HFlowContainer5" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer5" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 186.0 margin_top = 230.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 210.0 margin_bottom = 254.0
rect_pivot_offset = Vector2( -141, -49 ) rect_pivot_offset = Vector2( -141, -49 )
[node name="lucy_servermsg" type="LineEdit" parent="PanelContainer/VBoxContainer/HFlowContainer5"] [node name="lucy_servermsg" type="LineEdit" parent="PanelContainer/VBoxContainer/HFlowContainer5"]
@ -151,9 +188,9 @@ expand_to_text_length = true
placeholder_text = "Message" placeholder_text = "Message"
[node name="HFlowContainer7" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer7" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 214.0 margin_top = 258.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 228.0 margin_bottom = 272.0
rect_pivot_offset = Vector2( -141, -49 ) rect_pivot_offset = Vector2( -141, -49 )
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer7"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer7"]
@ -171,9 +208,9 @@ bbcode_enabled = true
scroll_active = false scroll_active = false
[node name="HFlowContainer10" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer10" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 232.0 margin_top = 276.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 246.0 margin_bottom = 290.0
rect_pivot_offset = Vector2( -141, -49 ) rect_pivot_offset = Vector2( -141, -49 )
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer10"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer10"]
@ -191,14 +228,14 @@ bbcode_enabled = true
scroll_active = false scroll_active = false
[node name="HSeparator5" type="HSeparator" parent="PanelContainer/VBoxContainer"] [node name="HSeparator5" type="HSeparator" parent="PanelContainer/VBoxContainer"]
margin_top = 250.0 margin_top = 294.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 254.0 margin_bottom = 298.0
[node name="HFlowContainer8" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer8" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 258.0 margin_top = 302.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 282.0 margin_bottom = 326.0
rect_pivot_offset = Vector2( -141, -49 ) rect_pivot_offset = Vector2( -141, -49 )
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer8"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer8"]
@ -222,22 +259,44 @@ margin_bottom = 24.0
rect_min_size = Vector2( 42, 0 ) rect_min_size = Vector2( 42, 0 )
edit_alpha = false edit_alpha = false
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer8"]
margin_left = 281.0
margin_top = 5.0
margin_right = 519.0
margin_bottom = 19.0
text = " Chat Text Color (LucysTools or bug)"
[node name="lucy_chatcolor_bool2" type="CheckBox" parent="PanelContainer/VBoxContainer/HFlowContainer8"]
unique_name_in_owner = true
margin_left = 523.0
margin_right = 593.0
margin_bottom = 24.0
text = "Enable"
[node name="lucy_chatcolor2" type="ColorPickerButton" parent="PanelContainer/VBoxContainer/HFlowContainer8"]
unique_name_in_owner = true
margin_left = 597.0
margin_right = 639.0
margin_bottom = 24.0
rect_min_size = Vector2( 42, 0 )
edit_alpha = false
[node name="HFlowContainer9" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer9" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 286.0 margin_top = 330.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 300.0 margin_bottom = 344.0
rect_pivot_offset = Vector2( -141, -49 ) rect_pivot_offset = Vector2( -141, -49 )
hint_tooltip = "Must match Steam username" hint_tooltip = "Must match Steam username"
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer9"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer9"]
margin_right = 379.0 margin_right = 392.0
margin_bottom = 14.0 margin_bottom = 14.0
text = "Custom Name - Must match Steam Name (LucysTools only)" text = "Custom Name - Must match Steam Name (LucysTools or bug)"
[node name="lucy_namegood" type="RichTextLabel" parent="PanelContainer/VBoxContainer/HFlowContainer9"] [node name="lucy_namegood" type="RichTextLabel" parent="PanelContainer/VBoxContainer/HFlowContainer9"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 383.0 margin_left = 396.0
margin_right = 433.0 margin_right = 446.0
margin_bottom = 14.0 margin_bottom = 14.0
rect_min_size = Vector2( 50, 0 ) rect_min_size = Vector2( 50, 0 )
bbcode_enabled = true bbcode_enabled = true
@ -247,17 +306,17 @@ scroll_active = false
[node name="lucy_name" type="LineEdit" parent="PanelContainer/VBoxContainer"] [node name="lucy_name" type="LineEdit" parent="PanelContainer/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_top = 304.0 margin_top = 348.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 328.0 margin_bottom = 372.0
expand_to_text_length = true expand_to_text_length = true
placeholder_text = "Name" placeholder_text = "Name"
[node name="lucy_name_preview" type="RichTextLabel" parent="PanelContainer/VBoxContainer"] [node name="lucy_name_preview" type="RichTextLabel" parent="PanelContainer/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_top = 332.0 margin_top = 376.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 347.0 margin_bottom = 391.0
rect_min_size = Vector2( 0, 15 ) rect_min_size = Vector2( 0, 15 )
size_flags_horizontal = 3 size_flags_horizontal = 3
bbcode_enabled = true bbcode_enabled = true
@ -266,14 +325,14 @@ text = "If you see this, modify your custom name"
scroll_active = false scroll_active = false
[node name="HSeparator6" type="HSeparator" parent="PanelContainer/VBoxContainer"] [node name="HSeparator6" type="HSeparator" parent="PanelContainer/VBoxContainer"]
margin_top = 351.0 margin_top = 395.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 355.0 margin_bottom = 399.0
[node name="HFlowContainer2" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer2" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 359.0 margin_top = 403.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 379.0 margin_bottom = 423.0
[node name="lucy_clearchat" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"] [node name="lucy_clearchat" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
margin_right = 76.0 margin_right = 76.0
@ -319,10 +378,14 @@ text = "Clear Meteor"
[connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer/lucy_bbcode" to="." method="_on_lucy_bbcode_toggled"] [connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer/lucy_bbcode" to="." method="_on_lucy_bbcode_toggled"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer/lucy_intbbcode" to="." method="_on_lucy_intbbcode_toggled"] [connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer/lucy_intbbcode" to="." method="_on_lucy_intbbcode_toggled"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer/lucy_punchback" to="." method="_on_lucy_punchback_toggled"] [connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer/lucy_punchback" to="." method="_on_lucy_punchback_toggled"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer3/lucy_srv_bbcode" to="." method="_on_lucy_srv_bbcode_toggled"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer3/lucy_bug_bb" to="." method="_on_lucy_bug_bb_toggled"]
[connection signal="text_changed" from="PanelContainer/VBoxContainer/HFlowContainer4/lucy_servername" to="." method="_on_lucy_servername_text_changed"] [connection signal="text_changed" from="PanelContainer/VBoxContainer/HFlowContainer4/lucy_servername" to="." method="_on_lucy_servername_text_changed"]
[connection signal="text_changed" from="PanelContainer/VBoxContainer/HFlowContainer5/lucy_servermsg" to="." method="_on_lucy_servermsg_text_changed"] [connection signal="text_changed" from="PanelContainer/VBoxContainer/HFlowContainer5/lucy_servermsg" to="." method="_on_lucy_servermsg_text_changed"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer8/lucy_chatcolor_bool" to="." method="_on_lucy_chatcolor_bool_toggled"] [connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer8/lucy_chatcolor_bool" to="." method="_on_lucy_chatcolor_bool_toggled"]
[connection signal="color_changed" from="PanelContainer/VBoxContainer/HFlowContainer8/lucy_chatcolor" to="." method="_on_lucy_chatcolor_color_changed"] [connection signal="color_changed" from="PanelContainer/VBoxContainer/HFlowContainer8/lucy_chatcolor" to="." method="_on_lucy_chatcolor_color_changed"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/HFlowContainer8/lucy_chatcolor_bool2" to="." method="_on_lucy_chatcolor_bool2_toggled"]
[connection signal="color_changed" from="PanelContainer/VBoxContainer/HFlowContainer8/lucy_chatcolor2" to="." method="_on_lucy_chatcolor2_color_changed"]
[connection signal="text_changed" from="PanelContainer/VBoxContainer/lucy_name" to="." method="_on_lucy_name_text_changed"] [connection signal="text_changed" from="PanelContainer/VBoxContainer/lucy_name" to="." method="_on_lucy_name_text_changed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_clearchat" to="." method="_on_lucy_clearchat_pressed"] [connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_clearchat" to="." method="_on_lucy_clearchat_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_raincloud" to="." method="_on_lucy_raincloud_pressed"] [connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_raincloud" to="." method="_on_lucy_raincloud_pressed"]

View File

@ -5,72 +5,247 @@ const LUCYS_MENU_SCENE = preload("res://mods/Lucy.LucysTools/lucys_menu.tscn")
var lucys_menu = null var lucys_menu = null
onready var root = get_tree().root onready var root = get_tree().root
var INCERCEPT_MSG = false var INCERCEPT_MSG: bool = false
var INCERCEPT_SEND_MSG = false var INCERCEPT_SEND_MSG: bool = false
var do_punchback = false var do_punchback: bool = false
var allow_bbcode = false var allow_bbcode: bool = false
var custom_server_name = "" setget set_server_name var custom_server_name: String = "" setget set_server_name
var server_join_message = "[color=#5BCEFA]TRAN[/color][color=#F5A9B8]S RIG[/color][color=#ffffff]HTS![/color]" setget set_join_message var server_join_message: String = "[color=#5BCEFA]TRAN[/color][color=#F5A9B8]S RIG[/color][color=#ffffff]HTS![/color]" setget set_join_message
var custom_color_enabled = false var custom_color_enabled: bool = false
var custom_color = Color("009cd0") setget set_custom_color var custom_color: Color = Color("009cd0") setget set_custom_color
var custom_name_enabled = false var custom_name_enabled: bool = false
var real_custom_name = "" var real_custom_name: String = ""
var custom_name = "" setget set_custom_name var custom_name: String = "" setget set_custom_name
var allow_intrusive_bbcode = false setget set_allow_intrusive_bbcode var allow_intrusive_bbcode: bool = false setget set_allow_intrusive_bbcode
var srv_bbcode: bool = false setget set_srv_bbcode
var log_messages = false setget set_log_messages var log_messages: bool = false setget set_log_messages
var lucys_menu_visible = true var DEBUG: bool = false
var allowed_tags = ["b", "i", "u", "s", "color"] var lucys_menu_visible: bool = true
var escape_invalid = true
var bbcode_matcher = null var custom_text_color: Color = Color("00ff00")
var custom_text_color_enabled: bool = false
var bug_bbcode: bool = false
func set_custom_name(val): func set_custom_name(val):
custom_name = val custom_name = val
var bb = bbcode_process(val) var bb = bbcode_process(val, 256)
real_custom_name = bb.fin real_custom_name = bb.fin
# i know this sucks func set_log_messages(val):
# but i have things to do log_messages = val
func bbcode_recurse(text, data): Network.LUCY_LOG_MESSAGES = val
var m = bbcode_matcher.search(text)
if m == null: func set_allow_intrusive_bbcode(bbcode):
var escaped = text.replace('[lb]','[').replace('[','[lb]') if escape_invalid else text allow_intrusive_bbcode = bbcode
data.fin += escaped bbcode_changes()
data.stripped += escaped
else: func set_srv_bbcode(bbcode):
#print("Found ", m.strings, " in '", text, "'") srv_bbcode = bbcode
bbcode_recurse(m.get_string(1), data) if Network.GAME_MASTER: send_lucy_sync()
var tag = m.get_string(2) bbcode_changes()
var junk = m.get_string(3)
var allowed = tag in allowed_tags func set_server_name(name):
if allowed: custom_server_name = name
data.fin += "[" + tag + junk + "]" Network.LUCY_SRV_NAME = name
else:
data.fin += "[lb]" + tag + junk + "]" func set_join_message(msg):
data.stripped += "[lb]" + tag + junk + "]" server_join_message = msg
#print("TAG ", m.get_string(2), " JUNK ", m.get_string(3))
data.tags.append([tag, junk]) func set_custom_color(val):
bbcode_recurse(m.get_string(4), data) custom_color = Color(val) if Color(val) != Color("d5aa73") else Color("739ed5")
if allowed: custom_color.a = 1
data.fin += "[/" + tag + "]"
else: var allowed_tags: Array = ["b", "i", "u", "s", "color"]
data.fin += "[lb]/" + tag + "]" var escape_invalid: bool = true
data.stripped += "[lb]/" + tag + "]" var strip_disallowed: bool = true
bbcode_recurse(m.get_string(5), data) var check_alpha: bool = true setget set_check_alpha
var bbcode_matcher = null
var junk_checkers: Dictionary = {}
var alpha_lim := 0.5
var alpha_getter: RegEx = null
func do_alpha_check(junk) -> String:
if not alpha_getter:
alpha_getter = RegEx.new()
alpha_getter.compile("\\s*=\\s*(\\S*)")
var color: Color = Color(alpha_getter.search(junk).get_string(1))
if color.a < alpha_lim:
color.a = alpha_lim
return "=#" + color.to_html()
return ""
func set_check_alpha(val):
check_alpha = val
if val: junk_checkers["color"] = funcref(self, "do_alpha_check")
else: junk_checkers.erase("color")
var INNER_MAX_LEN: int = 0
# ouch oof this sucks
func bbcode_process(text, max_len) -> Dictionary:
var end: int
var all: String
var before: String
var whole_tag: String
var tag_open: String
var junk: String
var tag_close: String
var tag: String
var is_close: bool
var inner_full: String
var inner_stripped: String
var prev_full: String
var prev_stripped: String
var checked: String
var last_tag
if DEBUG:
var thing = {"max_len":max_len,"allowed_tags":allowed_tags,"strip_disallowed":strip_disallowed,"escape_invalid":escape_invalid}
print("[BBCODE NEW] processing '", text, "' params ", thing)
func bbcode_process(text):
bbcode_matcher = RegEx.new() bbcode_matcher = RegEx.new()
bbcode_matcher.compile("^(.*?)\\[(\\w+?)([^\\]]*)\\](.+?)\\[/\\2\\](.*?)$") bbcode_matcher.compile("(.*?)(\\[(\\w+)([^\\[\\]]*?)\\]|\\[/(\\w+)\\])")
#print("processing '", text, "'")
var data = {"fin": "", "tags": [], "stripped": ""} var linear_matches: Array = bbcode_matcher.search_all(text)
bbcode_recurse(text, data) if linear_matches.empty():
return data var processed = {"fin": text.replace('[','[lb]'), "stripped": text}
if DEBUG: print("[BBCODE NEW] processed ", processed)
return processed
var tag_stack := []
var full_text_stack := [""]
var stripped_text_stack := [""]
var last_end: int = 0
# all this popping and pushing sucks. whatever
for m in linear_matches:
if DEBUG: print("[MATCH] ", m.strings)
if DEBUG: print("[STACKS] ", {
"tag stack": tag_stack,
"full text": full_text_stack,
"stripped text": stripped_text_stack
})
end = m.get_end()
if end != -1: last_end = end
all = m.get_string(0)
before = m.get_string(1)
whole_tag = m.get_string(2)
tag_open = m.get_string(3)
junk = m.get_string(4)
tag_close = m.get_string(5)
tag = tag_open
is_close = false
if tag_open == "":
tag = tag_close
is_close = true
if is_close:
# get the tag on the stack
last_tag = tag_stack.pop_back()
# get the full text on the stack
inner_full = full_text_stack.pop_back()
# get the stripped text on the stack
inner_stripped = stripped_text_stack.pop_back()
if last_tag == null:
if DEBUG: print("[UNOPENED CLOSE]")
# no tags on stack
# add stripped tag to all text
# and go back on stack
full_text_stack.push_back(inner_full+before.replace('[','[lb]')+"[lb]/"+tag+"]")
stripped_text_stack.push_back(inner_stripped+before.replace('[','[lb]')+"[lb]/"+tag+"]")
continue
elif last_tag[0] == tag:
if DEBUG: print("[CLOSED TAG]")
# we have closure.
# check junk
if junk_checkers.has(tag):
checked = junk_checkers[tag].call_func(last_tag[1])
junk = last_tag[1] if checked == "" else checked
if DEBUG: print("[BB NEW JUNK] ", junk)
else:
junk = last_tag[1]
# add tag in full text
# but not in stripped
prev_full = full_text_stack.pop_back()
prev_stripped = stripped_text_stack.pop_back()
if tag in allowed_tags:
full_text_stack.push_back(prev_full + "["+tag+junk+"]" + inner_full + before.replace('[','[lb]') + "[/"+tag+"]")
stripped_text_stack.push_back(prev_stripped + inner_stripped + before.replace('[','[lb]'))
else:
full_text_stack.push_back(prev_full + inner_full + before.replace('[','[lb]'))
stripped_text_stack.push_back(prev_stripped + inner_stripped + before.replace('[','[lb]'))
continue
else:
if DEBUG: print("[WRONG CLOSE]")
# open followed by different close
# escape and add the text to previous on stack
prev_full = full_text_stack.pop_back()
prev_stripped = stripped_text_stack.pop_back()
full_text_stack.push_back(prev_full + "[lb]"+last_tag[0]+last_tag[1]+"]" + inner_full + before.replace('[','[lb]') + "[lb]/"+tag+"]")
stripped_text_stack.push_back(prev_stripped + "[lb]"+last_tag[0]+last_tag[1]+"]" + inner_stripped + before.replace('[','[lb]') + "[lb]/"+tag+"]")
continue
else:
# special case
if tag == "lb" or tag == "rb":
if DEBUG: print("[LB/RB]")
# add directly to current inner
inner_full = full_text_stack.pop_back()
inner_stripped = stripped_text_stack.pop_back()
full_text_stack.push_back(inner_full + before.replace('[','[lb]') + whole_tag)
stripped_text_stack.push_back(inner_stripped + before.replace('[','[lb]') + whole_tag)
continue
if DEBUG: print("[OPEN TAG]")
# add to stack
tag_stack.push_back([tag, junk])
# add before text escaped to prev
inner_full = full_text_stack.pop_back()
inner_stripped = stripped_text_stack.pop_back()
full_text_stack.push_back(inner_full + before.replace('[','[lb]'))
stripped_text_stack.push_back(inner_stripped + before.replace('[','[lb]'))
# new inner text
full_text_stack.push_back("")
stripped_text_stack.push_back("")
continue
if DEBUG: print("[FINAL STACKS] ", {
"tag stack": tag_stack,
"full text": full_text_stack,
"stripped text": stripped_text_stack
})
# unroll opens at end
# TODO probably should write this in as escaped
# but im getting tired
while not tag_stack.empty():
tag_stack.pop_back()
full_text_stack.pop_back()
stripped_text_stack.pop_back()
if DEBUG: print("[LAST END] ", last_end)
var processed = {"fin": full_text_stack.pop_back(), "stripped": stripped_text_stack.pop_back()}
# end stuff isnt caught by the regex
if last_end != 0:
var end_str = text.substr(last_end).replace('[','[lb]')
if DEBUG: print("[END STR] ", end_str)
processed.fin += end_str
processed.stripped += end_str
if DEBUG: print("[BBCODE NEW] processed ", processed)
return processed
var ingame = false var ingame = false
@ -79,39 +254,58 @@ func get_user_color() -> Color:
var color = custom_color if custom_color_enabled else base_color var color = custom_color if custom_color_enabled else base_color
return color return color
func safe_message(user_id, color, boring_msg, local, lucy_user, lucy_msg): func safe_message(user_id, color, boring_msg, local, lucy_user, lucy_msg, require_name):
var username = Network._get_username_from_id(user_id) if lucy_user == "" else lucy_user var msg: String = boring_msg
var bb_user = bbcode_process(username) if lucy_msg != "": msg = lucy_msg
username = bb_user.fin var net_name: String = Network._get_username_from_id(user_id).replace('[','').replace(']','')
var name: String = net_name if lucy_user == "" else lucy_user
var msg = lucy_msg if lucy_msg != "" else boring_msg
var bb_data = bbcode_process(msg)
var filter_message = bb_data.fin
if bb_user.stripped != Network._get_username_from_id(user_id):
filter_message = "(" + Network._get_username_from_id(user_id) + ") " + filter_message
if OptionsMenu.chat_filter: if OptionsMenu.chat_filter:
filter_message = SwearFilter._filter_string(filter_message) msg = SwearFilter._filter_string(msg)
var final_message = filter_message.replace("%u", "[color=#" + str(color) + "]" + username + "[/color]") msg = msg.replace("%u", "[color=#" + str(color) + "]" + name + "[/color]")
var thing = {"username":username, "color":color, "filter_message":filter_message, if DEBUG: print("[MSG B4 PROC] ", msg)
"final_message":final_message,"lucy_user":lucy_user,"lucy_msg":lucy_msg}
#print("FUCK2 ", thing) # process message
Network._update_chat(final_message, local) var bb_msg = bbcode_process(msg, 512)
if require_name and not net_name in bb_msg.stripped:
msg = net_name + ": " + msg
bb_msg = bbcode_process(msg, 512)
if log_messages:
var thing = {"user_id":user_id, "steam name":Network._get_username_from_id(user_id),
"username":name, "color":color,
"final": bb_msg.fin, "message": boring_msg,
"bb_user":lucy_user,"bb_msg":lucy_msg}
print("[MESSAGE] ", thing)
Network._update_chat(bb_msg.fin, local)
# this is stinky # this is stinky
func process_message(lit_text, final, prefix, suffix, endcap, spoken_text, local, colon, playerhud): func process_message(lit_text, final, prefix, suffix, endcap, spoken_text, local, colon, playerhud):
var thing = { if log_messages:
"lit_text": lit_text, "final": final, "prefix": prefix, "suffix": suffix, var thing = {
"endcap": endcap, "lit_text": lit_text, "final": final, "prefix": prefix, "suffix": suffix,
"custom_color_enabled": custom_color_enabled, "endcap": endcap,
"custom_name_enabled": custom_name_enabled, "allow_bbcode": allow_bbcode, "custom_color_enabled": custom_color_enabled,
"allowed_tags": allowed_tags "custom_name_enabled": custom_name_enabled, "allow_bbcode": allow_bbcode,
} "allowed_tags": allowed_tags
#print("FUCK ", thing) }
if Network.GAME_MASTER and lit_text.begins_with("%"): print("process_message ", thing)
var bb_dat = bbcode_process(lit_text)
if (Network.GAME_MASTER or Network.PLAYING_OFFLINE) and lit_text.begins_with("%"):
var bb_dat = bbcode_process(lit_text.trim_prefix('%'), 512)
if bug_bbcode:
print("Using color field...")
var evil_color = "00ff0000]"\
+ "[color=#ffeed5]"\
+ bb_dat.fin\
+ "[/color]"
if bb_dat.fin != "":
lucy_send_message("", "%u", false, evil_color)
return [true]
lucy_send_message(lit_text.trim_prefix('%'), bb_dat.stripped, false) lucy_send_message(lit_text.trim_prefix('%'), bb_dat.stripped, false)
# we sent the message ourself # we sent the message ourself
return [true] return [true]
@ -119,16 +313,42 @@ func process_message(lit_text, final, prefix, suffix, endcap, spoken_text, local
var msg = final var msg = final
var boring_msg = final var boring_msg = final
var speak = spoken_text var speak = spoken_text
if allow_bbcode: if bug_bbcode:
var p = bbcode_process(lit_text) print("Using color field...")
if not p.tags.empty(): var p = bbcode_process(lit_text, 512)
msg = prefix + "%u" + endcap + p.fin + suffix var name = real_custom_name if custom_name_enabled else Network.STEAM_USERNAME
boring_msg = prefix + "%u" + endcap + p.stripped + suffix var name_color = get_user_color().to_html()
speak = p.stripped var text_color = "ffffeed5" if not custom_text_color_enabled else custom_text_color.to_html()
#print("FUCK3 ", {"msg":msg,"boring_msg":boring_msg,"p":p}) var evil_color = "00ff0000]"\
+ "[color=#" + text_color + "]"\
+ prefix\
+ "[color=#" + name_color + "]"\
+ name\
+ "[/color]"\
+ endcap + p.fin + suffix\
+ "[/color]"
boring_msg = "%u"
var bb_msg = ""
var bb_user = ""
speak = p.stripped
if p.fin != "":
lucy_send_message(bb_msg, boring_msg, local, evil_color)
if speak != "" and colon: playerhud.emit_signal("_message_sent", speak)
return [true]
elif allow_bbcode:
var p = bbcode_process(lit_text, 512)
var txt_col_start = "" if not custom_text_color_enabled else\
"[color=#"+custom_text_color.to_html()+"]"
var txt_col_end = "" if not custom_text_color_enabled else\
"[/color]"
msg = prefix + "%u" + txt_col_start + endcap + p.fin + suffix + txt_col_end
boring_msg = prefix + "%u" + endcap + p.stripped + suffix
speak = p.stripped
if msg != "": lucy_send_message(msg, boring_msg, local) if msg != "": lucy_send_message(msg, boring_msg, local)
if spoken_text != "" and colon: playerhud.emit_signal("_message_sent", speak) if speak != "" and colon: playerhud.emit_signal("_message_sent", speak)
# we did it ourselves # we did it ourselves
return [true] return [true]
@ -137,7 +357,7 @@ func process_message(lit_text, final, prefix, suffix, endcap, spoken_text, local
var LUCYSTOOLS_USERS = [] var LUCYSTOOLS_USERS = []
func lucy_send_message(message, boring_msg, local = false): func lucy_send_message(message, boring_msg, local = false, evil_color = ""):
if not Network._message_cap(Network.STEAM_ID): if not Network._message_cap(Network.STEAM_ID):
Network._update_chat("Sending too many messages too quickly!", false) Network._update_chat("Sending too many messages too quickly!", false)
Network._update_chat("Sending too many messages too quickly!", true) Network._update_chat("Sending too many messages too quickly!", true)
@ -145,10 +365,10 @@ func lucy_send_message(message, boring_msg, local = false):
var msg_pos = Network.MESSAGE_ORIGIN.round() var msg_pos = Network.MESSAGE_ORIGIN.round()
var lucy_user = real_custom_name if custom_name_enabled else "" var lucy_user = real_custom_name if custom_name_enabled and not bug_bbcode else ""
var color = get_user_color().to_html() var color = get_user_color().to_html() if not bug_bbcode else evil_color
safe_message(Network.STEAM_ID, color, boring_msg, local, lucy_user, message) safe_message(Network.STEAM_ID, color, boring_msg, local, lucy_user, message, false)
Network._send_P2P_Packet( Network._send_P2P_Packet(
{"type": "message", "message": boring_msg, "color": color, "local": local, {"type": "message", "message": boring_msg, "color": color, "local": local,
"position": Network.MESSAGE_ORIGIN, "zone": Network.MESSAGE_ZONE, "position": Network.MESSAGE_ORIGIN, "zone": Network.MESSAGE_ZONE,
@ -158,51 +378,58 @@ func lucy_send_message(message, boring_msg, local = false):
func process_read(DATA, PACKET_SENDER, from_host): func process_read(DATA, PACKET_SENDER, from_host) -> bool:
match DATA["type"]: match DATA["type"]:
"lucy_packet": "lucy_packet":
print("[LUCY PACKET]") print("[LUCY PACKET]")
if not PACKET_SENDER in LUCYSTOOLS_USERS: LUCYSTOOLS_USERS.append(PACKET_SENDER) if not PACKET_SENDER in LUCYSTOOLS_USERS: LUCYSTOOLS_USERS.append(PACKET_SENDER)
if Network.GAME_MASTER or not from_host: return true
if not Network._validate_packet_information(DATA, ["srv_bbcode"], [TYPE_BOOL]): return true
self.srv_bbcode = DATA["srv_bbcode"]
return true return true
"message": "message":
if DATA.has("message"): var has_bb = true
if typeof(DATA["message"]) == TYPE_STRING:
if not "%u" in DATA["message"] and not from_host:
DATA["message"] = "(%u)" + DATA["message"]
if DATA.has("bb_msg"):
if typeof(DATA["bb_msg"]) == TYPE_STRING:
if not "%u" in DATA["bb_msg"] and not from_host:
DATA["bb_msg"] = "(%u)" + DATA["bb_msg"]
if DATA.has("bb_msg") or DATA.has("bb_user"):
if not PACKET_SENDER in LUCYSTOOLS_USERS:
LUCYSTOOLS_USERS.append(PACKET_SENDER)
else:
return false
# yay! this is a lucy user :3
if PlayerData.players_muted.has(PACKET_SENDER) or PlayerData.players_hidden.has(PACKET_SENDER): return
if not Network._validate_packet_information(DATA, if not Network._validate_packet_information(DATA,
["message", "color", "local", "position", "zone", "zone_owner", "bb_user", "bb_msg"], ["message", "color", "local", "position", "zone", "zone_owner", "bb_user", "bb_msg"],
[TYPE_STRING, TYPE_STRING, TYPE_BOOL, TYPE_VECTOR3, TYPE_STRING, TYPE_INT, TYPE_STRING, TYPE_STRING]): [TYPE_STRING, TYPE_STRING, TYPE_BOOL, TYPE_VECTOR3, TYPE_STRING, TYPE_INT, TYPE_STRING, TYPE_STRING]):
return has_bb = false
if not Network._validate_packet_information(DATA,
["message", "color", "local", "position", "zone", "zone_owner"],
[TYPE_STRING, TYPE_STRING, TYPE_BOOL, TYPE_VECTOR3, TYPE_STRING, TYPE_INT]):
# invalid packet
if log_messages:
print("[MALFORMED MESSAGE] sender: ", Network._get_username_from_id(PACKET_SENDER), "(", PACKET_SENDER + ") " + DATA)
return true
if not Network._message_cap(PACKET_SENDER): return if has_bb:
if not PACKET_SENDER in LUCYSTOOLS_USERS:
LUCYSTOOLS_USERS.append(PACKET_SENDER)
if PlayerData.players_muted.has(PACKET_SENDER) or PlayerData.players_hidden.has(PACKET_SENDER):
return false
if not Network._message_cap(PACKET_SENDER): return false
var user_id: int = PACKET_SENDER var user_id: int = PACKET_SENDER
var user_color: String = DATA["color"] var user_color: String = DATA["color"]
var user_message: String = DATA["message"] var user_message: String = DATA["message"]
var lucy_user: String = DATA["bb_user"]
var lucy_msg: String = DATA["bb_msg"]
# if host, don't care about visibility
check_alpha = not from_host
var bb_user: String = ""
var bb_msg: String = ""
if has_bb:
bb_user = DATA["bb_user"]
bb_msg = DATA["bb_msg"]
if not DATA["local"]: if not DATA["local"]:
safe_message(user_id, user_color, user_message, false, lucy_user, lucy_msg) safe_message(user_id, user_color, user_message, false, bb_user, bb_msg, not from_host)
else : else :
var dist = DATA["position"].distance_to(Network.MESSAGE_ORIGIN) var dist = DATA["position"].distance_to(Network.MESSAGE_ORIGIN)
if DATA["zone"] == Network.MESSAGE_ZONE and DATA["zone_owner"] == PlayerData.player_saved_zone_owner: if DATA["zone"] == Network.MESSAGE_ZONE and DATA["zone_owner"] == PlayerData.player_saved_zone_owner:
if dist < 25.0: safe_message(user_id, user_color, user_message, true, lucy_user, lucy_msg) if dist < 25.0: safe_message(user_id, user_color, user_message, true, bb_user, bb_msg, not from_host)
# don't process it again! # don't process it again!
return true return true
@ -217,7 +444,7 @@ func process_read(DATA, PACKET_SENDER, from_host):
return false return false
func bbcode_changes(): func bbcode_changes():
if allow_intrusive_bbcode: if allow_intrusive_bbcode and srv_bbcode:
allowed_tags = [ allowed_tags = [
"b", "i", "u", "s", "color", "b", "i", "u", "s", "color",
"wave", "rainbow", "shake", "tornado", "font"] "wave", "rainbow", "shake", "tornado", "font"]
@ -226,24 +453,8 @@ func bbcode_changes():
"b", "i", "u", "s", "color"] "b", "i", "u", "s", "color"]
if lucys_menu != null: lucys_menu.update() if lucys_menu != null: lucys_menu.update()
func set_log_messages(val):
log_messages = val
Network.LUCY_LOG_MESSAGES = val
func set_allow_intrusive_bbcode(bbcode):
allow_intrusive_bbcode = bbcode
bbcode_changes()
func set_server_name(name):
custom_server_name = name
Network.LUCY_SRV_NAME = name
func set_join_message(msg):
server_join_message = msg
func set_custom_color(val):
custom_color = Color(val) if Color(val) != Color("d5aa73") else Color("739ed5")
custom_color.a = 1
func _ready(): func _ready():
print("[LUCY] Loaded LucysTools") print("[LUCY] Loaded LucysTools 0.6.0")
load_settings() load_settings()
root.connect("child_entered_tree", self, "_on_enter") root.connect("child_entered_tree", self, "_on_enter")
Network.connect("_new_player_join", self, "new_player") Network.connect("_new_player_join", self, "new_player")
@ -257,7 +468,7 @@ func inject_lobby_data(connect, lobby_id):
func send_lucy_sync(to = "peers"): func send_lucy_sync(to = "peers"):
if not Network.GAME_MASTER: return if not Network.GAME_MASTER: return
Network._send_P2P_Packet({"type": "lucy_packet"}, to, Network.CHANNELS.GAME_STATE) Network._send_P2P_Packet({"type": "lucy_packet", "srv_bbcode": srv_bbcode}, to, Network.CHANNELS.GAME_STATE)
func get_player() -> Actor: func get_player() -> Actor:
for p in get_tree().get_nodes_in_group("player"): for p in get_tree().get_nodes_in_group("player"):
@ -276,8 +487,17 @@ func new_player(id):
print("[LUCY] new player!") print("[LUCY] new player!")
if server_join_message.empty() or not Network.GAME_MASTER: return if server_join_message.empty() or not Network.GAME_MASTER: return
print("[LUCY] sending join message") print("[LUCY] sending join message")
var bb_msg = bbcode_process(server_join_message) var bb_msg = bbcode_process(server_join_message, 512)
lucy_send_message(bb_msg.fin, bb_msg.stripped, false) if not bug_bbcode:
lucy_send_message(bb_msg.fin, bb_msg.stripped, false)
else:
var evil_color = "00ff0000]"\
+ "[color=#ffeed5]"\
+ bb_msg.fin\
+ "[/color]"
if bb_msg.fin != "":
lucy_send_message("", "%u", false, evil_color)
send_lucy_sync(str(id)) send_lucy_sync(str(id))
func _on_enter(node: Node): func _on_enter(node: Node):
@ -300,7 +520,9 @@ const save_keys = [
"custom_server_name", "server_join_message", "custom_server_name", "server_join_message",
"custom_color_enabled", "custom_color", "custom_color_enabled", "custom_color",
"log_messages", "custom_name", "log_messages", "custom_name",
"allow_intrusive_bbcode" "allow_intrusive_bbcode", "DEBUG",
"bug_bbcode", "custom_text_color",
"custom_text_color_enabled"
] ]
func load_settings(): func load_settings():
@ -317,11 +539,12 @@ func load_settings():
func save_settings(): func save_settings():
print("[LUCY] Saving settings") print("[LUCY] Saving settings")
custom_color = Color(custom_color).to_html()
var settings = {} var settings = {}
for key in save_keys: for key in save_keys:
settings[key] = self[key] if key in ["custom_color", "custom_text_color"]:
settings[key] = self[key].to_html()
else:
settings[key] = self[key]
var file = File.new() var file = File.new()
if file.open(OS.get_executable_path().get_base_dir().plus_file("GDWeave/configs/LucysTools.json"),File.WRITE) == OK: if file.open(OS.get_executable_path().get_base_dir().plus_file("GDWeave/configs/LucysTools.json"),File.WRITE) == OK: