Added setting to allow disabling nanomachine particle effects client side for people running MC on a toaster. Closes #1550.

This commit is contained in:
Florian Nücke 2016-03-20 16:42:05 +01:00
parent 72d8a13a8a
commit fb7aa123ef
4 changed files with 10 additions and 2 deletions

View File

@ -106,6 +106,12 @@ opencomputers {
# treated as relative positions, values in [1, inf) will be treated as
# absolute positions.
nanomachineHudPos: [-1, -1]
# Whether to emit particle effects around players via nanomachines. This
# includes the basic particles giving a rough indication of the current
# power level of the nanomachines as well as particles emitted by the
# particle effect behaviors.
enableNanomachinePfx: true
}
# Computer related settings, concerns server performance and security.

View File

@ -45,6 +45,7 @@ class Settings(val config: Config) {
OpenComputers.log.warn("Bad number of HUD coordiantes, ignoring.")
(-1.0, -1.0)
}
val enableNanomachinePfx = config.getBoolean("client.enableNanomachinePfx")
// ----------------------------------------------------------------------- //
// computer

View File

@ -279,7 +279,7 @@ class ControllerImpl(val player: EntityPlayer) extends Controller with WirelessE
}
}
if (isClient) {
if (isClient && Settings.get.enableNanomachinePfx) {
val energyRatio = getLocalBuffer / (getLocalBufferSize + 1)
val triggerRatio = activeInputs / (configuration.triggers.length + 1)
val intensity = (energyRatio + triggerRatio) * 0.25

View File

@ -1,5 +1,6 @@
package li.cil.oc.common.nanomachines.provider
import li.cil.oc.Settings
import li.cil.oc.api
import li.cil.oc.api.nanomachines.Behavior
import li.cil.oc.api.prefab.AbstractBehavior
@ -44,7 +45,7 @@ object ParticleProvider extends ScalaProvider("b48c4bbd-51bb-4915-9367-16cff3220
override def update(): Unit = {
val world = player.getEntityWorld
if (world.isRemote) {
if (world.isRemote && Settings.get.enableNanomachinePfx) {
PlayerUtils.spawnParticleAround(player, effectName, api.Nanomachines.getController(player).getInputCount(this) * 0.25)
}
}