2024-10-30 21:18:01 -05:00
|
|
|
extends Control
|
|
|
|
|
2024-11-05 17:55:16 -06:00
|
|
|
var MANAGER
|
2024-10-30 21:18:01 -05:00
|
|
|
|
2024-11-13 18:34:53 -06:00
|
|
|
const LucysLib_t = preload("res://mods/LucysLib/main.gd")
|
|
|
|
const BBCode_t = preload("res://mods/LucysLib/bbcode.gd")
|
|
|
|
|
2024-11-05 17:55:16 -06:00
|
|
|
func setup():
|
2024-11-13 18:34:53 -06:00
|
|
|
if MANAGER.DEBUG: print("[LUCYSTOOLS MENU] Setup...")
|
2024-11-05 17:55:16 -06:00
|
|
|
get_node("%lucy_punchback").pressed = MANAGER.do_punchback
|
|
|
|
get_node("%lucy_servername").text = MANAGER.custom_server_name
|
2024-11-07 01:05:45 -06:00
|
|
|
get_node("%lucy_servername_preview").bbcode_text = MANAGER.custom_server_name
|
2024-11-05 17:55:16 -06:00
|
|
|
get_node("%lucy_servermsg").text = MANAGER.server_join_message
|
2024-11-13 18:34:53 -06:00
|
|
|
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()
|
2024-11-05 17:55:16 -06:00
|
|
|
|
|
|
|
get_node("%lucy_chatcolor_bool").pressed = MANAGER.custom_color_enabled
|
|
|
|
get_node("%lucy_chatcolor").color = Color(MANAGER.custom_color)
|
2024-11-08 03:54:34 -06:00
|
|
|
get_node("%lucy_chatcolor_bool2").pressed = MANAGER.custom_text_color_enabled
|
|
|
|
get_node("%lucy_chatcolor2").color = Color(MANAGER.custom_text_color)
|
2024-11-05 17:55:16 -06:00
|
|
|
|
2024-11-13 18:34:53 -06:00
|
|
|
get_node("%lucy_lobbycode").text = MANAGER.custom_lobbycode
|
2024-11-03 23:23:04 -06:00
|
|
|
|
2024-11-13 18:34:53 -06:00
|
|
|
get_node("%lucy_name").text = MANAGER.custom_name
|
2024-11-08 03:54:34 -06:00
|
|
|
|
2024-11-13 18:34:53 -06:00
|
|
|
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)
|
2024-11-08 03:54:34 -06:00
|
|
|
|
2024-11-02 18:49:03 -05:00
|
|
|
update()
|
|
|
|
|
|
|
|
func update():
|
2024-11-13 18:34:53 -06:00
|
|
|
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))
|
2024-11-05 17:55:16 -06:00
|
|
|
_on_lucy_name_text_changed(MANAGER.custom_name)
|
2024-11-13 18:34:53 -06:00
|
|
|
|
|
|
|
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
|
2024-11-05 17:55:16 -06:00
|
|
|
|
|
|
|
func _on_lucy_name_text_changed(new_text):
|
2024-11-13 18:34:53 -06:00
|
|
|
if MANAGER.DEBUG: print("[LUCYSTOOLS MENU] Name text changed...")
|
|
|
|
var result: BBCode_t.BBCodeTag = MANAGER.LucysLib.BBCode.parse_bbcode_text(new_text)
|
2024-11-05 17:55:16 -06:00
|
|
|
|
2024-11-13 18:34:53 -06:00
|
|
|
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)
|
2024-11-05 17:55:16 -06:00
|
|
|
get_node("%lucy_namegood").bbcode_text = "[color=green]Good[/color]" if good else "[color=red]Bad[/color]"
|
|
|
|
|
|
|
|
MANAGER.custom_name_enabled = good
|
2024-11-13 18:34:53 -06:00
|
|
|
MANAGER.custom_name = new_text if good else ""
|
2024-10-30 21:18:01 -05:00
|
|
|
|
|
|
|
func _ready():
|
2024-11-13 18:34:53 -06:00
|
|
|
print("[LUCYSTOOLS] Menu Ready")
|
2024-11-02 18:49:03 -05:00
|
|
|
|
2024-11-05 17:55:16 -06:00
|
|
|
MANAGER = $"/root/LucyLucysTools"
|
|
|
|
|
2024-11-07 01:05:45 -06:00
|
|
|
visible = MANAGER.lucys_menu_visible
|
|
|
|
|
2024-11-07 14:27:55 -06:00
|
|
|
var can_spawn = (Network.GAME_MASTER or Network.PLAYING_OFFLINE) and MANAGER.ingame
|
|
|
|
|
|
|
|
get_node("%lucy_raincloud").disabled = not can_spawn
|
|
|
|
get_node("%lucy_meteor").disabled = not can_spawn
|
2024-11-13 18:34:53 -06:00
|
|
|
get_node("%lucy_void").disabled = not can_spawn
|
2024-11-07 14:27:55 -06:00
|
|
|
get_node("%lucy_freezerain").disabled = not can_spawn
|
|
|
|
get_node("%lucy_clearrain").disabled = not can_spawn
|
|
|
|
get_node("%lucy_clearmeteor").disabled = not can_spawn
|
2024-11-13 18:34:53 -06:00
|
|
|
get_node("%lucy_lobbyrefresh").disabled = not can_spawn
|
2024-10-30 21:18:01 -05:00
|
|
|
|
|
|
|
func _input(event):
|
|
|
|
if event is InputEventKey and event.scancode == KEY_F5 && event.pressed:
|
|
|
|
visible = !visible
|
2024-11-13 18:34:53 -06:00
|
|
|
print("[LUCYSTOOLS] Menu visble: ", visible)
|
2024-11-07 01:05:45 -06:00
|
|
|
MANAGER.lucys_menu_visible = visible
|
2024-10-30 21:18:01 -05:00
|
|
|
|
|
|
|
if event is InputEventKey and event.scancode == KEY_F6 && event.pressed:
|
|
|
|
var name = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "name")
|
2024-11-07 01:05:45 -06:00
|
|
|
var lname = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "lobby_name")
|
2024-10-30 21:18:01 -05:00
|
|
|
var nm = Steam.getNumLobbyMembers(Network.STEAM_LOBBY_ID)
|
|
|
|
var code = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "code")
|
|
|
|
var type = Steam.getLobbyData(Network.STEAM_LOBBY_ID, "type")
|
2024-11-07 01:05:45 -06:00
|
|
|
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}
|
2024-11-13 18:34:53 -06:00
|
|
|
print("[LUCYSTOOLS] LOBBY ", lobby_dat)
|
2024-10-30 21:18:01 -05:00
|
|
|
|
|
|
|
func _on_lucy_bbcode_toggled(button_pressed):
|
|
|
|
MANAGER.allow_bbcode = button_pressed
|
|
|
|
func _on_lucy_punchback_toggled(button_pressed):
|
|
|
|
MANAGER.do_punchback = button_pressed
|
|
|
|
func _on_lucy_servername_text_changed(new_text):
|
2024-11-07 01:05:45 -06:00
|
|
|
get_node("%lucy_servername_preview").bbcode_text = new_text
|
2024-10-30 21:18:01 -05:00
|
|
|
MANAGER.custom_server_name = new_text
|
|
|
|
func _on_lucy_servermsg_text_changed(new_text):
|
2024-11-13 18:34:53 -06:00
|
|
|
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()
|
2024-10-30 21:18:01 -05:00
|
|
|
MANAGER.server_join_message = new_text
|
2024-11-03 23:23:04 -06:00
|
|
|
func _on_lucy_chatcolor_bool_toggled(button_pressed):
|
|
|
|
MANAGER.custom_color_enabled = button_pressed
|
|
|
|
func _on_lucy_chatcolor_color_changed(color):
|
|
|
|
MANAGER.custom_color = color
|
2024-11-08 03:54:34 -06:00
|
|
|
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
|
2024-11-05 17:55:16 -06:00
|
|
|
func _on_lucy_intbbcode_toggled(button_pressed):
|
|
|
|
MANAGER.allow_intrusive_bbcode = button_pressed
|
2024-11-08 03:54:34 -06:00
|
|
|
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
|
2024-11-13 18:34:53 -06:00
|
|
|
func _on_lucy_lobbycode_text_changed(new_text):
|
|
|
|
MANAGER.custom_lobbycode = new_text
|
2024-10-30 21:18:01 -05:00
|
|
|
|
|
|
|
func _on_lucy_raincloud_pressed():
|
2024-11-08 03:54:34 -06:00
|
|
|
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
2024-11-13 18:34:53 -06:00
|
|
|
print("[LUCYSTOOLS] Spawning raincloud")
|
2024-10-30 21:18:01 -05:00
|
|
|
var player = MANAGER.get_player()
|
|
|
|
var pos = Vector3(player.global_transform.origin.x, 42, player.global_transform.origin.z)
|
|
|
|
var zone = player.current_zone
|
|
|
|
Network._sync_create_actor("raincloud", pos, zone, - 1, Network.STEAM_ID)
|
|
|
|
|
|
|
|
func _on_lucy_meteor_pressed():
|
2024-11-08 03:54:34 -06:00
|
|
|
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
2024-11-03 23:23:04 -06:00
|
|
|
if get_tree().get_nodes_in_group("meteor").size() > 10: return
|
2024-11-13 18:34:53 -06:00
|
|
|
print("[LUCYSTOOLS] Spawning meteor")
|
2024-10-30 21:18:01 -05:00
|
|
|
var player_pos = MANAGER.get_player().global_transform.origin
|
|
|
|
var dist = INF
|
|
|
|
var point = null
|
|
|
|
for n in get_tree().get_nodes_in_group("fish_spawn"):
|
|
|
|
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("fish_spawn_alien", pos, zone, - 1, Network.STEAM_ID)
|
|
|
|
|
|
|
|
func _on_lucy_freezerain_pressed():
|
2024-11-08 03:54:34 -06:00
|
|
|
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
2024-11-13 18:34:53 -06:00
|
|
|
print("[LUCYSTOOLS] Freezing rain")
|
2024-10-30 21:18:01 -05:00
|
|
|
for cloud in get_tree().get_nodes_in_group("raincloud"):
|
|
|
|
if cloud.controlled == true:
|
|
|
|
cloud.speed = 0
|
|
|
|
cloud.decay = false
|
|
|
|
|
|
|
|
func _on_lucy_clearrain_pressed():
|
2024-11-08 03:54:34 -06:00
|
|
|
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
2024-11-13 18:34:53 -06:00
|
|
|
print("[LUCYSTOOLS] Clearing rain")
|
2024-10-30 21:18:01 -05:00
|
|
|
for cloud in get_tree().get_nodes_in_group("raincloud"):
|
|
|
|
cloud._deinstantiate(true)
|
|
|
|
|
2024-11-02 18:49:03 -05:00
|
|
|
func _on_lucy_clearchat_pressed():
|
2024-11-07 01:05:45 -06:00
|
|
|
Network._wipe_chat()
|
2024-11-02 18:49:03 -05:00
|
|
|
Network.emit_signal("_chat_update")
|
2024-11-03 23:23:04 -06:00
|
|
|
|
|
|
|
func _on_lucy_clearmeteor_pressed():
|
2024-11-08 03:54:34 -06:00
|
|
|
if not MANAGER.ingame or (not Network.GAME_MASTER and not Network.PLAYING_OFFLINE): return
|
2024-11-13 18:34:53 -06:00
|
|
|
print("[LUCYSTOOLS] Clearing meteor")
|
2024-11-03 23:23:04 -06:00
|
|
|
for meteor in get_tree().get_nodes_in_group("meteor"):
|
|
|
|
meteor._deinstantiate(true)
|
|
|
|
|
2024-11-13 18:34:53 -06:00
|
|
|
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)
|