This commit is contained in:
DBotThePony 2022-06-17 23:05:33 +07:00
parent 7504c1381d
commit 4870f6921a
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -34,7 +34,7 @@ class ConfigurableProjectile : ConfigurableDefinition<ConfigurableProjectile, Co
var bounces: Int = -1
var frameNumber: Int = 1
var scripts: Array<String> = Array(0) { "" }
var scripts: Array<String> = Array(0) { throw IllegalStateException() }
var hydrophobic: Boolean = false
@ -141,6 +141,9 @@ interface IConfigurableAction {
private val MISSING_ACTIONS = ObjectArraySet<String>()
private val LOGGER = LogManager.getLogger()
/**
* Определяет тип действия и возвращает прототип действия
*/
private fun constructAction(input: JsonObject): IConfigurableAction? {
return when (val elem = (input["action"] ?: throw IllegalArgumentException("Action has no, well, `action` key to specify whatever is it.")).asString) {
"config" -> Starbound.gson.fromJson(input, ActionConfig::class.java)
@ -159,6 +162,11 @@ private fun constructAction(input: JsonObject): IConfigurableAction? {
}
}
/**
* Выполняет действия из указанного файла
*
* По смыслу равен include
*/
class ActionConfig : IConfigurableAction {
lateinit var file: String
@ -180,6 +188,9 @@ class ActionConfig : IConfigurableAction {
}
}
/**
* Создает новый прожектайл с заданными параметрами
*/
class ActionProjectile : IConfigurableAction {
lateinit var type: String
var angle = 0.0
@ -198,6 +209,9 @@ class ActionProjectile : IConfigurableAction {
}
}
/**
* Проигрывает звук
*/
class ActionSound : IConfigurableAction {
lateinit var options: Array<String>
@ -212,6 +226,9 @@ class ActionSound : IConfigurableAction {
}
}
/**
* Выполняет указанные действия в [body] на [count] раз
*/
class ActionLoop : IConfigurableAction {
var count by Delegates.notNull<Int>()
var body by Delegates.notNull<Array<JsonObject>>()
@ -228,6 +245,9 @@ class ActionLoop : IConfigurableAction {
}
}
/**
* Выполняет указанные [list] действия
*/
class ActionActions : IConfigurableAction {
var list by Delegates.notNull<Array<JsonObject>>()