7
7
viewport, viewport_texture, performance, label, theme, dynamic_font,
8
8
resource_loader, main_loop, project_settings, input_map, input_event_action,
9
9
input_event_key, input_event, global_constants, scroll_container,
10
- voxel_server, world_environment
10
+ voxel_server, world_environment,
11
11
]
12
12
13
13
import ui/ virtual_joystick
@@ -22,9 +22,8 @@ when defined(metrics):
22
22
ZenContext .init_metrics " main" , " worker"
23
23
24
24
# saved state when restarting worker thread
25
- const savable_flags = {
26
- ConsoleVisible , MouseCaptured , Flying , God , AltWalkSpeed , AltFlySpeed
27
- }
25
+ const savable_flags =
26
+ {ConsoleVisible , MouseCaptured , Flying , God , AltWalkSpeed , AltFlySpeed }
28
27
29
28
var environment_cache {.threadvar .}: Table [string , Environment ]
30
29
@@ -150,17 +149,27 @@ gdobj Game of Node:
150
149
151
150
randomize ()
152
151
152
+ var args = get_cmdline_args ().to_seq
153
+
153
154
var connect_address = " "
154
155
var listen_address = " "
156
+ if (let i = args.find (" --connect" ); i) > - 1 and args.len > i + 1 :
157
+ connect_address = args[i + 1 ]
158
+ args.delete (i .. i + 1 )
159
+ if (let i = args.find (" --listen" ); i) > - 1 :
160
+ if args.len > i + 1 :
161
+ listen_address = args[i + 1 ]
162
+ args.delete (i .. i + 1 )
163
+ else :
164
+ listen_address = " 0.0.0.0"
165
+ args.delete (i)
155
166
156
- if ? get_env (" ENU_LISTEN_ADDRESS" ) and ? get_env (" ENU_CONNECT_ADDRESS" ):
157
- fail " Cannot set both ENU_LISTEN_ADDRESS and ENU_CONNECT_ADDRESS"
158
- elif ? get_env (" ENU_LISTEN_ADDRESS" ):
167
+ if ? get_env (" ENU_LISTEN_ADDRESS" ) and not ? listen_address:
159
168
listen_address = get_env (" ENU_LISTEN_ADDRESS" )
160
- connect_address = " "
161
- elif ? get_env (" ENU_CONNECT_ADDRESS" ):
169
+ if ? get_env (" ENU_CONNECT_ADDRESS" ) and not ? connect_address:
162
170
connect_address = get_env (" ENU_CONNECT_ADDRESS" )
163
- listen_address = " "
171
+ if ? listen_address and ? connect_address:
172
+ fail " Cannot set both ENU_LISTEN_ADDRESS and ENU_CONNECT_ADDRESS"
164
173
165
174
if ? saved_state.connect_address:
166
175
connect_address = saved_state.connect_address
0 commit comments