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