refactor; 0.2 features
This commit is contained in:
parent
1e1a77d4c6
commit
24883547ac
@ -13,9 +13,20 @@ func setup(manager):
|
||||
get_node("%lucy_binterval").value = manager.bulk_interval
|
||||
get_node("%lucy_finterval").value = manager.full_interval
|
||||
|
||||
update()
|
||||
|
||||
func update():
|
||||
get_node("%lucy_srv_allow_bbcode").text = "Yes" if MANAGER.srv_allow_bbcode else "No"
|
||||
|
||||
func _ready():
|
||||
print("[LUCY] Menu Ready")
|
||||
|
||||
get_node("%lucy_bbcode").disabled = MANAGER.host_required and not Network.GAME_MASTER
|
||||
get_node("%lucy_raincloud").disabled = (MANAGER.host_required and not Network.GAME_MASTER) or not MANAGER.ingame
|
||||
get_node("%lucy_meteor").disabled = (MANAGER.host_required and not Network.GAME_MASTER) or not MANAGER.ingame
|
||||
get_node("%lucy_freezerain").disabled = (MANAGER.host_required and not Network.GAME_MASTER) or not MANAGER.ingame
|
||||
get_node("%lucy_clearrain").disabled = (MANAGER.host_required and not Network.GAME_MASTER) or not MANAGER.ingame
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventKey and event.scancode == KEY_F5 && event.pressed:
|
||||
visible = !visible
|
||||
@ -83,4 +94,7 @@ func _on_lucy_clearrain_pressed():
|
||||
for cloud in get_tree().get_nodes_in_group("raincloud"):
|
||||
cloud._deinstantiate(true)
|
||||
|
||||
|
||||
func _on_lucy_clearchat_pressed():
|
||||
Network.GAMECHAT = ""
|
||||
Network.LOCAL_GAMECHAT = ""
|
||||
Network.emit_signal("_chat_update")
|
||||
|
@ -58,10 +58,28 @@ margin_left = 509.0
|
||||
margin_right = 585.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="HFlowContainer4" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
[node name="HFlowContainer3" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 70.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 94.0
|
||||
margin_bottom = 84.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
|
||||
margin_right = 196.0
|
||||
margin_bottom = 14.0
|
||||
text = "Server Allows BBCode in Chat: "
|
||||
|
||||
[node name="lucy_srv_allow_bbcode" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer3"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 200.0
|
||||
margin_right = 218.0
|
||||
margin_bottom = 14.0
|
||||
text = "No"
|
||||
|
||||
[node name="HFlowContainer4" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 88.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 112.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer4"]
|
||||
@ -79,9 +97,9 @@ expand_to_text_length = true
|
||||
placeholder_text = "Name"
|
||||
|
||||
[node name="HFlowContainer5" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 98.0
|
||||
margin_top = 116.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 122.0
|
||||
margin_bottom = 140.0
|
||||
rect_pivot_offset = Vector2( -141, -49 )
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/HFlowContainer5"]
|
||||
@ -99,42 +117,53 @@ expand_to_text_length = true
|
||||
placeholder_text = "Message"
|
||||
|
||||
[node name="HFlowContainer2" type="HFlowContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 126.0
|
||||
margin_top = 144.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 146.0
|
||||
margin_bottom = 164.0
|
||||
|
||||
[node name="lucy_raincloud" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 118.0
|
||||
margin_bottom = 20.0
|
||||
text = "Spawn Raincloud"
|
||||
|
||||
[node name="lucy_meteor" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 122.0
|
||||
margin_right = 224.0
|
||||
margin_bottom = 20.0
|
||||
text = "Spawn Meteor"
|
||||
|
||||
[node name="lucy_freezerain" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 228.0
|
||||
margin_right = 314.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 = 318.0
|
||||
margin_right = 393.0
|
||||
margin_bottom = 20.0
|
||||
text = "Clear Rain"
|
||||
|
||||
[node name="lucy_clearchat" type="Button" parent="PanelContainer/VBoxContainer/HFlowContainer2"]
|
||||
margin_left = 397.0
|
||||
margin_right = 473.0
|
||||
margin_bottom = 20.0
|
||||
hint_tooltip = "Clears game chat (for you only)"
|
||||
text = "Clear Chat"
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 150.0
|
||||
margin_top = 168.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 154.0
|
||||
margin_bottom = 172.0
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 158.0
|
||||
margin_top = 176.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 182.0
|
||||
margin_bottom = 200.0
|
||||
split_offset = 100
|
||||
|
||||
[node name="HFlowContainer3" type="HFlowContainer" parent="PanelContainer/VBoxContainer/HSplitContainer"]
|
||||
@ -179,9 +208,9 @@ rounded = true
|
||||
allow_greater = true
|
||||
|
||||
[node name="HSplitContainer2" type="HSplitContainer" parent="PanelContainer/VBoxContainer"]
|
||||
margin_top = 186.0
|
||||
margin_top = 204.0
|
||||
margin_right = 786.0
|
||||
margin_bottom = 210.0
|
||||
margin_bottom = 228.0
|
||||
split_offset = 100
|
||||
|
||||
[node name="HFlowContainer3" type="HFlowContainer" parent="PanelContainer/VBoxContainer/HSplitContainer2"]
|
||||
@ -233,6 +262,7 @@ allow_greater = true
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/HFlowContainer2/lucy_meteor" to="." method="_on_lucy_meteor_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_clearchat" to="." method="_on_lucy_clearchat_pressed"]
|
||||
[connection signal="value_changed" from="PanelContainer/VBoxContainer/HSplitContainer/HFlowContainer3/lucy_fpackets" to="." method="_on_lucy_fpackets_value_changed"]
|
||||
[connection signal="value_changed" from="PanelContainer/VBoxContainer/HSplitContainer/HFlowContainer/lucy_bpackets" to="." method="_on_lucy_bpackets_value_changed"]
|
||||
[connection signal="value_changed" from="PanelContainer/VBoxContainer/HSplitContainer2/HFlowContainer3/lucy_binterval" to="." method="_on_lucy_binterval_value_changed"]
|
||||
|
@ -2,6 +2,8 @@ extends Node
|
||||
|
||||
const LUCYS_MENU_SCENE = preload("res://mods/Lucy.LucysTools/lucys_menu.tscn")
|
||||
|
||||
var host_required = true
|
||||
|
||||
var lucys_menu = null
|
||||
onready var root = get_tree().root
|
||||
|
||||
@ -14,6 +16,8 @@ var bulk_packets = 200 setget set_bulk_packets
|
||||
var bulk_interval = 1 setget set_bulk_interval
|
||||
var full_interval = 5 setget set_full_interval
|
||||
|
||||
var srv_allow_bbcode = false setget set_srv_bbcode
|
||||
|
||||
# Patched Network vars
|
||||
# var LUCY_PACKETS_READ = 0
|
||||
# var LUCY_BULK_FULL_TIMER = 0
|
||||
@ -31,7 +35,12 @@ func set_punchback(punchback):
|
||||
do_punchback = punchback
|
||||
func set_bbcode(bbcode):
|
||||
allow_bbcode = bbcode
|
||||
Network.LUCY_CHAT_BBCODE = bbcode
|
||||
if Network.GAME_MASTER or not host_required: self.srv_allow_bbcode = bbcode
|
||||
func set_srv_bbcode(bbcode):
|
||||
if Network.GAME_MASTER and not Network.PLAYING_OFFLINE: send_server_sync_actor()
|
||||
srv_allow_bbcode = bbcode
|
||||
Network.LUCY_CHAT_BBCODE = bbcode if host_required else allow_bbcode
|
||||
if lucys_menu != null: lucys_menu.update()
|
||||
func set_server_name(name):
|
||||
custom_server_name = name
|
||||
Network.LUCY_SRV_NAME = name
|
||||
@ -58,6 +67,21 @@ func _ready():
|
||||
root.connect("child_entered_tree", self, "_on_enter")
|
||||
Network.connect("_new_player_join", self, "new_player")
|
||||
PlayerData.connect("_punched", self, "punched")
|
||||
Network.connect("_instance_actor", self, "_instance_actor")
|
||||
|
||||
|
||||
func send_server_sync_actor(to = "peers"):
|
||||
if not Network.GAME_MASTER: return
|
||||
var dict = {"actor_type": "lucy_fake_actor", "at": Vector3.ZERO, "zone": "", "actor_id": 0, "creator_id": Network.STEAM_ID, "data": {
|
||||
"allow_bbcode": allow_bbcode
|
||||
}}
|
||||
Network._send_P2P_Packet({"type": "instance_actor", "params": dict}, to, 2)
|
||||
|
||||
func _instance_actor(dict, sender_id):
|
||||
if dict["actor_type"] != "lucy_fake_actor": return
|
||||
if sender_id != Network.KNOWN_GAME_MASTER or Network.GAME_MASTER: return
|
||||
var data = dict["data"]
|
||||
self.srv_allow_bbcode = data["allow_bbcode"]
|
||||
|
||||
func get_player() -> Actor:
|
||||
for p in get_tree().get_nodes_in_group("player"):
|
||||
@ -84,6 +108,7 @@ func new_player(id):
|
||||
if server_join_message.empty() or not Network.GAME_MASTER: return
|
||||
print("[LUCY] sending join message")
|
||||
Network._send_message(server_join_message)
|
||||
send_server_sync_actor(str(id))
|
||||
|
||||
func _on_enter(node: Node):
|
||||
if node.name == "main_menu":
|
||||
@ -95,6 +120,9 @@ func _on_enter(node: Node):
|
||||
lucys_menu = LUCYS_MENU_SCENE.instance()
|
||||
node.add_child(lucys_menu)
|
||||
ingame = true
|
||||
# retrigger setter
|
||||
self.srv_allow_bbcode = false
|
||||
self.allow_bbcode = allow_bbcode
|
||||
lucys_menu.setup(self)
|
||||
|
||||
func load_settings():
|
||||
@ -113,6 +141,7 @@ func load_settings():
|
||||
self.bulk_packets = result.bulk_packets
|
||||
self.bulk_interval = result.bulk_interval
|
||||
self.full_interval = result.full_interval
|
||||
self.host_required = result.host_required
|
||||
|
||||
func save_settings():
|
||||
print("[LUCY] Saving settings")
|
||||
@ -124,7 +153,8 @@ func save_settings():
|
||||
"frame_packets": frame_packets,
|
||||
"bulk_packets": bulk_packets,
|
||||
"bulk_interval": bulk_interval,
|
||||
"full_interval": full_interval
|
||||
"full_interval": full_interval,
|
||||
"host_required": host_required
|
||||
}
|
||||
var file = File.new()
|
||||
if file.open(OS.get_executable_path().get_base_dir().plus_file("GDWeave/configs/LucysTools.json"),File.WRITE) == OK:
|
||||
|
@ -1,7 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace LucysTools;
|
||||
|
||||
public class Config {
|
||||
[JsonInclude] public bool SomeSetting = true;
|
||||
}
|
1213
LucysTools/Mod.cs
1213
LucysTools/Mod.cs
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user