Few small tweaks to silo / vehicle capacitor displays suggested by Sounours that I forgot about (#266)

This commit is contained in:
Mazo 2019-08-21 15:33:26 +01:00 committed by Fate-JH
parent 58d5f1c0fc
commit ad60b443e1
3 changed files with 8 additions and 8 deletions

View file

@ -55,7 +55,7 @@ class ResourceSiloControl(resourceSilo : ResourceSilo) extends Actor with Factio
}
val ntuBarLevel = scala.math.round((resourceSilo.ChargeLevel.toFloat / resourceSilo.MaximumCharge.toFloat) * 10)
val ntuBarLevel = scala.math.ceil((resourceSilo.ChargeLevel.toFloat / resourceSilo.MaximumCharge.toFloat) * 10).toInt
// Only send updated capacitor display value to all clients if it has actually changed
if(resourceSilo.CapacitorDisplay != ntuBarLevel) {
log.trace(s"Silo ${resourceSilo.GUID} NTU bar level has changed from ${resourceSilo.CapacitorDisplay} to $ntuBarLevel")

View file

@ -160,7 +160,7 @@ class ResourceSiloControlUpdate1Test extends ActorTest {
val reply1 = probe1.receiveOne(500 milliseconds)
val reply2 = probe2.receiveOne(500 milliseconds)
assert(obj.ChargeLevel == 305)
assert(obj.CapacitorDisplay == 3)
assert(obj.CapacitorDisplay == 4)
assert(reply1.isInstanceOf[AvatarServiceMessage])
assert(reply1.asInstanceOf[AvatarServiceMessage].forChannel == "nowhere")
assert(reply1.asInstanceOf[AvatarServiceMessage]
@ -170,7 +170,7 @@ class ResourceSiloControlUpdate1Test extends ActorTest {
assert(reply1.asInstanceOf[AvatarServiceMessage]
.actionMessage.asInstanceOf[AvatarAction.PlanetsideAttribute].attribute_type == 45)
assert(reply1.asInstanceOf[AvatarServiceMessage]
.actionMessage.asInstanceOf[AvatarAction.PlanetsideAttribute].attribute_value == 3)
.actionMessage.asInstanceOf[AvatarAction.PlanetsideAttribute].attribute_value == 4)
assert(reply2.isInstanceOf[Building.SendMapUpdate])
@ -231,7 +231,7 @@ class ResourceSiloControlUpdate2Test extends ActorTest {
val reply1 = probe1.receiveOne(500 milliseconds)
val reply2 = probe2.receiveOne(500 milliseconds)
assert(obj.ChargeLevel == 205)
assert(obj.CapacitorDisplay == 2)
assert(obj.CapacitorDisplay == 3)
assert(reply1.isInstanceOf[AvatarServiceMessage])
assert(reply1.asInstanceOf[AvatarServiceMessage].forChannel == "nowhere")
assert(reply1.asInstanceOf[AvatarServiceMessage]
@ -241,7 +241,7 @@ class ResourceSiloControlUpdate2Test extends ActorTest {
assert(reply1.asInstanceOf[AvatarServiceMessage]
.actionMessage.asInstanceOf[AvatarAction.PlanetsideAttribute].attribute_type == 45)
assert(reply1.asInstanceOf[AvatarServiceMessage]
.actionMessage.asInstanceOf[AvatarAction.PlanetsideAttribute].attribute_value == 2)
.actionMessage.asInstanceOf[AvatarAction.PlanetsideAttribute].attribute_value == 3)
assert(reply2.isInstanceOf[Building.SendMapUpdate])

View file

@ -2572,7 +2572,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
if(vehicle.Capacitor < vehicle.Definition.MaximumCapacitor) {
// Charging
vehicle.Capacitor += 100
sendResponse(PlanetsideAttributeMessage(vehicle.GUID, 45, scala.math.round((vehicle.Capacitor.toFloat / vehicle.Definition.MaximumCapacitor.toFloat) * 10))) // set ntu on vehicle UI
sendResponse(PlanetsideAttributeMessage(vehicle.GUID, 45, scala.math.ceil((vehicle.Capacitor.toFloat / vehicle.Definition.MaximumCapacitor.toFloat) * 10).toInt)) // set ntu on vehicle UI
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(vehicle.GUID, 52, 1L)) // panel glow on
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(vehicle.GUID, 49, 1L)) // orb particle effect on
@ -2580,7 +2580,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
}
else {
// Fully charged
sendResponse(PlanetsideAttributeMessage(vehicle.GUID, 45, scala.math.round((vehicle.Capacitor.toFloat / vehicle.Definition.MaximumCapacitor.toFloat) * 10).toInt)) // set ntu on vehicle UI
sendResponse(PlanetsideAttributeMessage(vehicle.GUID, 45, scala.math.ceil((vehicle.Capacitor.toFloat / vehicle.Definition.MaximumCapacitor.toFloat) * 10).toInt)) // set ntu on vehicle UI
// Turning off glow/orb effects on ANT doesn't seem to work when deployed. Try to undeploy ANT from server side
context.system.scheduler.scheduleOnce(vehicle.UndeployTime milliseconds, vehicle.Actor, Deployment.TryUndeploy(DriveState.Undeploying))
@ -2608,7 +2608,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
vehicle.Capacitor -= chargeToDeposit
silo.Actor ! ResourceSilo.UpdateChargeLevel(chargeToDeposit)
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(silo_guid, 49, 1L)) // panel glow on & orb particles on
sendResponse(PlanetsideAttributeMessage(vehicle.GUID, 45, scala.math.round((vehicle.Capacitor.toFloat / vehicle.Definition.MaximumCapacitor.toFloat) * 10))) // set ntu on vehicle UI
sendResponse(PlanetsideAttributeMessage(vehicle.GUID, 45, scala.math.ceil((vehicle.Capacitor.toFloat / vehicle.Definition.MaximumCapacitor.toFloat) * 10).toInt)) // set ntu on vehicle UI
//todo: grant BEP to user
//todo: grant BEP to squad in range