0.7; LucysLib 0.1
This commit is contained in:
parent
fc710e0566
commit
7d889c84cd
@ -2,49 +2,72 @@ extends Control
|
||||
|
||||
var MANAGER
|
||||
|
||||
const LucysLib_t = preload("res://mods/LucysLib/main.gd")
|
||||
const BBCode_t = preload("res://mods/LucysLib/bbcode.gd")
|
||||
|
||||
func setup():
|
||||
get_node("%lucy_bbcode").pressed = MANAGER.allow_bbcode
|
||||
if MANAGER.DEBUG: print("[LUCYSTOOLS MENU] Setup...")
|
||||
get_node("%lucy_punchback").pressed = MANAGER.do_punchback
|
||||
get_node("%lucy_servername").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
|
||||
var srv_m_bb = MANAGER.bbcode_process(MANAGER.server_join_message, 512)
|
||||
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_intbbcode").pressed = MANAGER.allow_intrusive_bbcode
|
||||
var srv_m_bb: BBCode_t.BBCodeTag = MANAGER.LucysLib.BBCode.parse_bbcode_text(MANAGER.server_join_message)
|
||||
get_node("%lucy_servermsg_preview").bbcode_text = srv_m_bb.get_full(MANAGER.allowed_bb)
|
||||
get_node("%lucy_servermsg_preview2").bbcode_text = srv_m_bb.get_stripped()
|
||||
|
||||
get_node("%lucy_chatcolor_bool").pressed = MANAGER.custom_color_enabled
|
||||
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_bug_bb").pressed = MANAGER.bug_bbcode
|
||||
|
||||
get_node("%lucy_srv_bbcode").pressed = MANAGER.srv_bbcode
|
||||
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()
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
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):
|
||||
var result = MANAGER.bbcode_process(new_text, 512)
|
||||
if MANAGER.DEBUG: print("[LUCYSTOOLS MENU] Name text changed...")
|
||||
var result: BBCode_t.BBCodeTag = MANAGER.LucysLib.BBCode.parse_bbcode_text(new_text)
|
||||
|
||||
var lol_steam_username = Network.STEAM_USERNAME.replace("[", "").replace("]", "")
|
||||
var good = result.stripped == lol_steam_username
|
||||
get_node("%lucy_name_preview").bbcode_text = result.fin
|
||||
var net_name = Network.STEAM_USERNAME.replace("[", "").replace("]", "")
|
||||
var good = result.get_stripped() == net_name
|
||||
get_node("%lucy_name_preview").bbcode_text = result.get_full(MANAGER.allowed_bb)
|
||||
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 = new_text
|
||||
MANAGER.custom_name = new_text if good else ""
|
||||
|
||||
func _ready():
|
||||
print("[LUCY] Menu Ready")
|
||||
print("[LUCYSTOOLS] Menu Ready")
|
||||
|
||||
MANAGER = $"/root/LucyLucysTools"
|
||||
|
||||
@ -54,16 +77,16 @@ func _ready():
|
||||
|
||||
get_node("%lucy_raincloud").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_clearrain").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)
|
||||
get_node("%lucy_lobbyrefresh").disabled = not can_spawn
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventKey and event.scancode == KEY_F5 && event.pressed:
|
||||
visible = !visible
|
||||
print("[LUCY] Menu visble: ", visible)
|
||||
print("[LUCYSTOOLS] Menu visble: ", visible)
|
||||
MANAGER.lucys_menu_visible = visible
|
||||
|
||||
if event is InputEventKey and event.scancode == KEY_F6 && event.pressed:
|
||||
@ -74,7 +97,7 @@ func _input(event):
|
||||
var type = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "type")
|
||||
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}
|
||||
print("[LUCY] LOBBY ", lobby_dat)
|
||||
print("[LUCYSTOOLS] LOBBY ", lobby_dat)
|
||||
|
||||
func _on_lucy_bbcode_toggled(button_pressed):
|
||||
MANAGER.allow_bbcode = button_pressed
|
||||
@ -84,9 +107,9 @@ func _on_lucy_servername_text_changed(new_text):
|
||||
get_node("%lucy_servername_preview").bbcode_text = new_text
|
||||
MANAGER.custom_server_name = new_text
|
||||
func _on_lucy_servermsg_text_changed(new_text):
|
||||
var result = MANAGER.bbcode_process(new_text, 512)
|
||||
get_node("%lucy_servermsg_preview").bbcode_text = result.fin
|
||||
get_node("%lucy_servermsg_preview2").bbcode_text = result.stripped
|
||||
var srv_m_bb: BBCode_t.BBCodeTag = MANAGER.LucysLib.BBCode.parse_bbcode_text(new_text)
|
||||
get_node("%lucy_servermsg_preview").bbcode_text = srv_m_bb.get_full(MANAGER.allowed_bb)
|
||||
get_node("%lucy_servermsg_preview2").bbcode_text = srv_m_bb.get_stripped()
|
||||
MANAGER.server_join_message = new_text
|
||||
func _on_lucy_chatcolor_bool_toggled(button_pressed):
|
||||
MANAGER.custom_color_enabled = button_pressed
|
||||
@ -103,10 +126,12 @@ func _on_lucy_bug_bb_toggled(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():
|
||||
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
||||
print("[LUCY] Spawning raincloud")
|
||||
print("[LUCYSTOOLS] Spawning raincloud")
|
||||
var player = MANAGER.get_player()
|
||||
var pos = Vector3(player.global_transform.origin.x, 42, player.global_transform.origin.z)
|
||||
var zone = player.current_zone
|
||||
@ -115,7 +140,7 @@ func _on_lucy_raincloud_pressed():
|
||||
func _on_lucy_meteor_pressed():
|
||||
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
|
||||
print("[LUCY] Spawning meteor")
|
||||
print("[LUCYSTOOLS] Spawning meteor")
|
||||
var player_pos = MANAGER.get_player().global_transform.origin
|
||||
var dist = INF
|
||||
var point = null
|
||||
@ -130,7 +155,7 @@ func _on_lucy_meteor_pressed():
|
||||
|
||||
func _on_lucy_freezerain_pressed():
|
||||
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
||||
print("[LUCY] Freezing rain")
|
||||
print("[LUCYSTOOLS] Freezing rain")
|
||||
for cloud in get_tree().get_nodes_in_group("raincloud"):
|
||||
if cloud.controlled == true:
|
||||
cloud.speed = 0
|
||||
@ -138,7 +163,7 @@ func _on_lucy_freezerain_pressed():
|
||||
|
||||
func _on_lucy_clearrain_pressed():
|
||||
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
||||
print("[LUCY] Clearing rain")
|
||||
print("[LUCYSTOOLS] Clearing rain")
|
||||
for cloud in get_tree().get_nodes_in_group("raincloud"):
|
||||
cloud._deinstantiate(true)
|
||||
|
||||
@ -148,7 +173,26 @@ func _on_lucy_clearchat_pressed():
|
||||
|
||||
func _on_lucy_clearmeteor_pressed():
|
||||
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
||||
print("[LUCY] Clearing meteor")
|
||||
print("[LUCYSTOOLS] Clearing meteor")
|
||||
for meteor in get_tree().get_nodes_in_group("meteor"):
|
||||
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)
|
||||
|
@ -10,18 +10,18 @@ script = ExtResource( 1 )
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_bottom = 100.0
|
||||
margin_bottom = 150.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 793.0
|
||||
margin_bottom = 493.0
|
||||
margin_bottom = 543.0
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer"]
|
||||
margin_right = 786.0
|
||||
margin_bottom = 14.0
|
||||
text = "Lucy's Options 0.6.1 - F5 to Toggle Menu"
|
||||
text = "Lucy's Options 0.7.0 - F5 to Toggle Menu"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 18.0
|
||||
@ -32,104 +32,75 @@ margin_bottom = 22.0
|
||||
margin_top = 26.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 40.0
|
||||
text = "BBCode is only visible to LucysTools-compatible users, unless Bug BBCode is enabled"
|
||||
text = "BBCode is only visible to LucysTools-compatible users. Allowed BBCode tags:"
|
||||
|
||||
[node name="HFlowContainer" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
[node name="bbcode_tags" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 44.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 84.0
|
||||
margin_bottom = 44.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"]
|
||||
margin_top = 13.0
|
||||
margin_right = 89.0
|
||||
margin_bottom = 27.0
|
||||
text = "Allow BBCode"
|
||||
[node name="HSeparator2" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 48.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 52.0
|
||||
|
||||
[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 = 372.0
|
||||
margin_bottom = 27.0
|
||||
text = "Allow Intrusive BBCode (Client)"
|
||||
|
||||
[node name="lucy_intbbcode" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 376.0
|
||||
margin_right = 452.0
|
||||
margin_bottom = 40.0
|
||||
[node name="HFlowContainer" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 56.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 80.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label5" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer"]
|
||||
margin_left = 456.0
|
||||
margin_top = 13.0
|
||||
margin_right = 591.0
|
||||
margin_bottom = 27.0
|
||||
margin_top = 5.0
|
||||
margin_right = 135.0
|
||||
margin_bottom = 19.0
|
||||
text = "Punch back on Punch"
|
||||
|
||||
[node name="lucy_punchback" type="CheckButton" parent="PanelContainer/VBoxContainer/HFlowContainer"]
|
||||
[node name="lucy_punchback" type="CheckBox" parent="PanelContainer/VBoxContainer/HFlowContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 595.0
|
||||
margin_right = 671.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="HFlowContainer3" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 88.0
|
||||
margin_right = 786.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!"
|
||||
margin_left = 139.0
|
||||
margin_right = 163.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 132.0
|
||||
margin_top = 84.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 136.0
|
||||
margin_bottom = 88.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"]
|
||||
margin_top = 140.0
|
||||
margin_top = 120.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 154.0
|
||||
text = "Custom Server Name - Only shown for LucysTools users (base game field for others)"
|
||||
margin_bottom = 134.0
|
||||
text = "Custom Server Name - Shown without BBCode for normal users"
|
||||
|
||||
[node name="HFlowContainer4" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 158.0
|
||||
margin_top = 138.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 182.0
|
||||
margin_bottom = 162.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="lucy_servername" type="LineEdit" parent="PanelContainer/VBoxContainer/HFlowContainer4"]
|
||||
@ -141,9 +112,9 @@ expand_to_text_length = true
|
||||
placeholder_text = "Name"
|
||||
|
||||
[node name="HFlowContainer6" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 186.0
|
||||
margin_top = 166.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 200.0
|
||||
margin_bottom = 180.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer6"]
|
||||
@ -163,20 +134,20 @@ text = "'s Lobby"
|
||||
scroll_active = false
|
||||
|
||||
[node name="HSeparator4" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 204.0
|
||||
margin_top = 184.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 208.0
|
||||
margin_bottom = 188.0
|
||||
|
||||
[node name="Label3" type="Label" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 212.0
|
||||
margin_top = 192.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 226.0
|
||||
text = "Server Join Message - Will be shown without BBCode for people without LucysTools (without bug enabled)"
|
||||
margin_bottom = 206.0
|
||||
text = "Server Join Message - Will be shown without BBCode for people without LucysTools"
|
||||
|
||||
[node name="HFlowContainer5" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 230.0
|
||||
margin_top = 210.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 254.0
|
||||
margin_bottom = 234.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="lucy_servermsg" type="LineEdit" parent="PanelContainer/VBoxContainer/HFlowContainer5"]
|
||||
@ -188,9 +159,9 @@ expand_to_text_length = true
|
||||
placeholder_text = "Message"
|
||||
|
||||
[node name="HFlowContainer7" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 258.0
|
||||
margin_top = 238.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 272.0
|
||||
margin_bottom = 252.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer7"]
|
||||
@ -208,9 +179,9 @@ bbcode_enabled = true
|
||||
scroll_active = false
|
||||
|
||||
[node name="HFlowContainer10" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 276.0
|
||||
margin_top = 256.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 290.0
|
||||
margin_bottom = 270.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer10"]
|
||||
@ -228,14 +199,14 @@ bbcode_enabled = true
|
||||
scroll_active = false
|
||||
|
||||
[node name="HSeparator5" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 294.0
|
||||
margin_top = 274.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 298.0
|
||||
margin_bottom = 278.0
|
||||
|
||||
[node name="HFlowContainer8" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 302.0
|
||||
margin_top = 282.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 326.0
|
||||
margin_bottom = 306.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer8"]
|
||||
@ -262,41 +233,41 @@ 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_right = 475.0
|
||||
margin_bottom = 19.0
|
||||
text = " Chat Text Color (LucysTools or bug)"
|
||||
text = " Chat Text Color (LucysTools)"
|
||||
|
||||
[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_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 = 597.0
|
||||
margin_right = 639.0
|
||||
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"]
|
||||
margin_top = 330.0
|
||||
margin_top = 310.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 344.0
|
||||
margin_bottom = 324.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
hint_tooltip = "Must match Steam username"
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer9"]
|
||||
margin_right = 392.0
|
||||
margin_right = 348.0
|
||||
margin_bottom = 14.0
|
||||
text = "Custom Name - Must match Steam Name (LucysTools or bug)"
|
||||
text = "Custom Name - Must match Steam Name (LucysTools)"
|
||||
|
||||
[node name="lucy_namegood" type="RichTextLabel" parent="PanelContainer/VBoxContainer/HFlowContainer9"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 396.0
|
||||
margin_right = 446.0
|
||||
margin_left = 352.0
|
||||
margin_right = 402.0
|
||||
margin_bottom = 14.0
|
||||
rect_min_size = Vector2( 50, 0 )
|
||||
bbcode_enabled = true
|
||||
@ -306,17 +277,17 @@ scroll_active = false
|
||||
|
||||
[node name="lucy_name" type="LineEdit" parent="PanelContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 348.0
|
||||
margin_top = 328.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 372.0
|
||||
margin_bottom = 352.0
|
||||
expand_to_text_length = true
|
||||
placeholder_text = "Name"
|
||||
|
||||
[node name="lucy_name_preview" type="RichTextLabel" parent="PanelContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 376.0
|
||||
margin_top = 356.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 391.0
|
||||
margin_bottom = 371.0
|
||||
rect_min_size = Vector2( 0, 15 )
|
||||
size_flags_horizontal = 3
|
||||
bbcode_enabled = true
|
||||
@ -325,14 +296,14 @@ text = "If you see this, modify your custom name"
|
||||
scroll_active = false
|
||||
|
||||
[node name="HSeparator6" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 395.0
|
||||
margin_top = 375.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 399.0
|
||||
margin_bottom = 379.0
|
||||
|
||||
[node name="HFlowContainer2" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 403.0
|
||||
margin_top = 383.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 423.0
|
||||
margin_bottom = 403.0
|
||||
|
||||
[node name="lucy_clearchat" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
margin_right = 76.0
|
||||
@ -340,46 +311,57 @@ margin_bottom = 20.0
|
||||
hint_tooltip = "Clears game chat (for you only)"
|
||||
text = "Clear Chat"
|
||||
|
||||
[node name="lucy_raincloud" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
[node name="lucy_lobbyrefresh" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 80.0
|
||||
margin_right = 198.0
|
||||
margin_right = 180.0
|
||||
margin_bottom = 20.0
|
||||
text = "Spawn Raincloud"
|
||||
text = "Update Lobby"
|
||||
|
||||
[node name="lucy_raincloud" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 184.0
|
||||
margin_right = 267.0
|
||||
margin_bottom = 20.0
|
||||
text = "Spawn Rain"
|
||||
|
||||
[node name="lucy_meteor" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 202.0
|
||||
margin_right = 304.0
|
||||
margin_left = 271.0
|
||||
margin_right = 373.0
|
||||
margin_bottom = 20.0
|
||||
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"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 308.0
|
||||
margin_right = 394.0
|
||||
margin_left = 465.0
|
||||
margin_right = 551.0
|
||||
margin_bottom = 20.0
|
||||
text = "Freeze Rain"
|
||||
|
||||
[node name="lucy_clearrain" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 398.0
|
||||
margin_right = 473.0
|
||||
margin_left = 555.0
|
||||
margin_right = 630.0
|
||||
margin_bottom = 20.0
|
||||
text = "Clear Rain"
|
||||
|
||||
[node name="lucy_clearmeteor" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 477.0
|
||||
margin_right = 571.0
|
||||
margin_left = 634.0
|
||||
margin_right = 728.0
|
||||
margin_bottom = 20.0
|
||||
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/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/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/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"]
|
||||
@ -388,8 +370,10 @@ text = "Clear Meteor"
|
||||
[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="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_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_clearrain" to="." method="_on_lucy_clearrain_pressed"]
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_clearmeteor" to="." method="_on_lucy_clearmeteor_pressed"]
|
||||
|
@ -1,495 +1,200 @@
|
||||
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")
|
||||
|
||||
var lucys_menu = null
|
||||
onready var root = get_tree().root
|
||||
|
||||
var INCERCEPT_MSG: bool = false
|
||||
var INCERCEPT_SEND_MSG: bool = false
|
||||
var custom_name_enabled: bool = false
|
||||
var ingame = false
|
||||
|
||||
# config options
|
||||
var do_punchback: bool = false
|
||||
var allow_bbcode: bool = false
|
||||
var custom_server_name: String = "" setget set_server_name
|
||||
var server_join_message: String = "[color=#5BCEFA]TRAN[/color][color=#F5A9B8]S RIG[/color][color=#ffffff]HTS![/color]" setget set_join_message
|
||||
|
||||
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 custom_name_enabled: bool = false
|
||||
var real_custom_name: String = ""
|
||||
var custom_name: String = "" setget set_custom_name
|
||||
|
||||
var allow_intrusive_bbcode: bool = false setget set_allow_intrusive_bbcode
|
||||
var srv_bbcode: bool = false setget set_srv_bbcode
|
||||
|
||||
var log_messages: bool = false
|
||||
|
||||
var DEBUG: bool = false
|
||||
|
||||
var lucys_menu_visible: bool = true
|
||||
|
||||
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 = ""
|
||||
|
||||
var bug_bbcode: bool = false
|
||||
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 set_custom_name(val):
|
||||
custom_name = val
|
||||
var bb = bbcode_process(val, 256)
|
||||
real_custom_name = bb.fin
|
||||
|
||||
func set_allow_intrusive_bbcode(bbcode):
|
||||
allow_intrusive_bbcode = bbcode
|
||||
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_srv_bbcode(bbcode):
|
||||
srv_bbcode = bbcode
|
||||
if Network.GAME_MASTER: send_lucy_sync()
|
||||
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
|
||||
|
||||
var allowed_tags: Array = ["b", "i", "u", "s", "color"]
|
||||
var escape_invalid: bool = true
|
||||
var strip_disallowed: bool = true
|
||||
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 to_add_full: String
|
||||
var to_add_stripped: 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)
|
||||
|
||||
bbcode_matcher = RegEx.new()
|
||||
bbcode_matcher.compile("(.*?)(\\[(\\w+)([^\\[\\]]*?)\\]|\\[/(\\w+)\\])")
|
||||
|
||||
var linear_matches: Array = bbcode_matcher.search_all(text)
|
||||
if linear_matches.empty():
|
||||
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:
|
||||
to_add_full = "["+tag+junk+"]" + inner_full + before.replace('[','[lb]') + "[/"+tag+"]"
|
||||
to_add_stripped = inner_stripped + before.replace('[','[lb]')
|
||||
else:
|
||||
to_add_full = inner_full + before.replace('[','[lb]')
|
||||
to_add_stripped = inner_stripped + before.replace('[','[lb]')
|
||||
# check length - this sucks but whatever
|
||||
# just use the stripped version if it's too long.
|
||||
# whatever
|
||||
if prev_full.length() + to_add_full.length() > max_len:
|
||||
to_add_full = to_add_stripped
|
||||
full_text_stack.push_back(prev_full + to_add_full)
|
||||
stripped_text_stack.push_back(prev_stripped + to_add_stripped)
|
||||
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
|
||||
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:
|
||||
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
|
||||
return color
|
||||
|
||||
func safe_message(user_id, color, boring_msg, local, lucy_user, lucy_msg, require_name):
|
||||
var msg: String = boring_msg
|
||||
if lucy_msg != "": msg = lucy_msg
|
||||
var net_name: String = Network._get_username_from_id(user_id).replace('[','').replace(']','')
|
||||
var name: String = net_name if lucy_user == "" else lucy_user
|
||||
|
||||
if OptionsMenu.chat_filter:
|
||||
msg = SwearFilter._filter_string(msg)
|
||||
|
||||
msg = msg.replace("%u", "[color=#" + str(color) + "]" + name + "[/color]")
|
||||
if DEBUG: print("[MSG B4 PROC] ", msg)
|
||||
|
||||
# process message
|
||||
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
|
||||
func process_message(lit_text, final, prefix, suffix, endcap, spoken_text, local, colon, playerhud):
|
||||
if log_messages:
|
||||
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("process_message ", thing)
|
||||
|
||||
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)
|
||||
# we sent the message ourself
|
||||
return [true]
|
||||
|
||||
var msg = final
|
||||
var boring_msg = final
|
||||
var speak = spoken_text
|
||||
if bug_bbcode:
|
||||
print("Using color field...")
|
||||
var p = bbcode_process(lit_text, 512)
|
||||
var name = real_custom_name if custom_name_enabled else Network.STEAM_USERNAME
|
||||
var name_color = get_user_color().to_html()
|
||||
var text_color = "ffffeed5" if not custom_text_color_enabled else custom_text_color.to_html()
|
||||
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 speak != "" 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 = []
|
||||
|
||||
var i_hate_regex: RegEx = null
|
||||
func lucy_send_message(message, boring_msg, local = false, evil_color = ""):
|
||||
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)
|
||||
# intercept player message send
|
||||
# we just take over - replicate as
|
||||
# much as i can be bothered to
|
||||
func process_message(text: String, local: bool, player, playerhud):
|
||||
if DEBUG:
|
||||
var thing = {"text":text,"local":local,"player":player,"playerhud":playerhud,"custom_name":custom_name}
|
||||
print("[LUCYSTOOLS process_message] ", thing)
|
||||
# is this a host message? (no username)
|
||||
if text.begins_with("%") and (Network.GAME_MASTER or Network.PLAYING_OFFLINE):
|
||||
text = text.trim_prefix("%")
|
||||
var msg := LucysLib.BBCode.parse_bbcode_text(text)
|
||||
LucysLib.send_message(msg, Color.aqua, false, null, "peers")
|
||||
return
|
||||
|
||||
var msg_pos = Network.MESSAGE_ORIGIN.round()
|
||||
# i don't know why the wag stuff toggles multiple times
|
||||
# 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 ")
|
||||
|
||||
var lucy_user = real_custom_name if custom_name_enabled and not bug_bbcode else ""
|
||||
var color = get_user_color().to_html() if not bug_bbcode else evil_color
|
||||
# process message into bbcode nodes
|
||||
var msg := LucysLib.BBCode.parse_bbcode_text(text)
|
||||
|
||||
# idfk
|
||||
# the first thing in a color string must be a valid html color,
|
||||
# followed optionally by a ] (if people are using bug bbcode)
|
||||
if not i_hate_regex:
|
||||
i_hate_regex = RegEx.new()
|
||||
i_hate_regex.compile("^([a-zA-Z0-9]*)(\\]?)(.*)$")
|
||||
var rmatch: RegExMatch = i_hate_regex.search(color)
|
||||
var col: Color = rmatch.get_string(1)
|
||||
var paren = rmatch.get_string(2)
|
||||
var rest = rmatch.get_string(3)
|
||||
if paren != "]" and rest != "": paren = "]"
|
||||
var idfk = 490 - boring_msg.length() - Network.STEAM_USERNAME.length()
|
||||
var ver_rest = bbcode_process(rest, idfk)
|
||||
color = col.to_html() + paren + ver_rest.fin.left(idfk)
|
||||
# clamp transparency
|
||||
if not (Network.GAME_MASTER or Network.PLAYING_OFFLINE):
|
||||
LucysLib.BBCode.clamp_alpha(msg, 0.7)
|
||||
|
||||
safe_message(Network.STEAM_ID, color, boring_msg, local, lucy_user, message, false)
|
||||
Network._send_P2P_Packet(
|
||||
{"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
|
||||
if custom_text_color_enabled:
|
||||
var col_tag: BBCode_t.BBCodeColorTag = BBCode_t.tag_creator(BBCode_t.TAG_TYPE.color, "")
|
||||
col_tag.color = custom_text_color
|
||||
col_tag.inner = [msg]
|
||||
msg = col_tag
|
||||
|
||||
# prefix endcap suffix stuff
|
||||
if colon:
|
||||
msg.inner.push_front("%u: ")
|
||||
else:
|
||||
msg.inner.push_front("(%u ")
|
||||
msg.inner.push_back(")")
|
||||
|
||||
var name := LucysLib.BBCode.parse_bbcode_text(custom_name) if custom_name_enabled else null
|
||||
if DEBUG:
|
||||
print("[LUCYSTOOLS process_message] ", {"name":name,"msg":msg})
|
||||
|
||||
LucysLib.send_message(msg, get_user_color(), local, name, "peers")
|
||||
var spoken_text := spoken_msg.get_stripped()
|
||||
if colon and spoken_text != "": playerhud.emit_signal("_message_sent", spoken_text)
|
||||
|
||||
# drunk processing. ouch this sucks
|
||||
# not quite the same as vanilla
|
||||
# if people want drunk text that
|
||||
# works better. i will but. ugh
|
||||
var line: String = ""
|
||||
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:
|
||||
drunk_text_add(msg.inner[index], drunk_chance, drunk_max, do_hicc)
|
||||
else:
|
||||
var lines = msg.inner[index].split(" ")
|
||||
var new: String = ""
|
||||
var linei: int = 0
|
||||
for line in lines:
|
||||
for i in drunk_max:
|
||||
if randf() >= drunk_chance or line == "": break
|
||||
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_read(DATA, PACKET_SENDER, from_host) -> bool:
|
||||
match DATA["type"]:
|
||||
"lucy_packet":
|
||||
print("[LUCY PACKET]")
|
||||
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
|
||||
|
||||
"message":
|
||||
var has_bb = true
|
||||
if not Network._validate_packet_information(DATA,
|
||||
["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]):
|
||||
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 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_color: String = DATA["color"]
|
||||
var user_message: String = DATA["message"]
|
||||
|
||||
# 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"]:
|
||||
safe_message(user_id, user_color, user_message, false, bb_user, bb_msg, not from_host)
|
||||
else :
|
||||
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 dist < 25.0: safe_message(user_id, user_color, user_message, true, bb_user, bb_msg, not from_host)
|
||||
|
||||
# don't process it again!
|
||||
return true
|
||||
|
||||
# lucy punchback :3
|
||||
"player_punch":
|
||||
if not DATA.has("nya"): punched(PACKET_SENDER, DATA["punch_type"])
|
||||
# still get punched!
|
||||
return false
|
||||
|
||||
# fall through to default code
|
||||
func process_packet_player_punch(DATA, PACKET_SENDER, from_host) -> bool:
|
||||
# lucy punchback :3
|
||||
if not DATA.has("nya"): punched(PACKET_SENDER, DATA["punch_type"])
|
||||
# still get punched!
|
||||
return false
|
||||
|
||||
func bbcode_changes():
|
||||
if allow_intrusive_bbcode and srv_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 _ready():
|
||||
print("[LUCY] Loaded LucysTools 0.6.1")
|
||||
print("[LUCY] Loaded LucysTools 0.7.0")
|
||||
LucysLib = $"/root/LucysLib"
|
||||
load_settings()
|
||||
root.connect("child_entered_tree", self, "_on_enter")
|
||||
Network.connect("_new_player_join", self, "new_player")
|
||||
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):
|
||||
if connect != 1: return
|
||||
|
||||
if custom_server_name != "":
|
||||
Steam.setLobbyData(lobby_id, "bbcode_lobby_name", custom_server_name)
|
||||
|
||||
func send_lucy_sync(to = "peers"):
|
||||
if not Network.GAME_MASTER: return
|
||||
Network._send_P2P_Packet({"type": "lucy_packet", "srv_bbcode": srv_bbcode}, to, Network.CHANNELS.GAME_STATE)
|
||||
var bb_name := LucysLib.BBCode.parse_bbcode_text(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())
|
||||
if custom_lobbycode != "":
|
||||
Steam.setLobbyData(lobby_id, "code", custom_lobbycode)
|
||||
Network.LOBBY_CODE = custom_lobbycode
|
||||
|
||||
func get_player() -> Actor:
|
||||
for p in get_tree().get_nodes_in_group("player"):
|
||||
@ -502,26 +207,19 @@ func punched(puncher_id, type):
|
||||
if not do_punchback: return
|
||||
if puncher_id == 0 or puncher_id == Network.STEAM_ID: return
|
||||
print("[LUCY] punching back...")
|
||||
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)
|
||||
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)
|
||||
|
||||
func new_player(id):
|
||||
print("[LUCY] new player!")
|
||||
if server_join_message.empty() or not Network.GAME_MASTER: return
|
||||
print("[LUCY] sending join message")
|
||||
var bb_msg = bbcode_process(server_join_message, 512)
|
||||
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))
|
||||
var bb_msg := LucysLib.BBCode.parse_bbcode_text(server_join_message)
|
||||
LucysLib.send_message(bb_msg, Color.aqua, false, null, "peers")
|
||||
|
||||
func _on_enter(node: Node):
|
||||
if DEBUG: print("[LUCY] INSTANCING MENU")
|
||||
if node.name == "main_menu":
|
||||
lucys_menu = LUCYS_MENU_SCENE.instance()
|
||||
lucys_menu.MANAGER = self
|
||||
@ -533,22 +231,8 @@ func _on_enter(node: Node):
|
||||
lucys_menu.MANAGER = self
|
||||
node.add_child(lucys_menu)
|
||||
ingame = true
|
||||
self.allow_intrusive_bbcode = allow_intrusive_bbcode
|
||||
if not Network.GAME_MASTER and not Network.PLAYING_OFFLINE:
|
||||
self.srv_bbcode = false
|
||||
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", "DEBUG",
|
||||
"bug_bbcode", "custom_text_color",
|
||||
"custom_text_color_enabled",
|
||||
"lucys_menu_visible"
|
||||
]
|
||||
|
||||
func load_settings():
|
||||
print("[LUCY] Loading settings")
|
||||
var file = File.new()
|
||||
@ -558,13 +242,13 @@ func load_settings():
|
||||
var result = parse.result
|
||||
# trigger setters
|
||||
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():
|
||||
print("[LUCY] Saving 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:
|
||||
|
2
LucysTools/.gitignore
vendored
2
LucysTools/.gitignore
vendored
@ -2,6 +2,6 @@
|
||||
.vs/
|
||||
*.user
|
||||
/local
|
||||
|
||||
Makefile
|
||||
bin/
|
||||
obj/
|
||||
|
@ -14,21 +14,4 @@
|
||||
<ItemGroup>
|
||||
<None Include="manifest.json" CopyToOutputDirectory="PreserveNewest"/>
|
||||
</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 "$(TargetDir)" "$(GDWeavePath)/mods/$(AssemblyName)""
|
||||
Condition="'$(IsWindows)' == 'true'"
|
||||
/>
|
||||
|
||||
<Exec
|
||||
Command="cp -r $(TargetDir) '$(GDWeavePath)/mods/$(AssemblyName)/'"
|
||||
Condition="'$(IsLinux)' == 'true'"
|
||||
/>
|
||||
</Target>
|
||||
</Project>
|
||||
|
@ -13,7 +13,6 @@ public class Mod : IMod {
|
||||
modInterface.Logger.Information("Lucy was here :3");
|
||||
ModInterface = modInterface;
|
||||
modInterface.RegisterScriptMod(new LucysChatChanges());
|
||||
modInterface.RegisterScriptMod(new LucysNetFixes());
|
||||
modInterface.RegisterScriptMod(new LucyServerBrowserChanges());
|
||||
modInterface.RegisterScriptMod(new LucyMainMenuChanges());
|
||||
}
|
||||
@ -215,7 +214,7 @@ public class LucysChatChanges : IScriptMod
|
||||
|
||||
CodeChange[] changes = {
|
||||
new CodeChange {
|
||||
name = "save lit text",
|
||||
name = "chat process intercept",
|
||||
// color.to_html()
|
||||
//
|
||||
// END
|
||||
@ -228,83 +227,25 @@ public class LucysChatChanges : IScriptMod
|
||||
t => t.Type == TokenType.Newline,
|
||||
t => t.Type == TokenType.Newline,
|
||||
},
|
||||
// var lit_text = text
|
||||
// $"/root/LucyLucysTools".process_message(text, chat_local, player, self)
|
||||
// return
|
||||
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 ConstantToken(new StringVariant("/root/LucyLucysTools")),
|
||||
new Token(TokenType.Period),
|
||||
new IdentifierToken("process_message"),
|
||||
new Token(TokenType.ParenthesisOpen),
|
||||
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 IdentifierToken("text"),
|
||||
new Token(TokenType.Comma),
|
||||
new IdentifierToken("chat_local"),
|
||||
new Token(TokenType.Comma),
|
||||
new IdentifierToken("colon"),
|
||||
new IdentifierToken("player"),
|
||||
new Token(TokenType.Comma),
|
||||
new Token(TokenType.Self),
|
||||
new Token(TokenType.ParenthesisClose),
|
||||
new Token(TokenType.Newline, 2),
|
||||
new Token(TokenType.Newline, 1),
|
||||
|
||||
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.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),
|
||||
}
|
||||
},
|
||||
@ -337,68 +278,3 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"Id": "Lucy.LucysTools",
|
||||
"AssemblyPath": "LucysTools.dll",
|
||||
"PackPath": "LucysTools.pck"
|
||||
"PackPath": "LucysTools.pck",
|
||||
"Dependencies": [ "LucysLib" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user