Skip to content

Commit

Permalink
rideable: fix pos not parsed + add addon function for interact & exit…
Browse files Browse the repository at this point in the history
… texts
  • Loading branch information
12rcu committed Feb 2, 2024
1 parent 3be1aaf commit 8fff7a5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.lop.devtools.monstera.addon.sound.Sound
import com.lop.devtools.monstera.files.beh.entitiy.BehEntityComponents
import com.lop.devtools.monstera.files.beh.entitiy.components.ComponentInventory
import com.lop.devtools.monstera.files.beh.entitiy.components.ComponentLoot
import com.lop.devtools.monstera.files.beh.entitiy.components.ComponentRideable
import com.lop.devtools.monstera.files.beh.entitiy.events.BehEntityEvent
import com.lop.devtools.monstera.files.beh.tables.loot.BehLootTables

Expand All @@ -13,6 +14,16 @@ interface OverwriteComponents {

fun ComponentLoot.table(tableName: String, table: BehLootTables.() -> Unit)

fun ComponentRideable.interactText(
displayName: String? = null,
key: String = "action.interact." + displayName?.replace(" ", "_")?.lowercase()
)

fun ComponentRideable.exitText(
displayText: String,
key: String
)

/**
* add a sound to a component
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.lop.devtools.monstera.addon.sound.SoundData
import com.lop.devtools.monstera.files.beh.entitiy.BehEntityComponents
import com.lop.devtools.monstera.files.beh.entitiy.components.ComponentInventory
import com.lop.devtools.monstera.files.beh.entitiy.components.ComponentLoot
import com.lop.devtools.monstera.files.beh.entitiy.components.ComponentRideable
import com.lop.devtools.monstera.files.beh.entitiy.events.BehEntityEvent
import com.lop.devtools.monstera.files.beh.tables.loot.BehLootTables
import com.lop.devtools.monstera.files.res.sounds.CategorySound
Expand All @@ -17,6 +18,14 @@ abstract class OverwriteComponentsImpl(override val unsafeParent: Entity) : Over
genTable(tableName, unsafeParent.addon, table)
}

override fun ComponentRideable.exitText(displayText: String, key: String) {
exitText(displayText, key, unsafeParent.addon.config)
}

override fun ComponentRideable.interactText(displayName: String?, key: String) {
interactText(displayName, key, unsafeParent.addon.config)
}

override fun BehEntityComponents.sound(data: Sound.() -> Unit): String {
val soundData = SoundData(unsafeParent.addon)
soundData.category = SoundCategory.NEUTRAL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ComponentRideable : MonsteraFile {
fun interactText(
displayName: String? = null,
key: String = "action.interact." + displayName?.replace(" ", "_")?.lowercase(),
config: Config? = null
config: Config?
) {
unsafe.general["interact_text"] = key
if (displayName != null)
Expand All @@ -89,7 +89,7 @@ class ComponentRideable : MonsteraFile {
fun exitText(
displayText: String,
key: String,
config: Config? = null
config: Config?
) {
setExitText = true
config?.langFileBuilder?.addonRes?.add(key, displayText)
Expand Down Expand Up @@ -117,8 +117,6 @@ class CompSeats {
}

class CompSeat : MonsteraFile {
val general = mutableMapOf<String, Any>()

override val unsafe = Unsafe()

inner class Unsafe : MonsteraUnsafeMap {
Expand All @@ -142,6 +140,6 @@ class CompSeat : MonsteraFile {
var lockRiderRotation: Number? = null

fun position(x: Float, y: Float, z: Float) {
general["position"] = arrayListOf(x, y, z)
unsafe.general["position"] = arrayListOf(x, y, z)
}
}

0 comments on commit 8fff7a5

Please sign in to comment.