mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-13 15:16:07 +09:00
wrench axle wip
This commit is contained in:
@@ -34,9 +34,9 @@ class WireActor : ActorWithBody, NoSerialise, InternalActor {
|
||||
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, 0)
|
||||
}
|
||||
|
||||
private var wireID = ""
|
||||
private var worldX = 0
|
||||
private var worldY = 0
|
||||
var wireID = ""; private set
|
||||
var worldX = 0; private set
|
||||
var worldY = 0; private set
|
||||
|
||||
/**
|
||||
* @param itemID must start with "wire@"
|
||||
|
||||
@@ -1,22 +1,34 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameitems
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gameactors.WireActor
|
||||
import net.torvald.terrarum.gameitems.FixtureInteractionBlocked
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.gameitems.mouseInInteractableRange
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.Reorientable
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.tooltipShowing
|
||||
import net.torvald.unicode.getMouseButton
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-08.
|
||||
*/
|
||||
class ItemWrench(originalID: ItemID) : GameItem(originalID), FixtureInteractionBlocked {
|
||||
|
||||
companion object {
|
||||
private val tooltipHash = 10003L
|
||||
private val SP = "\u3000"
|
||||
private val ML = getMouseButton(App.getConfigInt("config_mouseprimary"))
|
||||
private val MR = getMouseButton(App.getConfigInt("config_mousesecondary"))
|
||||
}
|
||||
|
||||
override val disallowToolDragging = true
|
||||
override var dynamicID: ItemID = originalID
|
||||
override var baseMass = 0.1
|
||||
@@ -35,6 +47,25 @@ class ItemWrench(originalID: ItemID) : GameItem(originalID), FixtureInteractionB
|
||||
originalName = "ITEM_WRENCH"
|
||||
}
|
||||
|
||||
override fun effectWhileEquipped(actor: ActorWithBody, delta: Float) {
|
||||
// flipping 'eck this was annoying
|
||||
/*var q = -1L
|
||||
q = mouseInInteractableRange(actor) { mwx, mwy, mtx, mty ->
|
||||
(INGAME as TerrarumIngame).world.getWireGraphOf(mtx, mty, "wire@basegame:256").let { cnx ->
|
||||
if (cnx != null) {
|
||||
INGAME.setTooltipMessage("$ML ${Lang["GAME_ACTION_DISMANTLE"]}\n$MR ${Lang["MENU_CONTROLS_ROTATE"]}")
|
||||
tooltipShowing[tooltipHash] = true
|
||||
}
|
||||
else {
|
||||
tooltipShowing[tooltipHash] = false
|
||||
}
|
||||
}
|
||||
0L
|
||||
}
|
||||
if (q == -1L)
|
||||
tooltipShowing[tooltipHash] = false*/
|
||||
}
|
||||
|
||||
override fun startPrimaryUse(actor: ActorWithBody, delta: Float) = mouseInInteractableRange(actor) { mwx, mwy, mtx, mty ->
|
||||
(INGAME as TerrarumIngame).getActorsUnderMouse(mwx, mwy).filterIsInstance<Reorientable>().firstOrNull()?.let { fixture ->
|
||||
fixture.orientClockwise()
|
||||
|
||||
Reference in New Issue
Block a user