Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scenes/TiledExhibitGenerator.gd
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ func add_room():
if len(_next_room_candidates) == 0:
push_error("no room candidate to create")
return
if _item_slots.size() > Util.get_max_slots_per_exhibit():
return

var idx = _rng.randi() % len(_next_room_candidates)
var room = _next_room_candidates.pop_at(idx)
Expand Down
3 changes: 1 addition & 2 deletions scenes/util/ExhibitFetcher.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ signal commons_images_complete(category, context)

const MAX_BATCH_SIZE = 50
const REQUEST_DELAY_MS = 1000
const COMMONS_IMAGE_LIMIT = 2500

# TODO: wikimedia support, and category support
const WIKIMEDIA_COMMONS_PREFIX = "https://commons.wikimedia.org/wiki/"
Expand Down Expand Up @@ -469,7 +468,7 @@ func _on_commons_images_request_complete(res, ctx, caller_ctx):
call_deferred("emit_signal", "commons_images_complete", file_batch, caller_ctx)

# handle continues
if res.has("continue") and len(get_result(ctx.category).images) <= COMMONS_IMAGE_LIMIT:
if res.has("continue") and len(get_result(ctx.category).images) <= Util.get_max_slots_per_exhibit():
return _dispatch_continue(res.continue, _get_commons_url(ctx.category), ctx.category, ctx, caller_ctx)
else:
_cache_all([ctx.category], WIKIMEDIA_COMMONS_PREFIX)
Expand Down
7 changes: 7 additions & 0 deletions scenes/util/Util.gd
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func is_xr():
func is_web():
return OS.get_name() == "Web"

func is_mobile():
return OS.has_feature("mobile")

func is_using_threads():
return OS.has_feature("threads")

Expand All @@ -60,6 +63,10 @@ func is_compatibility_renderer():
func is_meta_quest():
return OS.has_feature("meta_quest")

func get_max_slots_per_exhibit() -> int:
# @todo Should this be a setting?
return 200 if (is_mobile() or is_web()) else 2500

func delay_msec(msecs):
# Will only delay if we're not on the main thread.
if OS.get_thread_caller_id() == OS.get_main_thread_id():
Expand Down