mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
charcoal; smelter item sprite;
crafting-fixed navigate-ingredients-crafting-recipe behav
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
"basegame:176": { /* torch */
|
||||
"workbench": "",
|
||||
"ingredients": [
|
||||
[5, 1, "item@basegame:18", 1, "item@basegame:130"] /* 5 torches = 1 stick, 1 coal */
|
||||
[5, 1, "item@basegame:18", 1, "item@basegame:130"], /* 5 torches = 1 stick, 1 coal */
|
||||
[5, 1, "item@basegame:18", 1, "item@basegame:29"] /* 5 torches = 1 stick, 1 charcoal */
|
||||
]
|
||||
},
|
||||
"item@basegame:5": { /* tiki torch */
|
||||
|
||||
@@ -26,12 +26,13 @@ id;classname;tags
|
||||
25;net.torvald.terrarum.modulebasegame.gameitems.ItemClayBall;
|
||||
27;net.torvald.terrarum.modulebasegame.gameitems.ItemFurnaceAndAnvil;FIXTURE,CRAFTING
|
||||
28;net.torvald.terrarum.modulebasegame.gameitems.ItemJukebox;FIXTURE,MUSIC
|
||||
29;net.torvald.terrarum.modulebasegame.gameitems.ItemCharcoal;COMBUSTIBLE
|
||||
|
||||
# ingots
|
||||
26;net.torvald.terrarum.modulebasegame.gameitems.IngotSteel;INGOT
|
||||
112;net.torvald.terrarum.modulebasegame.gameitems.IngotCopper;INGOT
|
||||
113;net.torvald.terrarum.modulebasegame.gameitems.IngotIron;INGOT
|
||||
114;net.torvald.terrarum.modulebasegame.gameitems.ItemCoalCoke;INGOT,COMBUSTIBLE
|
||||
114;net.torvald.terrarum.modulebasegame.gameitems.ItemCoalCoke;COMBUSTIBLE
|
||||
115;net.torvald.terrarum.modulebasegame.gameitems.IngotZinc;INGOT
|
||||
116;net.torvald.terrarum.modulebasegame.gameitems.IngotTin;INGOT
|
||||
117;net.torvald.terrarum.modulebasegame.gameitems.IngotGold;INGOT
|
||||
@@ -59,10 +60,10 @@ id;classname;tags
|
||||
163;net.torvald.terrarum.modulebasegame.gameitems.ItemSeedRosewood;SEEDLING
|
||||
|
||||
# tree logs
|
||||
168;net.torvald.terrarum.modulebasegame.gameitems.ItemLogsOak;COMBUSTIBLE
|
||||
169;net.torvald.terrarum.modulebasegame.gameitems.ItemLogsEbony;COMBUSTIBLE
|
||||
170;net.torvald.terrarum.modulebasegame.gameitems.ItemLogsBirch;COMBUSTIBLE
|
||||
171;net.torvald.terrarum.modulebasegame.gameitems.ItemLogsRosewood;COMBUSTIBLE
|
||||
168;net.torvald.terrarum.modulebasegame.gameitems.ItemLogsOak;COMBUSTIBLE,SMELTABLE
|
||||
169;net.torvald.terrarum.modulebasegame.gameitems.ItemLogsEbony;COMBUSTIBLE,SMELTABLE
|
||||
170;net.torvald.terrarum.modulebasegame.gameitems.ItemLogsBirch;COMBUSTIBLE,SMELTABLE
|
||||
171;net.torvald.terrarum.modulebasegame.gameitems.ItemLogsRosewood;COMBUSTIBLE,SMELTABLE
|
||||
|
||||
|
||||
256;net.torvald.terrarum.modulebasegame.gameitems.ItemSwingingDoorOak;FIXTURE
|
||||
|
||||
|
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"ITEM_CALENDAR": "Calendar",
|
||||
"ITEM_CHARCOAL": "Charcoal",
|
||||
"ITEM_COAL_COKE": "Coal Coke",
|
||||
"ITEM_DOOR_OAK": "Oak Door",
|
||||
"ITEM_DOOR_EBONY": "Ebony Door",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"ITEM_CALENDAR": "달력",
|
||||
"ITEM_CHARCOAL": "목탄",
|
||||
"ITEM_COAL_COKE": "코크스",
|
||||
"ITEM_DOOR_OAK": "나무 문",
|
||||
"ITEM_DOOR_EBONY": "흑단 문",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameitems
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
|
||||
/**
|
||||
@@ -13,9 +14,7 @@ class ItemFurnaceAndAnvil(originalID: ItemID) : FixtureItemBase(originalID, "net
|
||||
override val isDynamic = false
|
||||
override val materialId = ""
|
||||
override val itemImage: TextureRegion
|
||||
get() = getItemImageFromSingleImage("basegame", "sprites/fixtures/metalworking_furnace_and_anvil.tga")
|
||||
override val itemImageEmissive: TextureRegion
|
||||
get() = getItemImageFromSingleImage("basegame", "sprites/fixtures/metalworking_furnace_and_anvil_emsv.tga")
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(5,3)
|
||||
|
||||
override var baseToolSize: Double? = baseMass
|
||||
override var originalName = "ITEM_FURNACE_AND_ANVIL"
|
||||
|
||||
@@ -10,26 +10,12 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
* Created by minjaesong on 2023-12-04.
|
||||
*/
|
||||
class ItemSmelterBasic(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureSmelterBasic") {
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("basegame/sprites/fixtures/smelter_tall.tga") {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "sprites/fixtures/smelter_tall.tga"), 48, 64)
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("basegame/sprites/fixtures/smelter_tall_emsv.tga") {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "sprites/fixtures/smelter_tall_emsv.tga"), 48, 64)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
}
|
||||
|
||||
override var baseMass = 100.0
|
||||
override val isDynamic = false
|
||||
override val materialId = ""
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsTextureRegionPack("basegame/sprites/fixtures/smelter_tall.tga").get(1, 0)
|
||||
override val itemImageEmissive: TextureRegion
|
||||
get() = CommonResourcePool.getAsTextureRegionPack("basegame/sprites/fixtures/smelter_tall_emsv.tga").get(1, 0)
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(4,3)
|
||||
|
||||
override var baseToolSize: Double? = baseMass
|
||||
override var originalName = "ITEM_SMELTER_SMALL"
|
||||
|
||||
}
|
||||
@@ -35,6 +35,7 @@ class ItemLogsOak(originalID: ItemID) : OreItemBase(originalID) {
|
||||
override val materialId = "WOOD"
|
||||
override var calories = 1920.0
|
||||
override var smokiness = 0.2f
|
||||
override var smeltingProduct: ItemID? = "item@basegame:29"
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(0,10)
|
||||
|
||||
@@ -48,6 +49,7 @@ class ItemLogsEbony(originalID: ItemID) : OreItemBase(originalID) {
|
||||
override val materialId = "WOOD"
|
||||
override var calories = 1920.0
|
||||
override var smokiness = 0.2f
|
||||
override var smeltingProduct: ItemID? = "item@basegame:29"
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(1,10)
|
||||
|
||||
@@ -61,6 +63,7 @@ class ItemLogsBirch(originalID: ItemID) : OreItemBase(originalID) {
|
||||
override val materialId = "WOOD"
|
||||
override var calories = 1920.0
|
||||
override var smokiness = 0.2f
|
||||
override var smeltingProduct: ItemID? = "item@basegame:29"
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(2,10)
|
||||
|
||||
@@ -74,6 +77,7 @@ class ItemLogsRosewood(originalID: ItemID) : OreItemBase(originalID) {
|
||||
override val materialId = "WOOD"
|
||||
override var calories = 1920.0
|
||||
override var smokiness = 0.2f
|
||||
override var smeltingProduct: ItemID? = "item@basegame:29"
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(3,10)
|
||||
|
||||
@@ -180,6 +184,13 @@ class ItemCoalCoke(originalID: ItemID) : OreItemBase(originalID) {
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(9,6)
|
||||
}
|
||||
class ItemCharcoal(originalID: ItemID) : OreItemBase(originalID) {
|
||||
override var originalName = "ITEM_CHARCOAL"
|
||||
override var calories = 4800.0
|
||||
override var smokiness = 0.3f
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(12,6)
|
||||
}
|
||||
class IngotCopper(originalID: ItemID) : OreItemBase(originalID) {
|
||||
override var originalName = "ITEM_INGOT_COPPER"
|
||||
override val itemImage: TextureRegion
|
||||
|
||||
@@ -120,7 +120,7 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
||||
val buttonWidth = (UIItemInventoryElemWide.height + listGap) * 3 - listGap - 2
|
||||
|
||||
// ingredient list
|
||||
itemListIngredients = UIItemInventoryItemGrid(
|
||||
itemListIngredients = UIItemInventoryItemGrid(
|
||||
this,
|
||||
{ ingredients },
|
||||
thisOffsetX,
|
||||
@@ -135,7 +135,8 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
||||
keyDownFun = { _, _, _, _, _ -> },
|
||||
wheelFun = { _, _, _, _, _, _ -> },
|
||||
touchDownFun = { gameItem, amount, _, _, _ -> gameItem?.let { gameItem ->
|
||||
// if the item is craftable one, load its recipe instead
|
||||
// if the clicked item is craftable one, present its recipe to the player //
|
||||
|
||||
CraftingRecipeCodex.getRecipesFor(gameItem.originalID)?.let { recipes ->
|
||||
// select most viable recipe (completely greedy search)
|
||||
val player = getPlayerInventory()
|
||||
@@ -150,7 +151,7 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
||||
|
||||
listOf(score, items, recipe)
|
||||
}.maxByOrNull { it[0] as Long }?.let { (_, items, recipe) ->
|
||||
val items = items as List<List<*>>
|
||||
val items = items as List<RecipeIngredientRecord>
|
||||
val recipe = recipe as CraftingCodex.CraftingRecipe
|
||||
|
||||
// change selected recipe to mostViableRecipe then update the UIs accordingly
|
||||
@@ -167,8 +168,8 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
||||
recipeClicked = recipe
|
||||
|
||||
items.forEach {
|
||||
val itm = it[0] as ItemID
|
||||
val qty = it[2] as Long
|
||||
val itm = it.selectedItem
|
||||
val qty = it.howManyRecipeWants
|
||||
|
||||
selectedItems.add(itm)
|
||||
ingredients.add(itm, qty)
|
||||
@@ -176,30 +177,14 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
||||
|
||||
_getItemListPlayer().let {
|
||||
it.removeFromForceHighlightList(oldSelectedItems)
|
||||
filterPlayerListUsing(recipeClicked)
|
||||
//filterPlayerListUsing(recipeClicked) // ???
|
||||
it.addToForceHighlightList(selectedItems)
|
||||
it.rebuild(FILTER_CAT_ALL)
|
||||
filterPlayerListUsing(recipeClicked)
|
||||
}
|
||||
|
||||
_getItemListIngredients().rebuild(FILTER_CAT_ALL)
|
||||
|
||||
// highlighting CraftingCandidateButton by searching for the buttons that has the recipe
|
||||
_getItemListCraftables().let {
|
||||
// turn the highlights off
|
||||
it.items.forEach { it.forceHighlighted = false }
|
||||
|
||||
// search for the recipe
|
||||
// also need to find what "page" the recipe might be in
|
||||
// use it.isCompactMode to find out the current mode
|
||||
var ord = 0
|
||||
while (ord < it.craftingRecipes.indices.last) {
|
||||
if (recipeClicked == it.craftingRecipes[ord]) break
|
||||
ord += 1
|
||||
}
|
||||
val itemSize = it.items.size
|
||||
|
||||
it.itemPage = ord / itemSize
|
||||
it.items[ord % itemSize].forceHighlighted = true
|
||||
}
|
||||
_getItemListCraftables().highlightRecipe(recipeClicked, true)
|
||||
|
||||
oldSelectedItems.clear()
|
||||
oldSelectedItems.addAll(selectedItems)
|
||||
|
||||
@@ -40,14 +40,34 @@ class UIItemCraftingCandidateGrid(
|
||||
|
||||
private var highlightedRecipe: CraftingCodex.CraftingRecipe? = null
|
||||
|
||||
fun highlightRecipe(recipe: CraftingCodex.CraftingRecipe?) {
|
||||
fun highlightRecipe(recipe: CraftingCodex.CraftingRecipe?, changePage: Boolean = false) {
|
||||
items.forEach { it.forceHighlighted = false }
|
||||
|
||||
highlightedRecipe = recipe
|
||||
|
||||
recipe?.let {
|
||||
items.find { it.extraInfo == recipe }?.let { buttonFound ->
|
||||
buttonFound.forceHighlighted = true
|
||||
// search for the recipe
|
||||
// also need to find what "page" the recipe might be in
|
||||
// use it.isCompactMode to find out the current mode
|
||||
var ord = 0
|
||||
var found = false
|
||||
while (ord < craftingRecipes.indices.last) {
|
||||
if (recipe == craftingRecipes[ord]) {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
ord += 1
|
||||
}
|
||||
val itemSize = items.size
|
||||
val newPage = ord / itemSize
|
||||
|
||||
if (found) {
|
||||
if (changePage) {
|
||||
itemPage = newPage
|
||||
items[ord % itemSize].forceHighlighted = true
|
||||
}
|
||||
// if we are on the same page, highlight the cell; otherwise, do nothing
|
||||
else if (itemPage == newPage) {
|
||||
items[ord % itemSize].forceHighlighted = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ class UIItemInventoryElemSimple(
|
||||
}
|
||||
// cell border
|
||||
batch.color = if (highlightToMainCol) colourTheme.cellHighlightMainCol
|
||||
else if (highlightToSubCol) colourTheme.cellHighlightSubCol
|
||||
else if (mouseUp && (item != null || updateOnNull)) colourTheme.cellHighlightMouseUpCol
|
||||
else if (highlightToSubCol) colourTheme.cellHighlightSubCol
|
||||
else colourTheme.cellHighlightNormalCol
|
||||
Toolkit.drawBoxBorder(batch, posX, posY, width, height)
|
||||
|
||||
|
||||
@@ -40,6 +40,6 @@ void main(void) {
|
||||
out_color = out_color * scanline_darkening;
|
||||
}
|
||||
|
||||
fragColor = vec4(out_color, 1);
|
||||
fragColor = vec4(out_color, color.a);
|
||||
//fragColor = texture(u_texture, v_texCoords);
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user