From 883d41011e18044a231977a30dbeff24b7bf4c12 Mon Sep 17 00:00:00 2001 From: SuperLlama88888 Date: Mon, 13 Jan 2025 08:56:32 +1100 Subject: [PATCH] Add backup slot count setting Also increase default to 10 slots. Testing at 30 slots didn't seem to cause any lag. Ofc I can make it higher if I want to, but I don't think anybody would be using more than 30 holograms at once... --- HoloPrint.js | 6 +++++- index.html | 1 + index.js | 1 + translations/en.json | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/HoloPrint.js b/HoloPrint.js index 4e47509..a146014 100644 --- a/HoloPrint.js +++ b/HoloPrint.js @@ -686,6 +686,7 @@ export async function makePack(structureFiles, config = {}, resourcePackStack, p if(q.distance_from_camera > 60 || q.time_stamp - v.hologram_backup_requested_time <= 600) { // 10 blocks leeway for automatic backups, and 30s after players request a backup // one by one, check each backup slot. if it's empty, we take that spot; if not, try to find which backup slot was set the earliest. t.earliest_backup_time_stamp = q.time_stamp + 9999; // all backups should be less than this + t.earliest_backup_index = -1; for(let i = 0; i < $[backupSlotCount]; i++) { if(v.hologram_backup_index == -1) { if(t.hologram_backup_empty_$[i] ?? true) { @@ -697,6 +698,9 @@ export async function makePack(structureFiles, config = {}, resourcePackStack, p } } if(v.hologram_backup_index == -1) { // none are empty, so overwrite the earliest backup + if(t.earliest_backup_index == -1) { // will only happen when the backup slot count is 0 + return 0; + } v.hologram_backup_index = t.earliest_backup_index; } @@ -1002,7 +1006,7 @@ export function addDefaultConfig(config) { SPAWN_ANIMATION_LENGTH: 0.4, // in seconds WRONG_BLOCK_OVERLAY_COLOR: [1, 0, 0, 0.3], CONTROLS: {}, - BACKUP_SLOT_COUNT: 5, + BACKUP_SLOT_COUNT: 10, MATERIAL_LIST_LANGUAGE: "en_US", PACK_NAME: undefined, PACK_ICON_BLOB: undefined, diff --git a/index.html b/index.html index eeb53f8..c27d6a9 100644 --- a/index.html +++ b/index.html @@ -86,6 +86,7 @@

HoloPrint

Advanced +