mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
deserialisable droppeditem
This commit is contained in:
@@ -18,12 +18,8 @@ import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
open class DroppedItem : ActorWithBody {
|
||||
|
||||
private var itemID: ItemID = ""
|
||||
set(value) {
|
||||
field = value
|
||||
textureRegion = ItemCodex.getItemImage(itemID)!!
|
||||
}
|
||||
|
||||
@Transient private lateinit var textureRegion: TextureRegion
|
||||
@Transient private var textureRegion: TextureRegion? = null // deserialiser won't call setter of the fields
|
||||
|
||||
var itemCount = 1
|
||||
|
||||
@@ -54,8 +50,12 @@ open class DroppedItem : ActorWithBody {
|
||||
}
|
||||
|
||||
override fun drawBody(batch: SpriteBatch) {
|
||||
// copy-pasted from ActorWithBody.drawSpriteInGoodPosition()
|
||||
// deserialiser won't call setter of the fields
|
||||
if (textureRegion == null) {
|
||||
textureRegion = ItemCodex.getItemImage(itemID)!!
|
||||
}
|
||||
|
||||
// copy-pasted from ActorWithBody.drawSpriteInGoodPosition()
|
||||
if (world == null) return
|
||||
|
||||
|
||||
|
||||
33
work_files/DataFormats/NewLangFile.md
Normal file
33
work_files/DataFormats/NewLangFile.md
Normal file
@@ -0,0 +1,33 @@
|
||||
#### Formal Grammar
|
||||
|
||||
````
|
||||
Text = Tag , Text | PlainText , Text ;
|
||||
|
||||
Tag = "{" , Code , { TagArgs } , "}" ;
|
||||
TagArgs = " " , Text ;
|
||||
Code = Number | "G" | "P" | "KC" | "NORMAL" | "EMPH" | "VERB" | "RED" | Code , "." , Subcode ;
|
||||
(* KC: keycap. e.g. "{KC config_keyinteract}" | "{KC e}" *)
|
||||
(* G: *)
|
||||
(* EMPH: emphasize noun. e.g. "Treasure for the {EMPH}paraglider{NORMAL}. A fair exchange, I believe." *)
|
||||
(* Number: n-th substitution target. e.g. "Treasure for the {EMPH}{0}{NORMAL}. A fair exchange, I believe." *)
|
||||
(* NORMAL: unset emphases. *)
|
||||
(* VERB: emphasize verb. e.g. "Press {KC use} to pay {VERB} respects" *)
|
||||
(* RED: red text. e.g. "Saving, {RED}do not turn off the power{NORMAL}..." *)
|
||||
|
||||
Subcode = Case | Count ;
|
||||
Case = "NOM" | "ACC" | "GEN" | "DAT" | ... ;
|
||||
Count = "SG" | "DU" | "PL" ;
|
||||
|
||||
Number = { "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" } ;
|
||||
|
||||
PlainText = ? regular string but does not contain { C u R l Y } brackets ? ;
|
||||
````
|
||||
|
||||
#### Code Example
|
||||
|
||||
```
|
||||
function ShowMsg(string: String, vararg args: String) { ... } // pre-defined
|
||||
|
||||
val m = "Give {0} {P 1 0} to {2.ACC}"
|
||||
ShowMsg(m, 42, "GAME_ITEM_COAL", conversationTarget.actorValue.name)
|
||||
```
|
||||
Reference in New Issue
Block a user