diff --git a/Scenes/Game.gd b/Scenes/Game.gd index 7e651d1..5ba6bf2 100644 --- a/Scenes/Game.gd +++ b/Scenes/Game.gd @@ -13,6 +13,7 @@ onready var physics = world.get_world_2d().direct_space_state var writing = false func _ready() -> void: + $"/root/Music/BGM".stop() randomize() if netgame.hosting: world.load_map(netgame.get_current_map()) diff --git a/Scenes/UI.gd b/Scenes/UI.gd index bc6b965..009cc9d 100644 --- a/Scenes/UI.gd +++ b/Scenes/UI.gd @@ -13,8 +13,11 @@ enum PopupName { onready var logs = $Logs onready var scene = $"/root/scene" +onready var netgame = $"/root/Multiplayer" +const WHISPER_RADIUS = 32*3 const CHAT_RADIUS = 32*10 +const SHOUT_RADIUS = 32*14 func _ready() -> void: # Add options to menu buttons @@ -27,19 +30,28 @@ func _server_option_chosen(id) -> void: ServerMenuItem.ServerInfo: $ServerInfoPopup.popup_centered() -func open_popup(map_name) -> void: - match map_name: +func open_popup(popup_name) -> void: + match popup_name: PopupName.SpaceMap: $MapPopup.popup_centered_ratio() PopupName.EnergyUsage: pass -func close_popup(map_name) -> void: - match map_name: +func close_popup(popup_name) -> void: + match popup_name: PopupName.SpaceMap: $MapPopup.visible = false PopupName.EnergyUsage: pass -func _send_chat(text): - scene.rpc("broadcast_zone", text + "\n", scene.world.player.global_position, CHAT_RADIUS) +const say_format = "%s says \"%s\"\n" +const shout_format = "%s shouts \"[b]%s[/b]\"\n" +const whisper_format = "[i]%s whispers \"%s\"[/i]\n" +func _send_chat(text: String) -> void: + var escaped_text = text.replace("[", "[\u8203") # Hacky way to escape BBCode + if text.ends_with("!!"): + scene.rpc("broadcast_zone", shout_format % [netgame.player_name, escaped_text], scene.world.player.global_position, SHOUT_RADIUS) + elif text.begins_with("#"): + scene.rpc("broadcast_zone", whisper_format % [netgame.player_name, escaped_text.substr(1)], scene.world.player.global_position, WHISPER_RADIUS) + else: + scene.rpc("broadcast_zone", say_format % [netgame.player_name, escaped_text], scene.world.player.global_position, CHAT_RADIUS) diff --git a/Sounds/SFX/ui/neutral-bi-beep.ogg.import b/Sounds/SFX/ui/neutral-bi-beep.ogg.import index cc18f0e..8ba8ed0 100644 --- a/Sounds/SFX/ui/neutral-bi-beep.ogg.import +++ b/Sounds/SFX/ui/neutral-bi-beep.ogg.import @@ -11,5 +11,5 @@ dest_files=[ "res://.import/neutral-bi-beep.ogg-b80d5dd9b7ca71aa0d191c8ef7940dc5 [params] -loop=true +loop=false loop_offset=0 diff --git a/Sounds/SFX/ui/radio-message.wav.import b/Sounds/SFX/ui/radio-message.wav.import index 3616076..9fb5898 100644 --- a/Sounds/SFX/ui/radio-message.wav.import +++ b/Sounds/SFX/ui/radio-message.wav.import @@ -11,11 +11,11 @@ dest_files=[ "res://.import/radio-message.wav-ce2c91f356066e01259b32b652b758a3.s [params] -force/8_bit=false -force/mono=false +force/8_bit=true +force/mono=true force/max_rate=false force/max_rate_hz=44100 -edit/trim=false -edit/normalize=false +edit/trim=true +edit/normalize=true edit/loop=false -compress/mode=0 +compress/mode=1