Start adding logging

This commit is contained in:
Hamcha 2020-07-21 19:47:33 +02:00
parent 995f2ab8b0
commit 9d6b29a933
Signed by: hamcha
GPG key ID: 477AFB9A47CD4B7F
9 changed files with 63 additions and 15 deletions

View file

@ -100,5 +100,5 @@ func draw_circle_arc_poly(center, radius, angle_from, angle_to, color):
points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
draw_polygon(points_arc, colors)
func _heard(area):
pass #TODO Sounds
func hear(event):
pass

View file

@ -30,4 +30,3 @@ collision_mask = 32
[node name="CollisionShape2D" type="CollisionShape2D" parent="Earing"]
shape = SubResource( 2 )
[connection signal="area_entered" from="Earing" to="." method="_heard"]

View file

@ -8,6 +8,7 @@ onready var ui = $CanvasLayer/ui
onready var world = $world
onready var systems = $systems
onready var netgame = $"/root/Multiplayer"
onready var physics = world.get_world_2d().direct_space_state
var writing = false
@ -53,10 +54,26 @@ master func ready_to_spawn() -> void:
# Then spawn him as well
rpc("spawn_player", id)
remotesync func spawn_player(id):
master func broadcast_zone(message: String, origin: Vector2, radius: float) -> void:
var shape = CircleShape2D.new()
shape.radius = radius
var query = Physics2DShapeQueryParameters.new()
query.collision_layer = 32
query.transform = Transform(world.transform.translated(origin))
query.set_shape(shape)
var res = physics.intersect_shape(query, 100)
print(res)
master func broadcast(message: String) -> void:
rpc("add_log", message)
remotesync func add_log(message: String) -> void:
ui.logs.add_line(message)
remotesync func spawn_player(id: int) -> void:
world.spawn_player(id, multiplayer.get_network_unique_id() == id)
remotesync func process_command(cmd: UICommand):
remotesync func process_command(cmd: UICommand) -> void:
match cmd.cmd_type:
UICommand.CommandType.SetShipTarget:
world.map.current_ship_target = cmd.cmd_args[0]

File diff suppressed because one or more lines are too long

View file

@ -13,6 +13,8 @@ enum PopupName {
EnergyUsage
}
onready var logs = $Logs
func _ready() -> void:
# Add options to menu buttons
var serverMenu = $Menu/Margins/Grid/Server.get_popup()

View file

@ -1,16 +1,20 @@
extends Control
onready var log_text = $ResizablePanel/RichTextLabel
onready var chat_bar = $ResizablePanel/LineEdit
func _input(event):
func _input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if not chat_bar_focus:
chat_bar.release_focus()
func add_line(line: String) -> void:
log_text.append_bbcode(line)
var chat_bar_focus = false
func _chat_bar_status(editing):
func _chat_bar_status(editing: bool) -> void:
$"/root/scene".writing = editing
func _chat_bar_focus(entered):
func _chat_bar_focus(entered: bool) -> void:
chat_bar_focus = entered

View file

@ -51,6 +51,7 @@ custom_fonts/bold_italics_font = SubResource( 1 )
custom_fonts/italics_font = SubResource( 2 )
custom_fonts/bold_font = SubResource( 3 )
custom_fonts/normal_font = SubResource( 4 )
bbcode_enabled = true
selection_enabled = true
__meta__ = {
"_edit_use_anchors_": false

View file

@ -53,3 +53,5 @@ func _make_socket(direction: String) -> void:
func _area_debug_modified(button_pressed):
var map = api.get_editor_interface().get_edited_scene_root() as GameMap
map.debug_areas = button_pressed
for area in map.get_node("areas").get_children():
area.update()

0
icon.png.import Executable file → Normal file
View file