i hate git

This commit is contained in:
Noobulus 2022-02-02 13:24:11 -06:00
parent 7e0723aee1
commit 4bddd7133f
3 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,13 @@
package at.petrak.hexcasting.common.casting.operators.lists
import at.petrak.hexcasting.api.ConstManaOperator
import at.petrak.hexcasting.api.Operator.Companion.spellListOf
import at.petrak.hexcasting.api.SpellDatum
import at.petrak.hexcasting.common.casting.CastingContext
object OpEmptyList : ConstManaOperator {
override val argc = 0
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): List<SpellDatum<*>> {
return spellListOf(emptyList<SpellDatum<*>>()) // sorry for taking all the easy impls, hudeler
}
}

View file

@ -0,0 +1,15 @@
package at.petrak.hexcasting.common.casting.operators.lists
import at.petrak.hexcasting.api.ConstManaOperator
import at.petrak.hexcasting.api.Operator.Companion.getChecked
import at.petrak.hexcasting.api.Operator.Companion.spellListOf
import at.petrak.hexcasting.api.SpellDatum
import at.petrak.hexcasting.common.casting.CastingContext
// it's still called beancounter's distillation in my heart
object OpListSize : ConstManaOperator {
override val argc = 1
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): List<SpellDatum<*>> {
return spellListOf(args.getChecked<List<SpellDatum<*>>>(0).toList().size.toDouble()) // mmm one-liner
}
}

View file

@ -0,0 +1,13 @@
package at.petrak.hexcasting.common.casting.operators.lists
import at.petrak.hexcasting.api.ConstManaOperator
import at.petrak.hexcasting.api.Operator.Companion.spellListOf
import at.petrak.hexcasting.api.SpellDatum
import at.petrak.hexcasting.common.casting.CastingContext
object OpSingleton : ConstManaOperator {
override val argc = 1
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): List<SpellDatum<*>> {
return spellListOf(listOf(args[0])) // god i love one-liners
}
}