Skip to content

Commit a94d32f

Browse files
Added sync loading for proxy
1 parent 7bc4f0f commit a94d32f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

atlas_loader/atlas_proxy.script

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local PROXY_UNLOADED = hash("proxy_unloaded")
55
local INIT = hash("init")
66
local ENABLE = hash("enable")
77
local ASYNC_LOAD = hash("async_load")
8+
local SYNC_LOAD = hash("load")
89
local DISABLE = hash("disable")
910
local FINAL = hash("final")
1011
local UNLOAD = hash("unload")
@@ -15,12 +16,14 @@ local UNLOAD_PROXY = hash("UNLOAD_PROXY")
1516
go.property("proxy_name", hash("NAME"))
1617
go.property("mount_key", hash("UNKNOWN"))
1718
go.property("proxy_url", msg.url("#proxy"))
19+
go.property("sync_load", false)
1820

1921
---@class atlas_proxy
2022
---@field current_object hash|nil
2123
---@field proxy_name hash
2224
---@field mount_key hash
2325
---@field proxy_url url
26+
---@field sync_load boolean
2427

2528
---Called when proxy unloaded
2629
---@param self atlas_proxy
@@ -57,7 +60,11 @@ function on_message(self, message_id, message, sender)
5760
elseif message_id == PROXY_UNLOADED then
5861
on_proxy_unloaded(self, message, sender)
5962
elseif message_id == LOAD_PROXY then
60-
msg.post(self.proxy_url, ASYNC_LOAD)
63+
if self.sync_load then
64+
msg.post(self.proxy_url, SYNC_LOAD)
65+
else
66+
msg.post(self.proxy_url, ASYNC_LOAD)
67+
end
6168
elseif message_id == UNLOAD_PROXY then
6269
msg.post(self.proxy_url, DISABLE)
6370
msg.post(self.proxy_url, FINAL)

example/main.collection

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ embedded_instances {
2828
" value: \"#collectionproxy\"\n"
2929
" type: PROPERTY_TYPE_URL\n"
3030
" }\n"
31+
" properties {\n"
32+
" id: \"sync_load\"\n"
33+
" value: \"true\"\n"
34+
" type: PROPERTY_TYPE_BOOLEAN\n"
35+
" }\n"
3136
"}\n"
3237
"embedded_components {\n"
3338
" id: \"collectionproxy\"\n"

game.project

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ input_method = HiddenInputField
1313

1414
[project]
1515
title = AtlasLoader
16-
version = 1.1.2
16+
version = 1.1.3
1717
dependencies#0 = https://github.com/andsve/dirtylarry/archive/refs/heads/master.zip
1818

1919
[library]

0 commit comments

Comments
 (0)