diff --git a/ModuleComputers/src/net/torvald/terrarum/modulecomputers/gameactors/FixtureHomeComputer.kt b/ModuleComputers/src/net/torvald/terrarum/modulecomputers/gameactors/FixtureHomeComputer.kt index d407728cc..4338f359f 100644 --- a/ModuleComputers/src/net/torvald/terrarum/modulecomputers/gameactors/FixtureHomeComputer.kt +++ b/ModuleComputers/src/net/torvald/terrarum/modulecomputers/gameactors/FixtureHomeComputer.kt @@ -114,6 +114,8 @@ internal class UIHomeComputer : UICanvas( otherBatch.end() fbo.inAction(camera, batch) { + Gdx.gl.glClearColor(0f,0f,0f,1f) // to hide the crap might be there + (vm.peripheralTable[1].peripheral as? GraphicsAdapter)?.let { gpu -> val clearCol = gpu.getBackgroundColour() Gdx.gl.glClearColor(clearCol.r, clearCol.g, clearCol.b, clearCol.a) diff --git a/assets/mods/dwarventech/ModuleComputers.jar b/assets/mods/dwarventech/ModuleComputers.jar index 354e09fd7..3d5b18cc6 100644 Binary files a/assets/mods/dwarventech/ModuleComputers.jar and b/assets/mods/dwarventech/ModuleComputers.jar differ diff --git a/src/net/torvald/terrarum/gameitems/GameItem.kt b/src/net/torvald/terrarum/gameitems/GameItem.kt index ce6a16565..0423f30f4 100644 --- a/src/net/torvald/terrarum/gameitems/GameItem.kt +++ b/src/net/torvald/terrarum/gameitems/GameItem.kt @@ -323,6 +323,11 @@ abstract class GameItem(val originalID: ItemID) : Comparable, Cloneabl } } } + +/** + * @param actor actor to check the reach + * @param action returns true if the action was successfully performed + */ fun inInteractableRange(actor: ActorWithBody, action: () -> Boolean): Boolean { val mousePos1 = Vector2(Terrarum.mouseX, Terrarum.mouseY) val mousePos2 = Vector2(Terrarum.mouseX + INGAME.world.width * TILE_SIZED, Terrarum.mouseY) diff --git a/src/net/torvald/terrarum/modulebasegame/TerrarumIngame.kt b/src/net/torvald/terrarum/modulebasegame/TerrarumIngame.kt index 783d3ead0..c05f0bda2 100644 --- a/src/net/torvald/terrarum/modulebasegame/TerrarumIngame.kt +++ b/src/net/torvald/terrarum/modulebasegame/TerrarumIngame.kt @@ -602,18 +602,22 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) { // what if there's multiple of such fixtures? whatever, you are supposed to DISALLOW such situation. if (itemOnGrip?.inventoryCategory != GameItem.Category.TOOL) { // don't open the UI when player's holding a tool for (kk in actorsUnderMouse.indices) { - actorsUnderMouse[kk].mainUI?.let { - uiOpened = true + if (inInteractableRange(actor) { + actorsUnderMouse[kk].mainUI?.let { + uiOpened = true - // property 'uiFixture' is a dedicated property that the TerrarumIngame recognises. - // when it's not null, the UI will be updated and rendered - // when the UI is closed, it'll be replaced with a null value - uiFixture = it - - it.setPosition(0, 0) - it.setAsOpen() - } - break + // property 'uiFixture' is a dedicated property that the TerrarumIngame recognises. + // when it's not null, the UI will be updated and rendered + // when the UI is closed, it'll be replaced with a null value + uiFixture = it + it.setPosition( + (Toolkit.drawWidth - it.width) / 4, + (App.scr.height - it.height) / 4 // what the fuck? + ) + it.setAsOpen() + } + true + }) break } }