mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-17 22:14:05 +09:00
buildingmaker: import using filename
This commit is contained in:
@@ -441,6 +441,7 @@ class BuildingMaker(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
240,
|
240,
|
||||||
32
|
32
|
||||||
)
|
)
|
||||||
|
it.reset()
|
||||||
it.setAsOpen()
|
it.setAsOpen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -854,10 +855,13 @@ class YamlCommandNewFlatTerrain : YamlInvokable {
|
|||||||
|
|
||||||
class YamlCommandToolImportTest : YamlInvokable {
|
class YamlCommandToolImportTest : YamlInvokable {
|
||||||
override fun invoke(args: Array<Any>) {
|
override fun invoke(args: Array<Any>) {
|
||||||
YamlCommandClearSelection().invoke(args)
|
|
||||||
val ui = (args[0] as BuildingMaker)
|
val ui = (args[0] as BuildingMaker)
|
||||||
|
ui.getPoiNameForImport { name ->
|
||||||
|
YamlCommandClearSelection().invoke(args)
|
||||||
|
|
||||||
val json = """{"genver":67108864,"id":"test","wlen":8,"w":5,"h":5,"lut":{"0":"basegame:0","1":"basegame:50","2":"basegame:-1"},"layers":[{"name":"test","dat":["abZy8000000rlLru|9OOu|r)UvQ#:F5SzVR5HEIzUt9H%0000","abZy8000000rlLru|9OO00j-Xv;?&=0ruM(r|DkH000"]}]}"""
|
val jsonFile = File(App.defaultDir, "/Exports/$name.poi")
|
||||||
|
if (jsonFile.exists()) {
|
||||||
|
val json = jsonFile.readText()
|
||||||
|
|
||||||
val poi = Common.jsoner.fromJson(PointOfInterest().javaClass, json).also {
|
val poi = Common.jsoner.fromJson(PointOfInterest().javaClass, json).also {
|
||||||
it.getReadyToBeUsed(ui.world.tileNameToNumberMap)
|
it.getReadyToBeUsed(ui.world.tileNameToNumberMap)
|
||||||
@@ -887,3 +891,5 @@ class YamlCommandToolImportTest : YamlInvokable {
|
|||||||
println("Imported POI: $poi")
|
println("Imported POI: $poi")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user