Phantom attractor android feature

This commit is contained in:
DBotThePony 2022-09-26 11:00:59 +07:00
parent 8150481081
commit 50a6806a0e
Signed by: DBot
GPG Key ID: DCC23B5715498507
6 changed files with 37 additions and 1 deletions

View File

@ -331,6 +331,20 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
serializer.accept(FALL_DAMPENERS_2) serializer.accept(FALL_DAMPENERS_2)
serializer.accept(FALL_DAMPENERS_3) serializer.accept(FALL_DAMPENERS_3)
val PHANTOM_ATTRACTOR =
AndroidResearchType.Builder(modLocation(MNames.PHANTOM_ATTRACTOR))
.withExperience(20)
.withDescription()
.withIcon(ResearchIcons.ICON_PHANTOM_ATTRACTOR)
.addFeatureResult(AndroidFeatures.PHANTOM_ATTRACTOR)
.addPrerequisite(NANOBOTS)
.addItem(MItems.PHANTOM_ATTRACTOR)
.addItem(MItemTags.COPPER_WIRES, 2)
.addItem(MItemTags.TRITANIUM_PLATES, 2)
.build()
serializer.accept(PHANTOM_ATTRACTOR)
with(lang.english) { with(lang.english) {
misc("fall_dampeners.description", "Reduces fall damage by %s%%") misc("fall_dampeners.description", "Reduces fall damage by %s%%")
@ -382,6 +396,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
add(SHOCKWAVE, "description0", "Releases a shockwave around unit, damaging everything in small radius, as unit quickly land on ground") add(SHOCKWAVE, "description0", "Releases a shockwave around unit, damaging everything in small radius, as unit quickly land on ground")
add(SHOCKWAVE, "description1", "It does not, however, help with ground impact damage!") add(SHOCKWAVE, "description1", "It does not, however, help with ground impact damage!")
add(PHANTOM_ATTRACTOR, "Builtin Phantom Attractor")
add(PHANTOM_ATTRACTOR, "description", "Allows unit to attract phantoms while active under same conditions as non-androids")
add(attackBoostList[0], "Attack Boost %s") add(attackBoostList[0], "Attack Boost %s")
add(attackBoostList[0], "description", "Increases total melee attack strength by %s%%") add(attackBoostList[0], "description", "Increases total melee attack strength by %s%%")
} }

View File

@ -482,6 +482,7 @@ private fun androidFeatures(provider: MatteryLanguageProvider) {
add(AndroidFeatures.NANOBOTS_ARMOR, "Nanobots Armor") add(AndroidFeatures.NANOBOTS_ARMOR, "Nanobots Armor")
add(AndroidFeatures.ITEM_MAGNET, "Item Magnet") add(AndroidFeatures.ITEM_MAGNET, "Item Magnet")
add(AndroidFeatures.STEP_ASSIST, "Step Assist") add(AndroidFeatures.STEP_ASSIST, "Step Assist")
add(AndroidFeatures.PHANTOM_ATTRACTOR, "Phantom Attractor")
} }
} }

View File

@ -0,0 +1,13 @@
package ru.dbotthepony.mc.otm.android.feature
import com.mojang.blaze3d.vertex.PoseStack
import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
import ru.dbotthepony.mc.otm.client.render.ResearchIcons
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
class PhantomAttractorFeature(android: MatteryPlayerCapability) : AndroidSwitchableFeature(AndroidFeatures.PHANTOM_ATTRACTOR, android) {
override fun renderIcon(stack: PoseStack, x: Float, y: Float, width: Float, height: Float) {
ResearchIcons.ICON_PHANTOM_ATTRACTOR.render(stack, x, y, width, height)
}
}

View File

@ -44,6 +44,7 @@ import ru.dbotthepony.mc.otm.android.AndroidFeatureType
import ru.dbotthepony.mc.otm.android.AndroidResearch import ru.dbotthepony.mc.otm.android.AndroidResearch
import ru.dbotthepony.mc.otm.android.AndroidResearchManager import ru.dbotthepony.mc.otm.android.AndroidResearchManager
import ru.dbotthepony.mc.otm.android.AndroidResearchType import ru.dbotthepony.mc.otm.android.AndroidResearchType
import ru.dbotthepony.mc.otm.android.AndroidSwitchableFeature
import ru.dbotthepony.mc.otm.container.MatteryContainer import ru.dbotthepony.mc.otm.container.MatteryContainer
import ru.dbotthepony.mc.otm.core.* import ru.dbotthepony.mc.otm.core.*
import ru.dbotthepony.mc.otm.menu.ExoSuitInventoryMenu import ru.dbotthepony.mc.otm.menu.ExoSuitInventoryMenu
@ -848,7 +849,7 @@ class MatteryPlayerCapability(val ply: Player) : ICapabilityProvider, INBTSerial
fun canEntitySpawn(event: LivingSpawnEvent.CheckSpawn) { fun canEntitySpawn(event: LivingSpawnEvent.CheckSpawn) {
if (event.spawnReason == MobSpawnType.NATURAL && event.entity is Phantom) { if (event.spawnReason == MobSpawnType.NATURAL && event.entity is Phantom) {
for (ply in event.entity.level.players()) { for (ply in event.entity.level.players()) {
if (ply.matteryPlayer?.isAndroid == true) { if (ply.matteryPlayer?.isAndroid == true && (ply.matteryPlayer?.getFeature(AndroidFeatures.PHANTOM_ATTRACTOR) as AndroidSwitchableFeature?)?.isActive != true) {
if ( if (
ply.position.y in event.y - 36.0 .. event.y - 19.0 && ply.position.y in event.y - 36.0 .. event.y - 19.0 &&
ply.position.x in event.x - 12.0 .. event.x + 12.0 && ply.position.x in event.x - 12.0 .. event.x + 12.0 &&

View File

@ -31,6 +31,9 @@ object ResearchIcons {
val ICON_EXTENDED_REACH: SkinElement val ICON_EXTENDED_REACH: SkinElement
val KOT = ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/block/ph_kitty.png").element(0f, 0f, 32f, 32f, 32f, 32f)
val ICON_PHANTOM_ATTRACTOR = KOT
init { init {
val grid = SkinGrid(ICONS, 18f, 18f, 7, 7) val grid = SkinGrid(ICONS, 18f, 18f, 7, 7)

View File

@ -21,6 +21,7 @@ object AndroidFeatures {
val SHOCKWAVE: AndroidFeatureType<*> by registry.register(MNames.SHOCKWAVE) { AndroidFeatureType(::ShockwaveFeature) } val SHOCKWAVE: AndroidFeatureType<*> by registry.register(MNames.SHOCKWAVE) { AndroidFeatureType(::ShockwaveFeature) }
val ITEM_MAGNET: AndroidFeatureType<*> by registry.register(MNames.ITEM_MAGNET) { AndroidFeatureType(::ItemMagnetFeature) } val ITEM_MAGNET: AndroidFeatureType<*> by registry.register(MNames.ITEM_MAGNET) { AndroidFeatureType(::ItemMagnetFeature) }
val FALL_DAMPENERS: AndroidFeatureType<*> by registry.register(MNames.FALL_DAMPENERS) { AndroidFeatureType(::FallDampenersFeature) } val FALL_DAMPENERS: AndroidFeatureType<*> by registry.register(MNames.FALL_DAMPENERS) { AndroidFeatureType(::FallDampenersFeature) }
val PHANTOM_ATTRACTOR: AndroidFeatureType<*> by registry.register(MNames.PHANTOM_ATTRACTOR) { AndroidFeatureType(::PhantomAttractorFeature) }
internal fun register(bus: IEventBus) { internal fun register(bus: IEventBus) {
registry.register(bus) registry.register(bus)