From 1ca60623c0d00eb88c6c821f603cc35df317421a Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Mon, 8 Jan 2024 19:16:12 +0100 Subject: [PATCH] Added possibility to change the relative position of descriptions in local description mode --- eid_data.lua | 7 +++++++ main.lua | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/eid_data.lua b/eid_data.lua index 61696e79..4524dd0d 100644 --- a/eid_data.lua +++ b/eid_data.lua @@ -894,3 +894,10 @@ EID.TransformationData = { EID.RoomShapeToMarkup = { "{{Room}}", "{{RoomSmallHorizontal}}", "{{RoomSmallVertical}}", "{{RoomLongVertical}}", "{{RoomLongThinVertical}}","{{RoomLongHorizontal}}", "{{RoomLongThinHorizontal}}", "{{RoomXL}}", "{{RoomLTopLeft}}", "{{RoomL}}", "{{RoomLBottomLeft}}", "{{RoomLBottomRight}}" } EID.RoomTypeToMarkup = { "{{Room}}", "{{Shop}}", "{{ErrorRoom}}", "{{TreasureRoom}}", "{{BossRoom}}", "{{MiniBoss}}", "{{SecretRoom}}", "{{SuperSecretRoom}}", "{{ArcadeRoom}}", "{{CursedRoom}}", "{{ChallengeRoom}}", "{{Library}}", "{{SacrificeRoom}}", "{{DevilRoom}}", "{{AngelRoom}}", "{{LadderRoom}}", "{{Room}}" --[[boss rush]], "{{IsaacsRoom}}", "{{BarrenRoom}}", "{{ChestRoom}}", "{{DiceRoom}}", "{{Shop}}", "{{Room}}", --[[Black Market / Greed Exit]] "{{Planetarium}}", "{{Teleporter}}","{{Teleporter}}", "{{Room}}", "{{Room}}" --[[Blue Key rooms]], "{{UltraSecretRoom}}" } EID.ItemPoolTypeToMarkup = { [0] = "{{ItemPoolTreasure}}", "{{ItemPoolShop}}", "{{ItemPoolBoss}}", "{{ItemPoolDevil}}", "{{ItemPoolAngel}}", "{{ItemPoolSecret}}", "{{ItemPoolLibrary}}", "{{ItemPoolShellGame}}", "{{ItemPoolGoldenChest}}", "{{ItemPoolRedChest}}", "{{ItemPoolBeggar}}", "{{ItemPoolDemonBeggar}}", "{{ItemPoolCurse}}", "{{ItemPoolKeyMaster}}", "{{ItemPoolBombBum}}", "{{ItemPoolMomsChest}}", "{{ItemPoolGreedTreasure}}", "{{ItemPoolGreedShop}}", "{{ItemPoolGreedBoss}}", "{{ItemPoolGreedDevil}}", "{{ItemPoolGreedAngel}}", "{{ItemPoolGreedCurse}}", "{{ItemPoolGreedSecret}}", "{{ItemPoolCraneGame}}", "{{ItemPoolUltraSecret}}", "{{ItemPoolBatteryBum}}", "{{ItemPoolPlanetarium}}", "{{ItemPoolOldChest}}", "{{ItemPoolBabyShop}}", "{{ItemPoolWoodenChest}}", "{{ItemPoolRottenBeggar}}"} + +-- additional offset of the textbox to the entity position. Only applies in local description mode. +-- If a function returns a value, it will be used as the offset +EID.LocalModePositionOffset = { + Default = Vector(0, 20), + Shop = function(entity) if entity:ToPickup() and entity:ToPickup():IsShopItem() then return Vector(0, 35) end end, +} diff --git a/main.lua b/main.lua index 620d1ffb..f5f1cd1a 100644 --- a/main.lua +++ b/main.lua @@ -918,7 +918,17 @@ function EID:PositionLocalMode(entity) EID.Scale = EID.Config["LocalModeSize"] EID.CurrentScaleType = "LocalModeSize" local textBoxWidth = EID.Config["LocalModeCentered"] and tonumber(EID.Config["TextboxWidth"])/2 * EID.Scale or -30 - local textPosOffset = Vector(-textBoxWidth, 20) + local textPosOffset = Vector(-textBoxWidth, 0) + + local additiveOffset = EID.LocalModePositionOffset.Default + for _, offsetFunc in pairs(EID.LocalModePositionOffset) do + if type(offsetFunc) == "function" then + additiveOffset = offsetFunc(entity) or additiveOffset + break + end + end + textPosOffset = textPosOffset + additiveOffset + EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset)) if EID.isMirrorRoom then EID:alterTextPos(Isaac.WorldToScreen(entity.Position + textPosOffset * Vector(-1,0)))