max exo-suits did not look like one another; revert to Standard upon final clean-up

This commit is contained in:
FateJH 2020-05-13 22:59:01 -04:00
parent 6ef6d6834f
commit 8f339801cf
3 changed files with 21 additions and 3 deletions

View file

@ -110,6 +110,20 @@ class ExoSuitDefinition(private val suitType : ExoSuitType.Value) extends BasicD
}
def Use : ExoSuitDefinition = this
def canEqual(other: Any): Boolean = other.isInstanceOf[ExoSuitDefinition]
override def equals(other: Any): Boolean = other match {
case that: ExoSuitDefinition =>
(that canEqual this) &&
suitType == that.suitType
case _ => false
}
override def hashCode(): Int = {
val state = Seq(suitType)
state.map(_.hashCode()).foldLeft(0)((a, b) => 31 * a + b)
}
}
class SpecialExoSuitDefinition(private val suitType : ExoSuitType.Value) extends ExoSuitDefinition(suitType) {

View file

@ -3,6 +3,7 @@ package services.avatar.support
import net.psforever.objects.guid.{GUIDTask, TaskResolver}
import net.psforever.objects.Player
import net.psforever.types.ExoSuitType
import services.{RemoverActor, Service}
import services.avatar.{AvatarAction, AvatarServiceMessage}
@ -28,6 +29,9 @@ class CorpseRemovalActor extends RemoverActor {
def ClearanceTest(entry : RemoverActor.Entry) : Boolean = !entry.zone.Corpses.contains(entry.obj)
def DeletionTask(entry : RemoverActor.Entry) : TaskResolver.GiveTask = {
GUIDTask.UnregisterPlayer(entry.obj.asInstanceOf[Player])(entry.zone.GUID)
val player = entry.obj.asInstanceOf[Player]
val task = GUIDTask.UnregisterPlayer(player)(entry.zone.GUID)
player.ExoSuit = ExoSuitType.Standard
task
}
}

View file

@ -467,7 +467,7 @@ class PlayerControlDeathStandingTest extends ActorTest {
assert(
msg_avatar(7) match {
case AvatarServiceMessage("test", AvatarAction.DestroyDisplay(killer, victim, _, _))
if killer == player1Source && victim == PlayerSource(player2) => true
if killer.Name.equals(player1.Name) && victim.Name.equals(player2.Name) => true
case _ => false
}
)
@ -585,7 +585,7 @@ class PlayerControlDeathSeatedTest extends ActorTest {
assert(
msg_avatar(8) match {
case AvatarServiceMessage("test", AvatarAction.DestroyDisplay(killer, victim, _, _))
if killer == player1Source && victim == PlayerSource(player2) => true
if killer.Name.equals(player1.Name) && victim.Name.equals(player2.Name) => true
case _ => false
}
)