root.monsterSkillParameter
This commit is contained in:
parent
62b8ca34ed
commit
f04df9feda
@ -33,6 +33,7 @@ import ru.dbotthepony.kstarbound.defs.item.impl.ItemPrototype
|
|||||||
import ru.dbotthepony.kstarbound.defs.item.impl.LegsArmorItemPrototype
|
import ru.dbotthepony.kstarbound.defs.item.impl.LegsArmorItemPrototype
|
||||||
import ru.dbotthepony.kstarbound.defs.item.impl.LiquidItemPrototype
|
import ru.dbotthepony.kstarbound.defs.item.impl.LiquidItemPrototype
|
||||||
import ru.dbotthepony.kstarbound.defs.item.impl.MaterialItemPrototype
|
import ru.dbotthepony.kstarbound.defs.item.impl.MaterialItemPrototype
|
||||||
|
import ru.dbotthepony.kstarbound.defs.monster.MonsterSkillDefinition
|
||||||
import ru.dbotthepony.kstarbound.defs.npc.NpcTypeDefinition
|
import ru.dbotthepony.kstarbound.defs.npc.NpcTypeDefinition
|
||||||
import ru.dbotthepony.kstarbound.defs.npc.TenantDefinition
|
import ru.dbotthepony.kstarbound.defs.npc.TenantDefinition
|
||||||
import ru.dbotthepony.kstarbound.defs.tile.LiquidDefinition
|
import ru.dbotthepony.kstarbound.defs.tile.LiquidDefinition
|
||||||
@ -148,6 +149,9 @@ class Starbound : ISBFileLocator {
|
|||||||
private val _treasurePools = ObjectRegistry("treasure pools", TreasurePoolDefinition::name)
|
private val _treasurePools = ObjectRegistry("treasure pools", TreasurePoolDefinition::name)
|
||||||
val treasurePools = _treasurePools.view
|
val treasurePools = _treasurePools.view
|
||||||
|
|
||||||
|
private val _monsterSkills = ObjectRegistry("monster skills", MonsterSkillDefinition::name)
|
||||||
|
val monsterSkills = _monsterSkills.view
|
||||||
|
|
||||||
val gson: Gson = with(GsonBuilder()) {
|
val gson: Gson = with(GsonBuilder()) {
|
||||||
serializeNulls()
|
serializeNulls()
|
||||||
setDateFormat(DateFormat.LONG)
|
setDateFormat(DateFormat.LONG)
|
||||||
@ -724,6 +728,14 @@ class Starbound : ISBFileLocator {
|
|||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state.setTableFunction("monsterSkillParameter", this) { args ->
|
||||||
|
val name = args.getString()
|
||||||
|
val param = args.getString()
|
||||||
|
// parity: если скила не существует, то оригинальный движок просто возвращает nil
|
||||||
|
args.push(monsterSkills[name]?.value?.config?.get(param))
|
||||||
|
1
|
||||||
|
}
|
||||||
|
|
||||||
state.pop()
|
state.pop()
|
||||||
|
|
||||||
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
state.load(polyfill, "@starbound.jar!/scripts/polyfill.lua")
|
||||||
@ -918,6 +930,7 @@ class Starbound : ISBFileLocator {
|
|||||||
loadStage(callback, _npcTypes, ext2files["npctype"] ?: listOf())
|
loadStage(callback, _npcTypes, ext2files["npctype"] ?: listOf())
|
||||||
loadStage(callback, _projectiles, ext2files["projectile"] ?: listOf())
|
loadStage(callback, _projectiles, ext2files["projectile"] ?: listOf())
|
||||||
loadStage(callback, _tenants, ext2files["tenant"] ?: listOf())
|
loadStage(callback, _tenants, ext2files["tenant"] ?: listOf())
|
||||||
|
loadStage(callback, _monsterSkills, ext2files["monsterskill"] ?: listOf())
|
||||||
|
|
||||||
pathStack.block("/") {
|
pathStack.block("/") {
|
||||||
//playerDefinition = gson.fromJson(locate("/player.config").reader(), PlayerDefinition::class.java)
|
//playerDefinition = gson.fromJson(locate("/player.config").reader(), PlayerDefinition::class.java)
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package ru.dbotthepony.kstarbound.defs.monster
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap
|
||||||
|
import com.google.gson.JsonElement
|
||||||
|
import ru.dbotthepony.kstarbound.defs.image.ImageReference
|
||||||
|
import ru.dbotthepony.kstarbound.io.json.builder.JsonFactory
|
||||||
|
|
||||||
|
@JsonFactory
|
||||||
|
data class MonsterSkillDefinition(
|
||||||
|
val name: String,
|
||||||
|
val label: String? = null,
|
||||||
|
val image: ImageReference? = null,
|
||||||
|
val config: ImmutableMap<String, JsonElement> = ImmutableMap.of(),
|
||||||
|
val animationParameters: ImmutableMap<String, JsonElement> = ImmutableMap.of(),
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user