diff --git a/assets/mods/basegame/configplan.csv b/assets/mods/basegame/configplan.csv index 0e0431317..c3f3646aa 100644 --- a/assets/mods/basegame/configplan.csv +++ b/assets/mods/basegame/configplan.csv @@ -1,3 +1,6 @@ ->Lang:MENU_OPTIONS_GAMEPLAY->h1 gameplay_max_crafting->Lang:MENU_OPTIONS_MAX_CRAFTING->spinner,100,1000,100 -showpickaxetooltip->Lang:MENU_OPTIONS_SHOW_ORES_TOOLTIP_WHEN_MINING->toggle \ No newline at end of file +showpickaxetooltip->Lang:MENU_OPTIONS_SHOW_ORES_TOOLTIP_WHEN_MINING->toggle +->Lang:MENU_OPTIONS_UNIT_OF_MEASUREMENT->h1 +gameplay_unit_distance->Lang:MENU_OPTIONS_DISTANCE_UNIT->textsel,meter=MENU_OPTIONS_UNIT_METRIC,foot=MENU_OPTIONS_UNIT_FEET,block=MENU_OPTIONS_UNIT_BLOCKS +gameplay_unit_temperature->Lang:MENU_OPTIONS_TEMPERATURE_UNIT->textsel,celsius=MENU_OPTIONS_UNIT_CELSIUS_DNT,fahrenheit=MENU_OPTIONS_UNIT_FAHRENHEIT_DNT,kelvin=MENU_OPTIONS_UNIT_KELVIN_DNT \ No newline at end of file diff --git a/assets/mods/basegame/default.json b/assets/mods/basegame/default.json index 22bab037b..f3da99c03 100644 --- a/assets/mods/basegame/default.json +++ b/assets/mods/basegame/default.json @@ -1,4 +1,6 @@ { "gameplay_max_crafting": 100, - "showpickaxetooltip": true + "showpickaxetooltip": true, + "gameplay_unit_distance": "meter", + "gameplay_unit_temperature": "celsius" } \ No newline at end of file diff --git a/assets/mods/basegame/locales/en/configmenu.json b/assets/mods/basegame/locales/en/configmenu.json new file mode 100644 index 000000000..e347d6e00 --- /dev/null +++ b/assets/mods/basegame/locales/en/configmenu.json @@ -0,0 +1,15 @@ +{ + "MENU_MONITOR_CALI_TITLE": "Check Monitor", + "MENU_OPTIONS_SHOW_ORES_TOOLTIP_WHEN_MINING": "Show Ore Tooltip When Mining", + "MENU_OPTIONS_MAX_CRAFTING": "Max Number of Items for Crafting", + "MENU_OPTIONS_UNIT_BLOCKS": "Blocks", + "MENU_OPTIONS_UNIT_FEET": "Imperial", + "MENU_OPTIONS_UNIT_METRIC": "Metric", + "MENU_OPTIONS_UNIT_OF_MEASUREMENT": "Unit of Measurement", + "MENU_OPTIONS_DISTANCE_UNIT": "Distance", + "MENU_OPTIONS_TEMPERATURE_UNIT": "Temperature", + + "MENU_OPTIONS_UNIT_CELSIUS_DNT": "°C", + "MENU_OPTIONS_UNIT_FAHRENHEIT_DNT": "°F", + "MENU_OPTIONS_UNIT_KELVIN_DNT": "K" +} \ No newline at end of file diff --git a/assets/mods/basegame/locales/en/game.json b/assets/mods/basegame/locales/en/game.json index b16bbda8a..16384006f 100644 --- a/assets/mods/basegame/locales/en/game.json +++ b/assets/mods/basegame/locales/en/game.json @@ -13,9 +13,6 @@ "MENU_LABEL_RENAME": "Rename", "MENU_LABEL_USE_CODE": "Use Code", "MENU_MODE_BUILDINGMAKER": "POI Editor", - "MENU_MONITOR_CALI_TITLE": "Check Monitor", - "MENU_OPTIONS_SHOW_ORES_TOOLTIP_WHEN_MINING": "Show Ore Tooltip When Mining", - "MENU_OPTIONS_MAX_CRAFTING": "Max Number of Items for Crafting", "MENU_UPDATE_UPDATE_AVAILABLE": "Update Available!", "GAME_ACTION_GRAPPLE": "Grapple", "GAME_ACTION_QUICKSEL": "Quick Select", diff --git a/assets/mods/basegame/locales/koKR/configmenu.json b/assets/mods/basegame/locales/koKR/configmenu.json new file mode 100644 index 000000000..823e81a2f --- /dev/null +++ b/assets/mods/basegame/locales/koKR/configmenu.json @@ -0,0 +1,11 @@ +{ + "MENU_MONITOR_CALI_TITLE": "모니터 확인", + "MENU_OPTIONS_SHOW_ORES_TOOLTIP_WHEN_MINING": "채굴 시 광석 툴팁 보이기", + "MENU_OPTIONS_MAX_CRAFTING": "한번에 제작할 최대 아이템 수", + "MENU_OPTIONS_UNIT_BLOCKS": "블록", + "MENU_OPTIONS_UNIT_FEET": "피트", + "MENU_OPTIONS_UNIT_METRIC": "미터", + "MENU_OPTIONS_UNIT_OF_MEASUREMENT": "측정 단위", + "MENU_OPTIONS_DISTANCE_UNIT": "거리", + "MENU_OPTIONS_TEMPERATURE_UNIT": "온도" +} \ No newline at end of file diff --git a/assets/mods/basegame/locales/koKR/game.json b/assets/mods/basegame/locales/koKR/game.json index 7b21c9f9b..e5b6f1fb3 100644 --- a/assets/mods/basegame/locales/koKR/game.json +++ b/assets/mods/basegame/locales/koKR/game.json @@ -12,9 +12,6 @@ "MENU_LABEL_PREV_SAVES": "이전 세이브", "MENU_LABEL_RENAME": "이름 바꾸기", "MENU_LABEL_USE_CODE": "코드 사용", - "MENU_MONITOR_CALI_TITLE": "모니터 확인", - "MENU_OPTIONS_SHOW_ORES_TOOLTIP_WHEN_MINING": "채굴 시 광석 툴팁 보이기", - "MENU_OPTIONS_MAX_CRAFTING": "한번에 제작할 최대 아이템 수", "MENU_UPDATE_UPDATE_AVAILABLE": "새 업데이트가 있습니다!", "GAME_ACTION_GRAPPLE": "매달리기", "GAME_ACTION_QUICKSEL": "빠른 선택", diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorInventory.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorInventory.kt index 887f20365..dd5a47317 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorInventory.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorInventory.kt @@ -8,6 +8,7 @@ import net.torvald.terrarum.gameactors.Actor import net.torvald.terrarum.gameitems.GameItem import net.torvald.terrarum.gameitems.ItemID import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar +import net.torvald.terrarum.sqr /** * Created by minjaesong on 2016-03-15. @@ -38,6 +39,21 @@ class ActorInventory() : FixtureInventory() { field = value } + val maxCapacityByActor: Double + get() = maxCapacity * ((actor.actorValue.getAsDouble(AVKey.SCALE) ?: 1.0) * (actor.actorValue.getAsDouble(AVKey.SCALEBUFF) ?: 1.0)).sqr() + + /** + * How encumbered the actor is. 1.0 if weight of the items are exactly same as the capacity limit, >1.0 if encumbered. + */ + override val encumberment: Double + get() = if (capacityMode == CAPACITY_MODE_NO_ENCUMBER) + 0.0 + else if (capacityMode == CAPACITY_MODE_WEIGHT) + capacity / maxCapacityByActor + else + 0.0 + + /** * List of all equipped items (tools, armours, rings, necklaces, etc.) * diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureInventory.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureInventory.kt index 4a790cd48..42127a2db 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureInventory.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureInventory.kt @@ -254,7 +254,7 @@ open class FixtureInventory() { /** * How encumbered the actor is. 1.0 if weight of the items are exactly same as the capacity limit, >1.0 if encumbered. */ - val encumberment: Double + open val encumberment: Double get() = if (capacityMode == CAPACITY_MODE_NO_ENCUMBER) 0.0 else if (capacityMode == CAPACITY_MODE_WEIGHT) diff --git a/src/net/torvald/terrarum/modulebasegame/ui/HasInventory.kt b/src/net/torvald/terrarum/modulebasegame/ui/HasInventory.kt index 4aa86bd5f..c87217aa4 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/HasInventory.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/HasInventory.kt @@ -1,11 +1,12 @@ package net.torvald.terrarum.modulebasegame.ui +import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory interface HasInventory { fun getNegotiator(): InventoryTransactionNegotiator fun getFixtureInventory(): FixtureInventory - fun getPlayerInventory(): FixtureInventory + fun getPlayerInventory(): ActorInventory } \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UICrafting.kt b/src/net/torvald/terrarum/modulebasegame/ui/UICrafting.kt index d2509d215..fc7f2a758 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UICrafting.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UICrafting.kt @@ -11,6 +11,7 @@ import net.torvald.terrarum.gameitems.ItemID import net.torvald.terrarum.gameitems.isWall import net.torvald.terrarum.itemproperties.CraftingCodex import net.torvald.terrarum.langpack.Lang +import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory import net.torvald.terrarum.modulebasegame.gameactors.CraftingStation import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory import net.torvald.terrarum.modulebasegame.gameactors.InventoryPair @@ -113,7 +114,7 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas( override fun getNegotiator() = negotiator override fun getFixtureInventory(): FixtureInventory = TODO() - override fun getPlayerInventory(): FixtureInventory = INGAME.actorNowPlaying!!.inventory + override fun getPlayerInventory(): ActorInventory = INGAME.actorNowPlaying!!.inventory private val halfSlotOffset = (UIItemInventoryElemSimple.height + listGap) / 2 @@ -463,9 +464,7 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas( // let itemlists be sorted itemListCraftable.rebuild() playerThings.rebuild(FILTER_CAT_ALL) - encumbrancePerc = getPlayerInventory().let { - it.capacity.toFloat() / it.maxCapacity - } + encumbrancePerc = getPlayerInventory().encumberment.toFloat() } override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryCells.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryCells.kt index da1e92b6d..e71d7edf3 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryCells.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryCells.kt @@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch import net.torvald.terrarum.* import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid +import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory import net.torvald.terrarum.modulebasegame.gameactors.DroppedItem import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_HOR @@ -36,7 +37,7 @@ internal class UIInventoryCells( val weightBarWidth = UIItemInventoryElemSimple.height * 2f + UIItemInventoryItemGrid.listGap // var encumbBarYPos = (App.scr.height + internalHeight).div(2) - 20 + 3f - fun drawEncumbranceBar(batch: SpriteBatch, encumbBarXPos: Float, encumbBarYPos: Float, encumbrancePerc: Float, actorInventory: FixtureInventory) { + fun drawEncumbranceBar(batch: SpriteBatch, encumbBarXPos: Float, encumbBarYPos: Float, encumbrancePerc: Float, actorInventory: ActorInventory) { //draw player encumb // encumbrance meter val encumbranceText = Lang["GAME_INVENTORY_ENCUMBRANCE"] @@ -75,7 +76,7 @@ internal class UIInventoryCells( else "${(actorInventory.capacity * 100L).toLong() / 100.0}" - INGAME.setTooltipMessage("$capaStr/${actorInventory.maxCapacity}.0") + INGAME.setTooltipMessage("$capaStr/${actorInventory.maxCapacityByActor}") tooltipShowing[10001] = true } else { diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UISmelterBasic.kt b/src/net/torvald/terrarum/modulebasegame/ui/UISmelterBasic.kt index 5a17dc3cb..080a8820f 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UISmelterBasic.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UISmelterBasic.kt @@ -7,6 +7,7 @@ import net.torvald.colourutil.cieluv_getGradient import net.torvald.terrarum.* import net.torvald.terrarum.App.printdbg import net.torvald.terrarum.langpack.Lang +import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory import net.torvald.terrarum.modulebasegame.gameactors.FixtureSmelterBasic import net.torvald.terrarum.modulebasegame.gameactors.InventoryPair @@ -128,7 +129,7 @@ class UISmelterBasic(val smelter: FixtureSmelterBasic) : UICanvas( } } - fun getPlayerInventory(): FixtureInventory = INGAME.actorNowPlaying!!.inventory + fun getPlayerInventory(): ActorInventory = INGAME.actorNowPlaying!!.inventory private var listModeButtonPushed = false @@ -357,9 +358,7 @@ class UISmelterBasic(val smelter: FixtureSmelterBasic) : UICanvas( // let itemlists be sorted inventoryFilter = { _: InventoryPair -> true } playerThings.rebuild(FILTER_CAT_ALL) - encumbrancePerc = getPlayerInventory().let { - it.capacity.toFloat() / it.maxCapacity - } + encumbrancePerc = getPlayerInventory().encumberment.toFloat() } private var inventoryFilter = { _: InventoryPair -> true } @@ -368,17 +367,13 @@ class UISmelterBasic(val smelter: FixtureSmelterBasic) : UICanvas( // let itemlists be sorted inventoryFilter = filter playerThings.rebuild(filter) - encumbrancePerc = getPlayerInventory().let { - it.capacity.toFloat() / it.maxCapacity - } + encumbrancePerc = getPlayerInventory().encumberment.toFloat() } private fun itemListUpdateKeepCurrentFilter() { // let itemlists be sorted playerThings.rebuild(inventoryFilter) - encumbrancePerc = getPlayerInventory().let { - it.capacity.toFloat() / it.maxCapacity - } + encumbrancePerc = getPlayerInventory().encumberment.toFloat() } init { diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIStorageChest.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIStorageChest.kt index 3305211a0..4e347624c 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIStorageChest.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIStorageChest.kt @@ -7,6 +7,7 @@ import net.torvald.terrarum.* import net.torvald.terrarum.gameactors.AVKey import net.torvald.terrarum.gameitems.GameItem import net.torvald.terrarum.langpack.Lang +import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.getWidthOfCells import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.tooltipShowing @@ -44,7 +45,7 @@ internal class UIStorageChest : UICanvas( override fun getNegotiator() = negotiator override fun getFixtureInventory(): FixtureInventory = chestInventory - override fun getPlayerInventory(): FixtureInventory = INGAME.actorNowPlaying!!.inventory + override fun getPlayerInventory(): ActorInventory = INGAME.actorNowPlaying!!.inventory private val catBar: UIItemCatBar private val itemListChest: UITemplateHalfInventory diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIWorldPortalCargo.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIWorldPortalCargo.kt index 0a3e5b603..a4b7d314f 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIWorldPortalCargo.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIWorldPortalCargo.kt @@ -7,6 +7,7 @@ import net.torvald.terrarum.* import net.torvald.terrarum.gameactors.AVKey import net.torvald.terrarum.gameitems.GameItem import net.torvald.terrarum.langpack.Lang +import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.tooltipShowing import net.torvald.terrarum.ui.* @@ -36,7 +37,7 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory { override fun getNegotiator() = negotiator override fun getFixtureInventory(): FixtureInventory = chestInventory - override fun getPlayerInventory(): FixtureInventory = INGAME.actorNowPlaying!!.inventory + override fun getPlayerInventory(): ActorInventory = INGAME.actorNowPlaying!!.inventory private val catBar: UIItemCatBar private val itemListChest: UIItemInventoryItemGrid @@ -155,7 +156,7 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory { itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIndex]) itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIndex]) - encumbrancePerc = getPlayerInventory().capacity.toFloat() / getPlayerInventory().maxCapacity + encumbrancePerc = (getPlayerInventory().capacity / getPlayerInventory().maxCapacityByActor).toFloat() isEncumbered = getPlayerInventory().isEncumbered }