com.skillw.pouvoir.internal.feature.selector.Projectile.kt Maven / Gradle / Ivy
package com.skillw.pouvoir.internal.feature.selector
import com.skillw.asahi.util.castSafely
import com.skillw.pouvoir.api.feature.selector.SimpleSelector
import com.skillw.pouvoir.api.feature.selector.Target
import com.skillw.pouvoir.api.feature.selector.target.EntityTarget
import com.skillw.pouvoir.api.feature.selector.toTarget
import com.skillw.pouvoir.api.plugin.annotation.AutoRegister
import com.skillw.pouvoir.api.plugin.map.DataMap
import com.skillw.pouvoir.util.getRayHits
/**
* Line
*
* @constructor Create empty Line
*/
@AutoRegister
object Projectile : SimpleSelector("projectile") {
override fun SelectorContext.getTargets(caster: Target): List {
val distance = get("distance", 10.0)
return caster.location.getRayHits(distance).map { it.toTarget() }
}
override fun addParameter(dataMap: DataMap, vararg args: Any?) {
dataMap["distance"] = args.getOrNull(0).castSafely() ?: 10.0
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy