mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-23 22:09:07 +00:00
Damage Changes/Explosions (#644)
* created base damage interaction classes and replaced various projectile-based damage that utilized ResolvedProjectile; not refined, maintains redundancy and overloads, but should work * continuing to reduce the exposure of ResolvedProjectile and replacing it with applications of DamageInteraction, DamageResult, and DamageReason * removed ResolvedProjectile from the project; adjusted remaining code paths to work around it * vitals.test became vital.base; no one liked this * lots of inheritance, polymorphism, and other chicanery; moved around files, so it also looks like more files have changed when they have not (even if they did) * codecov file correction * master rebase; vital directory structure changed, so file imports have been modified in several other files; ResolutionSelection has been removed, requiring direct function literal assignment; tests repaired, where necessary; no actual functional change * code comments * DamageResult is its own case class now, wrapping around a before/after target and the interaction used in its calaculations; tests have been corrected * adjusted Player.Die() to demonstrate a damage-based suicide approach * resolved circular inheritance in projectile damage modifiers; better employed explosion reason, damages players around exploding vehicle as example * expanded explosions to other object types; exploding is now a flag and the damage is an innate property of the object type; removed advanced references to properties on the damage source, since the damage source is easily accessible; wrote comments; fixed tests * overhaul to painbox damage to align with normal player damage handling, thus assimilating it properly into the damage system * future development; normal vector from euler angles; custom proximity test * where 'innateDamage' should have not replaced 'explosion' * moved the hitPos for the generator test; attempting to imrpove the reliability of the auto-repair integration tests (didn't ...) * spelling and private val
This commit is contained in:
parent
b3101d9a8d
commit
6c93746767
99 changed files with 4083 additions and 2490 deletions
|
|
@ -20,6 +20,9 @@ import net.psforever.services.avatar.{AvatarAction, AvatarServiceMessage}
|
|||
import net.psforever.services.local.{LocalAction, LocalServiceMessage}
|
||||
import net.psforever.services.support.SupportActor
|
||||
import net.psforever.objects.avatar.Avatar
|
||||
import net.psforever.objects.vital.base.DamageResolution
|
||||
import net.psforever.objects.vital.interaction.DamageInteraction
|
||||
import net.psforever.objects.vital.projectile.ProjectileReason
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
||||
|
|
@ -333,14 +336,16 @@ class ExplosiveDeployableJammerTest extends ActorTest {
|
|||
val jMineSource = SourceEntry(j_mine)
|
||||
val pSource = PlayerSource(player1)
|
||||
val projectile = weapon.Projectile
|
||||
val resolved = ResolvedProjectile(
|
||||
ProjectileResolution.Hit,
|
||||
Projectile(projectile, weapon.Definition, weapon.FireMode, pSource, 0, Vector3.Zero, Vector3.Zero),
|
||||
val resolved = DamageInteraction(
|
||||
jMineSource,
|
||||
j_mine.DamageModel,
|
||||
ProjectileReason(
|
||||
DamageResolution.Hit,
|
||||
Projectile(projectile, weapon.Definition, weapon.FireMode, pSource, 0, Vector3.Zero, Vector3.Zero),
|
||||
j_mine.DamageModel
|
||||
),
|
||||
Vector3(1, 0, 0)
|
||||
)
|
||||
val applyDamageToJ = resolved.damage_model.Calculate(resolved)
|
||||
val applyDamageToJ = resolved.calculate()
|
||||
|
||||
"ExplosiveDeployable" should {
|
||||
"handle being jammered appropriately (no detonation)" in {
|
||||
|
|
@ -428,17 +433,18 @@ class ExplosiveDeployableJammerExplodeTest extends ActorTest {
|
|||
h_mine.Faction = PlanetSideEmpire.NC
|
||||
h_mine.Actor = system.actorOf(Props(classOf[ExplosiveDeployableControl], h_mine), "h-mine-control")
|
||||
|
||||
val hMineSource = SourceEntry(h_mine)
|
||||
val pSource = PlayerSource(player1)
|
||||
val projectile = weapon.Projectile
|
||||
val resolved = ResolvedProjectile(
|
||||
ProjectileResolution.Hit,
|
||||
Projectile(projectile, weapon.Definition, weapon.FireMode, pSource, 0, Vector3.Zero, Vector3.Zero),
|
||||
hMineSource,
|
||||
h_mine.DamageModel,
|
||||
val resolved = DamageInteraction(
|
||||
SourceEntry(h_mine),
|
||||
ProjectileReason(
|
||||
DamageResolution.Hit,
|
||||
Projectile(projectile, weapon.Definition, weapon.FireMode, pSource, 0, Vector3.Zero, Vector3.Zero),
|
||||
h_mine.DamageModel
|
||||
),
|
||||
Vector3(1, 0, 0)
|
||||
)
|
||||
val applyDamageToH = resolved.damage_model.Calculate(resolved)
|
||||
val applyDamageToH = resolved.calculate()
|
||||
|
||||
"ExplosiveDeployable" should {
|
||||
"handle being jammered appropriately (detonation)" in {
|
||||
|
|
@ -498,7 +504,7 @@ class ExplosiveDeployableJammerExplodeTest extends ActorTest {
|
|||
)
|
||||
assert(
|
||||
msg_activity match {
|
||||
case Zone.HotSpot.Activity(target, attacker, _) => (target eq hMineSource) && (attacker eq pSource)
|
||||
case Zone.HotSpot.Conflict(target, attacker, _) => (target.Definition eq h_mine.Definition) && (attacker eq pSource)
|
||||
case _ => false
|
||||
}
|
||||
)
|
||||
|
|
@ -541,14 +547,16 @@ class ExplosiveDeployableDestructionTest extends ActorTest {
|
|||
val hMineSource = SourceEntry(h_mine)
|
||||
val pSource = PlayerSource(player1)
|
||||
val projectile = weapon.Projectile
|
||||
val resolved = ResolvedProjectile(
|
||||
ProjectileResolution.Hit,
|
||||
Projectile(projectile, weapon.Definition, weapon.FireMode, pSource, 0, Vector3.Zero, Vector3.Zero),
|
||||
val resolved = DamageInteraction(
|
||||
hMineSource,
|
||||
h_mine.DamageModel,
|
||||
ProjectileReason(
|
||||
DamageResolution.Hit,
|
||||
Projectile(projectile, weapon.Definition, weapon.FireMode, pSource, 0, Vector3.Zero, Vector3.Zero),
|
||||
h_mine.DamageModel
|
||||
),
|
||||
Vector3(1, 0, 0)
|
||||
)
|
||||
val applyDamageTo = resolved.damage_model.Calculate(resolved)
|
||||
val applyDamageTo = resolved.calculate()
|
||||
|
||||
"ExplosiveDeployable" should {
|
||||
"handle being destroyed" in {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue