mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-14 15:46:06 +09:00
LibGDX, here I am.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
import net.torvald.point.Point2d
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumGDX
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.ActorWithPhysics
|
||||
import net.torvald.terrarum.itemproperties.Calculate
|
||||
@@ -14,7 +14,6 @@ import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
// following two are NOT UNUSED!
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
|
||||
|
||||
@@ -56,42 +55,42 @@ class TestPick extends GameItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean primaryUse(@NotNull GameContainer gc, int delta) {
|
||||
int mouseTileX = Terrarum.getMouseTileX()
|
||||
int mouseTileY = Terrarum.getMouseTileY()
|
||||
boolean primaryUse(float delta) {
|
||||
int mouseTileX = TerrarumGdx.getMouseTileX()
|
||||
int mouseTileY = TerrarumGdx.getMouseTileY()
|
||||
|
||||
def mousePoint = new Point2d(mouseTileX, mouseTileY)
|
||||
def actorvalue = Terrarum.ingame.player.actorValue
|
||||
def actorvalue = TerrarumGDX.ingame.player.actorValue
|
||||
|
||||
using = true
|
||||
|
||||
// linear search filter (check for intersection with tilewise mouse point and tilewise hitbox)
|
||||
// return false if hitting actors
|
||||
Terrarum.ingame.actorContainer.forEach({
|
||||
TerrarumGDX.ingame.actorContainer.forEach({
|
||||
if (it instanceof ActorWithPhysics && it.tilewiseHitbox.intersects(mousePoint))
|
||||
return false
|
||||
})
|
||||
|
||||
// return false if here's no tile
|
||||
if (Block.AIR == Terrarum.ingame.world.getTileFromTerrain(mouseTileX, mouseTileY))
|
||||
if (Block.AIR == TerrarumGDX.ingame.world.getTileFromTerrain(mouseTileX, mouseTileY))
|
||||
return false
|
||||
|
||||
// filter passed, do the job
|
||||
double swingDmgToFrameDmg = delta.toDouble() / actorvalue.getAsDouble(AVKey.ACTION_INTERVAL)
|
||||
|
||||
Terrarum.ingame.world.inflictTerrainDamage(
|
||||
TerrarumGDX.ingame.world.inflictTerrainDamage(
|
||||
mouseTileX, mouseTileY,
|
||||
Calculate.pickaxePower(Terrarum.ingame.player, material) * swingDmgToFrameDmg
|
||||
Calculate.pickaxePower(TerrarumGDX.ingame.player, material) * swingDmgToFrameDmg
|
||||
)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean endPrimaryUse(@NotNull GameContainer gc, int delta) {
|
||||
boolean endPrimaryUse(float delta) {
|
||||
using = false
|
||||
// reset action timer to zero
|
||||
Terrarum.ingame.player.actorValue.set(AVKey.__ACTION_TIMER, 0.0)
|
||||
TerrarumGDX.ingame.player.actorValue.set(AVKey.__ACTION_TIMER, 0.0)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
BIN
assets/modules/basegame/sounds/ambient/ambient_forest_01.ogg
LFS
Normal file
BIN
assets/modules/basegame/sounds/ambient/ambient_forest_01.ogg
LFS
Normal file
Binary file not shown.
BIN
assets/modules/basegame/sounds/ambient/ambient_meadow_01.ogg
LFS
Normal file
BIN
assets/modules/basegame/sounds/ambient/ambient_meadow_01.ogg
LFS
Normal file
Binary file not shown.
BIN
assets/modules/basegame/sounds/ambient/ambient_windy_01.ogg
LFS
Normal file
BIN
assets/modules/basegame/sounds/ambient/ambient_windy_01.ogg
LFS
Normal file
Binary file not shown.
BIN
assets/modules/basegame/sounds/ambient/ambient_woods_01.ogg
LFS
Normal file
BIN
assets/modules/basegame/sounds/ambient/ambient_woods_01.ogg
LFS
Normal file
Binary file not shown.
BIN
assets/modules/basegame/sounds/ambient/crickets_01.ogg
LFS
Normal file
BIN
assets/modules/basegame/sounds/ambient/crickets_01.ogg
LFS
Normal file
Binary file not shown.
BIN
assets/modules/basegame/sounds/ambient/crickets_02.ogg
LFS
Normal file
BIN
assets/modules/basegame/sounds/ambient/crickets_02.ogg
LFS
Normal file
Binary file not shown.
BIN
assets/modules/basegame/sounds/effects/power_button_push.wav
Normal file
BIN
assets/modules/basegame/sounds/effects/power_button_push.wav
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,12 @@
|
||||
## Note to modders
|
||||
|
||||
- You DON'T just edit built-in modules; you must make your own module even if you want to replace defaults.
|
||||
|
||||
### To devs
|
||||
|
||||
- make that happen :\
|
||||
|
||||
|
||||
## Register modules
|
||||
|
||||
Only the modules that enlisted in LoadOrder.csv will be loaded.
|
||||
|
||||
Reference in New Issue
Block a user