mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
fixed a bug where actors lightbox won't follow the actor's scale
This commit is contained in:
@@ -16,17 +16,16 @@ internal object SetScale : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2 || args.size == 3) {
|
||||
try {
|
||||
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
||||
if (player == null) return
|
||||
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying ?: return
|
||||
|
||||
|
||||
val targetID = if (args.size == 3) args[1].toInt() else player.referenceID
|
||||
val scale = args[if (args.size == 3) 2 else 1].toDouble()
|
||||
val targetID = if (args.size == 3) args[2].toInt() else player.referenceID
|
||||
val scale = args[1].toDouble()
|
||||
|
||||
val target = INGAME.getActorByID(targetID)
|
||||
|
||||
if (target !is ActorWithBody) {
|
||||
EchoError("Target is not ActorWBMovable")
|
||||
EchoError("Target is not ActorWithBody")
|
||||
}
|
||||
else {
|
||||
target.actorValue[AVKey.SCALE] = scale
|
||||
@@ -41,6 +40,6 @@ internal object SetScale : ConsoleCommand {
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo("Usage: setscale scale | setscale actorID scale")
|
||||
Echo("Usage: setscale scale | setscale scale actorID")
|
||||
}
|
||||
}
|
||||
@@ -99,12 +99,14 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
* (Use ArrayList for normal circumstances)
|
||||
*/
|
||||
override val lightBoxList: List<Lightbox>
|
||||
get() = arrayOf(Lightbox(Hitbox(2.0, 2.0, hitbox.width - 3, hitbox.height - 3), actorValueColour)).toList() // things are asymmetric!!
|
||||
get() = arrayOf(Lightbox(Hitbox(2.0, 2.0, baseHitboxW - 3.0, baseHitboxH - 3.0), actorValueColour)).toList() // things are asymmetric!!
|
||||
// use getter; dimension of the player may change by time.
|
||||
// scaling of the lightbox is performed on the LightmapRenderer. Getter is still required because of the changing actorValueColour. Lightbox.light cannot be `() -> Cvec` due to performance and serialising issue.
|
||||
|
||||
override val shadeBoxList: List<Lightbox>
|
||||
get() = arrayOf(Lightbox(Hitbox(2.0, 2.0, hitbox.width - 3, hitbox.height - 3), actorValueShade)).toList() // things are asymmetric!!
|
||||
get() = arrayOf(Lightbox(Hitbox(2.0, 2.0, baseHitboxW - 3.0, baseHitboxH - 3.0), actorValueShade)).toList() // things are asymmetric!!
|
||||
// use getter; dimension of the player may change by time.
|
||||
// scaling of the shadebox is performed on the LightmapRenderer. Getter is still required because of the changing actorValueColour. Lightbox.light cannot be `() -> Cvec` due to performance and serialising issue.
|
||||
|
||||
@Transient val BASE_DENSITY = 980.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user