mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
new inventory category 'fixtures'; fixture code refactoring
This commit is contained in:
@@ -15,27 +15,14 @@ import net.torvald.terrarum.modulecomputers.gameactors.FixtureHomeComputer
|
|||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2021-12-04.
|
* Created by minjaesong on 2021-12-04.
|
||||||
*/
|
*/
|
||||||
class ItemHomeComputer(originalID: ItemID) : GameItem(originalID) {
|
class ItemHomeComputer(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulecomputers.gameactors.FixtureHomeComputer") {
|
||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 20.0
|
override var baseMass = 20.0
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = FixtureItemBase.getItemImageFromSheet("dwarventech", "sprites/fixtures/desktop_computer.tga", TerrarumAppConfiguration.TILE_SIZE, TerrarumAppConfiguration.TILE_SIZE)
|
get() = FixtureItemBase.getItemImageFromSheet("dwarventech", "sprites/fixtures/desktop_computer.tga", TerrarumAppConfiguration.TILE_SIZE, TerrarumAppConfiguration.TILE_SIZE)
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_DESKTOP_COMPUTER"
|
||||||
|
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_DESKTOP_COMPUTER"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun startPrimaryUse(actor: ActorWithBody, delta: Float) = mouseInInteractableRange(actor) { _, _, mtx, mty ->
|
|
||||||
val item = FixtureHomeComputer()
|
|
||||||
|
|
||||||
if (item.spawn(mtx, mty, if (actor is IngamePlayer) actor.uuid else null)) 1L else -1L
|
|
||||||
// return true when placed, false when cannot be placed
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"CONTEXT_GENERATOR_SEED": "Seed",
|
"CONTEXT_GENERATOR_SEED": "Seed",
|
||||||
|
"CONTEXT_ITEM_FIXTURES": "Fixtures",
|
||||||
"CONTEXT_ITEM_MAP": "Map",
|
"CONTEXT_ITEM_MAP": "Map",
|
||||||
"CONTEXT_ITEM_TOOL_PLURAL": "Tools",
|
"CONTEXT_ITEM_TOOL_PLURAL": "Tools",
|
||||||
"CONTEXT_PLACE_COORDINATE": "Coordinate",
|
"CONTEXT_PLACE_COORDINATE": "Coordinate",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"CONTEXT_GENERATOR_SEED": "시드",
|
"CONTEXT_GENERATOR_SEED": "시드",
|
||||||
|
"CONTEXT_ITEM_FIXTURES": "기구",
|
||||||
"CONTEXT_ITEM_MAP": "지도",
|
"CONTEXT_ITEM_MAP": "지도",
|
||||||
"CONTEXT_ITEM_TOOL_PLURAL": "도구",
|
"CONTEXT_ITEM_TOOL_PLURAL": "도구",
|
||||||
"CONTEXT_PLACE_COORDINATE": "좌표",
|
"CONTEXT_PLACE_COORDINATE": "좌표",
|
||||||
|
|||||||
@@ -177,6 +177,11 @@ open class IngameInstance(val batch: FlippingSpriteBatch, val isMultiplayer: Boo
|
|||||||
forceAddActor(it)
|
forceAddActor(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockMarkingActor.let {
|
||||||
|
it.unsetGhost()
|
||||||
|
it.setGhostColourNone()
|
||||||
|
}
|
||||||
|
|
||||||
gameInitialised = true
|
gameInitialised = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
# Windows -- C:\Users\<username>\AppData\Roaming\Terrarum
|
# Windows -- C:\Users\<username>\AppData\Roaming\Terrarum
|
||||||
# macOS -- /Users/<username>/Library/Application Support/Terrarum
|
# macOS -- /Users/<username>/Library/Application Support/Terrarum
|
||||||
# Linux -- /home/<username>/.Terrarum
|
# Linux -- /home/<username>/.Terrarum
|
||||||
# Please refrain from removing 'basegame' on the load order -- it may render the game unpalyable.
|
# Please refrain from removing 'basegame' on the load order -- it may render the game unplayable.
|
||||||
|
|
||||||
basegame
|
basegame
|
||||||
"""
|
"""
|
||||||
@@ -66,6 +66,7 @@ basegame
|
|||||||
// Commit counts up to the Release 0.3.0: 2259
|
// Commit counts up to the Release 0.3.0: 2259
|
||||||
// Commit counts up to the Release 0.3.1: 2278
|
// Commit counts up to the Release 0.3.1: 2278
|
||||||
// Commit counts up to the Release 0.3.2: 2732
|
// Commit counts up to the Release 0.3.2: 2732
|
||||||
|
// Commit counts up to the Release 0.3.3: ????
|
||||||
|
|
||||||
const val VERSION_TAG: String = ""
|
const val VERSION_TAG: String = ""
|
||||||
|
|
||||||
|
|||||||
@@ -26,30 +26,33 @@ class UIItemInventoryCatBar(
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal val catIcons: TextureRegionPack = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
internal val catIcons: TextureRegionPack = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
||||||
internal val catArrangement: IntArray = intArrayOf(9,6,7,1,0,2,3,4,5,8)
|
private val catArrangement: IntArray = intArrayOf(9,6,7,1,0,2,1_011,3,4,5,8) // icon order
|
||||||
internal val catIconsMeaning = listOf( // sortedBy: catArrangement
|
internal val catIconsMeaning = listOf( // sortedBy: catArrangement
|
||||||
arrayOf(GameItem.Category.WEAPON),
|
arrayOf(CAT_ALL),
|
||||||
arrayOf(GameItem.Category.TOOL, GameItem.Category.WIRE),
|
arrayOf(GameItem.Category.BLOCK),
|
||||||
arrayOf(GameItem.Category.ARMOUR),
|
arrayOf(GameItem.Category.WALL),
|
||||||
arrayOf(GameItem.Category.GENERIC),
|
arrayOf(GameItem.Category.TOOL, GameItem.Category.WIRE),
|
||||||
arrayOf(GameItem.Category.POTION),
|
arrayOf(GameItem.Category.WEAPON),
|
||||||
arrayOf(GameItem.Category.MAGIC),
|
arrayOf(GameItem.Category.ARMOUR),
|
||||||
arrayOf(GameItem.Category.BLOCK),
|
arrayOf(GameItem.Category.FIXTURE),
|
||||||
arrayOf(GameItem.Category.WALL),
|
arrayOf(GameItem.Category.GENERIC),
|
||||||
arrayOf(GameItem.Category.MISC),
|
arrayOf(GameItem.Category.POTION),
|
||||||
arrayOf(CAT_ALL)
|
arrayOf(GameItem.Category.MAGIC),
|
||||||
|
arrayOf(GameItem.Category.MISC),
|
||||||
)
|
)
|
||||||
|
|
||||||
internal val catIconsLabels = listOf(
|
internal val catIconsLabels = listOf(
|
||||||
{ Lang["GAME_INVENTORY_WEAPONS"] },
|
{ Lang["MENU_LABEL_ALL"] },
|
||||||
|
{ Lang["GAME_INVENTORY_BLOCKS"] },
|
||||||
|
{ Lang["GAME_INVENTORY_WALLS"] },
|
||||||
{ Lang["CONTEXT_ITEM_TOOL_PLURAL"] },
|
{ Lang["CONTEXT_ITEM_TOOL_PLURAL"] },
|
||||||
|
{ Lang["GAME_INVENTORY_WEAPONS"] },
|
||||||
{ Lang["CONTEXT_ITEM_ARMOR"] },
|
{ Lang["CONTEXT_ITEM_ARMOR"] },
|
||||||
|
{ Lang["CONTEXT_ITEM_FIXTURES"] },
|
||||||
{ Lang["GAME_INVENTORY_INGREDIENTS"] },
|
{ Lang["GAME_INVENTORY_INGREDIENTS"] },
|
||||||
{ Lang["GAME_INVENTORY_POTIONS"] },
|
{ Lang["GAME_INVENTORY_POTIONS"] },
|
||||||
{ Lang["CONTEXT_ITEM_MAGIC"] },
|
{ Lang["CONTEXT_ITEM_MAGIC"] },
|
||||||
{ Lang["GAME_INVENTORY_BLOCKS"] },
|
|
||||||
{ Lang["GAME_INVENTORY_WALLS"] },
|
|
||||||
{ Lang["GAME_GENRE_MISC"] },
|
{ Lang["GAME_GENRE_MISC"] },
|
||||||
{ Lang["MENU_LABEL_ALL"] },
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -60,11 +63,11 @@ class UIItemInventoryCatBar(
|
|||||||
private val mainButtons: Array<UIItemImageButton>
|
private val mainButtons: Array<UIItemImageButton>
|
||||||
private val buttonGapSize = (width.toFloat() - (catArrangement.size * catIcons.tileW)) / (catArrangement.size)
|
private val buttonGapSize = (width.toFloat() - (catArrangement.size * catIcons.tileW)) / (catArrangement.size)
|
||||||
/** raw order */
|
/** raw order */
|
||||||
private var selectedIndex = 0 // default to ALL
|
var selectedIndex = 0 // default to ALL
|
||||||
private set
|
private set
|
||||||
/** re-arranged order */
|
/** re-arranged order */
|
||||||
val selectedIcon: Int
|
// val selectedIcon: Int
|
||||||
get() = catArrangement[selectedIndex]
|
// get() = catArrangement[selectedIndex]
|
||||||
|
|
||||||
private val sideButtons: Array<UIItemImageButton>
|
private val sideButtons: Array<UIItemImageButton>
|
||||||
|
|
||||||
@@ -75,9 +78,13 @@ class UIItemInventoryCatBar(
|
|||||||
val iconPosX = ((buttonGapSize / 2) + index * (catIcons.tileW + buttonGapSize)).roundToInt()
|
val iconPosX = ((buttonGapSize / 2) + index * (catIcons.tileW + buttonGapSize)).roundToInt()
|
||||||
val iconPosY = 0
|
val iconPosY = 0
|
||||||
|
|
||||||
|
val iconIndex = catArrangement[index]
|
||||||
|
val iconIndexX = iconIndex % 1000
|
||||||
|
val iconIndexY = iconIndex / 1000
|
||||||
|
|
||||||
UIItemImageButton(
|
UIItemImageButton(
|
||||||
inventoryUI,
|
inventoryUI,
|
||||||
catIcons.get(catArrangement[index], 0),
|
catIcons.get(iconIndexX, iconIndexY),
|
||||||
activeBackCol = Color(0),
|
activeBackCol = Color(0),
|
||||||
backgroundCol = Color(0),
|
backgroundCol = Color(0),
|
||||||
highlightBackCol = Color(0),
|
highlightBackCol = Color(0),
|
||||||
@@ -291,7 +298,7 @@ class UIItemInventoryCatBar(
|
|||||||
|
|
||||||
// label
|
// label
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
catIconsLabels[selectedIcon]().let {
|
catIconsLabels[selectedIndex]().let {
|
||||||
App.fontGame.draw(batch, it, posX + ((width - App.fontGame.getWidth(it)) / 2), posY + highlighterYPos + 4)
|
App.fontGame.draw(batch, it, posX + ((width - App.fontGame.getWidth(it)) / 2), posY + highlighterYPos + 4)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
|
|||||||
* - `BLOCK_AIR` – Prints out `Lang.get("BLOCK_AIR")`
|
* - `BLOCK_AIR` – Prints out `Lang.get("BLOCK_AIR")`
|
||||||
* - `BLOCK_AIR>>=BLOCK_WALL_NAME_TEMPLATE` – Prints out `Formatter().format(Lang.get("BLOCK_WALL_NAME_TEMPLATE"), Lang.get("BLOCK_AIR")).toString()`
|
* - `BLOCK_AIR>>=BLOCK_WALL_NAME_TEMPLATE` – Prints out `Formatter().format(Lang.get("BLOCK_WALL_NAME_TEMPLATE"), Lang.get("BLOCK_AIR")).toString()`
|
||||||
*/
|
*/
|
||||||
@Transient var originalName: String = ""
|
@Transient open var originalName: String = ""
|
||||||
|
|
||||||
|
|
||||||
var newName: String = ""
|
var newName: String = ""
|
||||||
@@ -101,16 +101,8 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Where to equip the item.
|
* Where to equip the item.
|
||||||
*
|
|
||||||
* Can't use 'open val' as GSON doesn't like that. Initialise this property like:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* init {
|
|
||||||
* equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
*/
|
||||||
@Transient var equipPosition: Int = EquipPosition.NULL
|
@Transient open var equipPosition: Int = EquipPosition.NULL
|
||||||
|
|
||||||
internal val material: Material
|
internal val material: Material
|
||||||
get() = MaterialCodex.getOrDefault(materialId)
|
get() = MaterialCodex.getOrDefault(materialId)
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ open class GameWorld(
|
|||||||
var weatherbox = Weatherbox()
|
var weatherbox = Weatherbox()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
weatherbox.initWith(WeatherMixer.weatherDict["generic01"]!!, 3600L)
|
weatherbox.initWith(WeatherMixer.weatherDict["generic01"] ?: WeatherMixer.DEFAULT_WEATHER, 3600L)
|
||||||
val currentWeather = weatherbox.currentWeather
|
val currentWeather = weatherbox.currentWeather
|
||||||
// TEST FILL WITH RANDOM VALUES
|
// TEST FILL WITH RANDOM VALUES
|
||||||
(0..6).map { WeatherMixer.takeUniformRand(0f..1f) }.let {
|
(0..6).map { WeatherMixer.takeUniformRand(0f..1f) }.let {
|
||||||
|
|||||||
@@ -107,8 +107,7 @@ class EntryPoint : ModuleEntryPoint() {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
init {
|
init {
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
tags.addAll(tile.tags)
|
||||||
tags.addAll(tile.tags)
|
|
||||||
originalName =
|
originalName =
|
||||||
if (isWall && tags.contains("UNLIT")) "${tile.nameKey}>>=BLOCK_UNLIT_TEMPLATE>>=BLOCK_WALL_NAME_TEMPLATE"
|
if (isWall && tags.contains("UNLIT")) "${tile.nameKey}>>=BLOCK_UNLIT_TEMPLATE>>=BLOCK_WALL_NAME_TEMPLATE"
|
||||||
else if (isWall) "${tile.nameKey}>>=BLOCK_WALL_NAME_TEMPLATE"
|
else if (isWall) "${tile.nameKey}>>=BLOCK_WALL_NAME_TEMPLATE"
|
||||||
|
|||||||
@@ -39,10 +39,13 @@ open class FixtureItemBase(originalID: ItemID, val fixtureClassName: String) : G
|
|||||||
@Transient private var ghostInit = AtomicBoolean(false)
|
@Transient private var ghostInit = AtomicBoolean(false)
|
||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 1.0
|
@Transient override var baseMass = 1.0
|
||||||
override var inventoryCategory = Category.MISC
|
@Transient override var inventoryCategory = Category.FIXTURE
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
@Transient override val materialId = ""
|
||||||
|
|
||||||
|
@Transient override var equipPosition: Int = EquipPosition.HAND_GRIP
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not address the CommonResourcePool directly; just do it like this snippet:
|
* Do not address the CommonResourcePool directly; just do it like this snippet:
|
||||||
|
|||||||
@@ -12,18 +12,13 @@ class ItemLogicSignalEmitter(originalID: ItemID) : FixtureItemBase(originalID, "
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = FixtureLogicSignalEmitter.MASS
|
override var baseMass = FixtureLogicSignalEmitter.MASS
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
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/signal_source.tga")
|
get() = getItemImageFromSingleImage("basegame", "sprites/fixtures/signal_source.tga")
|
||||||
|
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_LOGIC_SIGNAL_EMITTER"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_LOGIC_SIGNAL_EMITTER"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun effectWhileEquipped(actor: ActorWithBody, delta: Float) {
|
override fun effectWhileEquipped(actor: ActorWithBody, delta: Float) {
|
||||||
super.effectWhileEquipped(actor, delta)
|
super.effectWhileEquipped(actor, delta)
|
||||||
|
|||||||
@@ -14,16 +14,11 @@ class ItemStorageChest(originalID: ItemID) : FixtureItemBase(originalID, "net.to
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = FixtureTikiTorch.MASS
|
override var baseMass = FixtureTikiTorch.MASS
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = CommonResourcePool.getAsTextureRegion("itemplaceholder_48")
|
get() = CommonResourcePool.getAsTextureRegion("itemplaceholder_48")
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_STORAGE_CHEST"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_STORAGE_CHEST"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -14,22 +14,12 @@ class ItemSwingingDoorOak(originalID: ItemID) :
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 20.0 // 360[L] * 0.1 * 0.56[SpecificGravity], rounded to the nearest integer
|
override var baseMass = 20.0 // 360[L] * 0.1 * 0.56[SpecificGravity], rounded to the nearest integer
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(8,3)
|
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(8,3)
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_DOOR_OAK"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_DOOR_OAK"
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transient override val makeFixture: () -> FixtureBase = {
|
|
||||||
FixtureSwingingDoorOak()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemSwingingDoorEbony(originalID: ItemID) :
|
class ItemSwingingDoorEbony(originalID: ItemID) :
|
||||||
@@ -37,22 +27,12 @@ class ItemSwingingDoorEbony(originalID: ItemID) :
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 30.0 // 360[L] * 0.1 * 0.82[SpecificGravity], rounded to the nearest integer
|
override var baseMass = 30.0 // 360[L] * 0.1 * 0.82[SpecificGravity], rounded to the nearest integer
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(9,3)
|
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(9,3)
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_DOOR_EBONY"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_DOOR_EBONY"
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transient override val makeFixture: () -> FixtureBase = {
|
|
||||||
FixtureSwingingDoorEbony()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemSwingingDoorBirch(originalID: ItemID) :
|
class ItemSwingingDoorBirch(originalID: ItemID) :
|
||||||
@@ -60,22 +40,12 @@ class ItemSwingingDoorBirch(originalID: ItemID) :
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 17.0 // 360[L] * 0.1 * 0.48[SpecificGravity], rounded to the nearest integer
|
override var baseMass = 17.0 // 360[L] * 0.1 * 0.48[SpecificGravity], rounded to the nearest integer
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(10,3)
|
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(10,3)
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_DOOR_BIRCH"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_DOOR_BIRCH"
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transient override val makeFixture: () -> FixtureBase = {
|
|
||||||
FixtureSwingingDoorBirch()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemSwingingDoorRosewood(originalID: ItemID) :
|
class ItemSwingingDoorRosewood(originalID: ItemID) :
|
||||||
@@ -83,20 +53,10 @@ class ItemSwingingDoorRosewood(originalID: ItemID) :
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 24.0 // 360[L] * 0.1 * 0.68[SpecificGravity], rounded to the nearest integer
|
override var baseMass = 24.0 // 360[L] * 0.1 * 0.68[SpecificGravity], rounded to the nearest integer
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(11,3)
|
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(11,3)
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_DOOR_ROSEWOOD"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_DOOR_ROSEWOOD"
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transient override val makeFixture: () -> FixtureBase = {
|
|
||||||
FixtureSwingingDoorRosewood()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,17 +16,12 @@ class ItemTapestry(originalID: ItemID) : FixtureItemBase(originalID, "net.torval
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 6.0
|
override var baseMass = 6.0
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = CommonResourcePool.getAsTextureRegion("itemplaceholder_16")
|
get() = CommonResourcePool.getAsTextureRegion("itemplaceholder_16")
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_TAPESTRY"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_TAPESTRY"
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transient override val makeFixture: () -> FixtureBase = {
|
@Transient override val makeFixture: () -> FixtureBase = {
|
||||||
FixtureTapestry(
|
FixtureTapestry(
|
||||||
|
|||||||
@@ -12,17 +12,12 @@ class ItemTikiTorch(originalID: ItemID) : FixtureItemBase(originalID, "net.torva
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = FixtureTikiTorch.MASS
|
override var baseMass = FixtureTikiTorch.MASS
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = getItemImageFromSheet("basegame", "sprites/fixtures/tiki_torch.tga", 16, 32)
|
get() = getItemImageFromSheet("basegame", "sprites/fixtures/tiki_torch.tga", 16, 32)
|
||||||
|
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_TIKI_TORCH"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_TIKI_TORCH"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,17 +12,12 @@ class ItemTypewriter(originalID: ItemID) : FixtureItemBase(originalID, "net.torv
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = FixtureTikiTorch.MASS
|
override var baseMass = FixtureTikiTorch.MASS
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = getItemImageFromSheet("basegame", "sprites/fixtures/typewriter.tga", 32, 16)
|
get() = getItemImageFromSheet("basegame", "sprites/fixtures/typewriter.tga", 32, 16)
|
||||||
|
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_TYPEWRITER"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_TYPEWRITER"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,17 +11,12 @@ class ItemWallCalendar(originalID: ItemID) : FixtureItemBase(originalID, "net.to
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 1.0
|
override var baseMass = 1.0
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
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/calendar.tga")
|
get() = getItemImageFromSingleImage("basegame", "sprites/fixtures/calendar.tga")
|
||||||
|
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_CALENDAR"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_CALENDAR"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,18 +10,12 @@ class ItemWorkbench(originalID: ItemID) : FixtureItemBase(originalID, "net.torva
|
|||||||
|
|
||||||
|
|
||||||
override var baseMass = 20.0
|
override var baseMass = 20.0
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
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/workbench.tga")
|
get() = getItemImageFromSingleImage("basegame", "sprites/fixtures/workbench.tga")
|
||||||
|
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_WORKBENCH"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_WORKBENCH"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,17 +12,11 @@ class ItemWorldPortal(originalID: ItemID) : FixtureItemBase(originalID, "net.tor
|
|||||||
|
|
||||||
override var dynamicID: ItemID = originalID
|
override var dynamicID: ItemID = originalID
|
||||||
override var baseMass = 6000.0
|
override var baseMass = 6000.0
|
||||||
override var inventoryCategory = Category.MISC
|
|
||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(3,3)
|
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(3,3)
|
||||||
|
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_WORLD_PORTAL"
|
||||||
init {
|
|
||||||
equipPosition = EquipPosition.HAND_GRIP
|
|
||||||
originalName = "ITEM_WORLD_PORTAL"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ internal class UIInventoryCells(
|
|||||||
fun rebuildList() {
|
fun rebuildList() {
|
||||||
// App.printdbg(this, "rebuilding list")
|
// App.printdbg(this, "rebuilding list")
|
||||||
|
|
||||||
itemList.rebuild(full.catBar.catIconsMeaning[full.catBar.selectedIcon])
|
itemList.rebuild(full.catBar.catIconsMeaning[full.catBar.selectedIndex])
|
||||||
equipped.rebuild()
|
equipped.rebuild()
|
||||||
|
|
||||||
encumbrancePerc = full.actor.inventory.encumberment.toFloat()
|
encumbrancePerc = full.actor.inventory.encumberment.toFloat()
|
||||||
@@ -81,7 +81,7 @@ internal class UIInventoryCells(
|
|||||||
|
|
||||||
fun resetStatusAsCatChanges(oldcat: Int?, newcat: Int) {
|
fun resetStatusAsCatChanges(oldcat: Int?, newcat: Int) {
|
||||||
itemList.itemPage = 0 // set scroll to zero
|
itemList.itemPage = 0 // set scroll to zero
|
||||||
itemList.rebuild(full.catBar.catIconsMeaning[full.catBar.catArrangement[newcat]]) // have to manually rebuild, too!
|
itemList.rebuild(full.catBar.catIconsMeaning[newcat]) // have to manually rebuild, too!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
|
|
||||||
val ingame = TerrarumIngame(App.batch)
|
val ingame = TerrarumIngame(App.batch)
|
||||||
val playerDisk = existingPlayer ?: App.savegamePlayers[UILoadGovernor.playerUUID]!!.loadable()
|
val playerDisk = existingPlayer ?: App.savegamePlayers[UILoadGovernor.playerUUID]!!.loadable()
|
||||||
|
playerDisk.rebuild()
|
||||||
val player = ReadActor.invoke(
|
val player = ReadActor.invoke(
|
||||||
playerDisk,
|
playerDisk,
|
||||||
ByteArray64Reader(playerDisk.getFile(SAVEGAMEINFO)!!.bytes, Common.CHARSET)
|
ByteArray64Reader(playerDisk.getFile(SAVEGAMEINFO)!!.bytes, Common.CHARSET)
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ internal class UIStorageChest : UICanvas(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun itemListUpdate() {
|
private fun itemListUpdate() {
|
||||||
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
|
|
||||||
encumbrancePerc = getPlayerInventory().capacity.toFloat() / getPlayerInventory().maxCapacity
|
encumbrancePerc = getPlayerInventory().capacity.toFloat() / getPlayerInventory().maxCapacity
|
||||||
isEncumbered = getPlayerInventory().isEncumbered
|
isEncumbered = getPlayerInventory().isEncumbered
|
||||||
@@ -143,13 +143,13 @@ internal class UIStorageChest : UICanvas(
|
|||||||
itemListChest.navRemoCon.gridModeButtons[0].highlighted = !yes
|
itemListChest.navRemoCon.gridModeButtons[0].highlighted = !yes
|
||||||
itemListChest.navRemoCon.gridModeButtons[1].highlighted = yes
|
itemListChest.navRemoCon.gridModeButtons[1].highlighted = yes
|
||||||
itemListChest.itemPage = 0
|
itemListChest.itemPage = 0
|
||||||
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
|
|
||||||
itemListPlayer.isCompactMode = yes
|
itemListPlayer.isCompactMode = yes
|
||||||
itemListPlayer.navRemoCon.gridModeButtons[0].highlighted = !yes
|
itemListPlayer.navRemoCon.gridModeButtons[0].highlighted = !yes
|
||||||
itemListPlayer.navRemoCon.gridModeButtons[1].highlighted = yes
|
itemListPlayer.navRemoCon.gridModeButtons[1].highlighted = yes
|
||||||
itemListPlayer.itemPage = 0
|
itemListPlayer.itemPage = 0
|
||||||
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
|
|
||||||
itemListUpdate()
|
itemListUpdate()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun itemListUpdate() {
|
private fun itemListUpdate() {
|
||||||
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
|
|
||||||
encumbrancePerc = getPlayerInventory().capacity.toFloat() / getPlayerInventory().maxCapacity
|
encumbrancePerc = getPlayerInventory().capacity.toFloat() / getPlayerInventory().maxCapacity
|
||||||
isEncumbered = getPlayerInventory().isEncumbered
|
isEncumbered = getPlayerInventory().isEncumbered
|
||||||
@@ -135,13 +135,13 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory {
|
|||||||
itemListChest.navRemoCon.gridModeButtons[0].highlighted = !yes
|
itemListChest.navRemoCon.gridModeButtons[0].highlighted = !yes
|
||||||
itemListChest.navRemoCon.gridModeButtons[1].highlighted = yes
|
itemListChest.navRemoCon.gridModeButtons[1].highlighted = yes
|
||||||
itemListChest.itemPage = 0
|
itemListChest.itemPage = 0
|
||||||
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
|
|
||||||
itemListPlayer.isCompactMode = yes
|
itemListPlayer.isCompactMode = yes
|
||||||
itemListPlayer.navRemoCon.gridModeButtons[0].highlighted = !yes
|
itemListPlayer.navRemoCon.gridModeButtons[0].highlighted = !yes
|
||||||
itemListPlayer.navRemoCon.gridModeButtons[1].highlighted = yes
|
itemListPlayer.navRemoCon.gridModeButtons[1].highlighted = yes
|
||||||
itemListPlayer.itemPage = 0
|
itemListPlayer.itemPage = 0
|
||||||
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIndex])
|
||||||
|
|
||||||
itemListUpdate()
|
itemListUpdate()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
weatherDB[weather.classification]!!.add(weather)
|
weatherDB[weather.classification]!!.add(weather)
|
||||||
}
|
}
|
||||||
|
|
||||||
weatherDict["titlescreen"] = weatherDB[WEATHER_GENERIC]!![0].copy(identifier = "titlescreen", windSpeed = 1f)
|
weatherDict["titlescreen"] = weatherDB[WEATHER_GENERIC]?.get(0)?.copy(identifier = "titlescreen", windSpeed = 1f) ?: DEFAULT_WEATHER
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user