mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-20 02:54:46 +00:00
making lava no longer deadly; wait ...
This commit is contained in:
parent
6790ced5a0
commit
bed4983555
|
|
@ -10,13 +10,14 @@ import net.psforever.objects.vital.environment.EnvironmentReason
|
|||
import net.psforever.objects.vital.interaction.DamageInteraction
|
||||
import net.psforever.objects.zones.InteractsWithZone
|
||||
|
||||
import scala.annotation.unused
|
||||
import scala.concurrent.duration._
|
||||
|
||||
class WithLava()
|
||||
extends InteractionWith {
|
||||
val attribute: EnvironmentTrait = EnvironmentAttribute.Lava
|
||||
|
||||
private var stopBurn: Boolean = false
|
||||
|
||||
/**
|
||||
* Lava causes players to take (considerable) damage until they inevitably die.
|
||||
* @param obj the target
|
||||
|
|
@ -25,9 +26,11 @@ class WithLava()
|
|||
def doInteractingWith(
|
||||
obj: InteractsWithZone,
|
||||
body: PieceOfEnvironment,
|
||||
@unused data: Option[Any]
|
||||
data: Option[Any]
|
||||
): Unit = {
|
||||
if (!obj.Destroyed) {
|
||||
if (stopBurn && data.nonEmpty) {
|
||||
stopBurn = false
|
||||
} else if (!obj.Destroyed) {
|
||||
obj.Actor ! Vitality.Damage(
|
||||
DamageInteraction(
|
||||
SourceEntry(obj),
|
||||
|
|
@ -37,7 +40,12 @@ class WithLava()
|
|||
)
|
||||
obj.Actor ! AuraEffectBehavior.StartEffect(Aura.Fire, duration = 1250L) //burn
|
||||
//keep doing damage
|
||||
obj.Actor ! RespondsToZoneEnvironment.Timer(attribute, delay = 250 milliseconds, obj.Actor, interaction.InteractingWithEnvironment(body, None))
|
||||
obj.Actor ! RespondsToZoneEnvironment.Timer(attribute, delay = 250 milliseconds, obj.Actor, interaction.InteractingWithEnvironment(body, Some("burning")))
|
||||
}
|
||||
}
|
||||
|
||||
override def stopInteractingWith(obj: InteractsWithZone, body: PieceOfEnvironment, parentInfo: Option[Any]): Unit = {
|
||||
stopBurn = true
|
||||
obj.Actor ! RespondsToZoneEnvironment.StopTimer(attribute)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
package net.psforever.objects.serverobject.environment.interaction
|
||||
|
||||
import akka.actor.{Actor, ActorRef, Cancellable}
|
||||
import net.psforever.objects.Default
|
||||
import net.psforever.objects.serverobject.environment.EnvironmentTrait
|
||||
import net.psforever.objects.zones.InteractsWithZone
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ trait RespondsToZoneEnvironment {
|
|||
|
||||
case RespondsToZoneEnvironment.StopTimer(attribute) =>
|
||||
interactionTimers.get(attribute).foreach(_.cancel())
|
||||
interactionTimers.update(attribute, Default.Cancellable)
|
||||
|
||||
case InteractingWithEnvironment(body, optional) =>
|
||||
applicableInteractions
|
||||
|
|
|
|||
|
|
@ -9,13 +9,14 @@ import net.psforever.objects.vital.environment.EnvironmentReason
|
|||
import net.psforever.objects.vital.interaction.DamageInteraction
|
||||
import net.psforever.objects.zones.InteractsWithZone
|
||||
|
||||
import scala.annotation.unused
|
||||
import scala.concurrent.duration._
|
||||
|
||||
class WithLava()
|
||||
extends InteractionWith {
|
||||
val attribute: EnvironmentTrait = EnvironmentAttribute.Lava
|
||||
|
||||
private var stopBurn: Boolean = false
|
||||
|
||||
/**
|
||||
* Lava causes vehicles to take (considerable) damage until they are inevitably destroyed.
|
||||
* @param obj the target
|
||||
|
|
@ -25,9 +26,11 @@ class WithLava()
|
|||
def doInteractingWith(
|
||||
obj: InteractsWithZone,
|
||||
body: PieceOfEnvironment,
|
||||
@unused data: Option[Any]
|
||||
data: Option[Any]
|
||||
): Unit = {
|
||||
if (!obj.Destroyed) {
|
||||
if (stopBurn && data.nonEmpty) {
|
||||
stopBurn = false
|
||||
} else if (!obj.Destroyed) {
|
||||
obj.Actor ! Vitality.Damage(
|
||||
DamageInteraction(
|
||||
SourceEntry(obj),
|
||||
|
|
@ -36,7 +39,12 @@ class WithLava()
|
|||
).calculate()
|
||||
)
|
||||
//keep doing damage
|
||||
obj.Actor ! RespondsToZoneEnvironment.Timer(attribute, delay = 250 milliseconds, obj.Actor, interaction.InteractingWithEnvironment(body, None))
|
||||
obj.Actor ! RespondsToZoneEnvironment.Timer(attribute, delay = 250 milliseconds, obj.Actor, interaction.InteractingWithEnvironment(body, Some("burning")))
|
||||
}
|
||||
}
|
||||
|
||||
override def stopInteractingWith(obj: InteractsWithZone, body: PieceOfEnvironment, parentInfo: Option[Any]): Unit = {
|
||||
stopBurn = true
|
||||
obj.Actor ! RespondsToZoneEnvironment.StopTimer(attribute)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue