diff --git a/assets/mods/basegame/audio/effects/explosion/bang_bomb.ogg b/assets/mods/basegame/audio/effects/explosion/bang_bomb.ogg deleted file mode 100644 index 341016f2f..000000000 --- a/assets/mods/basegame/audio/effects/explosion/bang_bomb.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e165b96c97358a47db014586d9f3c117ee79e8b978d431493098f8a0f4f93218 -size 66764 diff --git a/assets/mods/basegame/audio/effects/explosion/bang_bomb.wav b/assets/mods/basegame/audio/effects/explosion/bang_bomb.wav new file mode 100644 index 000000000..5b4ca19ca Binary files /dev/null and b/assets/mods/basegame/audio/effects/explosion/bang_bomb.wav differ diff --git a/assets/mods/basegame/audio/effects/explosion/fuse.ogg b/assets/mods/basegame/audio/effects/explosion/fuse.ogg deleted file mode 100644 index 85b59f55e..000000000 --- a/assets/mods/basegame/audio/effects/explosion/fuse.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:abe59ab65df6569b3a89dddfca0ac80026ec4252353b26732e843c020b80fe4d -size 429970 diff --git a/assets/mods/basegame/audio/effects/explosion/fuse.wav b/assets/mods/basegame/audio/effects/explosion/fuse.wav new file mode 100755 index 000000000..1a36ae8b8 Binary files /dev/null and b/assets/mods/basegame/audio/effects/explosion/fuse.wav differ diff --git a/assets/mods/basegame/audio/effects/explosion/fuse_continue.ogg b/assets/mods/basegame/audio/effects/explosion/fuse_continue.ogg deleted file mode 100644 index 4d15879a7..000000000 --- a/assets/mods/basegame/audio/effects/explosion/fuse_continue.ogg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2ab2d2f7c75866a05cefaa6338e8a533648c8b2d5181dc8256dfbbadacea78a1 -size 428307 diff --git a/assets/mods/basegame/audio/effects/explosion/fuse_continue.wav b/assets/mods/basegame/audio/effects/explosion/fuse_continue.wav new file mode 100755 index 000000000..e65a8d6e9 Binary files /dev/null and b/assets/mods/basegame/audio/effects/explosion/fuse_continue.wav differ diff --git a/assets/mods/basegame/items/itemid.csv b/assets/mods/basegame/items/itemid.csv index e9a6aea1c..7c3d48271 100644 --- a/assets/mods/basegame/items/itemid.csv +++ b/assets/mods/basegame/items/itemid.csv @@ -53,6 +53,8 @@ id;classname;tags 52;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalSevenSeg;FIXTURE,SIGNAL 53;net.torvald.terrarum.modulebasegame.gameitems.ItemEngravingWorkbench;FIXTURE,CRAFTING 54;net.torvald.terrarum.modulebasegame.gameitems.ItemMechanicalTines;FIXTURE,MUSIC,SIGNAL +55;net.torvald.terrarum.modulebasegame.gameitems.ItemGlowOrb;LIGHT,THROWABLE + # ingots 112;net.torvald.terrarum.modulebasegame.gameitems.IngotCopper;INGOT diff --git a/assets/mods/basegame/items/items.tga b/assets/mods/basegame/items/items.tga index 9134c4042..77a273f74 100644 --- a/assets/mods/basegame/items/items.tga +++ b/assets/mods/basegame/items/items.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:559324af689c1a3d7696a503df8235d83db561da0bdb72368db0bdc56ef00475 +oid sha256:789fcee21a0b8293c66bf2e62e8a503b53e4d242172dcd7ed4c24573e1f11bd3 size 4816914 diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorPrimedBomb.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorPrimedBomb.kt index a11914ecc..1b95ee642 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorPrimedBomb.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorPrimedBomb.kt @@ -1,14 +1,19 @@ package net.torvald.terrarum.modulebasegame.gameactors import com.badlogic.gdx.Gdx +import com.badlogic.gdx.graphics.Color +import com.badlogic.gdx.graphics.g2d.SpriteBatch +import com.badlogic.gdx.graphics.g2d.TextureRegion +import net.torvald.gdx.graphics.Cvec import net.torvald.spriteanimation.SingleImageSprite import net.torvald.terrarum.* import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED import net.torvald.terrarum.audio.audiobank.MusicContainer import net.torvald.terrarum.audio.decibelsToFullscale -import net.torvald.terrarum.gameactors.ActorWithBody -import net.torvald.terrarum.gameactors.PhysProperties +import net.torvald.terrarum.gameactors.* import net.torvald.terrarum.modulebasegame.ExplosionManager +import java.util.ArrayList +import kotlin.math.log10 /** * Created by minjaesong on 2024-02-13. @@ -34,17 +39,17 @@ open class ActorPrimedBomb( private var explosionCalled = false @Transient private val boomSound = MusicContainer( - "boom", ModMgr.getFile("basegame", "audio/effects/explosion/bang_bomb.ogg"), toRAM = true + "boom", ModMgr.getFile("basegame", "audio/effects/explosion/bang_bomb.wav"), toRAM = true ) { this.flagDespawn() } @Transient private val fuseSound = MusicContainer( - "fuse", ModMgr.getFile("basegame", "audio/effects/explosion/fuse.ogg"), toRAM = true + "fuse", ModMgr.getFile("basegame", "audio/effects/explosion/fuse.wav"), toRAM = true ) { this.flagDespawn() } @Transient private val fuseSoundCont = MusicContainer( - "fuse_continue", ModMgr.getFile("basegame", "audio/effects/explosion/fuse_continue.ogg"), toRAM = true + "fuse_continue", ModMgr.getFile("basegame", "audio/effects/explosion/fuse_continue.wav"), toRAM = true ) { this.flagDespawn() } @@ -89,6 +94,10 @@ open class ActorPrimedBomb( } } + fun updatePhysOnly(delta: Float) { + super.updateImpl(delta) + } + override fun dispose() { super.dispose() boomSound.dispose() @@ -102,7 +111,6 @@ open class ActorPrimedBomb( * Created by minjaesong on 2024-02-14. */ class ActorCherryBomb : ActorPrimedBomb(14f, 4.5f) { // 14 is the intended value; 32 is for testing - init { val itemImage = CommonResourcePool.getAsItemSheet("basegame.items").get(0,13) @@ -112,7 +120,51 @@ class ActorCherryBomb : ActorPrimedBomb(14f, 4.5f) { // 14 is the intended value avBaseMass = 1.0 density = 1400.0 } +} +/** + * Created by minjaesong on 2024-07-12. + */ +class ActorGlowOrb : ActorPrimedBomb(0f, 0f) { // 14 is the intended value; 32 is for testing + val spawnTime = INGAME.world.worldTime.TIME_T + init { + val itemImage = CommonResourcePool.getAsItemSheet("basegame.items").get(1,13) + + setHitboxDimension(7, 7, 2, -2) + sprite = SingleImageSprite(this, itemImage) + spriteEmissive = SingleImageSprite(this, itemImage) + + avBaseMass = 1.0 + density = 1400.0 + } + + @Transient private val lifePower = 10000L // charge reaches 0 on timeDelta = 9 * lifePower + @Transient private val lumMult = 0.8f + @Transient private val lumCol = BlockCodex["basegame:215"] + + override var lightBoxList = arrayListOf(Lightbox(Hitbox(1.0, 1.0, baseHitboxW - 2.0, baseHitboxH - 2.0), Cvec(0))) + + + override fun updateImpl(delta: Float) { + updatePhysOnly(delta) + + val timeDelta0 = INGAME.world.worldTime.TIME_T - spawnTime + val timeDelta = timeDelta0.coerceIn(0, 9 * lifePower) + val charge = log10((-timeDelta + 10 * lifePower.toFloat()) / lifePower.toFloat()) + + // set colours + spriteEmissive!!.colourFilter = Color(charge, charge, charge, 1f) + lightBoxList[0].light.set( + lumCol.baseLumColR * charge * lumMult, + lumCol.baseLumColG * charge * lumMult, + lumCol.baseLumColB * charge * lumMult, + lumCol.baseLumColA * charge * lumMult, + ) + // remove the actor some time AFTER the chemicals are exhausted + if (timeDelta0 >= 10 * lifePower) { + flagDespawn() + } + } } \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/gameitems/ItemThrowable.kt b/src/net/torvald/terrarum/modulebasegame/gameitems/ItemThrowable.kt index 9d327bd52..f8fc98937 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameitems/ItemThrowable.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameitems/ItemThrowable.kt @@ -73,4 +73,16 @@ class ItemCherryBomb(originalID: ItemID) : ItemThrowable(originalID, "net.torval init { itemImage = CommonResourcePool.getAsItemSheet("basegame.items").get(0,13) } +} + + +/** + * Created by minjaesong on 2024-07-12. + */ +class ItemGlowOrb(originalID: ItemID) : ItemThrowable(originalID, "net.torvald.terrarum.modulebasegame.gameactors.ActorGlowOrb") { + override var originalName = "ITEM_GLOW_ORB" + init { + itemImage = CommonResourcePool.getAsItemSheet("basegame.items").get(1,13) + } + // itemImageEmissive is not set because held glow orb does not glow (they get activated only when thrown) } \ No newline at end of file diff --git a/work_files/graphics/items/basegame_items.kra b/work_files/graphics/items/basegame_items.kra index 4f53f56fe..76c3d539c 100644 --- a/work_files/graphics/items/basegame_items.kra +++ b/work_files/graphics/items/basegame_items.kra @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e42ddbf0abe3896521daa657df4511e65f478cd0e84e874b98fdbc56a8aeae3 -size 2015334 +oid sha256:e477292296b31a5cf5670539ba49a592968d82262c6781ced1ad8d94f870c94c +size 2074184