From 01c1f08379d22b36f3eaedfa355c6e49ef3fa820 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 28 Mar 2024 23:45:40 -0400 Subject: AFD inverted camera --- Archipelago/player.gd | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Archipelago/player.gd') diff --git a/Archipelago/player.gd b/Archipelago/player.gd index 87d9d0c..244d9a8 100644 --- a/Archipelago/player.gd +++ b/Archipelago/player.gd @@ -1,5 +1,13 @@ extends "res://scripts/player.gd" +var april_fools = false + + +func _ready(): + var date = Time.get_date_dict_from_system() + if date["month"] == 4 && date["day"] == 1: + april_fools = true + func _solving(): ._solving() @@ -22,3 +30,10 @@ func _unhandled_input(event): if event.pressed and event.scancode == KEY_P: var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects") effects_node.skip_puzzle() + + +func rotate_y(amount): + if april_fools: + .rotate_y(-amount) + else: + .rotate_y(amount) -- cgit 1.4.1 From a6fa27bf9b8196f844281b2c6ab1a390178aee2e Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 1 Apr 2024 09:36:14 -0400 Subject: AFD 2024: Remove inverted camera thing --- Archipelago/player.gd | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'Archipelago/player.gd') diff --git a/Archipelago/player.gd b/Archipelago/player.gd index 244d9a8..87d9d0c 100644 --- a/Archipelago/player.gd +++ b/Archipelago/player.gd @@ -1,13 +1,5 @@ extends "res://scripts/player.gd" -var april_fools = false - - -func _ready(): - var date = Time.get_date_dict_from_system() - if date["month"] == 4 && date["day"] == 1: - april_fools = true - func _solving(): ._solving() @@ -30,10 +22,3 @@ func _unhandled_input(event): if event.pressed and event.scancode == KEY_P: var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects") effects_node.skip_puzzle() - - -func rotate_y(amount): - if april_fools: - .rotate_y(-amount) - else: - .rotate_y(amount) -- cgit 1.4.1 From 38175bd12c1a0a2c80be5f4011f69e4659f61ccd Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 3 Apr 2024 14:31:51 -0400 Subject: Added player position tracking --- Archipelago/client.gd | 18 +++++++++++++++++- Archipelago/player.gd | 28 ++++++++++++++++++++++++++++ Archipelago/settings_buttons.gd | 1 + Archipelago/settings_screen.gd | 1 + archipelago.tscn | 10 ++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) (limited to 'Archipelago/player.gd') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 47357ee..b825aaa 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -14,6 +14,7 @@ var ap_user = "" var ap_pass = "" var confusify_world = false var enable_multiplayer = false +var track_player = false const my_version = "2.0.0" const ap_version = {"major": 0, "minor": 4, "build": 5, "class": "Version"} @@ -158,6 +159,8 @@ func _init(): confusify_world = data[4] if data.size() > 5: enable_multiplayer = data[5] + if data.size() > 6: + track_player = data[6] processDatapackages() @@ -298,6 +301,11 @@ func _on_data(): if _slot_data.has("early_color_hallways"): _early_color_hallways = _slot_data["early_color_hallways"] + if track_player: + setValue("PlayerPos", {"x": 0, "z": 0}) + else: + setValue("PlayerPos", null) + _puzzle_skips = 0 _localdata_file = "user://archipelago_data/%s_%d" % [_seed, _slot] @@ -470,7 +478,15 @@ func saveSettings(): var file = File.new() file.open("user://settings/archipelago", File.WRITE) - var data = [ap_server, ap_user, ap_pass, _datapackages, confusify_world, enable_multiplayer] + var data = [ + ap_server, + ap_user, + ap_pass, + _datapackages, + confusify_world, + enable_multiplayer, + track_player + ] file.store_var(data, true) file.close() diff --git a/Archipelago/player.gd b/Archipelago/player.gd index 87d9d0c..49d907d 100644 --- a/Archipelago/player.gd +++ b/Archipelago/player.gd @@ -1,6 +1,34 @@ extends "res://scripts/player.gd" +var _oldpos = Vector3(0, -200, 0) + + +func _ready(): + _oldpos = translation + _oldpos.y = 0 + + var apclient = global.get_node("Archipelago") + if apclient.track_player: + var tracking_timer = Timer.new() + tracking_timer.name = "TrackingTimer" + tracking_timer.wait_time = 5.0 + add_child(tracking_timer) + tracking_timer.connect("timeout", self, "_tick_tracking") + tracking_timer.start() + + +func _tick_tracking(): + var newpos = translation + newpos.y = 0 + + if newpos != _oldpos && newpos.distance_to(_oldpos) > 10: + _oldpos = newpos + + var apclient = global.get_node("Archipelago") + apclient.setValue("PlayerPos", {"x": int(_oldpos.x), "z": int(_oldpos.z)}) + + func _solving(): ._solving() diff --git a/Archipelago/settings_buttons.gd b/Archipelago/settings_buttons.gd index e9cff9d..9193b61 100644 --- a/Archipelago/settings_buttons.gd +++ b/Archipelago/settings_buttons.gd @@ -14,6 +14,7 @@ func _connect_pressed(): apclient.ap_pass = self.get_parent().get_node("password_box").text apclient.confusify_world = self.get_parent().get_node("confusing_box").pressed apclient.enable_multiplayer = self.get_parent().get_node("multiplayer_box").pressed + apclient.track_player = self.get_parent().get_node("position_box").pressed apclient.saveSettings() apclient.connectToServer() diff --git a/Archipelago/settings_screen.gd b/Archipelago/settings_screen.gd index 7f50f51..deb0003 100644 --- a/Archipelago/settings_screen.gd +++ b/Archipelago/settings_screen.gd @@ -59,6 +59,7 @@ func _ready(): self.get_node("Panel/password_box").text = apclient.ap_pass self.get_node("Panel/confusing_box").pressed = apclient.confusify_world self.get_node("Panel/multiplayer_box").pressed = apclient.enable_multiplayer + self.get_node("Panel/position_box").pressed = apclient.track_player # Show client version. self.get_node("Panel/title").text = "ARCHIPELAGO (%s)" % apclient.my_version diff --git a/archipelago.tscn b/archipelago.tscn index 917db4e..f0b8ab9 100644 --- a/archipelago.tscn +++ b/archipelago.tscn @@ -173,5 +173,15 @@ custom_icons/checked = ExtResource( 8 ) custom_icons/unchecked = ExtResource( 7 ) text = "Show other players" +[node name="position_box" type="CheckBox" parent="Panel"] +margin_left = 1227.0 +margin_top = 571.0 +margin_right = 1832.0 +margin_bottom = 654.0 +custom_fonts/font = ExtResource( 6 ) +custom_icons/checked = ExtResource( 8 ) +custom_icons/unchecked = ExtResource( 7 ) +text = "Send position to tracker" + [connection signal="pressed" from="Panel/connect_button" to="Panel/connect_button" method="_connect_pressed"] [connection signal="pressed" from="Panel/quit_button" to="Panel/quit_button" method="_back_pressed"] -- cgit 1.4.1