mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
wrench axle wip
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
"MENU_LABEL_USE_CODE": "Use Code",
|
||||
"MENU_MODE_BUILDINGMAKER": "POI Editor",
|
||||
"MENU_UPDATE_UPDATE_AVAILABLE": "Update Available!",
|
||||
"GAME_ACTION_DISMANTLE": "Dismantle",
|
||||
"GAME_ACTION_GRAPPLE": "Grapple",
|
||||
"GAME_ACTION_QUICKSEL": "Quick Select",
|
||||
"GAME_ACTION_SELECT_SLOT": "Select Slot",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"TOOLTIP_basegame:256": "Provides stable light",
|
||||
"TOOLTIP_basegame:256": "Provides a stable light",
|
||||
"TOOLTIP_basegame:257": "Provides a light equal to the sun", /* it literally does -- provides the sunlight of the exact hour (emits "moonlight" at night time) */
|
||||
"TOOLTIP_basegame:258": "Provides a light equal to the sun at noon",
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"TOOLTIP_wire@basegame:1": "Carries power",
|
||||
"TOOLTIP_wire@basegame:2": "Carries power",
|
||||
"TOOLTIP_wire@basegame:16": "Carries information",
|
||||
"TOOLTIP_wire@basegame:256": "Carries rotational force",
|
||||
|
||||
"TOOLTIP_item@basegame:1": "Breaks rocks",
|
||||
"TOOLTIP_item@basegame:2": "Breaks rocks",
|
||||
@@ -44,7 +45,7 @@
|
||||
"TOOLTIP_item@basegame:28": "A music vending machine (free to play)",
|
||||
"TOOLTIP_item@basegame:29": "A coal lookalike that burns just as well and is renewable",
|
||||
"TOOLTIP_item@basegame:36": "Creates wires from metal ingots",
|
||||
"TOOLTIP_item@basegame:47": "Reorients gadgets",
|
||||
"TOOLTIP_item@basegame:47": "Reorients gadgets and axles",
|
||||
"TOOLTIP_item@basegame:48": "Melts two metal ingots to make a bar of alloy",
|
||||
"TOOLTIP_item@basegame:50": "Use it on the Electronics Workbench",
|
||||
|
||||
|
||||
@@ -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