Browse Source

resolution settings, clean up

Lurkars 6 years ago
parent
commit
7ca0f5c929
  1. 10
      project.godot
  2. 3
      scenes/menus/DirectHostMenu.tscn
  3. 3
      scenes/menus/DirectJoinMenu.tscn
  4. 3
      scenes/menus/IngameMenu.tscn
  5. 3
      scenes/menus/LobbyMenu.tscn
  6. 3
      scenes/menus/MainMenu.tscn
  7. 3
      scenes/menus/MultiplayerMenu.tscn
  8. 3
      scenes/menus/ServerCreateGameMenu.tscn
  9. 3
      scenes/menus/SettingsControlsMenu.tscn
  10. 65
      scenes/menus/SettingsMenu.tscn
  11. 3
      scenes/menus/SettingsPlayerMenu.tscn
  12. 47
      scenes/menus/SettingsSystemMenu.tscn
  13. 1
      scenes/player/Player.tscn
  14. 2
      scenes/road/roadCornerLarge.tscn
  15. 4
      scenes/road/roadCornerLargeFlipped.tscn
  16. 4
      scenes/road/roadCornerLarger.tscn
  17. 4
      scenes/road/roadCornerLargerFlipped.tscn
  18. 4
      scenes/road/roadCornerSmall.tscn
  19. 4
      scenes/road/roadCornerSmallFlipped.tscn
  20. 64
      scripts/game/local_storage.gd
  21. 94
      scripts/game/settings.gd
  22. 2
      scripts/menus/direct_host_menu.gd
  23. 0
      scripts/menus/direct_join_menu.gd
  24. 0
      scripts/menus/ingame_menu.gd
  25. 0
      scripts/menus/lobby_menu.gd
  26. 2
      scripts/menus/local_game.gd
  27. 0
      scripts/menus/main_menu.gd
  28. 4
      scripts/menus/server_create_menu.gd
  29. 0
      scripts/menus/server_menu.gd
  30. 0
      scripts/menus/settings_controls_menu.gd
  31. 38
      scripts/menus/settings_menu.gd
  32. 14
      scripts/menus/settings_player.gd
  33. 14
      scripts/menus/settings_player_menu.gd
  34. 1
      scripts/player/player.gd
  35. 3
      scripts/road/road.gd

10
project.godot

@ -86,9 +86,17 @@ client="*res://scripts/networking/client.gd"
server="*res://scripts/networking/server.gd" server="*res://scripts/networking/server.gd"
game_server="*res://scripts/networking/game_server.gd" game_server="*res://scripts/networking/game_server.gd"
roads_factory="*res://scripts/road/roads_factory.gd" roads_factory="*res://scripts/road/roads_factory.gd"
local_storage="*res://scripts/game/local_storage.gd"
settings="*res://scripts/game/settings.gd"
Util="*res://scripts/Util.gd" Util="*res://scripts/Util.gd"
[display]
window/size/width=1920
window/size/height=1080
window/size/resizable=false
window/stretch/mode="2d"
window/stretch/aspect="expand"
[input] [input]
ui_cancel={ ui_cancel={

3
scenes/menus/DirectHostMenu.tscn

@ -1,11 +1,12 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1]
[ext_resource path="res://scripts/menus/direct_host.gd" type="Script" id=2]
[ext_resource path="res://scripts/menus/direct_host_menu.gd" type="Script" id=2]
[ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=3] [ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=3]
[ext_resource path="res://assets/icons/exitRight.png" type="Texture" id=4] [ext_resource path="res://assets/icons/exitRight.png" type="Texture" id=4]
[ext_resource path="res://assets/icons/return.png" type="Texture" id=5] [ext_resource path="res://assets/icons/return.png" type="Texture" id=5]
[node name="direct_host_menu" type="Control"] [node name="direct_host_menu" type="Control"]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5

3
scenes/menus/DirectJoinMenu.tscn

@ -1,11 +1,12 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1]
[ext_resource path="res://scripts/menus/direct_join.gd" type="Script" id=2]
[ext_resource path="res://scripts/menus/direct_join_menu.gd" type="Script" id=2]
[ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=3] [ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=3]
[ext_resource path="res://assets/icons/exitRight.png" type="Texture" id=4] [ext_resource path="res://assets/icons/exitRight.png" type="Texture" id=4]
[ext_resource path="res://assets/icons/return.png" type="Texture" id=5] [ext_resource path="res://assets/icons/return.png" type="Texture" id=5]
[node name="direct_join_menu" type="Control"] [node name="direct_join_menu" type="Control"]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5

3
scenes/menus/IngameMenu.tscn

@ -1,11 +1,12 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1]
[ext_resource path="res://scripts/menus/ingame.gd" type="Script" id=2]
[ext_resource path="res://scripts/menus/ingame_menu.gd" type="Script" id=2]
[ext_resource path="res://assets/icons/open.png" type="Texture" id=3] [ext_resource path="res://assets/icons/open.png" type="Texture" id=3]
[ext_resource path="res://assets/icons/wrench.png" type="Texture" id=4] [ext_resource path="res://assets/icons/wrench.png" type="Texture" id=4]
[ext_resource path="res://assets/icons/arrowLeft.png" type="Texture" id=5] [ext_resource path="res://assets/icons/arrowLeft.png" type="Texture" id=5]
[node name="ingame_menu" type="Control"] [node name="ingame_menu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0

3
scenes/menus/LobbyMenu.tscn

@ -1,13 +1,14 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1]
[ext_resource path="res://scripts/menus/lobby.gd" type="Script" id=2]
[ext_resource path="res://scripts/menus/lobby_menu.gd" type="Script" id=2]
[ext_resource path="res://scenes/menus/BaseMenu.tscn" type="PackedScene" id=3] [ext_resource path="res://scenes/menus/BaseMenu.tscn" type="PackedScene" id=3]
[ext_resource path="res://assets/icons/checkmark.png" type="Texture" id=4] [ext_resource path="res://assets/icons/checkmark.png" type="Texture" id=4]
[ext_resource path="res://assets/icons/question.png" type="Texture" id=5] [ext_resource path="res://assets/icons/question.png" type="Texture" id=5]
[ext_resource path="res://scenes/menus/SettingsPlayerMenu.tscn" type="PackedScene" id=6] [ext_resource path="res://scenes/menus/SettingsPlayerMenu.tscn" type="PackedScene" id=6]
[ext_resource path="res://assets/fonts/Kenney Future Narrow.ttf" type="DynamicFontData" id=7] [ext_resource path="res://assets/fonts/Kenney Future Narrow.ttf" type="DynamicFontData" id=7]
[sub_resource type="DynamicFont" id=1] [sub_resource type="DynamicFont" id=1]
size = 100 size = 100
font_data = ExtResource( 7 ) font_data = ExtResource( 7 )

3
scenes/menus/MainMenu.tscn

@ -1,13 +1,14 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1]
[ext_resource path="res://scripts/menus/main.gd" type="Script" id=2]
[ext_resource path="res://scripts/menus/main_menu.gd" type="Script" id=2]
[ext_resource path="res://assets/icons/massiveMultiplayer.png" type="Texture" id=3] [ext_resource path="res://assets/icons/massiveMultiplayer.png" type="Texture" id=3]
[ext_resource path="res://assets/icons/singleplayer.png" type="Texture" id=4] [ext_resource path="res://assets/icons/singleplayer.png" type="Texture" id=4]
[ext_resource path="res://assets/icons/wrench.png" type="Texture" id=5] [ext_resource path="res://assets/icons/wrench.png" type="Texture" id=5]
[ext_resource path="res://assets/icons/power.png" type="Texture" id=6] [ext_resource path="res://assets/icons/power.png" type="Texture" id=6]
[ext_resource path="res://assets/icons/question.png" type="Texture" id=7] [ext_resource path="res://assets/icons/question.png" type="Texture" id=7]
[node name="main_menu" type="Control"] [node name="main_menu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0

3
scenes/menus/MultiplayerMenu.tscn

@ -1,7 +1,7 @@
[gd_scene load_steps=11 format=2] [gd_scene load_steps=11 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1]
[ext_resource path="res://scripts/menus/server.gd" type="Script" id=2]
[ext_resource path="res://scripts/menus/server_menu.gd" type="Script" id=2]
[ext_resource path="res://scenes/menus/BaseMenu.tscn" type="PackedScene" id=3] [ext_resource path="res://scenes/menus/BaseMenu.tscn" type="PackedScene" id=3]
[ext_resource path="res://assets/icons/cpu.png" type="Texture" id=4] [ext_resource path="res://assets/icons/cpu.png" type="Texture" id=4]
[ext_resource path="res://assets/icons/exitRight.png" type="Texture" id=5] [ext_resource path="res://assets/icons/exitRight.png" type="Texture" id=5]
@ -11,6 +11,7 @@
[ext_resource path="res://assets/icons/massiveMultiplayer.png" type="Texture" id=9] [ext_resource path="res://assets/icons/massiveMultiplayer.png" type="Texture" id=9]
[ext_resource path="res://assets/icons/fistPlus.png" type="Texture" id=10] [ext_resource path="res://assets/icons/fistPlus.png" type="Texture" id=10]
[node name="multiplayer_menu" type="Control"] [node name="multiplayer_menu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0

3
scenes/menus/ServerCreateGameMenu.tscn

@ -1,11 +1,12 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1]
[ext_resource path="res://scripts/menus/server_create.gd" type="Script" id=2]
[ext_resource path="res://scripts/menus/server_create_menu.gd" type="Script" id=2]
[ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=3] [ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=3]
[ext_resource path="res://assets/icons/fistPlus.png" type="Texture" id=4] [ext_resource path="res://assets/icons/fistPlus.png" type="Texture" id=4]
[ext_resource path="res://assets/icons/return.png" type="Texture" id=5] [ext_resource path="res://assets/icons/return.png" type="Texture" id=5]
[node name="server_create_menu" type="Control"] [node name="server_create_menu" type="Control"]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5

3
scenes/menus/SettingsControlsMenu.tscn

@ -1,6 +1,6 @@
[gd_scene load_steps=20 format=2] [gd_scene load_steps=20 format=2]
[ext_resource path="res://scripts/menus/settings_controls.gd" type="Script" id=1]
[ext_resource path="res://scripts/menus/settings_controls_menu.gd" type="Script" id=1]
[ext_resource path="res://assets/icons/keySmall_3d.png" type="Texture" id=2] [ext_resource path="res://assets/icons/keySmall_3d.png" type="Texture" id=2]
[ext_resource path="res://assets/icons/buttonA.png" type="Texture" id=3] [ext_resource path="res://assets/icons/buttonA.png" type="Texture" id=3]
[ext_resource path="res://assets/icons/buttonB.png" type="Texture" id=4] [ext_resource path="res://assets/icons/buttonB.png" type="Texture" id=4]
@ -20,6 +20,7 @@
[ext_resource path="res://assets/icons/DPAD_right.png" type="Texture" id=18] [ext_resource path="res://assets/icons/DPAD_right.png" type="Texture" id=18]
[ext_resource path="res://assets/icons/fightJ.png" type="Texture" id=19] [ext_resource path="res://assets/icons/fightJ.png" type="Texture" id=19]
[node name="settings_controls_menu" type="Control"] [node name="settings_controls_menu" type="Control"]
margin_left = 12.0 margin_left = 12.0
margin_top = 8.0 margin_top = 8.0

65
scenes/menus/SettingsMenu.tscn

@ -1,7 +1,7 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1]
[ext_resource path="res://scripts/menus/settings.gd" type="Script" id=2]
[ext_resource path="res://scripts/menus/settings_menu.gd" type="Script" id=2]
[ext_resource path="res://scenes/menus/BaseMenu.tscn" type="PackedScene" id=3] [ext_resource path="res://scenes/menus/BaseMenu.tscn" type="PackedScene" id=3]
[ext_resource path="res://scenes/menus/SettingsPlayerMenu.tscn" type="PackedScene" id=4] [ext_resource path="res://scenes/menus/SettingsPlayerMenu.tscn" type="PackedScene" id=4]
[ext_resource path="res://scenes/menus/SettingsControlsMenu.tscn" type="PackedScene" id=5] [ext_resource path="res://scenes/menus/SettingsControlsMenu.tscn" type="PackedScene" id=5]
@ -94,7 +94,6 @@ margin_right = -4.0
margin_bottom = -4.0 margin_bottom = -4.0
[node name="settings_controls" parent="menu/tabs/controls" instance=ExtResource( 5 )] [node name="settings_controls" parent="menu/tabs/controls" instance=ExtResource( 5 )]
editor/display_folded = true
[node name="empty" parent="menu/tabs/controls/settings_controls/ScrollContainer/grid" index="0"] [node name="empty" parent="menu/tabs/controls/settings_controls/ScrollContainer/grid" index="0"]
margin_bottom = 27.0 margin_bottom = 27.0
@ -106,6 +105,7 @@ margin_bottom = 27.0
margin_bottom = 27.0 margin_bottom = 27.0
[node name="graphics" type="Tabs" parent="menu/tabs"] [node name="graphics" type="Tabs" parent="menu/tabs"]
editor/display_folded = true
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -114,8 +114,33 @@ margin_top = 45.0
margin_right = -4.0 margin_right = -4.0
margin_bottom = -4.0 margin_bottom = -4.0
[node name="VBoxContainer" type="VBoxContainer" parent="menu/tabs/graphics"]
margin_right = 40.0
margin_bottom = 40.0
[node name="resolution" type="OptionButton" parent="menu/tabs/graphics/VBoxContainer"]
margin_right = 248.0
margin_bottom = 33.0
[node name="fullscreen" type="CheckButton" parent="menu/tabs/graphics/VBoxContainer"]
margin_top = 37.0
margin_right = 248.0
margin_bottom = 77.0
text = "FULLSCREEN"
[node name="light" type="CheckButton" parent="menu/tabs/graphics/VBoxContainer"]
margin_top = 81.0
margin_right = 248.0
margin_bottom = 121.0
text = "LIGHT"
[node name="shadows" type="CheckButton" parent="menu/tabs/graphics/VBoxContainer"]
margin_top = 125.0
margin_right = 248.0
margin_bottom = 165.0
text = "SHADOWS"
[node name="system" type="Tabs" parent="menu/tabs"] [node name="system" type="Tabs" parent="menu/tabs"]
editor/display_folded = true
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -132,45 +157,46 @@ margin_bottom = 124.0
columns = 2 columns = 2
[node name="locale_label" type="Label" parent="menu/tabs/system/GridContainer"] [node name="locale_label" type="Label" parent="menu/tabs/system/GridContainer"]
margin_right = 190.0
margin_bottom = 27.0
margin_right = 88.0
margin_bottom = 14.0
text = "LOCALE" text = "LOCALE"
valign = 1 valign = 1
[node name="locales" type="ItemList" parent="menu/tabs/system/GridContainer"] [node name="locales" type="ItemList" parent="menu/tabs/system/GridContainer"]
margin_left = 194.0
margin_left = 92.0
margin_right = 895.0 margin_right = 895.0
margin_bottom = 27.0
margin_bottom = 14.0
size_flags_horizontal = 3 size_flags_horizontal = 3
auto_height = true auto_height = true
[node name="server_addr_label" type="Label" parent="menu/tabs/system/GridContainer"] [node name="server_addr_label" type="Label" parent="menu/tabs/system/GridContainer"]
margin_top = 36.0
margin_right = 190.0
margin_bottom = 63.0
margin_top = 23.0
margin_right = 88.0
margin_bottom = 37.0
text = "SERVER_ADDR" text = "SERVER_ADDR"
valign = 1 valign = 1
[node name="server_addr" type="LineEdit" parent="menu/tabs/system/GridContainer"] [node name="server_addr" type="LineEdit" parent="menu/tabs/system/GridContainer"]
margin_left = 194.0
margin_top = 31.0
margin_left = 92.0
margin_top = 18.0
margin_right = 895.0 margin_right = 895.0
margin_bottom = 68.0
margin_bottom = 42.0
[node name="api_addr_label" type="Label" parent="menu/tabs/system/GridContainer"] [node name="api_addr_label" type="Label" parent="menu/tabs/system/GridContainer"]
margin_top = 77.0
margin_right = 190.0
margin_bottom = 104.0
margin_top = 51.0
margin_right = 88.0
margin_bottom = 65.0
text = "API_ADDR" text = "API_ADDR"
valign = 1 valign = 1
[node name="api_addr" type="LineEdit" parent="menu/tabs/system/GridContainer"] [node name="api_addr" type="LineEdit" parent="menu/tabs/system/GridContainer"]
margin_left = 194.0
margin_top = 72.0
margin_left = 92.0
margin_top = 46.0
margin_right = 895.0 margin_right = 895.0
margin_bottom = 109.0
margin_bottom = 70.0
[node name="HBoxContainer" type="HBoxContainer" parent="menu"] [node name="HBoxContainer" type="HBoxContainer" parent="menu"]
editor/display_folded = true
anchor_left = 1.0 anchor_left = 1.0
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 1.0 anchor_right = 1.0
@ -209,7 +235,6 @@ flat = true
align = 0 align = 0
[connection signal="item_selected" from="menu/tabs/system/GridContainer/locales" to="." method="_on_locales_item_selected"] [connection signal="item_selected" from="menu/tabs/system/GridContainer/locales" to="." method="_on_locales_item_selected"]
[connection signal="tree_exiting" from="menu/tabs/system/GridContainer/locales" to="." method="_on_locales_tree_exiting"] [connection signal="tree_exiting" from="menu/tabs/system/GridContainer/locales" to="." method="_on_locales_tree_exiting"]
[connection signal="visibility_changed" from="menu/tabs/system/GridContainer/locales" to="." method="_init_locales"]
[connection signal="pressed" from="menu/HBoxContainer/apply" to="." method="_on_apply_pressed"] [connection signal="pressed" from="menu/HBoxContainer/apply" to="." method="_on_apply_pressed"]
[connection signal="pressed" from="menu/HBoxContainer/save" to="." method="_on_save_pressed"] [connection signal="pressed" from="menu/HBoxContainer/save" to="." method="_on_save_pressed"]

3
scenes/menus/SettingsPlayerMenu.tscn

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://scripts/menus/settings_player.gd" type="Script" id=1]
[ext_resource path="res://scripts/menus/settings_player_menu.gd" type="Script" id=1]
[node name="settings_player_menu" type="Control"] [node name="settings_player_menu" type="Control"]
margin_left = 513.0 margin_left = 513.0

47
scenes/menus/SettingsSystemMenu.tscn

@ -0,0 +1,47 @@
[gd_scene format=2]
[node name="GridContainer" type="GridContainer"]
margin_left = 12.0
margin_top = 8.0
margin_right = 907.0
margin_bottom = 124.0
columns = 2
[node name="locale_label" type="Label" parent="."]
margin_right = 88.0
margin_bottom = 14.0
text = "LOCALE"
valign = 1
[node name="locales" type="ItemList" parent="."]
margin_left = 92.0
margin_right = 895.0
margin_bottom = 14.0
size_flags_horizontal = 3
auto_height = true
[node name="server_addr_label" type="Label" parent="."]
margin_top = 23.0
margin_right = 88.0
margin_bottom = 37.0
text = "SERVER_ADDR"
valign = 1
[node name="server_addr" type="LineEdit" parent="."]
margin_left = 92.0
margin_top = 18.0
margin_right = 895.0
margin_bottom = 42.0
[node name="api_addr_label" type="Label" parent="."]
margin_top = 51.0
margin_right = 88.0
margin_bottom = 65.0
text = "API_ADDR"
valign = 1
[node name="api_addr" type="LineEdit" parent="."]
margin_left = 92.0
margin_top = 46.0
margin_right = 895.0
margin_bottom = 70.0

1
scenes/player/Player.tscn

@ -31,7 +31,6 @@ rotation_mode = 4
loop = false loop = false
[node name="raceCar" type="KinematicBody" parent="Path/PathFollow"] [node name="raceCar" type="KinematicBody" parent="Path/PathFollow"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
collision_layer = 31 collision_layer = 31
collision_mask = 31 collision_mask = 31
script = ExtResource( 2 ) script = ExtResource( 2 )

2
scenes/road/roadCornerLarge.tscn

@ -13,7 +13,7 @@ script = ExtResource( 2 )
end_rotation = Vector3( 0, -1.571, 0 ) end_rotation = Vector3( 0, -1.571, 0 )
speed_constrains = PoolVector3Array( 0.2, 0.6, 0.13, 0.6, 1.5, 0.1, 1.5, 2.36, 0.13 ) speed_constrains = PoolVector3Array( 0.2, 0.6, 0.13, 0.6, 1.5, 0.1, 1.5, 2.36, 0.13 )
force_penalties = PoolVector3Array( 2, 0, 8 ) force_penalties = PoolVector3Array( 2, 0, 8 )
torque_penalties = PoolVector3Array( 0.5, 0.1, 0.1 )
torque_penalties = PoolVector3Array( 0.1, 0.1, -0.5 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )

4
scenes/road/roadCornerLargeFlipped.tscn

@ -12,8 +12,8 @@ material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
end_rotation = Vector3( 0, 1.571, 0 ) end_rotation = Vector3( 0, 1.571, 0 )
speed_constrains = PoolVector3Array( 0.2, 0.6, 0.13, 0.6, 1.5, 0.1, 1.5, 2.36, 0.13 ) speed_constrains = PoolVector3Array( 0.2, 0.6, 0.13, 0.6, 1.5, 0.1, 1.5, 2.36, 0.13 )
force_penalties = PoolVector3Array( 1, 0, 5 )
torque_penalties = PoolVector3Array( 0, 1, 1.5 )
force_penalties = PoolVector3Array( 2, 0, 8 )
torque_penalties = PoolVector3Array( 0.1, 0.1, 0.5 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )

4
scenes/road/roadCornerLarger.tscn

@ -12,8 +12,8 @@ material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
end_rotation = Vector3( 0, -1.571, 0 ) end_rotation = Vector3( 0, -1.571, 0 )
speed_constrains = PoolVector3Array( 0.3, 1, 0.16, 1, 2.7, 0.13, 2.7, 3.93, 0.16 ) speed_constrains = PoolVector3Array( 0.3, 1, 0.16, 1, 2.7, 0.13, 2.7, 3.93, 0.16 )
force_penalties = PoolVector3Array( 0, 0, 5 )
torque_penalties = PoolVector3Array( 0, 0, 1 )
force_penalties = PoolVector3Array( 2, 0, 8 )
torque_penalties = PoolVector3Array( 0.1, 0.1, -0.5 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )

4
scenes/road/roadCornerLargerFlipped.tscn

@ -12,8 +12,8 @@ material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
end_rotation = Vector3( 0, 1.571, 0 ) end_rotation = Vector3( 0, 1.571, 0 )
speed_constrains = PoolVector3Array( 0.3, 1, 0.16, 1, 2.7, 0.13, 2.7, 3.93, 0.16 ) speed_constrains = PoolVector3Array( 0.3, 1, 0.16, 1, 2.7, 0.13, 2.7, 3.93, 0.16 )
force_penalties = PoolVector3Array( 0, 0, 5 )
torque_penalties = PoolVector3Array( 0, 0, -1 )
force_penalties = PoolVector3Array( 2, 0, 8 )
torque_penalties = PoolVector3Array( 0.1, 0.1, 0.5 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )

4
scenes/road/roadCornerSmall.tscn

@ -12,8 +12,8 @@ material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
end_rotation = Vector3( 0, -1.571, 0 ) end_rotation = Vector3( 0, -1.571, 0 )
speed_constrains = PoolVector3Array( 0.1, 0.79, 0.08 ) speed_constrains = PoolVector3Array( 0.1, 0.79, 0.08 )
force_penalties = PoolVector3Array( 0, 0, 5 )
torque_penalties = PoolVector3Array( 0, 0, 1 )
force_penalties = PoolVector3Array( 2, 0, 8 )
torque_penalties = PoolVector3Array( 0.1, 0.1, -0.5 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )

4
scenes/road/roadCornerSmallFlipped.tscn

@ -12,8 +12,8 @@ material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
end_rotation = Vector3( 0, 1.571, 0 ) end_rotation = Vector3( 0, 1.571, 0 )
speed_constrains = PoolVector3Array( 0.1, 0.79, 0.08 ) speed_constrains = PoolVector3Array( 0.1, 0.79, 0.08 )
force_penalties = PoolVector3Array( 0, 0, 5 )
torque_penalties = PoolVector3Array( 0, 0, -1 )
force_penalties = PoolVector3Array( 2, 0, 8 )
torque_penalties = PoolVector3Array( 0.1, 0.1, 0.5 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )

64
scripts/game/local_storage.gd

@ -1,64 +0,0 @@
extends Node
const FILE_PATH = "user://local_storage"
func _ready():
TranslationServer.set_locale(read_value("locale","en"))
var server_addr = read_value("server_addr")
if server_addr != null && not server_addr.empty():
game_server.set_server_addr(server_addr)
var api_addr = read_value("api_addr")
if api_addr != null && not api_addr.empty():
game_server.set_api_addr(api_addr)
func read_content():
var f = File.new()
var err = f.open(FILE_PATH, File.READ)
var content = {}
if err == OK:
content = parse_json(f.get_as_text())
f.close()
if content == null:
content = {}
return content
func write_content(content:Dictionary):
var f = File.new()
var err = f.open(FILE_PATH, File.WRITE)
#var err = f.open_encrypted_with_pass(FILE_PATH, File.WRITE, OS.get_unique_id())
f.store_string(to_json(content))
f.close()
func write_value(key:String, value):
var content = read_content()
content[key] = value
write_content(content)
func read_value(key:String, default = null):
var content = read_content()
if content.has(key) && content.get(key) != null:
return content.get(key)
else:
return default
func delete_value(key:String):
var content = read_content()
content.erase(key)
write_content(content)
func write_values(new_content:Dictionary):
var content = read_content()
for key in new_content:
content[key] = new_content[key]
write_content(content)
func read_values():
return read_content()

94
scripts/game/settings.gd

@ -0,0 +1,94 @@
extends Node
const FILE_PATH = "user://local_storage"
const RESOLUTIONS = [Vector2(1920,1080),Vector2(1600,900),Vector2(1366,758),Vector2(1280,720),Vector2(1136,640),Vector2(1024,576)]
onready var view_port = get_tree().get_root()
func _ready():
apply_settings()
func read_config():
var f = File.new()
var err = f.open(FILE_PATH, File.READ)
var config = {}
if err == OK:
config = parse_json(f.get_as_text())
f.close()
if config == null:
config = {}
return config
func write_config(config:Dictionary):
var f = File.new()
var err = f.open(FILE_PATH, File.WRITE)
#var err = f.open_encrypted_with_pass(FILE_PATH, File.WRITE, OS.get_unique_id())
f.store_string(to_json(config))
f.close()
func write_value(key:String, value):
var config = read_config()
config[key] = value
write_config(config)
func read_value(key:String, default = null):
var config = read_config()
if config.has(key) && config.get(key) != null:
return config.get(key)
else:
return default
func delete_value(key:String):
var config = read_config()
config.erase(key)
write_config(config)
func write_values(new_config:Dictionary):
var config = read_config()
for key in new_config:
config[key] = new_config[key]
write_config(config)
func read_values():
return read_config()
func apply_settings():
apply_locale()
apply_game_server()
apply_resolution()
func apply_locale():
TranslationServer.set_locale(read_value("locale","en"))
func apply_game_server():
var server_addr = read_value("server_addr")
if server_addr != null && not server_addr.empty():
game_server.set_server_addr(server_addr)
var api_addr = read_value("api_addr")
if api_addr != null && not api_addr.empty():
game_server.set_api_addr(api_addr)
func apply_resolution():
OS.set_window_fullscreen(read_value("fullscreen", true))
if OS.is_window_fullscreen():
var base_size = Vector2(1920, 1080)
var scale= base_size.x / RESOLUTIONS[read_value("resolution",0)].x
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_2D,SceneTree.STRETCH_ASPECT_EXPAND,base_size,scale)
else:
OS.set_window_size(RESOLUTIONS[read_value("resolution",0)])
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT,SceneTree.STRETCH_ASPECT_IGNORE,OS.get_window_size(),1)

2
scripts/menus/direct_host.gd → scripts/menus/direct_host_menu.gd

@ -4,7 +4,7 @@ var LobbyMenu = preload("res://scenes/menus/LobbyMenu.tscn")
func _ready(): func _ready():
find_node("bots").set_pressed(local_storage.read_value("bots", true))
find_node("bots").set_pressed(settings.read_value("bots", true))
func _draw(): func _draw():

0
scripts/menus/direct_join.gd → scripts/menus/direct_join_menu.gd

0
scripts/menus/ingame.gd → scripts/menus/ingame_menu.gd

0
scripts/menus/lobby.gd → scripts/menus/lobby_menu.gd

2
scripts/menus/local_game.gd

@ -4,7 +4,7 @@ onready var player_settings = find_node("player_settings")
func _ready(): func _ready():
find_node("bots").set_pressed(local_storage.read_value("bots", true))
find_node("bots").set_pressed(settings.read_value("bots", true))
func _draw(): func _draw():

0
scripts/menus/main.gd → scripts/menus/main_menu.gd

4
scripts/menus/server_create.gd → scripts/menus/server_create_menu.gd

@ -2,12 +2,12 @@ extends Control
func _ready(): func _ready():
var player_name = local_storage.read_value("player_name", false)
var player_name = settings.read_value("player_name", false)
var game_title = "New Game" var game_title = "New Game"
if player_name: if player_name:
game_title += " by " + player_name game_title += " by " + player_name
find_node("name").set_text(game_title) find_node("name").set_text(game_title)
find_node("bots").set_pressed(local_storage.read_value("bots", true))
find_node("bots").set_pressed(settings.read_value("bots", true))
func _draw(): func _draw():

0
scripts/menus/server.gd → scripts/menus/server_menu.gd

0
scripts/menus/settings_controls.gd → scripts/menus/settings_controls_menu.gd

38
scripts/menus/settings.gd → scripts/menus/settings_menu.gd

@ -11,13 +11,22 @@ var locale
func _ready(): func _ready():
get_node("menu/back").connect("pressed",self,"_on_back_pressed") get_node("menu/back").connect("pressed",self,"_on_back_pressed")
find_node("bots").set_pressed(local_storage.read_value("bots", true))
# game
find_node("bots").set_pressed(settings.read_value("bots", true))
# graphics
find_node("fullscreen").set_pressed(settings.read_value("fullscreen", true))
for resolution in settings.RESOLUTIONS:
find_node("resolution").add_item(str(resolution.x) + " * " + str(resolution.y))
find_node("resolution").select(settings.read_value("resolution", 0))
# system
find_node("server_addr").set_text(game_server.get_server_addr()) find_node("server_addr").set_text(game_server.get_server_addr())
find_node("api_addr").set_text(game_server.get_api_addr()) find_node("api_addr").set_text(game_server.get_api_addr())
game_tab.set_name(tr("GAME"))
controls_tab.set_name(tr("CONTROLS"))
graphics_tab.set_name(tr("GRAPHICS"))
system_tab.set_name(tr("SYSTEM"))
_init_locales()
func _on_back_pressed(): func _on_back_pressed():
@ -45,7 +54,7 @@ func _init_locales():
locales.clear() locales.clear()
locales.add_item(tr("LOCALE_EN")) locales.add_item(tr("LOCALE_EN"))
locales.add_item(tr("LOCALE_DE")) locales.add_item(tr("LOCALE_DE"))
locale = local_storage.read_value("locale","en")
locale = settings.read_value("locale","en")
match locale: match locale:
"en": "en":
locales.select(0) locales.select(0)
@ -56,7 +65,7 @@ func _init_locales():
func _on_locales_tree_exiting(): func _on_locales_tree_exiting():
TranslationServer.set_locale(local_storage.read_value("locale","en"))
settings.apply_locale()
func _on_save_pressed(): func _on_save_pressed():
@ -66,11 +75,20 @@ func _on_save_pressed():
func _on_apply_pressed(): func _on_apply_pressed():
var values = {} var values = {}
# game
values['player_name'] = player_settings.get_name_node().get_text() values['player_name'] = player_settings.get_name_node().get_text()
values['player_color'] = player_settings.get_color_node().color.to_html() values['player_color'] = player_settings.get_color_node().color.to_html()
values['bots'] = find_node("bots").is_pressed() values['bots'] = find_node("bots").is_pressed()
values['locale'] = locale values['locale'] = locale
# graphics
values['resolution'] = find_node("resolution").get_selected()
values['fullscreen'] = find_node("fullscreen").is_pressed()
values['light'] = find_node("fullscreen").is_pressed()
values['shadows'] = find_node("fullscreen").is_pressed()
# system
var server_addr = find_node("server_addr").get_text() var server_addr = find_node("server_addr").get_text()
if server_addr.empty(): if server_addr.empty():
server_addr = game_server.SERVER_ADDR server_addr = game_server.SERVER_ADDR
@ -80,7 +98,7 @@ func _on_apply_pressed():
if api_addr.empty(): if api_addr.empty():
api_addr = game_server.API_ADDR api_addr = game_server.API_ADDR
values['api_addr'] = api_addr values['api_addr'] = api_addr
local_storage.write_values(values)
game_server.set_server_addr(server_addr)
game_server.set_api_addr(local_storage.read_value("api_addr",game_server.API_ADDR))
settings.write_values(values)
settings.apply_settings()

14
scripts/menus/settings_player.gd

@ -1,14 +0,0 @@
extends Control
func _ready():
get_name_node().set_text(local_storage.read_value("player_name", "Player"))
get_color_node().set_pick_color(Color(local_storage.read_value("player_color", "#000000")))
func get_name_node():
return find_node("name")
func get_color_node():
return find_node("color")

14
scripts/menus/settings_player_menu.gd

@ -0,0 +1,14 @@
extends Control
func _ready():
get_name_node().set_text(settings.read_value("player_name", "Player"))
get_color_node().set_pick_color(Color(settings.read_value("player_color", "#000000")))
func get_name_node():
return find_node("name")
func get_color_node():
return find_node("color")

1
scripts/player/player.gd

@ -116,6 +116,7 @@ func _physics_process(delta):
check_position() check_position()
else: else:
var road = get_road()
race_car.get_node("ray").set_enabled(false) race_car.get_node("ray").set_enabled(false)
if force_penalty.length() != 0: if force_penalty.length() != 0:
race_car.move_and_slide(force_penalty * current_speed + Vector3(0,-0.5,0)) race_car.move_and_slide(force_penalty * current_speed + Vector3(0,-0.5,0))

3
scripts/road/road.gd

@ -98,9 +98,6 @@ func get_torque_penalty(index:int):
if index >= 0: if index >= 0:
if torque_penalties.size() < (index + 1): if torque_penalties.size() < (index + 1):
return get_torque_penalty(index - 1) return get_torque_penalty(index - 1)
if get_rotation().length() != 0:
return torque_penalties[index].rotated(get_rotation().normalized(), get_rotation().length())
else:
return torque_penalties[index] return torque_penalties[index]
return Vector3(0,0,0) return Vector3(0,0,0)

Loading…
Cancel
Save