2020-09-13 18:40:44 +02:00
|
|
|
extends TextEdit
|
|
|
|
|
|
|
|
var path
|
2020-09-21 15:36:09 +02:00
|
|
|
|
|
|
|
var _server
|
|
|
|
var _client_connection
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
# Initialize TCP server for fake editor.
|
|
|
|
_server = TCP_Server.new()
|
|
|
|
_server.listen(1234)
|
|
|
|
|
|
|
|
func _process(_delta):
|
|
|
|
if _server.is_connection_available():
|
|
|
|
_client_connection = _server.take_connection()
|
|
|
|
var length = _client_connection.get_u8()
|
|
|
|
var filename = _client_connection.get_string(length)
|
2020-09-29 16:12:58 +02:00
|
|
|
filename = filename.replace("%s/active/" % game.tmp_prefix_inside, "")
|
2020-09-21 15:36:09 +02:00
|
|
|
open(filename)
|
|
|
|
|
|
|
|
func open(filename):
|
|
|
|
path = filename
|
|
|
|
|
2020-09-29 16:12:58 +02:00
|
|
|
var fixme_path = game.tmp_prefix_outside+"/active/"
|
2020-09-29 14:53:00 +02:00
|
|
|
var content = helpers.read_file(fixme_path+filename)
|
2020-09-21 15:36:09 +02:00
|
|
|
text = content
|
|
|
|
|
|
|
|
show()
|
|
|
|
grab_focus()
|
|
|
|
|
|
|
|
func save():
|
2020-09-29 16:12:58 +02:00
|
|
|
var fixme_path = game.tmp_prefix_outside+"/active/"
|
2020-09-29 14:53:00 +02:00
|
|
|
helpers.write_file(fixme_path+path, text)
|
2020-09-22 15:55:01 +02:00
|
|
|
close()
|
|
|
|
|
|
|
|
func close():
|
|
|
|
if _client_connection.is_connected_to_host():
|
|
|
|
_client_connection.disconnect_from_host()
|
2020-09-21 15:36:09 +02:00
|
|
|
text = ""
|
|
|
|
hide()
|