Compare commits

..

No commits in common. "master" and "0.5.1" have entirely different histories.

9 changed files with 522 additions and 440 deletions

View File

@ -38,20 +38,3 @@ initial release
- Lure 4.1.0 compatibility - Lure 4.1.0 compatibility
- log fixes - log fixes
- spawn fixes - spawn fixes
0.6.0
----
- custom text color (bbcode qol)
- experimental color bug bbcode
- better (actually somewhat working) bbcode filtering
0.6.1
----
- menu doesn't auto-open if it was closed
0.7.0
----
- update to webfishing 1.10
- bbcode stuff only to lucystools users, color bug was patched
- LucysLib 0.1.0 dependency
- custom lobby code

View File

@ -2,72 +2,46 @@ extends Control
var MANAGER var MANAGER
const LucysLib_t = preload("res://mods/LucysLib/main.gd")
const BBCode_t = preload("res://mods/LucysLib/bbcode.gd")
func setup(): func setup():
if MANAGER.DEBUG: print("[LUCYSTOOLS MENU] Setup...") get_node("%lucy_bbcode").pressed = MANAGER.allow_bbcode
get_node("%lucy_punchback").pressed = MANAGER.do_punchback get_node("%lucy_punchback").pressed = MANAGER.do_punchback
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
var srv_m_bb: BBCode_t.BBCodeTag = MANAGER.LucysLib.BBCode.parse_bbcode_text(MANAGER.server_join_message) get_node("%lucy_servermsg_preview").bbcode_text = MANAGER.server_join_message
get_node("%lucy_servermsg_preview").bbcode_text = srv_m_bb.get_full(MANAGER.allowed_bb) var srv_m_bb = MANAGER.bbcode_process(MANAGER.server_join_message)
get_node("%lucy_servermsg_preview2").bbcode_text = srv_m_bb.get_stripped() get_node("%lucy_servermsg_preview2").bbcode_text = srv_m_bb.stripped
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_lobbycode").text = MANAGER.custom_lobbycode
get_node("%lucy_name").text = MANAGER.custom_name get_node("%lucy_name").text = MANAGER.custom_name
var tag_container = get_node("%bbcode_tags")
var new_btn
for v in BBCode_t.TAG_TYPE.values():
if v == BBCode_t.TAG_TYPE.ROOT or v == BBCode_t.TAG_TYPE.NULL: continue
new_btn = CheckBox.new()
new_btn.text = BBCode_t.TAG_TYPE.keys()[v]
new_btn.connect("pressed",self,"_tags_changed")
tag_container.add_child(new_btn)
update() update()
func update(): func update():
if MANAGER.DEBUG: print("[LUCYSTOOLS MENU] Update...")
var tag_type
for tag_btn in get_node("%bbcode_tags").get_children():
tag_type = BBCode_t.TAG_TYPE[tag_btn.text]
tag_btn.pressed = tag_type in MANAGER.allowed_bb
if MANAGER.DEBUG: print("[LUCYSTOOLS M UPDATE] " + tag_btn.text + " " + str(tag_type) + " " + str(tag_btn.pressed))
_on_lucy_name_text_changed(MANAGER.custom_name) _on_lucy_name_text_changed(MANAGER.custom_name)
func _tags_changed():
if MANAGER.DEBUG: print("[LUCYSTOOLS MENU] Tags changed...")
var tag_type
var allowed = []
for tag_btn in get_node("%bbcode_tags").get_children():
tag_type = BBCode_t.TAG_TYPE[tag_btn.text]
if tag_btn.pressed: allowed.append(tag_type)
if MANAGER.DEBUG: print("[LUCYSTOOLS M _TAGS_CHANGED]" + tag_btn.text + " " + str(tag_type) + " " + str(tag_btn.pressed))
MANAGER.allowed_bb = allowed
func _on_lucy_name_text_changed(new_text): func _on_lucy_name_text_changed(new_text):
if MANAGER.DEBUG: print("[LUCYSTOOLS MENU] Name text changed...") var result = MANAGER.bbcode_process(new_text)
var result: BBCode_t.BBCodeTag = MANAGER.LucysLib.BBCode.parse_bbcode_text(new_text) #print("[fin] ", result.fin)
#print("[tags] ", result.tags)
#print("[stripped] ", result.stripped)
var net_name = Network.STEAM_USERNAME.replace("[", "").replace("]", "") var lol_steam_username = Network.STEAM_USERNAME.replace("[", "").replace("]", "")
var good = result.get_stripped() == net_name var good = result.stripped == lol_steam_username
get_node("%lucy_name_preview").bbcode_text = result.get_full(MANAGER.allowed_bb) get_node("%lucy_name_preview").bbcode_text = result.fin
get_node("%lucy_namegood").bbcode_text = "[color=green]Good[/color]" if good else "[color=red]Bad[/color]" get_node("%lucy_namegood").bbcode_text = "[color=green]Good[/color]" if good else "[color=red]Bad[/color]"
MANAGER.custom_name_enabled = good MANAGER.custom_name_enabled = good
MANAGER.custom_name = new_text if good else "" MANAGER.custom_name = new_text
func _ready(): func _ready():
print("[LUCYSTOOLS] Menu Ready") print("[LUCY] Menu Ready")
MANAGER = $"/root/LucyLucysTools" MANAGER = $"/root/LucyLucysTools"
@ -77,16 +51,14 @@ func _ready():
get_node("%lucy_raincloud").disabled = not can_spawn get_node("%lucy_raincloud").disabled = not can_spawn
get_node("%lucy_meteor").disabled = not can_spawn get_node("%lucy_meteor").disabled = not can_spawn
get_node("%lucy_void").disabled = not can_spawn
get_node("%lucy_freezerain").disabled = not can_spawn get_node("%lucy_freezerain").disabled = not can_spawn
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_lobbyrefresh").disabled = not can_spawn
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
print("[LUCYSTOOLS] Menu visble: ", visible) print("[LUCY] Menu visble: ", visible)
MANAGER.lucys_menu_visible = visible MANAGER.lucys_menu_visible = visible
if event is InputEventKey and event.scancode == KEY_F6 && event.pressed: if event is InputEventKey and event.scancode == KEY_F6 && event.pressed:
@ -97,7 +69,7 @@ func _input(event):
var type = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "type") var type = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "type")
var bbname = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "bbcode_lobby_name") var bbname = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "bbcode_lobby_name")
var lobby_dat = {"name": name, "lobby_name":lname, "bbcode_lobby_name":bbname, "nm": nm, "code": code, "type": type} var lobby_dat = {"name": name, "lobby_name":lname, "bbcode_lobby_name":bbname, "nm": nm, "code": code, "type": type}
print("[LUCYSTOOLS] LOBBY ", lobby_dat) print("[LUCY] LOBBY ", lobby_dat)
func _on_lucy_bbcode_toggled(button_pressed): func _on_lucy_bbcode_toggled(button_pressed):
MANAGER.allow_bbcode = button_pressed MANAGER.allow_bbcode = button_pressed
@ -107,40 +79,29 @@ 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 srv_m_bb: BBCode_t.BBCodeTag = MANAGER.LucysLib.BBCode.parse_bbcode_text(new_text) var result = MANAGER.bbcode_process(new_text)
get_node("%lucy_servermsg_preview").bbcode_text = srv_m_bb.get_full(MANAGER.allowed_bb) get_node("%lucy_servermsg_preview").bbcode_text = result.fin
get_node("%lucy_servermsg_preview2").bbcode_text = srv_m_bb.get_stripped() get_node("%lucy_servermsg_preview2").bbcode_text = result.stripped
MANAGER.server_join_message = new_text MANAGER.server_join_message = new_text
func _on_lucy_chatcolor_bool_toggled(button_pressed): 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_lobbycode_text_changed(new_text):
MANAGER.custom_lobbycode = new_text
func _on_lucy_raincloud_pressed(): func _on_lucy_raincloud_pressed():
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return if not MANAGER.ingame: return
print("[LUCYSTOOLS] 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)
var zone = player.current_zone var zone = player.current_zone
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 or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return if not MANAGER.ingame: return
if get_tree().get_nodes_in_group("meteor").size() > 10: return if get_tree().get_nodes_in_group("meteor").size() > 10: return
print("[LUCYSTOOLS] Spawning meteor") print("[LUCY] Spawning meteor")
var player_pos = MANAGER.get_player().global_transform.origin var player_pos = MANAGER.get_player().global_transform.origin
var dist = INF var dist = INF
var point = null var point = null
@ -154,16 +115,16 @@ 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 and not Network.PLAYING_OFFLINE): return if not MANAGER.ingame or not Network.GAME_MASTER: return
print("[LUCYSTOOLS] 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:
cloud.speed = 0 cloud.speed = 0
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 and not Network.PLAYING_OFFLINE): return if not MANAGER.ingame or not Network.GAME_MASTER: return
print("[LUCYSTOOLS] 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)
@ -172,27 +133,8 @@ 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 and not Network.PLAYING_OFFLINE): return if not MANAGER.ingame or not Network.GAME_MASTER: return
print("[LUCYSTOOLS] 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)
func _on_lucy_void_pressed():
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
if get_tree().get_nodes_in_group("void_portal").size() > 10: return
print("[LUCYSTOOLS] Spawning void")
var player_pos = MANAGER.get_player().global_transform.origin
var dist = INF
var point = null
for n in get_tree().get_nodes_in_group("hidden_spot"):
var node_dist = n.global_transform.origin.distance_to(player_pos)
if node_dist < dist:
dist = node_dist
point = n
var zone = "main_zone"
var pos = point.global_transform.origin
Network._sync_create_actor("void_portal", pos, zone, - 1, Network.STEAM_ID)
func _on_lucy_lobbyrefresh_pressed():
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
MANAGER.inject_lobby_data(1,Network.STEAM_LOBBY_ID)

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 = 400.0 margin_bottom = 329.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 = 150.0 margin_bottom = 71.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 = 543.0 margin_bottom = 393.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.7.0 - F5 to Toggle Menu" text = "Lucy's Options 0.5.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,75 +32,67 @@ 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. Allowed BBCode tags:" text = "BBCode is only visible to LucysTools-compatible users"
[node name="bbcode_tags" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
unique_name_in_owner = true
margin_top = 44.0
margin_right = 786.0
margin_bottom = 44.0
rect_pivot_offset = Vector2( -141, -49 )
[node name="HSeparator2" type="HSeparator" parent="PanelContainer/VBoxContainer"]
margin_top = 48.0
margin_right = 786.0
margin_bottom = 52.0
[node name="HFlowContainer" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 56.0 margin_top = 44.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 80.0 margin_bottom = 84.0
rect_pivot_offset = Vector2( -141, -49 ) rect_pivot_offset = Vector2( -141, -49 )
[node name="Label5" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"]
margin_top = 5.0 margin_top = 13.0
margin_right = 135.0 margin_right = 89.0
margin_bottom = 19.0 margin_bottom = 27.0
text = "Allow BBCode"
[node name="lucy_bbcode" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer"]
unique_name_in_owner = true
margin_left = 93.0
margin_right = 169.0
margin_bottom = 40.0
[node name="Label3" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"]
margin_left = 173.0
margin_top = 13.0
margin_right = 323.0
margin_bottom = 27.0
text = "Allow Intrusive BBCode"
[node name="lucy_intbbcode" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer"]
unique_name_in_owner = true
margin_left = 327.0
margin_right = 403.0
margin_bottom = 40.0
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"]
margin_left = 407.0
margin_top = 13.0
margin_right = 542.0
margin_bottom = 27.0
text = "Punch back on Punch" text = "Punch back on Punch"
[node name="lucy_punchback" type="CheckBox" 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 = 139.0 margin_left = 546.0
margin_right = 163.0 margin_right = 622.0
margin_bottom = 24.0 margin_bottom = 40.0
[node name="HSeparator3" type="HSeparator" parent="PanelContainer/VBoxContainer"] [node name="HSeparator3" type="HSeparator" parent="PanelContainer/VBoxContainer"]
margin_top = 84.0 margin_top = 88.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 88.0 margin_bottom = 92.0
[node name="HFlowContainer3" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 92.0
margin_right = 786.0
margin_bottom = 116.0
rect_pivot_offset = Vector2( -141, -49 )
[node name="Label5" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
margin_top = 5.0
margin_right = 127.0
margin_bottom = 19.0
text = "Custom Lobby Code"
[node name="lucy_lobbycode" type="LineEdit" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
unique_name_in_owner = true
margin_left = 131.0
margin_right = 786.0
margin_bottom = 24.0
size_flags_horizontal = 3
max_length = 6
expand_to_text_length = true
placeholder_text = "Code (1-6 characters)"
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer"] [node name="Label2" type="Label" parent="PanelContainer/VBoxContainer"]
margin_top = 120.0 margin_top = 96.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 134.0 margin_bottom = 110.0
text = "Custom Server Name - Shown without BBCode for normal users" 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 = 138.0 margin_top = 114.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 162.0 margin_bottom = 138.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"]
@ -112,9 +104,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 = 166.0 margin_top = 142.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 180.0 margin_bottom = 156.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"]
@ -134,20 +126,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 = 184.0 margin_top = 160.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 188.0 margin_bottom = 164.0
[node name="Label3" type="Label" parent="PanelContainer/VBoxContainer"] [node name="Label3" type="Label" parent="PanelContainer/VBoxContainer"]
margin_top = 192.0 margin_top = 168.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 206.0 margin_bottom = 182.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"
[node name="HFlowContainer5" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer5" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 210.0 margin_top = 186.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 234.0 margin_bottom = 210.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"]
@ -159,9 +151,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 = 238.0 margin_top = 214.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 252.0 margin_bottom = 228.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"]
@ -179,9 +171,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 = 256.0 margin_top = 232.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 270.0 margin_bottom = 246.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"]
@ -199,14 +191,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 = 274.0 margin_top = 250.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 278.0 margin_bottom = 254.0
[node name="HFlowContainer8" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer8" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 282.0 margin_top = 258.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 306.0 margin_bottom = 282.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"]
@ -230,44 +222,22 @@ 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 = 475.0
margin_bottom = 19.0
text = " Chat Text Color (LucysTools)"
[node name="lucy_chatcolor_bool2" type="CheckBox" parent="PanelContainer/VBoxContainer/HFlowContainer8"]
unique_name_in_owner = true
margin_left = 479.0
margin_right = 549.0
margin_bottom = 24.0
text = "Enable"
[node name="lucy_chatcolor2" type="ColorPickerButton" parent="PanelContainer/VBoxContainer/HFlowContainer8"]
unique_name_in_owner = true
margin_left = 553.0
margin_right = 595.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 = 310.0 margin_top = 286.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 324.0 margin_bottom = 300.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 = 348.0 margin_right = 379.0
margin_bottom = 14.0 margin_bottom = 14.0
text = "Custom Name - Must match Steam Name (LucysTools)" text = "Custom Name - Must match Steam Name (LucysTools only)"
[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 = 352.0 margin_left = 383.0
margin_right = 402.0 margin_right = 433.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
@ -277,17 +247,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 = 328.0 margin_top = 304.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 352.0 margin_bottom = 328.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 = 356.0 margin_top = 332.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 371.0 margin_bottom = 347.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
@ -296,14 +266,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 = 375.0 margin_top = 351.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 379.0 margin_bottom = 355.0
[node name="HFlowContainer2" type="HFlowContainer" parent="PanelContainer/VBoxContainer"] [node name="HFlowContainer2" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
margin_top = 383.0 margin_top = 359.0
margin_right = 786.0 margin_right = 786.0
margin_bottom = 403.0 margin_bottom = 379.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
@ -311,69 +281,52 @@ margin_bottom = 20.0
hint_tooltip = "Clears game chat (for you only)" hint_tooltip = "Clears game chat (for you only)"
text = "Clear Chat" text = "Clear Chat"
[node name="lucy_lobbyrefresh" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
unique_name_in_owner = true
margin_left = 80.0
margin_right = 180.0
margin_bottom = 20.0
text = "Update Lobby"
[node name="lucy_raincloud" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"] [node name="lucy_raincloud" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 184.0 margin_left = 80.0
margin_right = 267.0 margin_right = 198.0
margin_bottom = 20.0 margin_bottom = 20.0
text = "Spawn Rain" text = "Spawn Raincloud"
[node name="lucy_meteor" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"] [node name="lucy_meteor" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 271.0 margin_left = 202.0
margin_right = 373.0 margin_right = 304.0
margin_bottom = 20.0 margin_bottom = 20.0
text = "Spawn Meteor" text = "Spawn Meteor"
[node name="lucy_void" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
unique_name_in_owner = true
margin_left = 377.0
margin_right = 461.0
margin_bottom = 20.0
text = "Spawn Void"
[node name="lucy_freezerain" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"] [node name="lucy_freezerain" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 465.0 margin_left = 308.0
margin_right = 551.0 margin_right = 394.0
margin_bottom = 20.0 margin_bottom = 20.0
text = "Freeze Rain" text = "Freeze Rain"
[node name="lucy_clearrain" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"] [node name="lucy_clearrain" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 555.0 margin_left = 398.0
margin_right = 630.0 margin_right = 473.0
margin_bottom = 20.0 margin_bottom = 20.0
text = "Clear Rain" text = "Clear Rain"
[node name="lucy_clearmeteor" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"] [node name="lucy_clearmeteor" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 634.0 margin_left = 477.0
margin_right = 728.0 margin_right = 571.0
margin_bottom = 20.0 margin_bottom = 20.0
text = "Clear Meteor" 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_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="text_changed" from="PanelContainer/VBoxContainer/HFlowContainer3/lucy_lobbycode" to="." method="_on_lucy_lobbycode_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/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_lobbyrefresh" to="." method="_on_lucy_lobbyrefresh_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"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_meteor" to="." method="_on_lucy_meteor_pressed"] [connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_meteor" to="." method="_on_lucy_meteor_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_void" to="." method="_on_lucy_void_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_freezerain" to="." method="_on_lucy_freezerain_pressed"] [connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_freezerain" to="." method="_on_lucy_freezerain_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_clearrain" to="." method="_on_lucy_clearrain_pressed"] [connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_clearrain" to="." method="_on_lucy_clearrain_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_clearmeteor" to="." method="_on_lucy_clearmeteor_pressed"] [connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_clearmeteor" to="." method="_on_lucy_clearmeteor_pressed"]

View File

@ -1,200 +1,263 @@
extends Node extends Node
const LucysLib_t = preload("res://mods/LucysLib/main.gd")
var LucysLib: LucysLib_t
const BBCode_t = preload("res://mods/LucysLib/bbcode.gd")
const NetManager_t := preload("res://mods/LucysLib/net.gd")
const LUCYS_MENU_SCENE = preload("res://mods/Lucy.LucysTools/lucys_menu.tscn") 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 custom_name_enabled: bool = false var INCERCEPT_MSG = false
var INCERCEPT_SEND_MSG = false
var do_punchback = false
var allow_bbcode = false
var custom_server_name = "" 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 custom_color_enabled = false
var custom_color = Color("009cd0") setget set_custom_color
var custom_name_enabled = false
var real_custom_name = ""
var custom_name = "" setget set_custom_name
var allow_intrusive_bbcode = false setget set_allow_intrusive_bbcode
var log_messages = false setget set_log_messages
var lucys_menu_visible = true
var allowed_tags = ["b", "i", "u", "s", "color"]
var escape_invalid = true
var bbcode_matcher = null
func set_custom_name(val):
custom_name = val
var bb = bbcode_process(val)
real_custom_name = bb.fin
# i know this sucks
# but i have things to do
func bbcode_recurse(text, data):
var m = bbcode_matcher.search(text)
if m == null:
var escaped = text.replace('[lb]','[').replace('[','[lb]') if escape_invalid else text
data.fin += escaped
data.stripped += escaped
else:
#print("Found ", m.strings, " in '", text, "'")
bbcode_recurse(m.get_string(1), data)
var tag = m.get_string(2)
var junk = m.get_string(3)
var allowed = tag in allowed_tags
if allowed:
data.fin += "[" + tag + junk + "]"
else:
data.fin += "[lb]" + tag + junk + "]"
data.stripped += "[lb]" + tag + junk + "]"
#print("TAG ", m.get_string(2), " JUNK ", m.get_string(3))
data.tags.append([tag, junk])
bbcode_recurse(m.get_string(4), data)
if allowed:
data.fin += "[/" + tag + "]"
else:
data.fin += "[lb]/" + tag + "]"
data.stripped += "[lb]/" + tag + "]"
bbcode_recurse(m.get_string(5), data)
func bbcode_process(text):
bbcode_matcher = RegEx.new()
bbcode_matcher.compile("^(.*?)\\[(\\w+?)([^\\]]*)\\](.+?)\\[/\\2\\](.*?)$")
#print("processing '", text, "'")
var data = {"fin": "", "tags": [], "stripped": ""}
bbcode_recurse(text, data)
return data
var ingame = false var ingame = false
# config options
var do_punchback: bool = false
var custom_server_name: String = ""
var server_join_message: String = "[color=#5BCEFA]TRAN[/color][color=#F5A9B8]S RIG[/color][color=#ffffff]HTS![/color]"
var custom_color_enabled: bool = false
var custom_color: Color = Color("009cd0") setget set_custom_color
var log_messages: bool = false setget set_log_messages
var custom_name: String = ""
var DEBUG: bool = false setget set_DEBUG
var custom_text_color: Color = Color("00ff00")
var custom_text_color_enabled: bool = false
var lucys_menu_visible: bool = true
var allowed_bb: Array = BBCode_t.DEFAULT_ALLOWED_TYPES setget set_allowed_bb
var custom_lobbycode: String = ""
const SAVE_KEYS = [
"do_punchback", "allowed_bb",
"custom_server_name", "server_join_message",
"custom_color_enabled", "custom_color",
"log_messages", "custom_name",
"DEBUG", "custom_text_color",
"custom_text_color_enabled",
"lucys_menu_visible", "custom_lobbycode"
]
func bbcode_changes():
if lucys_menu != null: lucys_menu.update()
func set_allowed_bb(val):
var f = []
for v in val:
if v == BBCode_t.TAG_TYPE.NULL or v == BBCode_t.TAG_TYPE.ROOT:
continue
if v in BBCode_t.TAG_TYPE.values():
f.append(v)
allowed_bb = f
LucysLib.ALLOWED_TAG_TYPES = f
bbcode_changes()
func set_custom_color(val):
custom_color = Color(val) if Color(val) != Color("d5aa73") else Color("739ed5")
custom_color.a = 1
func set_log_messages(val):
log_messages = val
LucysLib.LOG_MESSAGES = val
func set_DEBUG(val):
DEBUG = val
LucysLib.DEBUG = val
LucysLib.NetManager.DEBUG = val
LucysLib.BBCode.DEBUG = val
func get_user_color() -> Color: func get_user_color() -> Color:
var base_color = Color(Globals.cosmetic_data[PlayerData.cosmetics_equipped["primary_color"]]["file"].main_color) * Color(0.95, 0.9, 0.9) var base_color = Color(Globals.cosmetic_data[PlayerData.cosmetics_equipped["primary_color"]]["file"].main_color) * Color(0.95, 0.9, 0.9)
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
# intercept player message send func safe_message(user_id, color, boring_msg, local, lucy_user, lucy_msg):
# we just take over - replicate as var username = Network._get_username_from_id(user_id) if lucy_user == "" else lucy_user
# much as i can be bothered to var bb_user = bbcode_process(username)
func process_message(text: String, local: bool, player, playerhud): username = bb_user.fin
if DEBUG:
var thing = {"text":text,"local":local,"player":player,"playerhud":playerhud,"custom_name":custom_name} var msg = lucy_msg if lucy_msg != "" else boring_msg
print("[LUCYSTOOLS process_message] ", thing) var bb_data = bbcode_process(msg)
# is this a host message? (no username) var filter_message = bb_data.fin
if text.begins_with("%") and (Network.GAME_MASTER or Network.PLAYING_OFFLINE):
text = text.trim_prefix("%") if bb_user.stripped != Network._get_username_from_id(user_id):
var msg := LucysLib.BBCode.parse_bbcode_text(text) filter_message = "(" + Network._get_username_from_id(user_id) + ") " + filter_message
LucysLib.send_message(msg, Color.aqua, false, null, "peers")
if OptionsMenu.chat_filter:
filter_message = SwearFilter._filter_string(filter_message)
var final_message = filter_message.replace("%u", "[color=#" + str(color) + "]" + username + "[/color]")
var thing = {"username":username, "color":color, "filter_message":filter_message,
"final_message":final_message,"lucy_user":lucy_user,"lucy_msg":lucy_msg}
#print("FUCK2 ", thing)
Network._update_chat(final_message, local)
# this is stinky
func process_message(lit_text, final, prefix, suffix, endcap, spoken_text, local, colon, playerhud):
var thing = {
"lit_text": lit_text, "final": final, "prefix": prefix, "suffix": suffix,
"endcap": endcap,
"custom_color_enabled": custom_color_enabled,
"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("%"):
var bb_dat = bbcode_process(lit_text)
lucy_send_message(lit_text.trim_prefix('%'), bb_dat.stripped, false)
# we sent the message ourself
return [true]
var msg = final
var boring_msg = final
var speak = spoken_text
if allow_bbcode:
var p = bbcode_process(lit_text)
if not p.tags.empty():
msg = prefix + "%u" + endcap + p.fin + suffix
boring_msg = prefix + "%u" + endcap + p.stripped + suffix
speak = p.stripped
#print("FUCK3 ", {"msg":msg,"boring_msg":boring_msg,"p":p})
if msg != "": lucy_send_message(msg, boring_msg, local)
if spoken_text != "" and colon: playerhud.emit_signal("_message_sent", speak)
# we did it ourselves
return [true]
# return the custom color
return [false, get_user_color().to_html()]
var LUCYSTOOLS_USERS = []
func lucy_send_message(message, boring_msg, local = false):
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!", true)
return return
# i don't know why the wag stuff toggles multiple times var msg_pos = Network.MESSAGE_ORIGIN.round()
# and applies anywhere in string
# i'm doing it once.
if "/wag" in text:
PlayerData.emit_signal("_wag_toggle")
text.replace("/wag","")
# /me has to be at beginning because i say so
var colon: bool = true
if text.begins_with("/me "):
colon = false
text = text.trim_prefix("/me ")
# process message into bbcode nodes var lucy_user = real_custom_name if custom_name_enabled else ""
var msg := LucysLib.BBCode.parse_bbcode_text(text) var color = get_user_color().to_html()
# clamp transparency safe_message(Network.STEAM_ID, color, boring_msg, local, lucy_user, message)
if not (Network.GAME_MASTER or Network.PLAYING_OFFLINE): Network._send_P2P_Packet(
LucysLib.BBCode.clamp_alpha(msg, 0.7) {"type": "message", "message": boring_msg, "color": color, "local": local,
"position": Network.MESSAGE_ORIGIN, "zone": Network.MESSAGE_ZONE,
"zone_owner": PlayerData.player_saved_zone_owner,
"bb_user": lucy_user, "bb_msg": message},
"peers", 2, Network.CHANNELS.GAME_STATE)
# get drunk params
var drunk_chance := 0.0
var drunk_max := 0
if is_instance_valid(player):
drunk_chance = 0.13 * player.drunk_tier
drunk_max = player.drunk_tier
# spoken text is gonna have different drunk text
# i don't want to think about this more
# get bbcode tag so it can get sent to the
# same function at least
# maybe i'll just add a toggle for hicc
var spoken_msg := LucysLib.BBCode.parse_bbcode_text(msg.get_stripped())
drunk_text_add(msg, drunk_chance, drunk_max, false)
drunk_text_add(spoken_msg, drunk_chance, drunk_max, true)
# add text color if it exists func process_read(DATA, PACKET_SENDER, from_host):
if custom_text_color_enabled: match DATA["type"]:
var col_tag: BBCode_t.BBCodeColorTag = BBCode_t.tag_creator(BBCode_t.TAG_TYPE.color, "") "lucy_packet":
col_tag.color = custom_text_color print("[LUCY PACKET]")
col_tag.inner = [msg] if not PACKET_SENDER in LUCYSTOOLS_USERS: LUCYSTOOLS_USERS.append(PACKET_SENDER)
msg = col_tag return true
# prefix endcap suffix stuff "message":
if colon: if DATA.has("message"):
msg.inner.push_front("%u: ") 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: else:
msg.inner.push_front("(%u ") return false
msg.inner.push_back(")") # yay! this is a lucy user :3
if PlayerData.players_muted.has(PACKET_SENDER) or PlayerData.players_hidden.has(PACKET_SENDER): return
var name := LucysLib.BBCode.parse_bbcode_text(custom_name) if custom_name_enabled else null if not Network._validate_packet_information(DATA,
if DEBUG: ["message", "color", "local", "position", "zone", "zone_owner", "bb_user", "bb_msg"],
print("[LUCYSTOOLS process_message] ", {"name":name,"msg":msg}) [TYPE_STRING, TYPE_STRING, TYPE_BOOL, TYPE_VECTOR3, TYPE_STRING, TYPE_INT, TYPE_STRING, TYPE_STRING]):
return
LucysLib.send_message(msg, get_user_color(), local, name, "peers") if not Network._message_cap(PACKET_SENDER): return
var spoken_text := spoken_msg.get_stripped()
if colon and spoken_text != "": playerhud.emit_signal("_message_sent", spoken_text)
# drunk processing. ouch this sucks var user_id: int = PACKET_SENDER
# not quite the same as vanilla var user_color: String = DATA["color"]
# if people want drunk text that var user_message: String = DATA["message"]
# works better. i will but. ugh var lucy_user: String = DATA["bb_user"]
var line: String = "" var lucy_msg: String = DATA["bb_msg"]
func drunk_text_add(msg: BBCode_t.BBCodeTag, drunk_chance: float, drunk_max: int, do_hicc: bool):
for index in msg.inner.size():
if msg.inner[index] is BBCode_t.BBCodeTag: if not DATA["local"]:
drunk_text_add(msg.inner[index], drunk_chance, drunk_max, do_hicc) safe_message(user_id, user_color, user_message, false, lucy_user, lucy_msg)
else: else :
var lines = msg.inner[index].split(" ") var dist = DATA["position"].distance_to(Network.MESSAGE_ORIGIN)
var new: String = "" if DATA["zone"] == Network.MESSAGE_ZONE and DATA["zone_owner"] == PlayerData.player_saved_zone_owner:
var linei: int = 0 if dist < 25.0: safe_message(user_id, user_color, user_message, true, lucy_user, lucy_msg)
for line in lines:
for i in drunk_max: # don't process it again!
if randf() >= drunk_chance or line == "": break return true
var d_effect = randi() % 5
var slot = randi() % line.length()
match d_effect:
0, 1: line = line.insert(slot, line[slot])
2: line = line.insert(slot, "'")
3: line = line.insert(slot, ",")
4:
if do_hicc: line = line.insert(slot, " -*HICC*- ")
break
if linei > 0: new += " "
linei += 1
new += line
msg.inner[index] = new
func process_packet_player_punch(DATA, PACKET_SENDER, from_host) -> bool:
# lucy punchback :3 # lucy punchback :3
"player_punch":
if not DATA.has("nya"): punched(PACKET_SENDER, DATA["punch_type"]) if not DATA.has("nya"): punched(PACKET_SENDER, DATA["punch_type"])
# still get punched! # still get punched!
return false return false
# fall through to default code
return false
func bbcode_changes():
if allow_intrusive_bbcode:
allowed_tags = [
"b", "i", "u", "s", "color",
"wave", "rainbow", "shake", "tornado", "font"]
else:
allowed_tags = [
"b", "i", "u", "s", "color"]
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 0.7.0") print("[LUCY] Loaded LucysTools")
LucysLib = $"/root/LucysLib"
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")
Steam.connect("lobby_created", self, "inject_lobby_data") Steam.connect("lobby_created", self, "inject_lobby_data")
LucysLib.register_bb_msg_support()
LucysLib.register_log_msg_support()
LucysLib.NetManager.add_network_processor("player_punch", funcref(self, "process_packet_player_punch"), 10)
func inject_lobby_data(connect, lobby_id): func inject_lobby_data(connect, lobby_id):
if connect != 1: return if connect != 1: return
if custom_server_name != "": if custom_server_name != "":
var bb_name := LucysLib.BBCode.parse_bbcode_text(custom_server_name) Steam.setLobbyData(lobby_id, "bbcode_lobby_name", custom_server_name)
Steam.setLobbyData(lobby_id, "bbcode_lobby_name", bb_name.get_full(LucysLib.ALLOWED_TAG_TYPES))
Steam.setLobbyData(lobby_id, "lobby_name", bb_name.get_stripped()) func send_lucy_sync(to = "peers"):
if custom_lobbycode != "": if not Network.GAME_MASTER: return
Steam.setLobbyData(lobby_id, "code", custom_lobbycode) Network._send_P2P_Packet({"type": "lucy_packet"}, to, Network.CHANNELS.GAME_STATE)
Network.LOBBY_CODE = custom_lobbycode
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"):
@ -207,19 +270,17 @@ func punched(puncher_id, type):
if not do_punchback: return if not do_punchback: return
if puncher_id == 0 or puncher_id == Network.STEAM_ID: return if puncher_id == 0 or puncher_id == Network.STEAM_ID: return
print("[LUCY] punching back...") print("[LUCY] punching back...")
Network._send_P2P_Packet( Network._send_P2P_Packet({"type": "player_punch", "from_pos": get_player().global_transform.origin, "punch_type": type, "nya": "nya"}, str(puncher_id), 2, Network.CHANNELS.ACTOR_ACTION)
{"type": "player_punch", "from_pos": get_player().global_transform.origin, "punch_type": type, "nya": "nya"},
str(puncher_id), 2, Network.CHANNELS.ACTOR_ACTION)
func new_player(id): 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 := LucysLib.BBCode.parse_bbcode_text(server_join_message) var bb_msg = bbcode_process(server_join_message)
LucysLib.send_message(bb_msg, Color.aqua, false, null, "peers") lucy_send_message(bb_msg.fin, bb_msg.stripped, false)
send_lucy_sync(str(id))
func _on_enter(node: Node): func _on_enter(node: Node):
if DEBUG: print("[LUCY] INSTANCING MENU")
if node.name == "main_menu": if node.name == "main_menu":
lucys_menu = LUCYS_MENU_SCENE.instance() lucys_menu = LUCYS_MENU_SCENE.instance()
lucys_menu.MANAGER = self lucys_menu.MANAGER = self
@ -231,8 +292,17 @@ func _on_enter(node: Node):
lucys_menu.MANAGER = self lucys_menu.MANAGER = self
node.add_child(lucys_menu) node.add_child(lucys_menu)
ingame = true ingame = true
self.allow_intrusive_bbcode = allow_intrusive_bbcode
lucys_menu.setup() lucys_menu.setup()
const save_keys = [
"do_punchback", "allow_bbcode",
"custom_server_name", "server_join_message",
"custom_color_enabled", "custom_color",
"log_messages", "custom_name",
"allow_intrusive_bbcode"
]
func load_settings(): func load_settings():
print("[LUCY] Loading settings") print("[LUCY] Loading settings")
var file = File.new() var file = File.new()
@ -242,16 +312,15 @@ func load_settings():
var result = parse.result var result = parse.result
# trigger setters # trigger setters
for key in result.keys(): for key in result.keys():
if key in SAVE_KEYS: self[key] = result[key] if key in save_keys: self[key] = result[key]
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:
if key in ["custom_color", "custom_text_color"]:
settings[key] = self[key].to_html()
else:
settings[key] = self[key] settings[key] = self[key]
var file = File.new() var file = File.new()

View File

@ -2,6 +2,6 @@
.vs/ .vs/
*.user *.user
/local /local
Makefile
bin/ bin/
obj/ obj/

View File

@ -14,4 +14,21 @@
<ItemGroup> <ItemGroup>
<None Include="manifest.json" CopyToOutputDirectory="PreserveNewest"/> <None Include="manifest.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(GDWeavePath)' != ''">
<PropertyGroup>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'">true</IsWindows>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">true</IsLinux>
</PropertyGroup>
<Exec
Command="xcopy /Y /I &quot;$(TargetDir)&quot; &quot;$(GDWeavePath)/mods/$(AssemblyName)&quot;"
Condition="'$(IsWindows)' == 'true'"
/>
<Exec
Command="cp -r $(TargetDir) '$(GDWeavePath)/mods/$(AssemblyName)/'"
Condition="'$(IsLinux)' == 'true'"
/>
</Target>
</Project> </Project>

View File

@ -13,6 +13,7 @@ public class Mod : IMod {
modInterface.Logger.Information("Lucy was here :3"); modInterface.Logger.Information("Lucy was here :3");
ModInterface = modInterface; ModInterface = modInterface;
modInterface.RegisterScriptMod(new LucysChatChanges()); modInterface.RegisterScriptMod(new LucysChatChanges());
modInterface.RegisterScriptMod(new LucysNetFixes());
modInterface.RegisterScriptMod(new LucyServerBrowserChanges()); modInterface.RegisterScriptMod(new LucyServerBrowserChanges());
modInterface.RegisterScriptMod(new LucyMainMenuChanges()); modInterface.RegisterScriptMod(new LucyMainMenuChanges());
} }
@ -214,7 +215,7 @@ public class LucysChatChanges : IScriptMod
CodeChange[] changes = { CodeChange[] changes = {
new CodeChange { new CodeChange {
name = "chat process intercept", name = "save lit text",
// color.to_html() // color.to_html()
// //
// END // END
@ -227,25 +228,83 @@ public class LucysChatChanges : IScriptMod
t => t.Type == TokenType.Newline, t => t.Type == TokenType.Newline,
t => t.Type == TokenType.Newline, t => t.Type == TokenType.Newline,
}, },
// $"/root/LucyLucysTools".process_message(text, chat_local, player, self) // var lit_text = text
// return
code_to_add = new Token[] { code_to_add = new Token[] {
new Token(TokenType.PrVar),
new IdentifierToken("lit_text"),
new Token(TokenType.OpAssign),
new IdentifierToken("text"),
new Token(TokenType.Newline, 1),
}
},
new CodeChange {
name = "chat bbcode",
// endcap + final_text + suffix
// END
multitoken_prefix = new Func<Token, bool>[] {
t => t is IdentifierToken {Name: "endcap"},
t => t.Type == TokenType.OpAdd,
t => t is IdentifierToken {Name: "final_text"},
t => t.Type == TokenType.OpAdd,
t => t is IdentifierToken {Name: "suffix"},
t => t.Type == TokenType.Newline,
},
// if $"/root/LucyLucysTools".INTERCEPT_SEND_MSG:
// var tmp = $"/root/LucyLucysTools".process_message(lit_text, final, prefix, suffix, endcap, final_color, spoken_text, chat_local, colon, self)
// if tmp[0]: return
// final_color = tmp[1]
// END
code_to_add = new Token[] {
new Token(TokenType.CfIf),
new Token(TokenType.Dollar),
new ConstantToken(new StringVariant("/root/LucyLucysTools")),
new Token(TokenType.Colon),
new Token(TokenType.Newline, 2),
new Token(TokenType.PrVar),
new IdentifierToken("tmp"),
new Token(TokenType.OpAssign),
new Token(TokenType.Dollar), new Token(TokenType.Dollar),
new ConstantToken(new StringVariant("/root/LucyLucysTools")), new ConstantToken(new StringVariant("/root/LucyLucysTools")),
new Token(TokenType.Period), new Token(TokenType.Period),
new IdentifierToken("process_message"), new IdentifierToken("process_message"),
new Token(TokenType.ParenthesisOpen), new Token(TokenType.ParenthesisOpen),
new IdentifierToken("text"), new IdentifierToken("lit_text"),
new Token(TokenType.Comma),
new IdentifierToken("final"),
new Token(TokenType.Comma),
new IdentifierToken("prefix"),
new Token(TokenType.Comma),
new IdentifierToken("suffix"),
new Token(TokenType.Comma),
new IdentifierToken("endcap"),
new Token(TokenType.Comma),
new IdentifierToken("spoken_text"),
new Token(TokenType.Comma), new Token(TokenType.Comma),
new IdentifierToken("chat_local"), new IdentifierToken("chat_local"),
new Token(TokenType.Comma), new Token(TokenType.Comma),
new IdentifierToken("player"), new IdentifierToken("colon"),
new Token(TokenType.Comma), new Token(TokenType.Comma),
new Token(TokenType.Self), new Token(TokenType.Self),
new Token(TokenType.ParenthesisClose), new Token(TokenType.ParenthesisClose),
new Token(TokenType.Newline, 1), new Token(TokenType.Newline, 2),
new Token(TokenType.CfIf),
new IdentifierToken("tmp"),
new Token(TokenType.BracketOpen),
new ConstantToken(new IntVariant(0)),
new Token(TokenType.BracketClose),
new Token(TokenType.Colon),
new Token(TokenType.CfReturn), new Token(TokenType.CfReturn),
new Token(TokenType.Newline, 2),
new IdentifierToken("final_color"),
new Token(TokenType.OpAssign),
new IdentifierToken("tmp"),
new Token(TokenType.BracketOpen),
new ConstantToken(new IntVariant(1)),
new Token(TokenType.BracketClose),
new Token(TokenType.Newline, 1), new Token(TokenType.Newline, 1),
} }
}, },
@ -278,3 +337,68 @@ public class LucysChatChanges : IScriptMod
} }
} }
public class LucysNetFixes : IScriptMod {
bool IScriptMod.ShouldRun(string path) => path == "res://Scenes/Singletons/SteamNetwork.gdc";
CodeChange[] changes = {
new CodeChange {
name = "read packet intercept",
// FLUSH_PACKET_INFORMATION[PACKET_SENDER] += 1
// END
multitoken_prefix = new Func<Token, bool>[] {
t => t is IdentifierToken {Name: "FLUSH_PACKET_INFORMATION"},
t => t.Type == TokenType.BracketOpen,
t => t is IdentifierToken {Name: "PACKET_SENDER"},
t => t.Type == TokenType.BracketClose,
t => t.Type == TokenType.OpAssignAdd,
t => t is ConstantToken {Value:IntVariant{Value: 1}},
t => t.Type == TokenType.Newline,
},
// if $"/root/LucyLucysTools".process_read(DATA, PACKET_SENDER, from_host): return
// END
code_to_add = new Token[] {
new Token(TokenType.CfIf),
new Token(TokenType.Dollar),
new ConstantToken(new StringVariant("/root/LucyLucysTools")),
new Token(TokenType.Period),
new IdentifierToken("process_read"),
new Token(TokenType.ParenthesisOpen),
new IdentifierToken("DATA"),
new Token(TokenType.Comma),
new IdentifierToken("PACKET_SENDER"),
new Token(TokenType.Comma),
new IdentifierToken("from_host"),
new Token(TokenType.ParenthesisClose),
new Token(TokenType.Colon),
new Token(TokenType.CfReturn),
new Token(TokenType.Newline, 2),
}
},
};
IEnumerable<Token> IScriptMod.Modify(string path, IEnumerable<Token> tokens)
{
var pending_changes = changes
.Select(c => (c, new MultiTokenWaiter(c.multitoken_prefix)))
.ToList();
// I'm sure there's a better way to do this
// with list comprehension stuff, but my
// C# is too rusty
foreach (var token in tokens) {
var had_change = false;
foreach (var (change, waiter) in pending_changes) {
if (waiter.Check(token)) {
Mod.ModInterface.Logger.Information($"Adding Lucy Network mod {change.name}");
yield return token;
foreach (var t in change.code_to_add) yield return t;
had_change = true;
break;
}
}
if (!had_change) yield return token;
}
}
}

View File

@ -1,6 +1,5 @@
{ {
"Id": "Lucy.LucysTools", "Id": "Lucy.LucysTools",
"AssemblyPath": "LucysTools.dll", "AssemblyPath": "LucysTools.dll",
"PackPath": "LucysTools.pck", "PackPath": "LucysTools.pck"
"Dependencies": [ "LucysLib" ]
} }

View File

@ -7,27 +7,22 @@ Client Features:
- Lets you clear gamechat - Lets you clear gamechat
- Allows custom name color (for all users) - Allows custom name color (for all users)
- Allows custom name BBCode (for compatible peers) - Allows custom name BBCode (for compatible peers)
- Allows custom text color (for compatible peers)
- Allows BBCode in chat (for compatible peers) - Allows BBCode in chat (for compatible peers)
Host Features: Host Features:
- Lets you set a message that will be sent when someone joins. - Lets you set a message that will be sent when someone joins.
- Lets you spawn rainclouds, voids, & meteors. - Lets you spawn rainclouds & meteors.
- As host 'raw' messages can be sent with a % prefix - If intrusive BBCode is enabled, as host 'raw' messages can be sent with a % prefix
- Lets you set a custom server name with BBCode (for compatible peers)
- Lets you set a custom lobby code
- Lets you update lobby name & code while running
Info for Modders: Info for Modders:
- Check out LucysLib (in progress)
- If you'd like to make things compatible, servers get a "bbcode_lobby_name" property, and messages have additional "bb_msg" and "bb_user" fields. DM me! - If you'd like to make things compatible, servers get a "bbcode_lobby_name" property, and messages have additional "bb_msg" and "bb_user" fields. DM me!
More coming soon! More coming soon!
Probably certainly full of bugs. Probably certainly full of bugs.
Compatibility: Compatibility:
- Works *only* with WEBFISHING 1.10 - Works *only* with WEBFISHING 1.09
- I haven't tested any other mods with this, but I'm happy to try to make things compatible, submit a bug report with the incompatible mod! (Only mods that have source available) - I haven't tested any other mods with this, but I'm happy to try to make things compatible, submit a bug report with the incompatible mod! (Only mods that have source available)
Bugs: Bugs:
- Make sure your versions of LucysTools & LucysLib are the latest release before submitting bug reports, please. - Make sure your version of LucysTools is the latest release before submitting bug reports, please.