mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-29 07:45:26 +00:00
corrected drowning issues when inland on forseral (#1186)
This commit is contained in:
parent
23c4310258
commit
34e2ad5ea3
2 changed files with 43 additions and 9 deletions
|
|
@ -58,15 +58,36 @@ class WithWater(val channel: String)
|
||||||
data: Option[Any]
|
data: Option[Any]
|
||||||
): Unit = {
|
): Unit = {
|
||||||
val (effect, time, percentage) = Watery.recoveringFromWateryConditions(obj, condition.map(_.state), waterInteractionTime)
|
val (effect, time, percentage) = Watery.recoveringFromWateryConditions(obj, condition.map(_.state), waterInteractionTime)
|
||||||
|
if (percentage > 99f) {
|
||||||
|
recoverFromInteracting(obj)
|
||||||
|
} else {
|
||||||
|
stopInteractingAction(obj, body, data, effect, time, percentage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When out of water, the player is no longer suffocating.
|
||||||
|
* The player does have to endure a recovery period to get back to normal, though.
|
||||||
|
* @param obj the target
|
||||||
|
* @param body the environment
|
||||||
|
* @param effect na
|
||||||
|
* @param time current time until completion of the next effect
|
||||||
|
* @param percentage value to display in the drowning UI progress bar
|
||||||
|
*/
|
||||||
|
private def stopInteractingAction(
|
||||||
|
obj: InteractsWithZone,
|
||||||
|
body: PieceOfEnvironment,
|
||||||
|
data: Option[Any],
|
||||||
|
effect: Boolean,
|
||||||
|
time: Long,
|
||||||
|
percentage: Float
|
||||||
|
): Unit = {
|
||||||
val cond = OxygenStateTarget(obj.GUID, body, OxygenState.Recovery, percentage)
|
val cond = OxygenStateTarget(obj.GUID, body, OxygenState.Recovery, percentage)
|
||||||
val extra = data.collect {
|
val extra = data.collect {
|
||||||
case t: OxygenStateTarget => Some(t)
|
case t: OxygenStateTarget => Some(t)
|
||||||
case w: Watery => w.Condition
|
case w: Watery => w.Condition
|
||||||
}.flatten
|
}.flatten
|
||||||
if (percentage > 99f) {
|
if (effect) {
|
||||||
recoverFromInteracting(obj)
|
|
||||||
}
|
|
||||||
if (effect) {
|
|
||||||
condition = Some(cond)
|
condition = Some(cond)
|
||||||
waterInteractionTime = System.currentTimeMillis() + time
|
waterInteractionTime = System.currentTimeMillis() + time
|
||||||
obj.Actor ! RespondsToZoneEnvironment.Timer(attribute, delay = time milliseconds, obj.Actor, interaction.RecoveredFromEnvironmentInteraction(attribute))
|
obj.Actor ! RespondsToZoneEnvironment.Timer(attribute, delay = time milliseconds, obj.Actor, interaction.RecoveredFromEnvironmentInteraction(attribute))
|
||||||
|
|
@ -80,8 +101,9 @@ class WithWater(val channel: String)
|
||||||
|
|
||||||
override def recoverFromInteracting(obj: InteractsWithZone): Unit = {
|
override def recoverFromInteracting(obj: InteractsWithZone): Unit = {
|
||||||
super.recoverFromInteracting(obj)
|
super.recoverFromInteracting(obj)
|
||||||
if (condition.exists(info => info.state == OxygenState.Suffocation && info.progress < 99f)) {
|
if (condition.exists(_.state == OxygenState.Suffocation)) {
|
||||||
stopInteractingWith(obj, condition.map(_.body).get, None)
|
val (effect, time, percentage) = Watery.recoveringFromWateryConditions(obj, condition.map(_.state), waterInteractionTime)
|
||||||
|
stopInteractingAction(obj, condition.map(_.body).get, None, effect, time, percentage)
|
||||||
}
|
}
|
||||||
waterInteractionTime = 0L
|
waterInteractionTime = 0L
|
||||||
condition = None
|
condition = None
|
||||||
|
|
|
||||||
|
|
@ -140,20 +140,32 @@ case object MapInfo extends StringEnum[MapInfo] {
|
||||||
scale = MapScale.Dim8192,
|
scale = MapScale.Dim8192,
|
||||||
hotSpotSpan = 80,
|
hotSpotSpan = 80,
|
||||||
environment = List(
|
environment = List(
|
||||||
SeaLevel(EnvironmentAttribute.Water, 35.015625f),
|
//ocean
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 8192f, 2648f, 0f, 0f), //west
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 8192f, 6093f, 5968f, 2648f), //north
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 8192f, 8192f, 0f, 6093f), //east
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 1709f, 6093f, 0f, 2648f), //south
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 5968f, 4465f, 5130f, 2648f), //northwest
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 5968f, 6093f, 5415f, 5088f), //northeast
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 2515f, 3356f, 1709f, 2648f), //southwest
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 3136f, 6093f, 1709f, 5516f), //southeast
|
||||||
|
//lakes and ponds
|
||||||
Pool(EnvironmentAttribute.Water, 51.875f, 4571.8125f, 3015.5547f, 4455.8047f, 2852.711f), //down the road, west of bel
|
Pool(EnvironmentAttribute.Water, 51.875f, 4571.8125f, 3015.5547f, 4455.8047f, 2852.711f), //down the road, west of bel
|
||||||
Pool(EnvironmentAttribute.Water, 49.8125f, 4902.336f, 3413.461f, 4754.0938f, 3210.8125f), //west of bel
|
Pool(EnvironmentAttribute.Water, 49.8125f, 4902.336f, 3413.461f, 4754.0938f, 3210.8125f), //west of bel
|
||||||
Pool(EnvironmentAttribute.Water, 49.515625f, 4044.3984f, 4700.8516f, 3999.9688f, 4517.375f), //southeast of neit
|
Pool(EnvironmentAttribute.Water, 49.515625f, 4044.3984f, 4700.8516f, 3999.9688f, 4517.375f), //southeast of neit
|
||||||
Pool(EnvironmentAttribute.Water, 48.515625f, 4553.75f, 4110.2188f, 4438.6875f, 3995.3125f), //northwest of neit
|
Pool(EnvironmentAttribute.Water, 48.515625f, 4553.75f, 4110.2188f, 4438.6875f, 3995.3125f), //northwest of neit
|
||||||
Pool(EnvironmentAttribute.Water, 48.28125f, 4474.3906f, 4551.2812f, 4339.3984f, 4472.4375f), //northeast of neit
|
Pool(EnvironmentAttribute.Water, 48.28125f, 4474.3906f, 4551.2812f, 4339.3984f, 4472.4375f), //northeast of neit
|
||||||
Pool(EnvironmentAttribute.Water, 45.828125f, 3808.0547f, 3901.3828f, 1432.5625f, 3720.9844f), //J17
|
Pool(EnvironmentAttribute.Water, 45.828125f, 1669f, 3903f, 1432.5625f, 3720.9844f), //J17
|
||||||
Pool(EnvironmentAttribute.Water, 43.765625f, 3997.2812f, 3991.539f, 3937.8906f, 3937.875f), //southwest of neit
|
Pool(EnvironmentAttribute.Water, 43.765625f, 3997.2812f, 3991.539f, 3937.8906f, 3937.875f), //southwest of neit
|
||||||
Pool(EnvironmentAttribute.Water, 43.671875f, 2694.2031f, 3079.875f, 2552.414f, 2898.8203f), //west of anu
|
Pool(EnvironmentAttribute.Water, 43.671875f, 2694.2031f, 3079.875f, 2552.414f, 2898.8203f), //west of anu
|
||||||
|
Pool(EnvironmentAttribute.Water, 43.470588f, 4910f, 6106f, 4843f, 6006f), //south of lugh
|
||||||
Pool(EnvironmentAttribute.Water, 42.671875f, 5174.4844f, 5930.133f, 4981.4297f, 5812.383f), //west of lugh
|
Pool(EnvironmentAttribute.Water, 42.671875f, 5174.4844f, 5930.133f, 4981.4297f, 5812.383f), //west of lugh
|
||||||
Pool(EnvironmentAttribute.Water, 42.203125f, 4935.742f, 5716.086f, 4711.289f, 5444.5625f), //across road, west of lugh
|
Pool(EnvironmentAttribute.Water, 42.203125f, 4935.742f, 5716.086f, 4711.289f, 5444.5625f), //across road, west of lugh
|
||||||
Pool(EnvironmentAttribute.Water, 41.765625f, 2073.914f, 4982.5938f, 1995.4688f, 4899.086f), //L15-M16
|
Pool(EnvironmentAttribute.Water, 41.765625f, 2073.914f, 4982.5938f, 1995.4688f, 4899.086f), //L15-M16
|
||||||
Pool(EnvironmentAttribute.Water, 41.3125f, 3761.1484f, 2616.75f, 3627.4297f, 2505.1328f), //G11, south
|
Pool(EnvironmentAttribute.Water, 41.3125f, 3761.1484f, 2616.75f, 3627.4297f, 2505.1328f), //G11, south
|
||||||
Pool(EnvironmentAttribute.Water, 40.421875f, 4058.8281f, 2791.6562f, 3985.1016f, 2685.3672f) //G11, north
|
Pool(EnvironmentAttribute.Water, 40.421875f, 4058.8281f, 2791.6562f, 3985.1016f, 2685.3672f), //G11, north
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 2932f, 3367f, 2816f, 3234f), //north of anu
|
||||||
|
Pool(EnvironmentAttribute.Water, 35.015625f, 2564f, 4518f, 1972f, 3770f) //between anu and caer
|
||||||
) ++ MapEnvironment.zoneMapEdgeKillPlane(
|
) ++ MapEnvironment.zoneMapEdgeKillPlane(
|
||||||
MapScale.Dim8192,
|
MapScale.Dim8192,
|
||||||
(400, 10, 200, 400),
|
(400, 10, 200, 400),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue