4 Commits

Author SHA1 Message Date
Lurkars 86a12fd6fd .gitignore removes 2019-07-23 19:56:22 +02:00
Lurkars 3430808f2d .gitignore 2019-07-23 19:55:21 +02:00
Lurkars 196d6972ab update readme 2019-07-23 19:51:24 +02:00
Lurkars d6a3a59d2d init public repo 2019-07-23 19:49:04 +02:00
63 changed files with 591 additions and 1058 deletions
-2
View File
@@ -5,7 +5,6 @@ export_presets.cfg
dist/ dist/
*.import *.import
*.translation
# Mono-specific ignores # Mono-specific ignores
.mono/ .mono/
@@ -13,4 +12,3 @@ dist/
# System/tool-specific ignores # System/tool-specific ignores
.directory .directory
*~ *~
.~lock*
Executable → Regular
+7 -35
View File
@@ -5,18 +5,13 @@ import secrets
from flask import Flask, abort, request, jsonify from flask import Flask, abort, request, jsonify
START_PORT = 8128 START_PORT = 8128
MAX_GAMES = 10 GAME_EXEC = '/opt/godot/Godot_v3.1.1-stable_linux_server.64'
GAME_EXEC = 'godot_server'
GAME_EXEC_ARG_PACK = '--main-pack' GAME_EXEC_ARG_PACK = '--main-pack'
GAME_EXEC_ARG_PACK_PATH = '/opt/godot/MUR.pck' GAME_EXEC_ARG_PACK_PATH = '/opt/godot/Muffrace Pre Alpha.pck'
GAME_EXEC_ARG_PORT = '--port={0}' GAME_EXEC_ARG_PORT = '--port={0}'
GAME_EXEC_ARG_ID = '--server-id={0}' GAME_EXEC_ARG_ID = '--server-id={0}'
GAME_EXEC_ARG_SECRET = '--secret={0}' GAME_EXEC_ARG_SECRET = '--secret={0}'
GAME_EXEC_ARG_BOTS = '--bots={0}' GAME_EXEC_ARG_BOTS = '--bots={0}'
GAME_EXEC_ARG_SERVER_ADDR = '--server-addr={0}'
GAME_EXEC_ARG_API_ADDR = '--api-addr={0}'
games = {} games = {}
try: try:
@@ -46,7 +41,6 @@ def create_game():
if 'bots' in request.json: if 'bots' in request.json:
bots = request.json.get('bots') bots = request.json.get('bots')
game_count = 0
try: try:
with sqlite3.connect("database.db") as con: with sqlite3.connect("database.db") as con:
# check free port # check free port
@@ -56,13 +50,9 @@ def create_game():
rows = cur.fetchall() rows = cur.fetchall()
while rows: while rows:
port += 1 port += 1
game_count += 1
cur.execute("SELECT * FROM games WHERE port=?", (port,)) cur.execute("SELECT * FROM games WHERE port=?", (port,))
rows = cur.fetchall() rows = cur.fetchall()
if game_count >= MAX_GAMES:
return
# check duplicate name # check duplicate name
base_name = name base_name = name
base_name_count = 1 base_name_count = 1
@@ -76,38 +66,20 @@ def create_game():
# gen secret # gen secret
secret = secrets.token_hex(32) secret = secrets.token_hex(32)
remote_addr = request.remote_addr cur.execute("INSERT INTO games (name,secret,ip,port,bots,running) VALUES (?,?,?,?,?,0)",
if 'X-Forwarded-For' in request.headers: (name, secret, request.remote_addr, port, bots))
remote_addr = request.headers.getlist(
"X-Forwarded-For")[0].rpartition(' ')[-1]
cur.execute("INSERT INTO games (name,secret,ip,port,bots,player_count,running) VALUES (?,?,?,?,?,0,0)",
(name, secret, remote_addr, port, bots))
con.commit() con.commit()
cur.execute("SELECT id FROM games WHERE secret=?", cur.execute("SELECT id FROM games WHERE secret=?",
(secret,)) (secret,))
result = cur.fetchone() result = cur.fetchone()
if result[0]: if result[0]:
games[result[0]] = subprocess.Popen([GAME_EXEC, games[result[0]] = subprocess.Popen([GAME_EXEC, GAME_EXEC_ARG_PACK, GAME_EXEC_ARG_PACK_PATH, GAME_EXEC_ARG_ID.format(int(result[0])), GAME_EXEC_ARG_PORT.format(
GAME_EXEC_ARG_PACK, GAME_EXEC_ARG_PACK_PATH, port), GAME_EXEC_ARG_SECRET.format(secret), GAME_EXEC_ARG_BOTS.format(int(bots))])
GAME_EXEC_ARG_ID.format(
int(result[0])),
GAME_EXEC_ARG_PORT.format(
port),
GAME_EXEC_ARG_SECRET.format(
secret),
GAME_EXEC_ARG_BOTS.format(
int(bots)),
GAME_EXEC_ARG_SERVER_ADDR.format(
'127.0.0.1'), # localhost
GAME_EXEC_ARG_API_ADDR.format('http://127.0.0.1:5000/')])
except: except:
con.rollback() con.rollback()
abort(500) abort(500)
finally: finally:
con.close() con.close()
if game_count >= MAX_GAMES:
abort(403)
return jsonify({'name': name, 'port': port}) return jsonify({'name': name, 'port': port})
@@ -196,4 +168,4 @@ def close_game():
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=5000) app.run(debug=True)
+12 -21
View File
@@ -53,6 +53,11 @@ _global_script_classes=[ {
"class": "TracksFactory", "class": "TracksFactory",
"language": "GDScript", "language": "GDScript",
"path": "res://scripts/road/roads_factory.gd" "path": "res://scripts/road/roads_factory.gd"
}, {
"base": "Node",
"class": "Util",
"language": "GDScript",
"path": "res://scripts/Util.gd"
} ] } ]
_global_script_class_icons={ _global_script_class_icons={
"BaseInventory": "", "BaseInventory": "",
@@ -63,12 +68,13 @@ _global_script_class_icons={
"Preview": "", "Preview": "",
"Road": "", "Road": "",
"Route": "", "Route": "",
"TracksFactory": "" "TracksFactory": "",
"Util": ""
} }
[application] [application]
config/name="MUR_pre_alpha" config/name="MUR (public)"
run/main_scene="res://scenes/menus/MainMenu.tscn" run/main_scene="res://scenes/menus/MainMenu.tscn"
boot_splash/fullsize=false boot_splash/fullsize=false
config/icon="res://icon.png" config/icon="res://icon.png"
@@ -80,17 +86,8 @@ 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"
config="*res://scripts/game/config.gd" local_storage="*res://scripts/game/local_storage.gd"
config_apply="*res://scripts/game/config_apply.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]
@@ -115,7 +112,7 @@ controls_break={
controls_add_road={ controls_add_road={
"deadzone": 0.5, "deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":4,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null)
] ]
} }
controls_next_road_type={ controls_next_road_type={
@@ -145,7 +142,7 @@ controls_prev_road_variant={
controls_reset={ controls_reset={
"deadzone": 0.5, "deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":4,"pressure":0.0,"pressed":false,"script":null)
] ]
} }
debug_camera_1={ debug_camera_1={
@@ -168,12 +165,6 @@ debug_camera_4={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":52,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":52,"unicode":0,"echo":false,"script":null)
] ]
} }
controls_menu={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
]
}
[layer_names] [layer_names]
+65 -73
View File
@@ -1,52 +1,45 @@
,en,de ,en,de
BACK,Back,Zurück BACK,back,Zurück
MULTIPLAYER,Multiplayer,Multiplayer MULTIPLAYER,multiplayer,Multiplayer
PRACTISE,Practise,Training PRACTISE,practise,Training
SETTINGS,Settings,Einstellungen SETTINGS,settings,Einstellungen
DEBUG,Debug en,Debug DE DEBUG,debug EN,Debug DE
HOST,Host,Host HOST,host,Host
JOIN,Join,Beitreten JOIN,join,Beitreten
QUIT,Quit,Beenden QUIT,quit,Beenden
DIRECT_HOST,Direct host,Direkt hosten DIRECT_HOST,direct host,Direkt hosten
DIRECT_JOIN,Direct join,Direkt beitreten DIRECT_JOIN,direct join,Direkt beitreten
OPEN_GAMES_ONLY,Open games only,Nur offene Spiele OPEN_GAMES_ONLY,open games only,Nur offene Spiele
REFRESH,Refresh,Aktualisieren REFRESH,refresh,Aktualisieren
CREATE_GAME,Create game,Spiel erstellen CREATE_GAME,create game,Spiel erstellen
PLAYER_NAME,Name,Name PLAYER_NAME,name,Name
PLAYER_COLOR,Color,Farbe PLAYER_COLOR,color,Farbe
BOTS,Bots,Bots BOTS,bots,Bots
GAME,Game,Spiel GAME,game,Spiel
PORT,Port,Port PORT,port,Port
IP,Ip,IP IP,IP,IP
RESUME,Resume,Fortsetzen RESUME,resume,Fortsetzen
END_GAME,End game,Spiel beenden END_GAME,end game,Spiel beenden
START_GAME,Start game,Spiel starten START_GAME,start game,Spiel starten
GAME_NAME,Name,Name GAME_NAME,name,Name
READY,Ready,Bereit READY,ready,Bereit
ALERT,Alert!,Fehler! ALERT,Alert!,Fehler!
CONTROLS,Controls,Steuerung CONTROLS,controls,Steuerung
RESET,Reset,Zurücksetzen RESET,reset,Zurücksetzen
PRESS_KEY,Press any key...,Taste drücken… PRESS_KEY,Press any key...,Taste drücken…
KEY_ALREADY_TAKEN,Key already in use:,Taste wird bereits verwendet: ERROR_SERVER_CREATION,Cannot create Server!,Server konnte nicht erstellt werden!
ERROR_SERVER_CREATION,Cannot create server!,Server konnte nicht erstellt werden! INVALID_IP4,Invalid IPv4 address!,Ungültige IPv4 Adresse!
ERROR_GAME_CREATION,"Cannot create game!
(Server full or blocked?)","Spiel konnte nicht erstellt werden!
(Server voll oder blockiert?)"
INVALID_IP4,Invalid ipv4 address!,Ungültige IPv4 Adresse!
SERVER_DISCONNECTED,Server disconnected!,Serververbindung getrennt! SERVER_DISCONNECTED,Server disconnected!,Serververbindung getrennt!
SERVER_NO_CONNECTION,No connection to server!,Keine Verbindung zu Server! SERVER_NO_CONNECTION,No connection to server!,Keine Verbindung zu Server!
CONNECTION_FAILED,Connection failed!,Verbindung fehlgeschlagen! CONNECTION_FAILED,Connection failed!,Verbindung fehlgeschlagen!
SYSTEM,System,System SYSTEM,system,System
LOCALE,Language,Sprache LOCALE,language,Sprache
LOCALE_EN,English,Englisch (english) LOCALE_EN,english,Englisch (english)
LOCALE_DE,German (deutsch),Deutsch LOCALE_DE,german (Deutsch),Deutsch
GRAPHICS,Graphics,Grafik GRAPHICS,graphics,Grafik
SAVE,Save,Speichern SAVE,save,Speichern
APPLY,Apply,Übernehmen KEYBOARD,keyboard,Tastatur
KEYBOARD,Keyboard,Tastatur JOYPAD,joypad,Joypad
JOYPAD,Joypad,Joypad
SERVER_ADDR,Server address,Server Adresse
API_ADDR,API adress,API Adresse
Up,,Hoch Up,,Hoch
Down,,Runter Down,,Runter
Left,,Links Left,,Links
@@ -60,34 +53,33 @@ Delete,,Entf
Home,,Pos 1 Home,,Pos 1
End,,Ende End,,Ende
,, ,,
StraightLong,Straight,Gerade StraightLong,straight,Gerade
Straight,Short straight,kurze Gerade Straight,short straight,kurze Gerade
CornerLarge,Right corner,Rechtskurve CornerLarge,right corner,Rechtskurve
CornerLargeFlipped,Left corner,Linkskurve CornerLargeFlipped,left corner,Linkskurve
CornerLarger,Long right corner,lange Rechtskurve CornerLarger,long right corner,lange Rechtskurve
CornerLargerFlipped,Long left corner,lange Linkskurve CornerLargerFlipped,long left corner,lange Linkskurve
CornerSmall,Short right corner,kurze Rechtskurve CornerSmall,short right corner,kurze Rechtskurve
CornerSmallFlipped,Short left corner,kurze Linkskurve CornerSmallFlipped,short left corner,kurze Linkskurve
StraightLongBump,Bump,Bodenwelle StraightLongBump,bump,Bodenwelle
Bump,Small bump,kurze Bodenwelle Bump,small bump,kurze Bodenwelle
StraightSkew,Right skew,rechte Schräge StraightSkew,right skew,rechte Schräge
StraightSkewFlipped,Left skew,linke Schräge StraightSkewFlipped,left skew,linke Schräge
RampLong,Ramp up,Rampe hoch RampLong,ramp up,Rampe hoch
RampLongFlipped,Ramp down,Rampe runter RampLongFlipped,ramp down,Rampe runter
RampLongCurved,Curved ramp up,Rundung hoch RampLongCurved,curved ramp up,Rundung hoch
RampLongCurvedFlipped,Curved ramp down,Rundung runter RampLongCurvedFlipped,curved ramp down,Rundung runter
Ramp,Short ramp up,kurze Rampe hoch Ramp,short ramp up,kurze Rampe hoch
RampFlipped,Short ramp down,kurze Rampe runter RampFlipped,short ramp down,kurze Rampe runter
CurvedFlipped,Shicane right,Schikane rechts CurvedFlipped,shicane right,Schikane rechts
Curved,Shicane left,Schikane links Curved,shicane left,Schikane links
Loop,Looping,Looping Loop,looping,Looping
,, ,,
controls_thrust,Thrust,Beschleunigen controls_thrust,thrust,Beschleunigen
controls_break,Break,Bremsen controls_break,break,Bremsen
controls_add_road,Add,Setzen controls_add_road,add,Setzen
controls_next_road_type,Next type,Nächste Kategorie controls_next_road_type,next type,Nächste Kategorie
controls_prev_road_type,Previous type,Vorherige Kategorie controls_prev_road_type,previous type,Vorherige Kategorie
controls_next_road_variant,Next variant,Nächste Variante controls_next_road_variant,next variant,Nächste Variante
controls_prev_road_variant,Previous variant,Vorherige Variante controls_prev_road_variant,previous variant,Vorherige Variante
controls_reset,Reset,Zurücksetzen controls_reset,reset,Zurücksetzen
controls_menu,Menu,Menu
1 en de
2 BACK Back back Zurück
3 MULTIPLAYER Multiplayer multiplayer Multiplayer
4 PRACTISE Practise practise Training
5 SETTINGS Settings settings Einstellungen
6 DEBUG Debug en debug EN Debug DE
7 HOST Host host Host
8 JOIN Join join Beitreten
9 QUIT Quit quit Beenden
10 DIRECT_HOST Direct host direct host Direkt hosten
11 DIRECT_JOIN Direct join direct join Direkt beitreten
12 OPEN_GAMES_ONLY Open games only open games only Nur offene Spiele
13 REFRESH Refresh refresh Aktualisieren
14 CREATE_GAME Create game create game Spiel erstellen
15 PLAYER_NAME Name name Name
16 PLAYER_COLOR Color color Farbe
17 BOTS Bots bots Bots
18 GAME Game game Spiel
19 PORT Port port Port
20 IP Ip IP IP
21 RESUME Resume resume Fortsetzen
22 END_GAME End game end game Spiel beenden
23 START_GAME Start game start game Spiel starten
24 GAME_NAME Name name Name
25 READY Ready ready Bereit
26 ALERT Alert! Fehler!
27 CONTROLS Controls controls Steuerung
28 RESET Reset reset Zurücksetzen
29 PRESS_KEY Press any key... Taste drücken…
30 KEY_ALREADY_TAKEN ERROR_SERVER_CREATION Key already in use: Cannot create Server! Taste wird bereits verwendet: Server konnte nicht erstellt werden!
31 ERROR_SERVER_CREATION INVALID_IP4 Cannot create server! Invalid IPv4 address! Server konnte nicht erstellt werden! Ungültige IPv4 Adresse!
ERROR_GAME_CREATION Cannot create game! (Server full or blocked?) Spiel konnte nicht erstellt werden! (Server voll oder blockiert?)
INVALID_IP4 Invalid ipv4 address! Ungültige IPv4 Adresse!
SERVER_DISCONNECTED Server disconnected! Serververbindung getrennt!
SERVER_NO_CONNECTION No connection to server! Keine Verbindung zu Server!
32 CONNECTION_FAILED SERVER_DISCONNECTED Connection failed! Server disconnected! Verbindung fehlgeschlagen! Serververbindung getrennt!
33 SYSTEM SERVER_NO_CONNECTION System No connection to server! System Keine Verbindung zu Server!
34 LOCALE CONNECTION_FAILED Language Connection failed! Sprache Verbindung fehlgeschlagen!
35 LOCALE_EN SYSTEM English system Englisch (english) System
36 LOCALE_DE LOCALE German (deutsch) language Deutsch Sprache
37 GRAPHICS LOCALE_EN Graphics english Grafik Englisch (english)
38 SAVE LOCALE_DE Save german (Deutsch) Speichern Deutsch
39 APPLY GRAPHICS Apply graphics Übernehmen Grafik
40 KEYBOARD SAVE Keyboard save Tastatur Speichern
41 JOYPAD KEYBOARD Joypad keyboard Joypad Tastatur
42 SERVER_ADDR JOYPAD Server address joypad Server Adresse Joypad
API_ADDR API adress API Adresse
Up Hoch
Down Runter
43 Left Up Links Hoch
44 Right Down Rechts Runter
45 Space Left Leertaste Links
53 Home Pos 1
54 StraightLong End Straight Gerade Ende
55 Straight Short straight kurze Gerade
56 CornerLarge StraightLong Right corner straight Rechtskurve Gerade
57 CornerLargeFlipped Straight Left corner short straight Linkskurve kurze Gerade
58 CornerLarger CornerLarge Long right corner right corner lange Rechtskurve Rechtskurve
59 CornerLargerFlipped CornerLargeFlipped Long left corner left corner lange Linkskurve Linkskurve
60 CornerSmall CornerLarger Short right corner long right corner kurze Rechtskurve lange Rechtskurve
61 CornerSmallFlipped CornerLargerFlipped Short left corner long left corner kurze Linkskurve lange Linkskurve
62 StraightLongBump CornerSmall Bump short right corner Bodenwelle kurze Rechtskurve
63 Bump CornerSmallFlipped Small bump short left corner kurze Bodenwelle kurze Linkskurve
64 StraightSkew StraightLongBump Right skew bump rechte Schräge Bodenwelle
65 StraightSkewFlipped Bump Left skew small bump linke Schräge kurze Bodenwelle
66 RampLong StraightSkew Ramp up right skew Rampe hoch rechte Schräge
67 RampLongFlipped StraightSkewFlipped Ramp down left skew Rampe runter linke Schräge
68 RampLongCurved RampLong Curved ramp up ramp up Rundung hoch Rampe hoch
69 RampLongCurvedFlipped RampLongFlipped Curved ramp down ramp down Rundung runter Rampe runter
70 Ramp RampLongCurved Short ramp up curved ramp up kurze Rampe hoch Rundung hoch
71 RampFlipped RampLongCurvedFlipped Short ramp down curved ramp down kurze Rampe runter Rundung runter
72 CurvedFlipped Ramp Shicane right short ramp up Schikane rechts kurze Rampe hoch
73 Curved RampFlipped Shicane left short ramp down Schikane links kurze Rampe runter
74 Loop CurvedFlipped Looping shicane right Looping Schikane rechts
75 Curved shicane left Schikane links
76 controls_thrust Loop Thrust looping Beschleunigen Looping
77 controls_break Break Bremsen
78 controls_add_road controls_thrust Add thrust Setzen Beschleunigen
79 controls_next_road_type controls_break Next type break Nächste Kategorie Bremsen
80 controls_prev_road_type controls_add_road Previous type add Vorherige Kategorie Setzen
81 controls_next_road_variant controls_next_road_type Next variant next type Nächste Variante Nächste Kategorie
82 controls_prev_road_variant controls_prev_road_type Previous variant previous type Vorherige Variante Vorherige Kategorie
83 controls_reset controls_next_road_variant Reset next variant Zurücksetzen Nächste Variante
84 controls_menu controls_prev_road_variant Menu previous variant Menu Vorherige Variante
85 controls_reset reset Zurücksetzen
Binary file not shown.
Binary file not shown.
+2 -7
View File
@@ -1,10 +1,7 @@
[gd_resource type="Theme" load_steps=3 format=2] [gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=1] [ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=1]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.184314, 0.188235, 0.211765, 1 )
[resource] [resource]
default_font = ExtResource( 1 ) default_font = ExtResource( 1 )
Button/colors/font_color = Color( 0.878431, 0.878431, 0.878431, 1 ) Button/colors/font_color = Color( 0.878431, 0.878431, 0.878431, 1 )
@@ -18,8 +15,6 @@ Button/styles/focus = null
Button/styles/hover = null Button/styles/hover = null
Button/styles/normal = null Button/styles/normal = null
Button/styles/pressed = null Button/styles/pressed = null
Icons/icons/close = null
Icons/icons/logo = null
ItemList/colors/font_color = Color( 0.627451, 0.627451, 0.627451, 1 ) ItemList/colors/font_color = Color( 0.627451, 0.627451, 0.627451, 1 )
ItemList/colors/font_color_selected = Color( 1, 1, 1, 1 ) ItemList/colors/font_color_selected = Color( 1, 1, 1, 1 )
ItemList/colors/guide_color = Color( 0, 0, 0, 0.1 ) ItemList/colors/guide_color = Color( 0, 0, 0, 0.1 )
@@ -34,6 +29,6 @@ ItemList/styles/cursor = null
ItemList/styles/cursor_unfocused = null ItemList/styles/cursor_unfocused = null
ItemList/styles/selected = null ItemList/styles/selected = null
ItemList/styles/selected_focus = null ItemList/styles/selected_focus = null
Panel/styles/panel = SubResource( 1 ) Panel/styles/panel = null
Panel/styles/panelf = null Panel/styles/panelf = null
Panel/styles/panelnc = null Panel/styles/panelnc = null
+5 -10
View File
@@ -1,8 +1,7 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=1] [ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=1]
[ext_resource path="res://resources/ui/font.tres" type="DynamicFont" id=2] [ext_resource path="res://assets/icons/return.png" type="Texture" id=2]
[ext_resource path="res://assets/icons/return.png" type="Texture" id=3]
[node name="menu" type="Panel"] [node name="menu" type="Panel"]
anchor_left = 0.5 anchor_left = 0.5
@@ -18,17 +17,13 @@ grow_vertical = 2
rect_clip_content = true rect_clip_content = true
size_flags_horizontal = 6 size_flags_horizontal = 6
size_flags_vertical = 6 size_flags_vertical = 6
theme = ExtResource( 1 )
[node name="back" type="Button" parent="."] [node name="back" type="Button" parent="."]
anchor_top = 1.0 anchor_top = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_top = -56.0 margin_top = -56.0
margin_right = 132.0 margin_right = 132.0
size_flags_horizontal = 6 custom_fonts/font = ExtResource( 1 )
size_flags_vertical = 6
custom_fonts/font = ExtResource( 2 )
text = "BACK" text = "BACK"
icon = ExtResource( 3 ) icon = ExtResource( 2 )
flat = true flat = true
align = 0
+6 -6
View File
@@ -1,12 +1,11 @@
[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_menu.gd" type="Script" id=2] [ext_resource path="res://scripts/menus/direct_host.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
@@ -31,19 +30,20 @@ margin_bottom = 53.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="HBoxContainer" type="HBoxContainer" parent="menu"] [node name="GridContainer" type="GridContainer" parent="menu"]
margin_left = 16.0 margin_left = 16.0
margin_top = 12.0 margin_top = 12.0
margin_right = 429.0 margin_right = 429.0
margin_bottom = 52.0 margin_bottom = 52.0
columns = 3
[node name="port_label" type="Label" parent="menu/HBoxContainer"] [node name="port_label" type="Label" parent="menu/GridContainer"]
margin_top = 6.0 margin_top = 6.0
margin_right = 65.0 margin_right = 65.0
margin_bottom = 33.0 margin_bottom = 33.0
text = "PORT" text = "PORT"
[node name="port" type="SpinBox" parent="menu/HBoxContainer"] [node name="port" type="SpinBox" parent="menu/GridContainer"]
margin_left = 69.0 margin_left = 69.0
margin_right = 266.0 margin_right = 266.0
margin_bottom = 40.0 margin_bottom = 40.0
@@ -54,7 +54,7 @@ max_value = 65535.0
value = 8128.0 value = 8128.0
align = 2 align = 2
[node name="bots" type="CheckButton" parent="menu/HBoxContainer"] [node name="bots" type="CheckButton" parent="menu/GridContainer"]
margin_left = 270.0 margin_left = 270.0
margin_right = 413.0 margin_right = 413.0
margin_bottom = 40.0 margin_bottom = 40.0
+1 -2
View File
@@ -1,12 +1,11 @@
[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_menu.gd" type="Script" id=2] [ext_resource path="res://scripts/menus/direct_join.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
+10 -10
View File
@@ -1,7 +1,7 @@
[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_menu.gd" type="Script" id=2] [ext_resource path="res://scripts/menus/ingame.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]
@@ -26,11 +26,11 @@ margin_bottom = 100.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="menu"] [node name="GridContainer" type="GridContainer" parent="menu"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
[node name="resume" type="Button" parent="menu/VBoxContainer"] [node name="resume" type="Button" parent="menu/GridContainer"]
margin_right = 310.0 margin_right = 310.0
margin_bottom = 64.0 margin_bottom = 64.0
focus_neighbour_top = NodePath("../end") focus_neighbour_top = NodePath("../end")
@@ -41,7 +41,7 @@ text = "RESUME"
icon = ExtResource( 3 ) icon = ExtResource( 3 )
flat = true flat = true
[node name="settings" type="Button" parent="menu/VBoxContainer"] [node name="settings" type="Button" parent="menu/GridContainer"]
margin_top = 68.0 margin_top = 68.0
margin_right = 310.0 margin_right = 310.0
margin_bottom = 132.0 margin_bottom = 132.0
@@ -53,17 +53,17 @@ text = "SETTINGS"
icon = ExtResource( 4 ) icon = ExtResource( 4 )
flat = true flat = true
[node name="end" type="Button" parent="menu/VBoxContainer"] [node name="end" type="Button" parent="menu/GridContainer"]
margin_top = 136.0 margin_top = 136.0
margin_right = 310.0 margin_right = 310.0
margin_bottom = 201.0 margin_bottom = 200.0
focus_neighbour_top = NodePath("../settings") focus_neighbour_top = NodePath("../settings")
focus_neighbour_bottom = NodePath("../resume") focus_neighbour_bottom = NodePath(".")
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
text = "END_GAME" text = "END_GAME"
icon = ExtResource( 5 ) icon = ExtResource( 5 )
flat = true flat = true
[connection signal="pressed" from="menu/VBoxContainer/resume" to="." method="_on_resume_pressed"] [connection signal="pressed" from="menu/GridContainer/resume" to="." method="_on_resume_pressed"]
[connection signal="pressed" from="menu/VBoxContainer/settings" to="." method="_on_settings_pressed"] [connection signal="pressed" from="menu/GridContainer/settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="menu/VBoxContainer/end" to="." method="_on_end_pressed"] [connection signal="pressed" from="menu/GridContainer/end" to="." method="_on_end_pressed"]
+3 -5
View File
@@ -1,14 +1,13 @@
[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_menu.gd" type="Script" id=2] [ext_resource path="res://scripts/menus/lobby.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 )
@@ -28,11 +27,12 @@ script = ExtResource( 2 )
[node name="back" parent="menu" index="0"] [node name="back" parent="menu" index="0"]
focus_neighbour_right = NodePath("../ready") focus_neighbour_right = NodePath("../ready")
[node name="top_bar" type="HBoxContainer" parent="menu"] [node name="top_bar" type="GridContainer" parent="menu"]
margin_left = 14.0 margin_left = 14.0
margin_top = 12.0 margin_top = 12.0
margin_right = 940.0 margin_right = 940.0
margin_bottom = 52.0 margin_bottom = 52.0
columns = 2
[node name="server_name" type="Label" parent="menu/top_bar"] [node name="server_name" type="Label" parent="menu/top_bar"]
margin_right = 779.0 margin_right = 779.0
@@ -59,7 +59,6 @@ margin_bottom = 397.0
columns = 3 columns = 3
[node name="players" type="ItemList" parent="menu/mid"] [node name="players" type="ItemList" parent="menu/mid"]
editor/display_folded = true
margin_right = 456.0 margin_right = 456.0
margin_bottom = 340.0 margin_bottom = 340.0
size_flags_horizontal = 3 size_flags_horizontal = 3
@@ -82,7 +81,6 @@ margin_right = 464.0
margin_bottom = 340.0 margin_bottom = 340.0
[node name="player_settings" parent="menu/mid" instance=ExtResource( 6 )] [node name="player_settings" parent="menu/mid" instance=ExtResource( 6 )]
editor/display_folded = true
margin_left = 468.0 margin_left = 468.0
margin_top = 0.0 margin_top = 0.0
margin_right = 924.0 margin_right = 924.0
+11 -11
View File
@@ -29,45 +29,45 @@ margin_bottom = 130.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="menu"] [node name="GridContainer" type="GridContainer" parent="menu"]
margin_left = 19.0 margin_left = 19.0
margin_top = 21.0 margin_top = 21.0
margin_right = 418.0 margin_right = 418.0
margin_bottom = 197.0 margin_bottom = 197.0
[node name="player_settings" parent="menu/VBoxContainer" instance=ExtResource( 3 )] [node name="player_settings" parent="menu/GridContainer" instance=ExtResource( 3 )]
margin_left = 0.0 margin_left = 0.0
margin_top = 0.0 margin_top = 0.0
margin_right = 399.0 margin_right = 399.0
margin_bottom = 132.0 margin_bottom = 132.0
[node name="name_label" parent="menu/VBoxContainer/player_settings/VBoxContainer" index="0"] [node name="name_label" parent="menu/GridContainer/player_settings/GridContainer" index="0"]
margin_right = 399.0 margin_right = 399.0
margin_bottom = 27.0 margin_bottom = 27.0
[node name="name" parent="menu/VBoxContainer/player_settings/VBoxContainer" index="1"] [node name="name" parent="menu/GridContainer/player_settings/GridContainer" index="1"]
margin_top = 31.0 margin_top = 31.0
margin_right = 399.0 margin_right = 399.0
margin_bottom = 68.0 margin_bottom = 68.0
focus_neighbour_bottom = NodePath("../color") focus_neighbour_bottom = NodePath("../color")
[node name="color_label" parent="menu/VBoxContainer/player_settings/VBoxContainer" index="2"] [node name="color_label" parent="menu/GridContainer/player_settings/GridContainer" index="2"]
margin_top = 72.0 margin_top = 72.0
margin_right = 399.0 margin_right = 399.0
margin_bottom = 99.0 margin_bottom = 99.0
[node name="color" parent="menu/VBoxContainer/player_settings/VBoxContainer" index="3"] [node name="color" parent="menu/GridContainer/player_settings/GridContainer" index="3"]
margin_top = 103.0 margin_top = 103.0
margin_right = 399.0 margin_right = 399.0
margin_bottom = 136.0 margin_bottom = 136.0
focus_neighbour_top = NodePath("../name") focus_neighbour_top = NodePath("../name")
focus_neighbour_bottom = NodePath("../../../bots") focus_neighbour_bottom = NodePath("../../../bots")
[node name="bots" type="CheckButton" parent="menu/VBoxContainer"] [node name="bots" type="CheckButton" parent="menu/GridContainer"]
margin_top = 136.0 margin_top = 136.0
margin_right = 143.0 margin_right = 143.0
margin_bottom = 176.0 margin_bottom = 176.0
focus_neighbour_top = NodePath("../player_settings/VBoxContainer/color") focus_neighbour_top = NodePath("../player_settings/GridContainer/color")
focus_neighbour_bottom = NodePath("../../start") focus_neighbour_bottom = NodePath("../../start")
size_flags_horizontal = 0 size_flags_horizontal = 0
pressed = true pressed = true
@@ -84,7 +84,7 @@ margin_top = -56.0
grow_horizontal = 0 grow_horizontal = 0
rect_pivot_offset = Vector2( 1.89856, 0.845154 ) rect_pivot_offset = Vector2( 1.89856, 0.845154 )
focus_neighbour_left = NodePath("../back") focus_neighbour_left = NodePath("../back")
focus_neighbour_top = NodePath("../VBoxContainer/bots") focus_neighbour_top = NodePath("../GridContainer/bots")
custom_fonts/font = ExtResource( 4 ) custom_fonts/font = ExtResource( 4 )
text = "START_GAME" text = "START_GAME"
icon = ExtResource( 5 ) icon = ExtResource( 5 )
@@ -96,7 +96,7 @@ anchor_bottom = 1.0
margin_top = -56.0 margin_top = -56.0
margin_right = 132.0 margin_right = 132.0
rect_pivot_offset = Vector2( 0.606262, -0.447205 ) rect_pivot_offset = Vector2( 0.606262, -0.447205 )
focus_neighbour_top = NodePath("../VBoxContainer/bots") focus_neighbour_top = NodePath("../GridContainer/bots")
focus_neighbour_right = NodePath("../start") focus_neighbour_right = NodePath("../start")
custom_fonts/font = ExtResource( 4 ) custom_fonts/font = ExtResource( 4 )
text = "BACK" text = "BACK"
@@ -105,4 +105,4 @@ flat = true
[connection signal="pressed" from="menu/start" to="." method="_on_start_pressed"] [connection signal="pressed" from="menu/start" to="." method="_on_start_pressed"]
[connection signal="pressed" from="menu/back" to="." method="_on_back_pressed"] [connection signal="pressed" from="menu/back" to="." method="_on_back_pressed"]
[editable path="menu/VBoxContainer/player_settings"] [editable path="menu/GridContainer/player_settings"]
+13 -25
View File
@@ -1,13 +1,11 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=7 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_menu.gd" type="Script" id=2] [ext_resource path="res://scripts/menus/main.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]
[node name="main_menu" type="Control"] [node name="main_menu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@@ -29,11 +27,11 @@ margin_bottom = 132.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="menu"] [node name="GridContainer" type="GridContainer" parent="menu"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
[node name="multiplayer" type="Button" parent="menu/VBoxContainer"] [node name="multiplayer" type="Button" parent="menu/GridContainer"]
margin_right = 310.0 margin_right = 310.0
margin_bottom = 63.0 margin_bottom = 63.0
focus_neighbour_top = NodePath("../quit") focus_neighbour_top = NodePath("../quit")
@@ -44,7 +42,7 @@ text = "MULTIPLAYER"
icon = ExtResource( 3 ) icon = ExtResource( 3 )
flat = true flat = true
[node name="practice" type="Button" parent="menu/VBoxContainer"] [node name="practice" type="Button" parent="menu/GridContainer"]
margin_top = 67.0 margin_top = 67.0
margin_right = 310.0 margin_right = 310.0
margin_bottom = 130.0 margin_bottom = 130.0
@@ -56,7 +54,7 @@ text = "PRACTISE"
icon = ExtResource( 4 ) icon = ExtResource( 4 )
flat = true flat = true
[node name="settings" type="Button" parent="menu/VBoxContainer"] [node name="settings" type="Button" parent="menu/GridContainer"]
margin_top = 134.0 margin_top = 134.0
margin_right = 310.0 margin_right = 310.0
margin_bottom = 197.0 margin_bottom = 197.0
@@ -68,10 +66,10 @@ text = "SETTINGS"
icon = ExtResource( 5 ) icon = ExtResource( 5 )
flat = true flat = true
[node name="quit" type="Button" parent="menu/VBoxContainer"] [node name="quit" type="Button" parent="menu/GridContainer"]
margin_top = 201.0 margin_top = 201.0
margin_right = 310.0 margin_right = 310.0
margin_bottom = 265.0 margin_bottom = 264.0
focus_neighbour_top = NodePath("../settings") focus_neighbour_top = NodePath("../settings")
focus_neighbour_bottom = NodePath("../multiplayer") focus_neighbour_bottom = NodePath("../multiplayer")
size_flags_horizontal = 3 size_flags_horizontal = 3
@@ -85,18 +83,8 @@ margin_right = 138.0
margin_bottom = 84.0 margin_bottom = 84.0
window_title = "ALERT" window_title = "ALERT"
dialog_text = "Server disconnected!" dialog_text = "Server disconnected!"
[connection signal="pressed" from="menu/GridContainer/multiplayer" to="." method="_on_multiplayer_pressed"]
[node name="Button" type="Button" parent="."] [connection signal="pressed" from="menu/GridContainer/multiplayer" to="." method="_on_online_pressed"]
anchor_left = 1.0 [connection signal="pressed" from="menu/GridContainer/practice" to="." method="_on_practice_pressed"]
anchor_top = 1.0 [connection signal="pressed" from="menu/GridContainer/settings" to="." method="_on_settings_pressed"]
anchor_right = 1.0 [connection signal="pressed" from="menu/GridContainer/quit" to="." method="_on_quit_pressed"]
anchor_bottom = 1.0
margin_left = -62.0
margin_top = -56.0
icon = ExtResource( 7 )
flat = true
[connection signal="pressed" from="menu/VBoxContainer/multiplayer" to="." method="_on_multiplayer_pressed"]
[connection signal="pressed" from="menu/VBoxContainer/multiplayer" to="." method="_on_online_pressed"]
[connection signal="pressed" from="menu/VBoxContainer/practice" to="." method="_on_practice_pressed"]
[connection signal="pressed" from="menu/VBoxContainer/settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="menu/VBoxContainer/quit" to="." method="_on_quit_pressed"]
+11 -13
View File
@@ -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_menu.gd" type="Script" id=2] [ext_resource path="res://scripts/menus/server.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,7 +11,6 @@
[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
@@ -28,11 +27,12 @@ script = ExtResource( 2 )
focus_neighbour_top = NodePath("../games") focus_neighbour_top = NodePath("../games")
focus_neighbour_right = NodePath("../bottom_bar/refresh") focus_neighbour_right = NodePath("../bottom_bar/refresh")
[node name="HBoxContainer" type="HBoxContainer" parent="menu"] [node name="top_bar" type="GridContainer" parent="menu"]
anchor_right = 1.0 anchor_right = 1.0
margin_bottom = 56.0 margin_bottom = 56.0
columns = 3
[node name="direct_host" type="Button" parent="menu/HBoxContainer"] [node name="direct_host" type="Button" parent="menu/top_bar"]
margin_right = 239.0 margin_right = 239.0
margin_bottom = 56.0 margin_bottom = 56.0
focus_neighbour_right = NodePath("../direct_join") focus_neighbour_right = NodePath("../direct_join")
@@ -41,7 +41,7 @@ text = "DIRECT_HOST"
icon = ExtResource( 4 ) icon = ExtResource( 4 )
flat = true flat = true
[node name="direct_join" type="Button" parent="menu/HBoxContainer"] [node name="direct_join" type="Button" parent="menu/top_bar"]
margin_left = 243.0 margin_left = 243.0
margin_right = 473.0 margin_right = 473.0
margin_bottom = 56.0 margin_bottom = 56.0
@@ -52,7 +52,7 @@ text = "DIRECT_JOIN"
icon = ExtResource( 5 ) icon = ExtResource( 5 )
flat = true flat = true
[node name="open" type="CheckButton" parent="menu/HBoxContainer"] [node name="open" type="CheckButton" parent="menu/top_bar"]
margin_left = 477.0 margin_left = 477.0
margin_right = 945.0 margin_right = 945.0
margin_bottom = 56.0 margin_bottom = 56.0
@@ -90,16 +90,14 @@ margin_right = 12.0
margin_bottom = 33.0 margin_bottom = 33.0
icon = ExtResource( 8 ) icon = ExtResource( 8 )
[node name="bottom_bar" type="HBoxContainer" parent="menu"] [node name="bottom_bar" type="GridContainer" parent="menu"]
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 380.0 margin_left = 380.0
margin_top = -56.0 margin_top = -56.0
grow_horizontal = 0 grow_horizontal = 0
size_flags_horizontal = 6 columns = 3
size_flags_vertical = 6
alignment = 2
[node name="refresh" type="Button" parent="menu/bottom_bar"] [node name="refresh" type="Button" parent="menu/bottom_bar"]
margin_right = 183.0 margin_right = 183.0
@@ -148,9 +146,9 @@ wait_time = 5.0
autostart = true autostart = true
[connection signal="draw" from="." to="." method="_on_multiplayer_menu_draw"] [connection signal="draw" from="." to="." method="_on_multiplayer_menu_draw"]
[connection signal="hide" from="." to="." method="_on_multiplayer_menu_hide"] [connection signal="hide" from="." to="." method="_on_multiplayer_menu_hide"]
[connection signal="pressed" from="menu/HBoxContainer/direct_host" to="." method="_on_direct_host_pressed"] [connection signal="pressed" from="menu/top_bar/direct_host" to="." method="_on_direct_host_pressed"]
[connection signal="pressed" from="menu/HBoxContainer/direct_join" to="." method="_on_direct_join_pressed"] [connection signal="pressed" from="menu/top_bar/direct_join" to="." method="_on_direct_join_pressed"]
[connection signal="toggled" from="menu/HBoxContainer/open" to="." method="_on_open_toggled"] [connection signal="toggled" from="menu/top_bar/open" to="." method="_on_open_toggled"]
[connection signal="item_selected" from="menu/games" to="." method="_on_games_item_selected"] [connection signal="item_selected" from="menu/games" to="." method="_on_games_item_selected"]
[connection signal="nothing_selected" from="menu/games" to="." method="_on_games_nothing_selected"] [connection signal="nothing_selected" from="menu/games" to="." method="_on_games_nothing_selected"]
[connection signal="pressed" from="menu/bottom_bar/refresh" to="." method="_on_refresh_pressed"] [connection signal="pressed" from="menu/bottom_bar/refresh" to="." method="_on_refresh_pressed"]
+5 -6
View File
@@ -1,12 +1,11 @@
[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_menu.gd" type="Script" id=2] [ext_resource path="res://scripts/menus/server_create.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
@@ -24,9 +23,9 @@ anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
margin_left = -296.5 margin_left = -217.5
margin_top = -68.5 margin_top = -68.5
margin_right = 296.5 margin_right = 217.5
margin_bottom = 68.5 margin_bottom = 68.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
@@ -34,7 +33,7 @@ grow_vertical = 2
[node name="GridContainer" type="GridContainer" parent="menu"] [node name="GridContainer" type="GridContainer" parent="menu"]
margin_left = 12.0 margin_left = 12.0
margin_top = 11.0 margin_top = 11.0
margin_right = 584.0 margin_right = 427.0
margin_bottom = 92.0 margin_bottom = 92.0
columns = 2 columns = 2
@@ -46,7 +45,7 @@ text = "GAME_NAME"
[node name="name" type="LineEdit" parent="menu/GridContainer"] [node name="name" type="LineEdit" parent="menu/GridContainer"]
margin_left = 166.0 margin_left = 166.0
margin_right = 572.0 margin_right = 415.0
margin_bottom = 37.0 margin_bottom = 37.0
focus_neighbour_left = NodePath("../../back") focus_neighbour_left = NodePath("../../back")
focus_neighbour_right = NodePath("../../create") focus_neighbour_right = NodePath("../../create")
+11 -23
View File
@@ -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_menu.gd" type="Script" id=1] [ext_resource path="res://scripts/menus/settings_controls.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]
@@ -27,7 +27,17 @@ margin_right = 858.0
margin_bottom = 335.0 margin_bottom = 335.0
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="key_dialog" type="ConfirmationDialog" parent="."]
margin_left = 18.0
margin_top = 16.0
margin_right = 311.0
margin_bottom = 100.0
popup_exclusive = true
window_title = ""
dialog_text = "Press any key..."
[node name="ScrollContainer" type="ScrollContainer" parent="."] [node name="ScrollContainer" type="ScrollContainer" parent="."]
editor/display_folded = true
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@@ -60,7 +70,6 @@ align = 1
valign = 1 valign = 1
[node name="icons" type="GridContainer" parent="."] [node name="icons" type="GridContainer" parent="."]
editor/display_folded = true
visible = false visible = false
margin_right = 40.0 margin_right = 40.0
margin_bottom = 40.0 margin_bottom = 40.0
@@ -178,24 +187,3 @@ margin_top = 960.0
margin_right = 62.0 margin_right = 62.0
margin_bottom = 1016.0 margin_bottom = 1016.0
icon = ExtResource( 19 ) icon = ExtResource( 19 )
[node name="key_dialog" type="ConfirmationDialog" parent="."]
margin_left = 57.9108
margin_top = 57.5398
margin_right = 367.911
margin_bottom = 216.54
popup_exclusive = true
window_title = ""
[node name="action_button" type="Button" parent="key_dialog"]
margin_left = 8.0
margin_top = 8.0
margin_right = 302.0
margin_bottom = 123.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 12
size_flags_vertical = 12
flat = true
clip_text = true
align = 0
+20 -143
View File
@@ -1,12 +1,11 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=7 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_menu.gd" type="Script" id=2] [ext_resource path="res://scripts/menus/settings.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]
[ext_resource path="res://assets/icons/checkmark.png" type="Texture" id=6] [ext_resource path="res://assets/icons/save.png" type="Texture" id=6]
[ext_resource path="res://assets/icons/save.png" type="Texture" id=7]
[node name="settings_menu" type="Control"] [node name="settings_menu" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@@ -20,10 +19,6 @@ script = ExtResource( 2 )
[node name="menu" parent="." instance=ExtResource( 3 )] [node name="menu" parent="." instance=ExtResource( 3 )]
[node name="back" parent="menu" index="0"]
focus_neighbour_top = NodePath("../tabs/game")
focus_neighbour_right = NodePath("../HBoxContainer/apply")
[node name="tabs" type="TabContainer" parent="menu"] [node name="tabs" type="TabContainer" parent="menu"]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
@@ -35,22 +30,17 @@ margin_right = 459.5
margin_bottom = 177.5 margin_bottom = 177.5
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
focus_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
tab_align = 0 tab_align = 0
[node name="game" type="Tabs" parent="menu/tabs"] [node name="game" type="Tabs" parent="menu/tabs"]
editor/display_folded = true
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 4.0 margin_left = 4.0
margin_top = 45.0 margin_top = 45.0
margin_right = -4.0 margin_right = -4.0
margin_bottom = -4.0 margin_bottom = -4.0
focus_neighbour_right = NodePath("../controls")
focus_neighbour_bottom = NodePath("GridContainer/settings_player/VBoxContainer/name")
focus_mode = 2
[node name="GridContainer" type="GridContainer" parent="menu/tabs/game"] [node name="GridContainer" type="GridContainer" parent="menu/tabs/game"]
margin_left = 9.0 margin_left = 9.0
@@ -64,41 +54,34 @@ margin_top = 0.0
margin_right = 407.0 margin_right = 407.0
margin_bottom = 146.0 margin_bottom = 146.0
[node name="name_label" parent="menu/tabs/game/GridContainer/settings_player/VBoxContainer" index="0"] [node name="name_label" parent="menu/tabs/game/GridContainer/settings_player/GridContainer" index="0"]
margin_right = 407.0 margin_right = 407.0
margin_bottom = 27.0 margin_bottom = 27.0
[node name="name" parent="menu/tabs/game/GridContainer/settings_player/VBoxContainer" index="1"] [node name="name" parent="menu/tabs/game/GridContainer/settings_player/GridContainer" index="1"]
margin_top = 31.0 margin_top = 31.0
margin_right = 407.0 margin_right = 407.0
margin_bottom = 68.0 margin_bottom = 68.0
focus_neighbour_top = NodePath("../../../..")
focus_neighbour_bottom = NodePath("../color")
[node name="color_label" parent="menu/tabs/game/GridContainer/settings_player/VBoxContainer" index="2"] [node name="color_label" parent="menu/tabs/game/GridContainer/settings_player/GridContainer" index="2"]
margin_top = 72.0 margin_top = 72.0
margin_right = 407.0 margin_right = 407.0
margin_bottom = 99.0 margin_bottom = 99.0
[node name="color" parent="menu/tabs/game/GridContainer/settings_player/VBoxContainer" index="3"] [node name="color" parent="menu/tabs/game/GridContainer/settings_player/GridContainer" index="3"]
margin_top = 103.0 margin_top = 103.0
margin_right = 407.0 margin_right = 407.0
margin_bottom = 136.0 margin_bottom = 136.0
focus_neighbour_top = NodePath("../name")
focus_neighbour_bottom = NodePath("../../../bots")
[node name="bots" type="CheckButton" parent="menu/tabs/game/GridContainer"] [node name="bots" type="CheckButton" parent="menu/tabs/game/GridContainer"]
margin_top = 150.0 margin_top = 150.0
margin_right = 143.0 margin_right = 143.0
margin_bottom = 190.0 margin_bottom = 190.0
focus_neighbour_top = NodePath("../settings_player/VBoxContainer/color")
focus_neighbour_bottom = NodePath("../../../../HBoxContainer/apply")
size_flags_horizontal = 0 size_flags_horizontal = 0
size_flags_vertical = 0 size_flags_vertical = 0
text = "Bots" text = "Bots"
[node name="controls" type="Tabs" parent="menu/tabs"] [node name="controls" 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
@@ -106,25 +89,9 @@ margin_left = 4.0
margin_top = 45.0 margin_top = 45.0
margin_right = -4.0 margin_right = -4.0
margin_bottom = -4.0 margin_bottom = -4.0
focus_neighbour_left = NodePath("../game")
focus_neighbour_right = NodePath("../graphics")
focus_mode = 2
[node name="settings_controls" parent="menu/tabs/controls" instance=ExtResource( 5 )] [node name="settings_controls" parent="menu/tabs/controls" instance=ExtResource( 5 )]
[node name="empty" parent="menu/tabs/controls/settings_controls/ScrollContainer/grid" index="0"]
margin_bottom = 27.0
[node name="keyboard_label" parent="menu/tabs/controls/settings_controls/ScrollContainer/grid" index="1"]
margin_bottom = 27.0
[node name="joypad_label" parent="menu/tabs/controls/settings_controls/ScrollContainer/grid" index="2"]
margin_bottom = 27.0
[node name="action_button" parent="menu/tabs/controls/settings_controls/key_dialog" index="3"]
margin_right = 302.0
margin_bottom = 110.0
[node name="graphics" type="Tabs" parent="menu/tabs"] [node name="graphics" type="Tabs" parent="menu/tabs"]
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
@@ -133,40 +100,8 @@ margin_left = 4.0
margin_top = 45.0 margin_top = 45.0
margin_right = -4.0 margin_right = -4.0
margin_bottom = -4.0 margin_bottom = -4.0
focus_neighbour_left = NodePath("../controls")
focus_neighbour_right = NodePath("../system")
focus_mode = 2
[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
pressed = true
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
disabled = true
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
@@ -174,103 +109,45 @@ margin_left = 4.0
margin_top = 45.0 margin_top = 45.0
margin_right = -4.0 margin_right = -4.0
margin_bottom = -4.0 margin_bottom = -4.0
focus_neighbour_left = NodePath("../graphics")
focus_mode = 2
[node name="GridContainer" type="GridContainer" parent="menu/tabs/system"] [node name="GridContainer" type="GridContainer" parent="menu/tabs/system"]
margin_left = 12.0 margin_left = 12.0
margin_top = 8.0 margin_top = 8.0
margin_right = 907.0 margin_right = 476.0
margin_bottom = 124.0 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 = 88.0 margin_right = 102.0
margin_bottom = 14.0 margin_bottom = 27.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 = 92.0 margin_left = 106.0
margin_right = 895.0 margin_right = 464.0
margin_bottom = 14.0 margin_bottom = 27.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="save" type="Button" parent="menu"]
margin_top = 23.0
margin_right = 88.0
margin_bottom = 37.0
text = "SERVER_ADDR"
valign = 1
[node name="server_addr" type="LineEdit" parent="menu/tabs/system/GridContainer"]
margin_left = 92.0
margin_top = 18.0
margin_right = 895.0
margin_bottom = 42.0
[node name="api_addr_label" type="Label" parent="menu/tabs/system/GridContainer"]
margin_top = 51.0
margin_right = 88.0
margin_bottom = 65.0
text = "API_ADDR"
valign = 1
[node name="api_addr" type="LineEdit" parent="menu/tabs/system/GridContainer"]
margin_left = 92.0
margin_top = 46.0
margin_right = 895.0
margin_bottom = 70.0
[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
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = -286.0 margin_left = -147.0
margin_top = -56.0 margin_top = -56.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
size_flags_horizontal = 8 size_flags_horizontal = 3
size_flags_vertical = 8 size_flags_vertical = 3
alignment = 2 text = "SAVE"
[node name="apply" type="Button" parent="menu/HBoxContainer"]
margin_right = 150.0
margin_bottom = 56.0
grow_horizontal = 0
grow_vertical = 0
focus_neighbour_left = NodePath("../../back")
focus_neighbour_top = NodePath("../../tabs/game")
focus_neighbour_right = NodePath("../save")
size_flags_horizontal = 10
size_flags_vertical = 10
text = "APPLY"
icon = ExtResource( 6 ) icon = ExtResource( 6 )
flat = true flat = true
align = 0
[node name="save" type="Button" parent="menu/HBoxContainer"]
margin_left = 154.0
margin_right = 286.0
margin_bottom = 56.0
grow_horizontal = 0
grow_vertical = 0
focus_neighbour_left = NodePath("../apply")
focus_neighbour_top = NodePath("../../tabs/game")
size_flags_horizontal = 10
size_flags_vertical = 10
text = "SAVE"
icon = ExtResource( 7 )
flat = true
align = 0
[connection signal="toggled" from="menu/tabs/graphics/VBoxContainer/light" to="." method="_on_light_toggled"]
[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="pressed" from="menu/HBoxContainer/apply" to="." method="_on_apply_pressed"] [connection signal="visibility_changed" from="menu/tabs/system/GridContainer/locales" to="." method="_init_locales"]
[connection signal="pressed" from="menu/HBoxContainer/save" to="." method="_on_save_pressed"] [connection signal="pressed" from="menu/save" to="." method="_on_save_pressed"]
[editable path="menu"] [editable path="menu"]
+6 -7
View File
@@ -1,7 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://scripts/menus/settings_player_menu.gd" type="Script" id=1] [ext_resource path="res://scripts/menus/settings_player.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
@@ -12,28 +11,28 @@ size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="GridContainer" type="GridContainer" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
[node name="name_label" type="Label" parent="VBoxContainer"] [node name="name_label" type="Label" parent="GridContainer"]
margin_right = 365.0 margin_right = 365.0
margin_bottom = 14.0 margin_bottom = 14.0
text = "PLAYER_NAME" text = "PLAYER_NAME"
[node name="name" type="LineEdit" parent="VBoxContainer"] [node name="name" type="LineEdit" parent="GridContainer"]
margin_top = 18.0 margin_top = 18.0
margin_right = 365.0 margin_right = 365.0
margin_bottom = 42.0 margin_bottom = 42.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="color_label" type="Label" parent="VBoxContainer"] [node name="color_label" type="Label" parent="GridContainer"]
margin_top = 46.0 margin_top = 46.0
margin_right = 365.0 margin_right = 365.0
margin_bottom = 60.0 margin_bottom = 60.0
text = "PLAYER_COLOR" text = "PLAYER_COLOR"
[node name="color" type="ColorPickerButton" parent="VBoxContainer"] [node name="color" type="ColorPickerButton" parent="GridContainer"]
margin_top = 64.0 margin_top = 64.0
margin_right = 365.0 margin_right = 365.0
margin_bottom = 84.0 margin_bottom = 84.0
-47
View File
@@ -1,47 +0,0 @@
[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
+9 -15
View File
@@ -1,8 +1,8 @@
[gd_scene load_steps=11 format=2] [gd_scene load_steps=11 format=2]
[ext_resource path="res://scripts/player/human_controls.gd" type="Script" id=1] [ext_resource path="res://scripts/player/human_controls.gd" type="Script" id=1]
[ext_resource path="res://resources/ui/theme.tres" type="Theme" id=2] [ext_resource path="res://assets/fonts/Kenney Future Narrow.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://assets/fonts/Kenney Future Narrow.ttf" type="DynamicFontData" id=3] [ext_resource path="res://resources/ui/theme.tres" type="Theme" id=3]
[ext_resource path="res://scenes/menus/IngameMenu.tscn" type="PackedScene" id=4] [ext_resource path="res://scenes/menus/IngameMenu.tscn" type="PackedScene" id=4]
[ext_resource path="res://scripts/player/human_inventory.gd" type="Script" id=5] [ext_resource path="res://scripts/player/human_inventory.gd" type="Script" id=5]
[ext_resource path="res://scenes/road/roadStraightLong.tscn" type="PackedScene" id=6] [ext_resource path="res://scenes/road/roadStraightLong.tscn" type="PackedScene" id=6]
@@ -13,11 +13,11 @@ viewport_path = NodePath("inventory/viewport")
[sub_resource type="DynamicFont" id=2] [sub_resource type="DynamicFont" id=2]
size = 14 size = 14
font_data = ExtResource( 3 ) font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=3] [sub_resource type="DynamicFont" id=3]
size = 85 size = 85
font_data = ExtResource( 3 ) font_data = ExtResource( 2 )
[node name="HumanPlayer" type="Spatial"] [node name="HumanPlayer" type="Spatial"]
script = ExtResource( 1 ) script = ExtResource( 1 )
@@ -27,16 +27,15 @@ script = ExtResource( 1 )
[node name="inventory" type="Control" parent="hud"] [node name="inventory" type="Control" parent="hud"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
theme = ExtResource( 2 )
[node name="track_container" type="Panel" parent="hud/inventory"] [node name="background" type="ColorRect" parent="hud/inventory"]
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
margin_left = -75.0 margin_left = -75.0
margin_right = 75.0 margin_right = 75.0
margin_bottom = 150.0 margin_bottom = 150.0
[node name="track" type="TextureRect" parent="hud/inventory/track_container"] [node name="track" type="TextureRect" parent="hud/inventory"]
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
margin_left = -75.0 margin_left = -75.0
@@ -44,7 +43,7 @@ margin_right = 75.0
margin_bottom = 150.0 margin_bottom = 150.0
texture = SubResource( 1 ) texture = SubResource( 1 )
[node name="type" type="Label" parent="hud/inventory/track_container"] [node name="type" type="Label" parent="hud/inventory"]
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
margin_left = -74.0 margin_left = -74.0
@@ -53,15 +52,10 @@ margin_bottom = 58.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
custom_fonts/font = SubResource( 2 ) custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
align = 1 align = 1
valign = 1 valign = 1
[node name="speed_slider" type="VSlider" parent="hud"]
anchor_bottom = 1.0
margin_right = 16.0
max_value = 250.0
step = 0.5
[node name="speed" type="Label" parent="hud"] [node name="speed" type="Label" parent="hud"]
anchor_left = 0.5 anchor_left = 0.5
anchor_top = 1.0 anchor_top = 1.0
@@ -72,7 +66,7 @@ margin_top = -39.0
margin_right = 77.0 margin_right = 77.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource( 2 ) theme = ExtResource( 3 )
align = 1 align = 1
valign = 1 valign = 1
+1
View File
@@ -31,6 +31,7 @@ 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 )
+1 -1
View File
@@ -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.1, 0.1, -0.5 ) torque_penalties = PoolVector3Array( 0.5, 0.1, 0.1 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )
+2 -2
View File
@@ -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( 2, 0, 8 ) force_penalties = PoolVector3Array( 1, 0, 5 )
torque_penalties = PoolVector3Array( 0.1, 0.1, 0.5 ) torque_penalties = PoolVector3Array( 0, 1, 1.5 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )
+2 -2
View File
@@ -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( 2, 0, 8 ) force_penalties = PoolVector3Array( 0, 0, 5 )
torque_penalties = PoolVector3Array( 0.1, 0.1, -0.5 ) torque_penalties = PoolVector3Array( 0, 0, 1 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )
+2 -2
View File
@@ -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( 2, 0, 8 ) force_penalties = PoolVector3Array( 0, 0, 5 )
torque_penalties = PoolVector3Array( 0.1, 0.1, 0.5 ) torque_penalties = PoolVector3Array( 0, 0, -1 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )
+3 -3
View File
@@ -11,9 +11,9 @@ material/1 = null
material/2 = null 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.6, 0.08 ) speed_constrains = PoolVector3Array( 0.1, 0.79, 0.08 )
force_penalties = PoolVector3Array( 2, 0, 8 ) force_penalties = PoolVector3Array( 0, 0, 5 )
torque_penalties = PoolVector3Array( 0.1, 0.1, -0.5 ) torque_penalties = PoolVector3Array( 0, 0, 1 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )
+3 -3
View File
@@ -11,9 +11,9 @@ material/1 = null
material/2 = null 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.6, 0.08 ) speed_constrains = PoolVector3Array( 0.1, 0.79, 0.08 )
force_penalties = PoolVector3Array( 2, 0, 8 ) force_penalties = PoolVector3Array( 0, 0, 5 )
torque_penalties = PoolVector3Array( 0.1, 0.1, 0.5 ) torque_penalties = PoolVector3Array( 0, 0, -1 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )
+1 -1
View File
@@ -11,7 +11,7 @@ material/1 = null
material/2 = null material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
reset_index = 1 reset_index = 1
speed_constrains = PoolVector3Array( 0.5, 0.9, -0.025 ) speed_constrains = PoolVector3Array( 0, 1, -0.05 )
path_penalties = [ 1.0 ] path_penalties = [ 1.0 ]
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
+1 -1
View File
@@ -10,7 +10,7 @@ material/0 = null
material/1 = null material/1 = null
material/2 = null material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
speed_constrains = PoolVector3Array( 0, 0.1, 0.12 ) speed_constrains = PoolVector3Array( 0, 0.3, 0.12 )
force_penalties = PoolVector3Array( 0, 0, 4 ) force_penalties = PoolVector3Array( 0, 0, 4 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
+1 -3
View File
@@ -11,10 +11,8 @@ material/1 = null
material/2 = null material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
reset_index = 1 reset_index = 1
speed_constrains = PoolVector3Array( 0.7, 1.9, -0.03 ) speed_constrains = PoolVector3Array( 0, 2, -0.05 )
path_penalties = [ 2.0 ] path_penalties = [ 2.0 ]
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
curve = ExtResource( 3 ) curve = ExtResource( 3 )
[node name="PathFollow" type="PathFollow" parent="Path"]
+1 -1
View File
@@ -11,7 +11,7 @@ material/1 = null
material/2 = null material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
reset_index = 1 reset_index = 1
speed_constrains = PoolVector3Array( 0.7, 1.5, -0.03 ) speed_constrains = PoolVector3Array( 0.25, 1.5, -0.05 )
path_penalties = [ 1.25 ] path_penalties = [ 1.25 ]
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
+1 -1
View File
@@ -10,7 +10,7 @@ material/0 = null
material/1 = null material/1 = null
material/2 = null material/2 = null
script = ExtResource( 2 ) script = ExtResource( 2 )
speed_constrains = PoolVector3Array( 0.1, 0.3, 0.12 ) speed_constrains = PoolVector3Array( 0, 0.1, 0.12 )
force_penalties = PoolVector3Array( 0, 0, 4 ) force_penalties = PoolVector3Array( 0, 0, 4 )
[node name="Path" type="Path" parent="."] [node name="Path" type="Path" parent="."]
+3 -27
View File
@@ -1,36 +1,12 @@
extends Node extends Node
var random_number_generator:RandomNumberGenerator = RandomNumberGenerator.new() class_name Util
func _ready(): static func clear_node(node:Node):
random_number_generator.randomize()
func randf():
return random_number_generator.randf()
func randf_range (from:float, to:float ):
return random_number_generator.randf_range(from,to)
func randfn (mean:float=0.0, deviation:float=1.0 ):
return random_number_generator.randfn(mean, deviation)
func randi():
return random_number_generator.randi()
func randi_range ( from:int, to:int ):
return random_number_generator.randi_range( from, to)
func clear_node(node:Node):
for idx in range(node.get_child_count()): for idx in range(node.get_child_count()):
node.remove_child(node.get_child(0)) node.remove_child(node.get_child(0))
func curve_get_last_point(curve:Curve3D): static func curve_get_last_point(curve:Curve3D):
return curve.get_point_position(curve.get_point_count() - 1) return curve.get_point_position(curve.get_point_count() - 1)
-28
View File
@@ -1,28 +0,0 @@
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)]
const CONTROL_ACTIONS = ["controls_thrust", "controls_break", "controls_add_road", "controls_next_road_type", "controls_prev_road_type", "controls_next_road_variant", "controls_prev_road_variant", "controls_reset", "controls_menu"]
const INPUT_UI_MAPPING = {"ui_accept" : "controls_add_road", "ui_select" : "controls_add_road", "ui_up" : "controls_next_road_variant", "ui_down" : "controls_prev_road_variant", "ui_left" : "controls_prev_road_type", "ui_right" : "controls_next_road_type"}
var config_file:ConfigFile = ConfigFile.new()
func _ready():
config_file.load(FILE_PATH)
func save():
config_file.save(FILE_PATH)
func get_value(section:String, key:String, default = null):
return config_file.get_value(section,key,default)
func set_value(section:String, key:String, value):
config_file.set_value(section,key,value)
-62
View File
@@ -1,62 +0,0 @@
extends Node
const FILE_PATH = "user://local_storage"
func _ready():
apply_settings()
func apply_settings():
apply_locale()
apply_game_server()
apply_resolution()
apply_controls()
func apply_locale():
TranslationServer.set_locale(config.get_value("system","locale","en"))
func apply_game_server():
var server_addr = config.get_value("game_server", "server_addr")
if server_addr != null && not server_addr.empty():
game_server.set_server_addr(server_addr)
var api_addr = config.get_value("game_server","api_addr")
if api_addr != null && not api_addr.empty():
game_server.set_api_addr(api_addr)
func apply_resolution():
var view_port = get_tree().get_root()
OS.set_window_fullscreen(config.get_value("graphics","fullscreen", true))
var resolution = config.get_value("graphics","resolution",config.RESOLUTIONS[0])
if OS.is_window_fullscreen():
var base_size = Vector2(1920, 1080)
var scale= base_size.x / resolution.x
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_2D,SceneTree.STRETCH_ASPECT_EXPAND,base_size,scale)
else:
OS.set_window_size(resolution)
get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT,SceneTree.STRETCH_ASPECT_IGNORE,OS.get_window_size(),1)
func apply_controls():
InputMap.load_from_globals()
var control_map = config.get_value("controls","mapping",{})
for action in InputMap.get_actions():
if control_map.has(action):
for event in InputMap.get_action_list(action):
if event is InputEventKey && control_map[action].has("key"):
InputMap.action_erase_event(action, event)
event.set_scancode(OS.find_scancode_from_string(control_map[action]["key"]))
InputMap.action_add_event(action,event)
elif event is InputEventJoypadButton && control_map[action].has("joypad"):
InputMap.action_erase_event(action, event)
event.set_button_index(control_map[action]["joypad"])
InputMap.action_add_event(action,event)
for ui_mapping in config.INPUT_UI_MAPPING:
for event in InputMap.get_action_list(config.INPUT_UI_MAPPING[ui_mapping]):
InputMap.action_add_event(ui_mapping, event)
-3
View File
@@ -12,9 +12,6 @@ const REMOVE_LAST = 2
func _ready(): func _ready():
route = get_node("route") route = get_node("route")
find_node("sun").set_visible(config.get_value("graphics","light", false))
if find_node("sun").is_visible_in_tree():
find_node("sun").set_shadow(config.get_value("graphics","shadows", false))
if is_network_master(): if is_network_master():
route.rpc("add_road",roads_factory.START, -1) route.rpc("add_road",roads_factory.START, -1)
+58
View File
@@ -0,0 +1,58 @@
extends Node
const FILE_PATH = "user://local_storage"
func _ready():
TranslationServer.set_locale(read_value("locale","en"))
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()
-3
View File
@@ -14,10 +14,7 @@ func get_last_road():
func get_road(road_index): func get_road(road_index):
if get_child_count() > road_index:
return get_child(road_index) return get_child(road_index)
else:
return null
remotesync func add_road(type, creator): remotesync func add_road(type, creator):
@@ -4,7 +4,7 @@ var LobbyMenu = preload("res://scenes/menus/LobbyMenu.tscn")
func _ready(): func _ready():
find_node("bots").set_pressed(config.get_value("game","bots", true)) find_node("bots").set_pressed(local_storage.read_value("bots", true))
func _draw(): func _draw():
@@ -5,6 +5,14 @@ func _draw():
find_node("resume").grab_focus() find_node("resume").grab_focus()
func _physics_process(delta):
if Input.is_action_just_pressed("ui_cancel"):
if is_visible_in_tree():
hide()
else:
show()
func _on_resume_pressed(): func _on_resume_pressed():
hide() hide()
+1 -1
View File
@@ -4,7 +4,7 @@ onready var player_settings = find_node("player_settings")
func _ready(): func _ready():
find_node("bots").set_pressed(config.get_value("game","bots", true)) find_node("bots").set_pressed(local_storage.read_value("bots", true))
func _draw(): func _draw():
@@ -8,11 +8,9 @@ var SettingsMenu = preload("res://scenes/menus/SettingsMenu.tscn")
func _ready(): func _ready():
gamestate.connect("server_disconnected", self, "_server_disconnected") gamestate.connect("server_disconnected", self, "_server_disconnected")
func _draw(): func _draw():
find_node("multiplayer").grab_focus() find_node("multiplayer").grab_focus()
func _on_multiplayer_pressed(): func _on_multiplayer_pressed():
var multiplayer_menu = MultiplayerMenu.instance() var multiplayer_menu = MultiplayerMenu.instance()
get_tree().get_root().add_child(multiplayer_menu) get_tree().get_root().add_child(multiplayer_menu)
@@ -116,7 +116,7 @@ func _on_create_pressed():
func _on_join_pressed(): func _on_join_pressed():
client.join_game(game_server.get_server_addr(), int(selected_game['port'])) client.join_game(game_server.SERVER_ADDR, int(selected_game['port']))
func _connection_succeeded(): func _connection_succeeded():
@@ -2,12 +2,12 @@ extends Control
func _ready(): func _ready():
var player_name = config.get_value("game","player_name", false) var player_name = local_storage.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(config.get_value("game","bots", true)) find_node("bots").set_pressed(local_storage.read_value("bots", true))
func _draw(): func _draw():
@@ -28,9 +28,7 @@ func _on_game_created(result, response_code, headers, body):
if result == OK && response_code == HTTPClient.RESPONSE_OK: if result == OK && response_code == HTTPClient.RESPONSE_OK:
var json = JSON.parse(body.get_string_from_utf8()) var json = JSON.parse(body.get_string_from_utf8())
gamestate.game_name = json.result['name'] gamestate.game_name = json.result['name']
client.join_game(game_server.get_server_addr(), int(json.result['port'])) client.join_game(game_server.SERVER_ADDR, int(json.result['port']))
else:
get_tree().get_root().get_node("multiplayer_menu").show_error_dialog(tr("ERROR_GAME_CREATION"))
queue_free() queue_free()
+67
View File
@@ -0,0 +1,67 @@
extends Control
onready var player_settings = find_node("settings_player")
onready var game_tab = find_node("game")
onready var controls_tab = find_node("controls")
onready var graphics_tab = find_node("graphics")
onready var system_tab = find_node("system")
var locale
func _ready():
get_node("menu/back").connect("pressed",self,"_on_back_pressed")
find_node("bots").set_pressed(local_storage.read_value("bots", true))
game_tab.set_name(tr("GAME"))
controls_tab.set_name(tr("CONTROLS"))
graphics_tab.set_name(tr("GRAPHICS"))
system_tab.set_name(tr("SYSTEM"))
func _on_back_pressed():
queue_free()
get_tree().get_root().get_node("main_menu").show()
func _on_locales_item_selected(index):
match index:
0:
locale = "en"
1:
locale = "de"
_:
locale = "en"
TranslationServer.set_locale(locale)
game_tab.set_name(tr("GAME"))
controls_tab.set_name(tr("CONTROLS"))
graphics_tab.set_name(tr("GRAPHICS"))
system_tab.set_name(tr("SYSTEM"))
func _init_locales():
var locales = find_node("locales")
locales.clear()
locales.add_item(tr("LOCALE_EN"))
locales.add_item(tr("LOCALE_DE"))
locale = local_storage.read_value("locale","en")
match locale:
"en":
locales.select(0)
_on_locales_item_selected(0)
"de":
locales.select(1)
_on_locales_item_selected(1)
func _on_locales_tree_exiting():
TranslationServer.set_locale(local_storage.read_value("locale","en"))
func _on_save_pressed():
var values = {}
values['player_name'] = player_settings.get_name_node().text
values['player_color'] = player_settings.get_color_node().color.to_html()
values['bots'] = find_node("bots").is_pressed()
values['locale'] = locale
local_storage.write_values(values)
_on_back_pressed()
+89
View File
@@ -0,0 +1,89 @@
tool
extends Control
onready var grid = find_node("grid")
onready var key_dialog = get_node("key_dialog")
const INPUT_TYPE_KEY = 0
const INPUT_TYPE_JOYPAD = 1
var last_action:String
var last_event:InputEvent
var new_inputs = {}
func _ready():
init_mapping()
func init_mapping():
new_inputs = {}
for action in InputMap.get_actions():
if action.begins_with("controls_"):
var action_label = Label.new()
action_label.set_name(action + "_label")
action_label.set_text(action)
grid.add_child(action_label)
var key_action_button = Button.new()
key_action_button.set_h_size_flags(SIZE_SHRINK_CENTER)
key_action_button.set_flat(true)
key_action_button.set_meta("action",action)
key_action_button.set_button_icon(get_node("icons/key").get_button_icon())
var joypad_action_button = Button.new()
joypad_action_button.set_h_size_flags(SIZE_SHRINK_CENTER)
joypad_action_button.set_flat(true)
joypad_action_button.set_meta("action",action)
for mapping in InputMap.get_action_list(action):
if mapping is InputEventKey:
key_action_button.set_text(mapping.as_text())
key_action_button.set_tooltip(mapping.as_text())
elif mapping is InputEventJoypadButton:
joypad_action_button.set_tooltip(str(mapping.button_index))
if has_node("icons/joypad/" + str(mapping.button_index)):
joypad_action_button.set_button_icon(get_node("icons/joypad/" + str(mapping.button_index)).get_button_icon())
else:
joypad_action_button.set_button_icon(get_node("icons/joypad/other").get_button_icon())
joypad_action_button.set_text(str(mapping.button_index))
grid.add_child(key_action_button)
key_action_button.connect("pressed",self,"_on_button_pressed",[action, INPUT_TYPE_KEY])
grid.add_child(joypad_action_button)
joypad_action_button.connect("pressed",self,"_on_button_pressed",[action, INPUT_TYPE_JOYPAD])
func _unhandled_input(event):
if key_dialog.is_visible_in_tree():
if key_dialog.get_meta("type") == INPUT_TYPE_KEY && event is InputEventKey:
last_event = event
key_dialog.set_text(tr(last_event.as_text()))
key_dialog.get_ok().set_disabled(false)
elif key_dialog.get_meta("type") == INPUT_TYPE_JOYPAD && event is InputEventJoypadButton:
last_event = event
key_dialog.set_text(last_event.as_text())
key_dialog.get_ok().set_disabled(false)
func _on_button_pressed(action, type):
last_action = action
last_event = null
key_dialog.set_text(tr("PRESS_KEY"))
key_dialog.set_meta("type", type)
key_dialog.connect("confirmed",self,"_on_dialog_confirmed")
key_dialog.get_ok().set_disabled(true)
key_dialog.popup_centered()
func _on_dialog_confirmed(type):
if not new_inputs.has(last_action):
new_inputs[last_action] = {}
match key_dialog.get_meta("type"):
INPUT_TYPE_KEY:
if last_event is InputEventKey:
new_inputs[last_action]["key"] = OS.get_scancode_string(last_event.scancode)
INPUT_TYPE_JOYPAD:
if last_event is InputEventJoypadButton:
new_inputs[last_action]["joypad"] = last_event.button_index
-124
View File
@@ -1,124 +0,0 @@
extends Control
onready var grid = find_node("grid")
onready var key_dialog = get_node("key_dialog")
const INPUT_TYPE_KEY = 0
const INPUT_TYPE_JOYPAD = 1
var last_action:String
var last_event:InputEvent
var new_inputs = {}
func _ready():
init_mapping()
func init_mapping():
new_inputs = {}
for action in config.CONTROL_ACTIONS:
var action_label = Label.new()
action_label.set_name(action + "_label")
action_label.set_text(action)
grid.add_child(action_label)
var key_action_button = Button.new()
key_action_button.set_h_size_flags(SIZE_SHRINK_CENTER)
key_action_button.set_flat(true)
key_action_button.set_meta("action",action)
key_action_button.set_button_icon(get_node("icons/key").get_button_icon())
var joypad_action_button = Button.new()
joypad_action_button.set_h_size_flags(SIZE_SHRINK_CENTER)
joypad_action_button.set_flat(true)
joypad_action_button.set_meta("action",action)
for event in InputMap.get_action_list(action):
if event is InputEventKey:
key_action_button.set_text(event.as_text())
key_action_button.set_tooltip(event.as_text())
elif event is InputEventJoypadButton:
joypad_action_button.set_tooltip(str(event.button_index))
if has_node("icons/joypad/" + str(event.button_index)):
joypad_action_button.set_button_icon(get_node("icons/joypad/" + str(event.button_index)).get_button_icon())
else:
joypad_action_button.set_button_icon(get_node("icons/joypad/other").get_button_icon())
joypad_action_button.set_text(str(event.button_index))
grid.add_child(key_action_button)
key_action_button.connect("pressed",self,"_on_button_pressed",[key_action_button, INPUT_TYPE_KEY])
grid.add_child(joypad_action_button)
joypad_action_button.connect("pressed",self,"_on_button_pressed",[joypad_action_button, INPUT_TYPE_JOYPAD])
func _unhandled_input(event):
if key_dialog.is_visible_in_tree():
var action_button = key_dialog.find_node("action_button")
var check_usage = false
if key_dialog.get_meta("type") == INPUT_TYPE_KEY && event is InputEventKey:
check_usage = true
last_event = event
action_button.set_button_icon(get_node("icons/key").get_button_icon())
action_button.set_text(event.as_text())
action_button.set_tooltip(event.as_text())
elif key_dialog.get_meta("type") == INPUT_TYPE_JOYPAD && event is InputEventJoypadButton:
check_usage = true
last_event = event
action_button.set_tooltip(str(event.button_index))
if has_node("icons/joypad/" + str(event.button_index)):
action_button.set_text("")
action_button.set_button_icon(get_node("icons/joypad/" + str(event.button_index)).get_button_icon())
else:
action_button.set_button_icon(get_node("icons/joypad/other").get_button_icon())
action_button.set_text(str(event.button_index))
if check_usage:
var has_event = ""
for action in config.CONTROL_ACTIONS:
if InputMap.event_is_action(event, action):
has_event = action
if not has_event == "" && not has_event == last_action:
key_dialog.set_text(tr("KEY_ALREADY_TAKEN") + '\n\'' + tr(has_event) + '\'')
key_dialog.get_ok().set_disabled(true)
else:
key_dialog.set_text(tr("PRESS_KEY"))
key_dialog.get_ok().set_disabled(false)
func _on_button_pressed(button, type):
last_action = button.get_meta("action")
last_event = null
var action_button = key_dialog.find_node("action_button")
action_button.set_text("")
action_button.set_button_icon(null)
key_dialog.set_text(tr("PRESS_KEY"))
key_dialog.set_meta("type", type)
key_dialog.connect("confirmed",self,"_on_dialog_confirmed",[button])
key_dialog.get_ok().set_disabled(true)
key_dialog.get_label().set_align(HALIGN_CENTER)
key_dialog.popup_centered()
func _on_dialog_confirmed(button):
if not new_inputs.has(last_action):
new_inputs[last_action] = {}
match key_dialog.get_meta("type"):
INPUT_TYPE_KEY:
if last_event is InputEventKey:
new_inputs[last_action]["key"] = OS.get_scancode_string(last_event.scancode)
button.set_text(last_event.as_text())
button.set_tooltip(last_event.as_text())
INPUT_TYPE_JOYPAD:
if last_event is InputEventJoypadButton:
new_inputs[last_action]["joypad"] = last_event.button_index
button.set_tooltip(str(last_event.button_index))
if has_node("icons/joypad/" + str(last_event.button_index)):
button.set_button_icon(get_node("icons/joypad/" + str(last_event.button_index)).get_button_icon())
else:
button.set_button_icon(get_node("icons/joypad/other").get_button_icon())
button.set_text(str(last_event.button_index))
-116
View File
@@ -1,116 +0,0 @@
extends Control
onready var player_settings = find_node("settings_player")
onready var game_tab = find_node("game")
onready var controls_tab = find_node("controls")
onready var graphics_tab = find_node("graphics")
onready var system_tab = find_node("system")
var locale
func _ready():
get_node("menu/back").connect("pressed",self,"_on_back_pressed")
# game
find_node("bots").set_pressed(config.get_value("game","bots", true))
# graphics
find_node("fullscreen").set_pressed(config.get_value("graphics","fullscreen", true))
find_node("light").set_pressed(config.get_value("graphics","light", false))
find_node("shadows").set_pressed(config.get_value("graphics","shadows", false))
find_node("shadows").set_disabled(not find_node("light").is_pressed())
for resolution in config.RESOLUTIONS:
find_node("resolution").add_item(str(resolution.x) + " * " + str(resolution.y))
find_node("resolution").select(config.RESOLUTIONS.find(config.get_value("graphics","resolution", config.RESOLUTIONS[0])))
# system
find_node("server_addr").set_text(game_server.get_server_addr())
find_node("api_addr").set_text(game_server.get_api_addr())
_init_locales()
func _draw():
game_tab.grab_focus()
func _on_back_pressed():
queue_free()
get_tree().get_root().get_node("main_menu").show()
func _on_locales_item_selected(index):
match index:
0:
locale = "en"
1:
locale = "de"
_:
locale = "en"
TranslationServer.set_locale(locale)
game_tab.set_name(tr("GAME"))
controls_tab.set_name(tr("CONTROLS"))
graphics_tab.set_name(tr("GRAPHICS"))
system_tab.set_name(tr("SYSTEM"))
func _init_locales():
var locales = find_node("locales")
locales.clear()
locales.add_item(tr("LOCALE_EN"))
locales.add_item(tr("LOCALE_DE"))
locale = config.get_value("system","locale","en")
match locale:
"en":
locales.select(0)
_on_locales_item_selected(0)
"de":
locales.select(1)
_on_locales_item_selected(1)
func _on_locales_tree_exiting():
config_apply.apply_locale()
func _on_save_pressed():
_on_apply_pressed()
_on_back_pressed()
func _on_apply_pressed():
# game
config.set_value("game","player_name",player_settings.get_name_node().get_text())
config.set_value("game","player_color",player_settings.get_color_node().color)
config.set_value("game","bots",find_node("bots").is_pressed())
# graphics
config.set_value("graphics","resolution",config.RESOLUTIONS[find_node("resolution").get_selected()])
config.set_value("graphics","fullscreen",find_node("fullscreen").is_pressed())
config.set_value("graphics","light",find_node("light").is_pressed())
config.set_value("graphics","shadows",find_node("shadows").is_pressed())
# controls
config.set_value("controls","mapping",find_node("settings_controls").new_inputs)
# system
config.set_value("system","locale",locale)
var server_addr = find_node("server_addr").get_text()
if server_addr.empty():
server_addr = game_server.SERVER_ADDR
config.set_value("system","server_addr",server_addr)
var api_addr = find_node("api_addr").get_text()
if api_addr.empty():
api_addr = game_server.API_ADDR
config.set_value("system","api_addr",api_addr)
config.save()
config_apply.apply_settings()
func _on_light_toggled(button_pressed):
find_node("shadows").set_disabled(not button_pressed)
+14
View File
@@ -0,0 +1,14 @@
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
View File
@@ -1,14 +0,0 @@
extends Control
func _ready():
get_name_node().set_text(config.get_value("game","player_name", "Player"))
get_color_node().set_pick_color(config.get_value("game","player_color", Color.black))
func get_name_node():
return find_node("name")
func get_color_node():
return find_node("color")
-31
View File
@@ -7,39 +7,8 @@ const API_ADDR = "https://" + SERVER_ADDR + "/"
const HEADERS = ["Content-Type: application/json"] const HEADERS = ["Content-Type: application/json"]
const SSL = false const SSL = false
var server_addr:String = SERVER_ADDR
var api_addr:String = API_ADDR
var headers:Array = HEADERS
var ssl:bool = SSL
func http(): func http():
var game_server_requests = GameServerRequests.new() var game_server_requests = GameServerRequests.new()
add_child(game_server_requests) add_child(game_server_requests)
return game_server_requests return game_server_requests
func get_server_addr():
return server_addr
func set_server_addr(new_server_addr:String):
server_addr = new_server_addr
func get_api_addr():
return api_addr
func set_api_addr(new_api_addr:String):
if not new_api_addr.ends_with("/"):
new_api_addr += "/"
api_addr = new_api_addr
func get_headers():
return headers
func get_ssl():
return ssl
+4 -4
View File
@@ -16,19 +16,19 @@ func connect_http(node,function):
func get_request(path:String): func get_request(path:String):
http.request(game_server.get_api_addr() + path, game_server.get_headers(), game_server.get_ssl(), HTTPClient.METHOD_GET) http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_GET)
func post_request(path:String, data:String = ""): func post_request(path:String, data:String = ""):
http.request(game_server.get_api_addr() + path, game_server.get_headers(), game_server.get_ssl(), HTTPClient.METHOD_POST, data) http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_POST, data)
func put_request(path:String, data:String = ""): func put_request(path:String, data:String = ""):
http.request(game_server.get_api_addr() + path, game_server.get_headers(), game_server.get_ssl(), HTTPClient.METHOD_PUT, data) http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_PUT, data)
func delete_request(path:String, data:String = ""): func delete_request(path:String, data:String = ""):
http.request(game_server.get_api_addr() + path, game_server.get_headers(), game_server.get_ssl(), HTTPClient.METHOD_DELETE, data) http.request(game_server.API_ADDR + path, game_server.HEADERS, game_server.SSL, HTTPClient.METHOD_DELETE, data)
func _self_destroy(result, response_code, headers, body): func _self_destroy(result, response_code, headers, body):
+3 -16
View File
@@ -3,7 +3,6 @@ extends Node
const MAX_PEERS = 4 const MAX_PEERS = 4
const LOBBY_READY_WAIT_TIME = 3 const LOBBY_READY_WAIT_TIME = 3
const EMPTY_WAIT_TIME = 30 const EMPTY_WAIT_TIME = 30
const EMPTY_CLOSING_TIME = 60
var port:int = -1 var port:int = -1
var dedicated_server:bool = false var dedicated_server:bool = false
@@ -26,21 +25,13 @@ func _ready():
server_secret=argument.split("=")[1] server_secret=argument.split("=")[1]
if argument.split("=")[0] == "--bots": if argument.split("=")[0] == "--bots":
gamestate.set_bots(bool(int(argument.split("=")[1]))) gamestate.set_bots(bool(int(argument.split("=")[1])))
if argument.split("=")[0] == "--server-addr":
game_server.set_server_addr(str(argument.split("=")[1]))
if argument.split("=")[0] == "--api-addr":
game_server.set_api_addr(str(argument.split("=")[1]))
if dedicated_server: if dedicated_server:
var err = host_game(port) var err = host_game(port)
if err == OK: if err == OK:
print(server_id + "New game hosted: port=" + str(port) + " secret=" + str(server_secret) + " bots=" + str(gamestate.bots) + " server-addr=" + game_server.get_server_addr() + " api-addr=" + game_server.get_api_addr()) print(server_id + "New game hosted: port=" + str(port) + " secret=" + str(server_secret) + " bots=" + str(gamestate.bots))
print(server_id + "Waiting for connection, closing server in " + str(EMPTY_CLOSING_TIME) + " seconds")
timer.set_wait_time(EMPTY_CLOSING_TIME)
timer.connect("timeout",self,"quit_server",[true])
timer.start()
else: else:
push_error(server_id + "Could not create Server! (port=" + str(port) + " secret=" + str(server_secret) + " server-addr=" + game_server.get_server_addr() + " api-addr=" + game_server.get_api_addr() + ")") print(server_id + "Could not create Server! (port=" + str(port) + " secret=" + str(server_secret) + ")")
quit_server() quit_server()
@@ -85,11 +76,7 @@ func local_game(name:String, color:Color, bots:bool):
func update_server_data(): func update_server_data():
var req = game_server.http() var req = game_server.http()
var player_count = 0 req.put_request("game",to_json({'secret' : server_secret, 'player_count' : gamestate.players.size(), 'running' : gamestate.game_running}))
if gamestate.players != null:
player_count = gamestate.players.size()
req.put_request("game",to_json({'secret' : server_secret, 'player_count' : player_count, 'running' : gamestate.game_running}))
func _client_connected(id): func _client_connected(id):
if get_tree().is_network_server(): if get_tree().is_network_server():
+9 -9
View File
@@ -9,14 +9,6 @@ var road_straights = [
roads_factory.STRAIGHT_SMALL, roads_factory.STRAIGHT_SMALL,
] ]
var roads_right = [
roads_factory.CURVE_RIGHT,
roads_factory.CURVE_LARGE_RIGHT,
roads_factory.CURVE_SMALL_RIGHT,
roads_factory.SKEW_RIGHT,
roads_factory.CURVED_RIGHT,
]
var roads_left = [ var roads_left = [
roads_factory.CURVE_LEFT, roads_factory.CURVE_LEFT,
roads_factory.CURVE_LARGE_LEFT, roads_factory.CURVE_LARGE_LEFT,
@@ -25,6 +17,14 @@ var roads_left = [
roads_factory.CURVED_LEFT, roads_factory.CURVED_LEFT,
] ]
var roads_right = [
roads_factory.CURVE_RIGHT,
roads_factory.CURVE_LARGE_RIGHT,
roads_factory.CURVE_SMALL_RIGHT,
roads_factory.SKEW_RIGHT,
roads_factory.CURVED_RIGHT,
]
var roads_up = [ var roads_up = [
roads_factory.RAMP_UP, roads_factory.RAMP_UP,
roads_factory.RAMP_CURVED_UP, roads_factory.RAMP_CURVED_UP,
@@ -41,7 +41,7 @@ var roads_special = [
roads_factory.LOOP, roads_factory.LOOP,
] ]
var roads = [ road_straights, roads_right, roads_left, roads_up, roads_down, roads_special ] var roads = [ road_straights, roads_left, roads_right, roads_up, roads_down, roads_special ]
var player:Player var player:Player
var route:Route var route:Route
+24 -33
View File
@@ -2,13 +2,13 @@ extends Spatial
var player:Player var player:Player
const MAX_OFFSET = 8.0 const MAX_ROAD_INDEX = 1
const OFFSET_STEPS = 0.01 var error_rate:float = 0.00
var underspeed_rate:float = 0.00
var break_constrain = 0.0
export var overspeed_rate:float = 0.3 func _ready():
export var underspeed_rate:float = 0.1 randomize()
func _physics_process(delta): func _physics_process(delta):
@@ -18,35 +18,26 @@ func _physics_process(delta):
player.reset() player.reset()
else: else:
if player.get_road() != null: if player.get_road() != null:
var rate = randf()
var road = player.get_road() var road = player.get_road()
var rate = util.randf() var road_index = 0
var speed_constrain = 0.0
while road != null && road_index < MAX_ROAD_INDEX:
for index in range(road.speed_constrains.size()):
var constrain = road.speed_constrains[index]
if constrain.z > 0:
speed_constrain = max(speed_constrain, constrain.z)
elif constrain.z < 0:
speed_constrain = min(speed_constrain, constrain.z)
road = player.route.get_road(road.get_index() + 1)
road_index += 1
var speed = player.current_speed var speed = player.current_speed
var offset = 0 if speed_constrain < 0:
var distance = player.follow.get_offset()
var tmp_break_constrain = 0.0
break_constrain = 0.0
while tmp_break_constrain == 0.0 and offset < MAX_OFFSET && road != null:
var constrain_index = road.get_constrain_index(distance)
var road_length = road.get_lane_curve(player.lane).get_baked_length()
if constrain_index >= 0:
tmp_break_constrain = road.speed_constrains[constrain_index].z
if tmp_break_constrain > break_constrain:
break_constrain = tmp_break_constrain
distance += OFFSET_STEPS
offset += OFFSET_STEPS
if distance >= road_length:
distance = 0
road = gamestate.game.route.get_road(road.get_index()+1)
if break_constrain > 0 && speed > break_constrain - 0.04 && rate > overspeed_rate:
player.thrust = -1
elif speed - 0.08 < break_constrain && rate > underspeed_rate:
player.thrust = 1 player.thrust = 1
elif break_constrain == 0 && rate > underspeed_rate: elif speed_constrain > 0 && speed > speed_constrain:
player.thrust = -1
elif rate > underspeed_rate:
player.thrust = 1 player.thrust = 1
else: else:
player.thrust = 0 player.thrust = 0
@@ -57,8 +48,8 @@ func set_player(path:String):
get_node("inventory").set_player(player) get_node("inventory").set_player(player)
func set_overspeed_rate(new_overspeed_rate:float): func set_error_rate(new_error_rate:float):
overspeed_rate = new_overspeed_rate error_rate = new_error_rate
func set_underspeed_rate(new_underspeed_rate:float): func set_underspeed_rate(new_underspeed_rate:float):
+4 -7
View File
@@ -2,13 +2,10 @@ extends Spatial
var player:Player var player:Player
onready var camera:InterpolatedCamera = get_node("camera") onready var camera:InterpolatedCamera = get_node("camera")
onready var ingame_menu:Spatial = find_node("ingame_menu")
func _physics_process(delta): func _physics_process(delta):
if is_network_master() && player != null: if is_network_master() && player != null:
if Input.is_action_just_pressed("controls_menu"):
ingame_menu.set_visible(not ingame_menu.is_visible_in_tree())
if player.is_out: if player.is_out:
camera.set_speed(0.1) camera.set_speed(0.1)
if player.timer.get_time_left() > 0: if player.timer.get_time_left() > 0:
@@ -19,7 +16,7 @@ func _physics_process(delta):
if player.reset(): if player.reset():
camera.set_speed(10) camera.set_speed(10)
get_node("hud/reset").set_text("") get_node("hud/reset").set_text("")
elif not ingame_menu.is_visible_in_tree(): else:
if Input.is_action_pressed("controls_thrust"): if Input.is_action_pressed("controls_thrust"):
player.thrust = 1 player.thrust = 1
elif Input.is_action_pressed("controls_break"): elif Input.is_action_pressed("controls_break"):
@@ -27,7 +24,7 @@ func _physics_process(delta):
else: else:
player.thrust = 0 player.thrust = 0
get_node("hud/speed_slider").set_value(player.current_speed * 1000) get_node("hud/speed").set_text(str(player.current_speed))
if Input.is_action_pressed("debug_camera_1"): if Input.is_action_pressed("debug_camera_1"):
set_debug_camera(0) set_debug_camera(0)
@@ -48,5 +45,5 @@ func set_player(path:String):
func set_debug_camera(idx): func set_debug_camera(idx):
if idx < gamestate.game.get_node("players").get_child_count(): if idx < gamestate.game.players.get_child_count():
camera.set_target_path(gamestate.game.get_node("players").get_child(idx).find_node("CameraTarget").get_path()) camera.set_target_path(gamestate.game.players.get_child(idx).find_node("CameraTarget").get_path())
+2 -2
View File
@@ -7,7 +7,7 @@ var preview:Spatial
func _ready(): func _ready():
view = get_node("view") view = get_node("view")
preview = get_node("preview") preview = get_node("preview")
var hud_track = get_node("../hud/inventory/track_container/track") var hud_track = get_node("../hud/inventory/track")
hud_track.get_texture().set_viewport_path_in_scene(str(get_path()) + "/viewport") hud_track.get_texture().set_viewport_path_in_scene(str(get_path()) + "/viewport")
connect("item_changed",self,"_on_item_changed") connect("item_changed",self,"_on_item_changed")
connect("item_changed",preview,"_on_inventory_item_changed") connect("item_changed",preview,"_on_inventory_item_changed")
@@ -59,4 +59,4 @@ func _on_item_changed(road_identifier, player):
view.add_child(item) view.add_child(item)
get_node("../hud/inventory/track_container/type").set_text(tr(road_identifier)) get_node("../hud/inventory/type").set_text(tr(road_identifier))
+4 -3
View File
@@ -58,11 +58,12 @@ func _physics_process(delta):
var road = get_road() var road = get_road()
if is_in_group("first"): if is_in_group("first"):
max_speed *= road.get_first_speed_factor() max_speed *= road.get_first_speed_factor()
elif road.get_creator() == get_index(): if road.get_creator() == get_index():
max_speed *= road.get_creator_speed_factor() max_speed *= road.get_creator_speed_factor()
else: else:
max_speed *= road.get_chasers_speed_factor() max_speed *= road.get_chasers_speed_factor()
if thrust == 1: if thrust == 1:
current_speed += speed_factor current_speed += speed_factor
elif thrust == -1: elif thrust == -1:
@@ -115,7 +116,6 @@ 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))
@@ -146,7 +146,7 @@ func _on_raceCar_road_entered(road):
buffered_rotation = last_rotation buffered_rotation = last_rotation
if path.curve.get_point_count() > 0: if path.curve.get_point_count() > 0:
buffered_translate = util.curve_get_last_point(path.curve) buffered_translate = Util.curve_get_last_point(path.curve)
if road.get_end_rotation().length() != 0: if road.get_end_rotation().length() != 0:
last_rotation += road.get_end_rotation() last_rotation += road.get_end_rotation()
@@ -211,6 +211,7 @@ master func reset():
race_car.transform = Transform() race_car.transform = Transform()
race_car.get_node("ray").set_enabled(true) race_car.get_node("ray").set_enabled(true)
follow.set_transform(road.get_transform()) follow.set_transform(road.get_transform())
is_out = false is_out = false
+5 -10
View File
@@ -85,20 +85,12 @@ func get_next_lane(lane):
return lane return lane
func get_constrain_index(distance:float): func penalty_index(distance:float, speed:float):
for index in range(speed_constrains.size()): for index in range(speed_constrains.size()):
var constrain = speed_constrains[index] var constrain = speed_constrains[index]
if constrain.x <= distance && constrain.y >= distance: if constrain.x <= distance && constrain.y >= distance:
return index
return -1
func penalty_index(distance:float, speed:float):
var constrain_index = get_constrain_index(distance)
if constrain_index >= 0:
var constrain = speed_constrains[constrain_index]
if constrain.z < 0 && speed < constrain.z * -1 || constrain.z > 0 && speed > constrain.z: if constrain.z < 0 && speed < constrain.z * -1 || constrain.z > 0 && speed > constrain.z:
return constrain_index return index
return -1 return -1
@@ -106,6 +98,9 @@ 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)