Scorpion Death Message (#1044)

* correction to scorpion sub-projectile death message

* redirected the definition fields

* output method of demise to chat; chat will answer us the mystery

* finally attributes the scorpion as the method of demise
This commit is contained in:
Fate-JH 2023-03-06 14:16:56 -05:00 committed by GitHub
parent 36c7a1e520
commit ae66f86f63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 102 additions and 21 deletions

View file

@ -1,11 +1,12 @@
// Copyright (c) 2022 PSForever
package net.psforever.objects
import net.psforever.objects.ballistics.Projectile
import net.psforever.objects.definition.{ObjectDefinition, ProjectileDefinition}
import net.psforever.objects.serverobject.affinity.FactionAffinity
import net.psforever.objects.vital.resolution.{DamageAndResistance, DamageResistanceModel}
import net.psforever.objects.vital.{Vitality, VitalityDefinition}
import net.psforever.types.{PlanetSideEmpire, Vector3}
import net.psforever.types.{PlanetSideEmpire, PlanetSideGUID, Vector3}
class DummyExplodingEntity(
private val obj: PlanetSideGameObject,
@ -14,7 +15,7 @@ class DummyExplodingEntity(
extends PlanetSideGameObject
with FactionAffinity
with Vitality {
override def GUID = obj.GUID
override def GUID: PlanetSideGUID = obj.GUID
override def Position: Vector3 = {
if (super.Position == Vector3.Zero) {
@ -41,20 +42,29 @@ class DummyExplodingEntity(
def DamageModel: DamageAndResistance = DummyExplodingEntity.DefaultDamageResistanceModel
def Definition: ObjectDefinition with VitalityDefinition = {
new DefinitionWrappedInVitality(obj.Definition)
new DefinitionWrappedInVitality(obj)
}
}
private class DefinitionWrappedInVitality(definition: ObjectDefinition)
extends ObjectDefinition(definition.ObjectId)
private class DefinitionWrappedInVitality(private val entity: PlanetSideGameObject)
extends ObjectDefinition(entity.Definition.ObjectId)
with VitalityDefinition {
innateDamage = definition match {
private val internalDefinition = entity.Definition
innateDamage = internalDefinition match {
case v: VitalityDefinition if v.innateDamage.nonEmpty => v.innateDamage.get
case p: ProjectileDefinition => p
case _ => GlobalDefinitions.no_projectile
}
Name = { definition.Name }
Name = internalDefinition.Name
DefaultHealth = 1 //just cuz
override def ObjectId: Int = entity match {
case p: Projectile => p.tool_def.ObjectId //projectiles point back to the weapon of origin
case _ => internalDefinition.ObjectId //what are we?
}
}
object DummyExplodingEntity {