mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 20:14:05 +09:00
glow orbs
This commit is contained in:
Binary file not shown.
BIN
assets/mods/basegame/audio/effects/explosion/bang_bomb.wav
Normal file
BIN
assets/mods/basegame/audio/effects/explosion/bang_bomb.wav
Normal file
Binary file not shown.
Binary file not shown.
BIN
assets/mods/basegame/audio/effects/explosion/fuse.wav
Executable file
BIN
assets/mods/basegame/audio/effects/explosion/fuse.wav
Executable file
Binary file not shown.
Binary file not shown.
BIN
assets/mods/basegame/audio/effects/explosion/fuse_continue.wav
Executable file
BIN
assets/mods/basegame/audio/effects/explosion/fuse_continue.wav
Executable file
Binary file not shown.
@@ -53,6 +53,8 @@ id;classname;tags
|
|||||||
52;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalSevenSeg;FIXTURE,SIGNAL
|
52;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalSevenSeg;FIXTURE,SIGNAL
|
||||||
53;net.torvald.terrarum.modulebasegame.gameitems.ItemEngravingWorkbench;FIXTURE,CRAFTING
|
53;net.torvald.terrarum.modulebasegame.gameitems.ItemEngravingWorkbench;FIXTURE,CRAFTING
|
||||||
54;net.torvald.terrarum.modulebasegame.gameitems.ItemMechanicalTines;FIXTURE,MUSIC,SIGNAL
|
54;net.torvald.terrarum.modulebasegame.gameitems.ItemMechanicalTines;FIXTURE,MUSIC,SIGNAL
|
||||||
|
55;net.torvald.terrarum.modulebasegame.gameitems.ItemGlowOrb;LIGHT,THROWABLE
|
||||||
|
|
||||||
|
|
||||||
# ingots
|
# ingots
|
||||||
112;net.torvald.terrarum.modulebasegame.gameitems.IngotCopper;INGOT
|
112;net.torvald.terrarum.modulebasegame.gameitems.IngotCopper;INGOT
|
||||||
|
|||||||
|
Binary file not shown.
@@ -1,14 +1,19 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.gameactors
|
package net.torvald.terrarum.modulebasegame.gameactors
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
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.spriteanimation.SingleImageSprite
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||||
import net.torvald.terrarum.audio.audiobank.MusicContainer
|
import net.torvald.terrarum.audio.audiobank.MusicContainer
|
||||||
import net.torvald.terrarum.audio.decibelsToFullscale
|
import net.torvald.terrarum.audio.decibelsToFullscale
|
||||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
import net.torvald.terrarum.gameactors.*
|
||||||
import net.torvald.terrarum.gameactors.PhysProperties
|
|
||||||
import net.torvald.terrarum.modulebasegame.ExplosionManager
|
import net.torvald.terrarum.modulebasegame.ExplosionManager
|
||||||
|
import java.util.ArrayList
|
||||||
|
import kotlin.math.log10
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2024-02-13.
|
* Created by minjaesong on 2024-02-13.
|
||||||
@@ -34,17 +39,17 @@ open class ActorPrimedBomb(
|
|||||||
private var explosionCalled = false
|
private var explosionCalled = false
|
||||||
|
|
||||||
@Transient private val boomSound = MusicContainer(
|
@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()
|
this.flagDespawn()
|
||||||
}
|
}
|
||||||
@Transient private val fuseSound = MusicContainer(
|
@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()
|
this.flagDespawn()
|
||||||
}
|
}
|
||||||
@Transient private val fuseSoundCont = MusicContainer(
|
@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()
|
this.flagDespawn()
|
||||||
}
|
}
|
||||||
@@ -89,6 +94,10 @@ open class ActorPrimedBomb(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updatePhysOnly(delta: Float) {
|
||||||
|
super.updateImpl(delta)
|
||||||
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
super.dispose()
|
super.dispose()
|
||||||
boomSound.dispose()
|
boomSound.dispose()
|
||||||
@@ -102,7 +111,6 @@ open class ActorPrimedBomb(
|
|||||||
* Created by minjaesong on 2024-02-14.
|
* Created by minjaesong on 2024-02-14.
|
||||||
*/
|
*/
|
||||||
class ActorCherryBomb : ActorPrimedBomb(14f, 4.5f) { // 14 is the intended value; 32 is for testing
|
class ActorCherryBomb : ActorPrimedBomb(14f, 4.5f) { // 14 is the intended value; 32 is for testing
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val itemImage = CommonResourcePool.getAsItemSheet("basegame.items").get(0,13)
|
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
|
avBaseMass = 1.0
|
||||||
density = 1400.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()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -73,4 +73,16 @@ class ItemCherryBomb(originalID: ItemID) : ItemThrowable(originalID, "net.torval
|
|||||||
init {
|
init {
|
||||||
itemImage = CommonResourcePool.getAsItemSheet("basegame.items").get(0,13)
|
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)
|
||||||
}
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user