mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 10:34:06 +09:00
revived the worldSecondaryClick function
This commit is contained in:
@@ -221,19 +221,19 @@ open class IngameInstance(val batch: FlippingSpriteBatch, val isMultiplayer: Boo
|
|||||||
open fun worldPrimaryClickEnd(actor: ActorWithBody, delta: Float) {
|
open fun worldPrimaryClickEnd(actor: ActorWithBody, delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26
|
||||||
|
// Nevermind: we need to distinguish picking up and using the fixture. --Torvald on 2022-08-26
|
||||||
/**
|
/**
|
||||||
* I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26
|
|
||||||
*
|
|
||||||
* Event for triggering held item's `startSecondaryUse(Float)`
|
* Event for triggering held item's `startSecondaryUse(Float)`
|
||||||
*/
|
*/
|
||||||
//open fun worldSecondaryClickStart(delta: Float) { }
|
open fun worldSecondaryClickStart(actor: ActorWithBody, delta: Float) { }
|
||||||
|
|
||||||
/**
|
// I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26
|
||||||
* I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26
|
// Nevermind: we need to distinguish picking up and using the fixture. --Torvald on 2022-08-26
|
||||||
*
|
/***
|
||||||
* Event for triggering held item's `endSecondaryUse(Float)`
|
* Event for triggering held item's `endSecondaryUse(Float)`
|
||||||
*/
|
*/
|
||||||
//open fun worldSecondaryClickEnd(delta: Float) { }
|
open fun worldSecondaryClickEnd(actor: ActorWithBody, delta: Float) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event for triggering fixture update when something is placed/removed on the world.
|
* Event for triggering fixture update when something is placed/removed on the world.
|
||||||
|
|||||||
@@ -135,9 +135,9 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
|||||||
terrarumIngame.worldPrimaryClickStart(terrarumIngame.actorNowPlaying!!, App.UPDATE_RATE)
|
terrarumIngame.worldPrimaryClickStart(terrarumIngame.actorNowPlaying!!, App.UPDATE_RATE)
|
||||||
worldPrimaryClickLatched = true
|
worldPrimaryClickLatched = true
|
||||||
}
|
}
|
||||||
/*if Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mousesecondary")) {
|
if (Gdx.input.isButtonPressed(App.getConfigInt("config_mousesecondary"))) {
|
||||||
ingame.worldSecondaryClickStart(AppLoader.UPDATE_RATE)
|
terrarumIngame.worldSecondaryClickStart(terrarumIngame.actorNowPlaying!!, App.UPDATE_RATE)
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// unlatch when:
|
// unlatch when:
|
||||||
// - not clicking anymore
|
// - not clicking anymore
|
||||||
@@ -225,9 +225,9 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
|||||||
button == App.getConfigInt("config_mousesecondary"))) {
|
button == App.getConfigInt("config_mousesecondary"))) {
|
||||||
terrarumIngame.worldPrimaryClickEnd(terrarumIngame.actorNowPlaying!!, App.UPDATE_RATE)
|
terrarumIngame.worldPrimaryClickEnd(terrarumIngame.actorNowPlaying!!, App.UPDATE_RATE)
|
||||||
}
|
}
|
||||||
/*if (button == AppLoader.getConfigInt("config_mousesecondary")) {
|
if (button == App.getConfigInt("config_mousesecondary")) {
|
||||||
ingame.worldSecondaryClickEnd(AppLoader.UPDATE_RATE)
|
terrarumIngame.worldSecondaryClickEnd(terrarumIngame.actorNowPlaying!!, App.UPDATE_RATE)
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -585,6 +585,9 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
}// END enter
|
}// END enter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// left click: use item, use fixture, use something else
|
||||||
override fun worldPrimaryClickStart(actor: ActorWithBody, delta: Float) {
|
override fun worldPrimaryClickStart(actor: ActorWithBody, delta: Float) {
|
||||||
//println("[Ingame] worldPrimaryClickStart $delta")
|
//println("[Ingame] worldPrimaryClickStart $delta")
|
||||||
|
|
||||||
@@ -606,7 +609,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
// #1. Try to open a UI under the cursor
|
// #1. Try to open a UI under the cursor
|
||||||
// scan for the one with non-null UI.
|
// scan for the one with non-null UI.
|
||||||
// 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) {
|
||||||
if (mouseInInteractableRange(actor) {
|
if (mouseInInteractableRange(actor) {
|
||||||
actorsUnderMouse[kk].mainUI?.let {
|
actorsUnderMouse[kk].mainUI?.let {
|
||||||
@@ -625,7 +628,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
0L
|
0L
|
||||||
} == 0L) break
|
} == 0L) break
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
// #2. If there is no UI under and if I'm holding an item, use it
|
// #2. If there is no UI under and if I'm holding an item, use it
|
||||||
// don't want to open the UI and use the item at the same time, would ya?
|
// don't want to open the UI and use the item at the same time, would ya?
|
||||||
@@ -653,18 +656,14 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// I have decided that left and right clicks must do the same thing, so no secondary use from now on. --Torvald on 2019-05-26
|
// right click: pick up fixture, open debug menu (if applicable)
|
||||||
/*override fun worldSecondaryClickStart(delta: Float) {
|
override fun worldSecondaryClickStart(actor: ActorWithBody, delta: Float) {
|
||||||
val itemOnGrip = actorNowPlaying?.inventory?.itemEquipped?.get(GameItem.EquipPosition.HAND_GRIP)
|
// println("Secondary click start!")
|
||||||
val consumptionSuccessful = ItemCodex[itemOnGrip]?.startSecondaryUse(delta) ?: false
|
|
||||||
if (consumptionSuccessful > -1)
|
|
||||||
actorNowPlaying?.inventory?.consumeItem(ItemCodex[itemOnGrip]!!, consumptionSuccessful)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun worldSecondaryClickEnd(delta: Float) {
|
override fun worldSecondaryClickEnd(actor: ActorWithBody, delta: Float) {
|
||||||
val itemOnGrip = actorNowPlaying?.inventory?.itemEquipped?.get(GameItem.EquipPosition.HAND_GRIP)
|
// println("Secondary click start!")
|
||||||
ItemCodex[itemOnGrip]?.endSecondaryUse(delta)
|
}
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user