mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
block placing is now primary-use (left click/main trigger/screen tap)
This commit is contained in:
@@ -133,9 +133,14 @@ abstract class GameItem : Comparable<GameItem>, Cloneable {
|
||||
open fun effectWhenPickedUp(delta: Float) { }
|
||||
|
||||
/**
|
||||
* Apply effects (continuously or not) while primary button (usually left mouse button) is down.
|
||||
* Apply effects (continuously or not) while primary button is down.
|
||||
* The item will NOT be consumed, so you will want to consume it yourself by inventory.consumeItem(item)
|
||||
*
|
||||
* Primary button refers to all of these:
|
||||
* - Left mouse button (configurable)
|
||||
* - Screen tap
|
||||
* - XBox controller RT (fixed; LT is for jumping)
|
||||
*
|
||||
* @return true when used successfully, false otherwise
|
||||
*
|
||||
* note: DO NOT super() this!
|
||||
@@ -146,9 +151,11 @@ abstract class GameItem : Comparable<GameItem>, Cloneable {
|
||||
open fun startPrimaryUse(delta: Float): Boolean = false
|
||||
|
||||
/**
|
||||
* Apply effects (continuously or not) while secondary button (usually right mouse button) is down
|
||||
* Apply effects (continuously or not) while secondary button is down
|
||||
* The item will NOT be consumed, so you will want to consume it yourself by inventory.consumeItem(item)
|
||||
*
|
||||
* NOTE: please refrain from using this; secondary button is currently undefined in the gamepad and touch input.
|
||||
*
|
||||
* @return true when used successfully, false otherwise
|
||||
*
|
||||
* note: DO NOT super() this!
|
||||
|
||||
@@ -190,7 +190,7 @@ object ItemCodex {
|
||||
|
||||
override val equipPosition: Int = EquipPosition.HAND_GRIP
|
||||
|
||||
override fun startSecondaryUse(delta: Float): Boolean {
|
||||
override fun startPrimaryUse(delta: Float): Boolean {
|
||||
val ingame = Terrarum.ingame!! as Ingame // must be in here
|
||||
ingame.world.setFluid(Terrarum.mouseTileX, Terrarum.mouseTileY, Fluid.WATER, 4f)
|
||||
return true
|
||||
@@ -217,7 +217,7 @@ object ItemCodex {
|
||||
|
||||
override val equipPosition: Int = EquipPosition.HAND_GRIP
|
||||
|
||||
override fun startSecondaryUse(delta: Float): Boolean {
|
||||
override fun startPrimaryUse(delta: Float): Boolean {
|
||||
val ingame = Terrarum.ingame!! as Ingame // must be in here
|
||||
ingame.world.setFluid(Terrarum.mouseTileX, Terrarum.mouseTileY, Fluid.LAVA, 4f)
|
||||
return true
|
||||
|
||||
@@ -2,17 +2,19 @@ package net.torvald.terrarum.modulebasegame
|
||||
|
||||
import net.torvald.terrarum.AppLoader.IS_DEVELOPMENT_BUILD
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.Point2d
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.ModuleEntryPoint
|
||||
import net.torvald.terrarum.Point2d
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||
|
||||
/**
|
||||
* The entry point for the module "Basegame"
|
||||
*
|
||||
* Created by minjaesong on 2018-06-21.
|
||||
*/
|
||||
class EntryPoint : ModuleEntryPoint() {
|
||||
@@ -52,11 +54,6 @@ class EntryPoint : ModuleEntryPoint() {
|
||||
}
|
||||
|
||||
override fun startPrimaryUse(delta: Float): Boolean {
|
||||
return false
|
||||
// TODO base punch attack
|
||||
}
|
||||
|
||||
override fun startSecondaryUse(delta: Float): Boolean {
|
||||
val ingame = Terrarum.ingame!! as Ingame
|
||||
|
||||
val mousePoint = Point2d(Terrarum.mouseTileX.toDouble(), Terrarum.mouseTileY.toDouble())
|
||||
|
||||
@@ -4,7 +4,6 @@ import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.AIControlled
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.ai.ActorAI
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.time_t
|
||||
@@ -49,7 +48,7 @@ open class HumanoidNPC(
|
||||
override val isDynamic = false
|
||||
override val material = Material(0,0,0,0,0,0,0,0,0,0.0)
|
||||
|
||||
override fun startSecondaryUse(delta: Float): Boolean {
|
||||
override fun startPrimaryUse(delta: Float): Boolean {
|
||||
try {
|
||||
// place the actor to the world
|
||||
this@HumanoidNPC.setPosition(Terrarum.mouseX, Terrarum.mouseY)
|
||||
|
||||
Reference in New Issue
Block a user