mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +09:00
working crafting workbench
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2023-09-20.
|
||||
*/
|
||||
open interface CraftingStation {
|
||||
|
||||
val tags: List<String>
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ class FixtureWallCalendar : FixtureBase {
|
||||
val itemImage = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/calendar.tga")
|
||||
|
||||
density = 600.0
|
||||
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, 1)
|
||||
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, 0)
|
||||
|
||||
makeNewSprite(TextureRegionPack(itemImage.texture, TILE_SIZE, TILE_SIZE)).let {
|
||||
it.setRowsAndFrames(1,1)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.BlockCodex
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIWallCalendar
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2023-09-20.
|
||||
*/
|
||||
class FixtureWorkbench : FixtureBase, CraftingStation {
|
||||
|
||||
@Transient override val tags = listOf("basiccrafting")
|
||||
|
||||
constructor() : super(
|
||||
BlockBox(BlockBox.ALLOW_MOVE_DOWN, 2, 1),
|
||||
nameFun = { Lang["ITEM_WORKBENCH"] },
|
||||
mainUI = UIWallCalendar()
|
||||
) {
|
||||
val itemImage = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/workbench.tga")
|
||||
|
||||
density = BlockCodex[Block.PLANK_NORMAL].density.toDouble()
|
||||
setHitboxDimension(itemImage.texture.width, itemImage.texture.height, 0, 0)
|
||||
|
||||
makeNewSprite(TextureRegionPack(itemImage.texture, itemImage.texture.width, itemImage.texture.height)).let {
|
||||
it.setRowsAndFrames(1,1)
|
||||
}
|
||||
|
||||
actorValue[AVKey.BASEMASS] = 20.0
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.BlockCodex
|
||||
import net.torvald.terrarum.WireCodex
|
||||
|
||||
/**
|
||||
@@ -72,13 +73,20 @@ object PlayerBuilderSigrid {
|
||||
|
||||
fun fillTestInventory(inventory: ActorInventory) {
|
||||
|
||||
App.tileMaker.tags.forEach { t, _ ->
|
||||
inventory.add(t, 9995)
|
||||
try {
|
||||
inventory.add("wall@$t", 9995) // this code will try to add nonexisting wall items, do not get surprised with NPEs
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
System.err.println("[PlayerBuilder] $e")
|
||||
App.tileMaker.tags.forEach { (t, _) ->
|
||||
if (!BlockCodex[t].isActorBlock) {
|
||||
|
||||
inventory.add(t, 9995)
|
||||
try {
|
||||
inventory.add(
|
||||
"wall@$t",
|
||||
9995
|
||||
) // this code will try to add nonexisting wall items, do not get surprised with NPEs
|
||||
}
|
||||
catch (e: NullPointerException) { /* tHiS iS fInE */ }
|
||||
catch (e: Throwable) {
|
||||
System.err.println("[PlayerBuilder] $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +108,8 @@ object PlayerBuilderSigrid {
|
||||
|
||||
inventory.add("item@basegame:11", 10) // calendar
|
||||
|
||||
inventory.add("item@basegame:16", 10) // workbench
|
||||
|
||||
// inventory.add("item@basegame:256", 995) // doors
|
||||
// inventory.add("item@basegame:257", 995) // doors
|
||||
// inventory.add("item@basegame:258", 995) // doors
|
||||
|
||||
Reference in New Issue
Block a user