mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
range check for fixtures with UI; fixture UI is centred now
This commit is contained in:
@@ -114,6 +114,8 @@ internal class UIHomeComputer : UICanvas(
|
|||||||
otherBatch.end()
|
otherBatch.end()
|
||||||
|
|
||||||
fbo.inAction(camera, batch) {
|
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 ->
|
(vm.peripheralTable[1].peripheral as? GraphicsAdapter)?.let { gpu ->
|
||||||
val clearCol = gpu.getBackgroundColour()
|
val clearCol = gpu.getBackgroundColour()
|
||||||
Gdx.gl.glClearColor(clearCol.r, clearCol.g, clearCol.b, clearCol.a)
|
Gdx.gl.glClearColor(clearCol.r, clearCol.g, clearCol.b, clearCol.a)
|
||||||
|
|||||||
Binary file not shown.
@@ -323,6 +323,11 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, 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 {
|
fun inInteractableRange(actor: ActorWithBody, action: () -> Boolean): Boolean {
|
||||||
val mousePos1 = Vector2(Terrarum.mouseX, Terrarum.mouseY)
|
val mousePos1 = Vector2(Terrarum.mouseX, Terrarum.mouseY)
|
||||||
val mousePos2 = Vector2(Terrarum.mouseX + INGAME.world.width * TILE_SIZED, Terrarum.mouseY)
|
val mousePos2 = Vector2(Terrarum.mouseX + INGAME.world.width * TILE_SIZED, Terrarum.mouseY)
|
||||||
|
|||||||
@@ -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.
|
// 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
|
if (itemOnGrip?.inventoryCategory != GameItem.Category.TOOL) { // don't open the UI when player's holding a tool
|
||||||
for (kk in actorsUnderMouse.indices) {
|
for (kk in actorsUnderMouse.indices) {
|
||||||
actorsUnderMouse[kk].mainUI?.let {
|
if (inInteractableRange(actor) {
|
||||||
uiOpened = true
|
actorsUnderMouse[kk].mainUI?.let {
|
||||||
|
uiOpened = true
|
||||||
|
|
||||||
// property 'uiFixture' is a dedicated property that the TerrarumIngame recognises.
|
// property 'uiFixture' is a dedicated property that the TerrarumIngame recognises.
|
||||||
// when it's not null, the UI will be updated and rendered
|
// 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
|
// when the UI is closed, it'll be replaced with a null value
|
||||||
uiFixture = it
|
uiFixture = it
|
||||||
|
it.setPosition(
|
||||||
it.setPosition(0, 0)
|
(Toolkit.drawWidth - it.width) / 4,
|
||||||
it.setAsOpen()
|
(App.scr.height - it.height) / 4 // what the fuck?
|
||||||
}
|
)
|
||||||
break
|
it.setAsOpen()
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}) break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user