mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-14 16:04:41 +00:00
Additional checks to ensure players don't heal themselves immediately after dying (#289)
* Additional checks to ensure players don't heal themselves immediately after dying * Move alive check to cover other kit use * Don't use ammo on full health/armour players and change adv medical revive to take 5 seconds + 25 ammo * Fix merge conflict oopsie * Fix merge conflict oopsie. Properly this time. * Allow PlayerStateMessageUpstream to be processed even when the player is dead, to prevent corpses sliding from interpolated client side movement
This commit is contained in:
parent
cea105042c
commit
31bdf58ea4
1 changed files with 58 additions and 53 deletions
|
|
@ -3882,6 +3882,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
player.Stamina = player.Stamina + 1
|
player.Stamina = player.Stamina + 1
|
||||||
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.PlanetsideAttributeSelf(player.GUID, 2, player.Stamina))
|
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.PlanetsideAttributeSelf(player.GUID, 2, player.Stamina))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
player.Position = pos
|
player.Position = pos
|
||||||
player.Velocity = vel
|
player.Velocity = vel
|
||||||
|
|
@ -3926,11 +3927,6 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
}
|
}
|
||||||
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlayerState(avatar_guid, player.Position, player.Velocity, yaw, pitch, yaw_upper, seq_time, is_crouching, is_jumping, jump_thrust, is_cloaking, spectator, wepInHand))
|
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlayerState(avatar_guid, player.Position, player.Velocity, yaw, pitch, yaw_upper, seq_time, is_crouching, is_jumping, jump_thrust, is_cloaking, spectator, wepInHand))
|
||||||
updateSquad()
|
updateSquad()
|
||||||
}
|
|
||||||
else {
|
|
||||||
timeDL = 0
|
|
||||||
timeSurge = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
case msg @ ChildObjectStateMessage(object_guid, pitch, yaw) =>
|
case msg @ ChildObjectStateMessage(object_guid, pitch, yaw) =>
|
||||||
//the majority of the following check retrieves information to determine if we are in control of the child
|
//the majority of the following check retrieves information to determine if we are in control of the child
|
||||||
|
|
@ -4756,7 +4752,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
sendResponse(UseItemMessage(avatar_guid, item_used_guid, object_guid, unk2, unk3, unk4, unk5, unk6, unk7, unk8, itemType))
|
sendResponse(UseItemMessage(avatar_guid, item_used_guid, object_guid, unk2, unk3, unk4, unk5, unk6, unk7, unk8, itemType))
|
||||||
accessedContainer = Some(obj)
|
accessedContainer = Some(obj)
|
||||||
}
|
}
|
||||||
else if(!unk3) { //potential kit use
|
else if(!unk3 && player.isAlive) { //potential kit use
|
||||||
continent.GUID(item_used_guid) match {
|
continent.GUID(item_used_guid) match {
|
||||||
case Some(kit : Kit) =>
|
case Some(kit : Kit) =>
|
||||||
player.Find(kit) match {
|
player.Find(kit) match {
|
||||||
|
|
@ -4874,7 +4870,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
if (tool.Definition == GlobalDefinitions.bank) {
|
if (tool.Definition == GlobalDefinitions.bank) {
|
||||||
continent.GUID(object_guid) match {
|
continent.GUID(object_guid) match {
|
||||||
case Some(tplayer: Player) =>
|
case Some(tplayer: Player) =>
|
||||||
if (player.GUID != tplayer.GUID && Vector3.Distance(player.Position, tplayer.Position) < 5 && player.Faction == tplayer.Faction && player.Velocity.isEmpty && tplayer.MaxArmor > 0) {
|
if (player.GUID != tplayer.GUID && Vector3.Distance(player.Position, tplayer.Position) < 5 && player.Faction == tplayer.Faction && player.Velocity.isEmpty && tplayer.MaxArmor > 0 && tplayer.Armor < tplayer.MaxArmor) {
|
||||||
tplayer.Armor += 15
|
tplayer.Armor += 15
|
||||||
tool.Discharge
|
tool.Discharge
|
||||||
sendResponse(InventoryStateMessage(tool.AmmoSlot.Box.GUID, obj.GUID, tool.Magazine))
|
sendResponse(InventoryStateMessage(tool.AmmoSlot.Box.GUID, obj.GUID, tool.Magazine))
|
||||||
|
|
@ -4893,8 +4889,15 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
} else if (tool.Definition == GlobalDefinitions.medicalapplicator) {
|
} else if (tool.Definition == GlobalDefinitions.medicalapplicator) {
|
||||||
continent.GUID(object_guid) match {
|
continent.GUID(object_guid) match {
|
||||||
case Some(tplayer: Player) =>
|
case Some(tplayer: Player) =>
|
||||||
if (player.GUID != tplayer.GUID && Vector3.Distance(player.Position, tplayer.Position) < 5 && player.Faction == tplayer.Faction && player.Velocity.isEmpty && tplayer.MaxHealth > 0) {
|
if (player.GUID != tplayer.GUID && Vector3.Distance(player.Position, tplayer.Position) < 5 && player.Faction == tplayer.Faction && player.Velocity.isEmpty && tplayer.MaxHealth > 0 && tplayer.Health < tplayer.MaxHealth) {
|
||||||
|
if(tplayer.isAlive) {
|
||||||
tplayer.Health += 10
|
tplayer.Health += 10
|
||||||
|
} else {
|
||||||
|
// Reviving another player is normally 25 "medical energy" (ammo) and 5,000 milliseconds duration, based on the game properties revive_ammo_required and revive_time
|
||||||
|
//todo: @NotEnoughAmmoToRevive=You do not have enough medical energy to revive this corpse.
|
||||||
|
tplayer.Health += 4 // 4 health per tick = 5 second revive timer from 0 health
|
||||||
|
}
|
||||||
|
|
||||||
tool.Discharge
|
tool.Discharge
|
||||||
sendResponse(InventoryStateMessage(tool.AmmoSlot.Box.GUID, obj.GUID, tool.Magazine))
|
sendResponse(InventoryStateMessage(tool.AmmoSlot.Box.GUID, obj.GUID, tool.Magazine))
|
||||||
val repairPercent: Int = tplayer.Health * 100 / tplayer.MaxHealth
|
val repairPercent: Int = tplayer.Health * 100 / tplayer.MaxHealth
|
||||||
|
|
@ -4908,8 +4911,8 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
if(tplayer.isAlive) {
|
if(tplayer.isAlive) {
|
||||||
avatarService ! AvatarServiceMessage(tplayer.Continent, AvatarAction.PlanetsideAttributeToAll(tplayer.GUID, 0, tplayer.Health))
|
avatarService ! AvatarServiceMessage(tplayer.Continent, AvatarAction.PlanetsideAttributeToAll(tplayer.GUID, 0, tplayer.Health))
|
||||||
}
|
}
|
||||||
} else if (player.GUID == tplayer.GUID && player.Velocity.isEmpty && tplayer.MaxHealth > 0) {
|
} else if (player.GUID == tplayer.GUID && player.Velocity.isEmpty && tplayer.MaxHealth > 0 && player.isAlive) {
|
||||||
player.Health += 10
|
tplayer.Health += 10
|
||||||
tool.Discharge
|
tool.Discharge
|
||||||
sendResponse(InventoryStateMessage(tool.AmmoSlot.Box.GUID, obj.GUID, tool.Magazine))
|
sendResponse(InventoryStateMessage(tool.AmmoSlot.Box.GUID, obj.GUID, tool.Magazine))
|
||||||
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.PlanetsideAttributeToAll(player.GUID, 0, player.Health))
|
avatarService ! AvatarServiceMessage(player.Continent, AvatarAction.PlanetsideAttributeToAll(player.GUID, 0, player.Health))
|
||||||
|
|
@ -7605,6 +7608,8 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
val respawnTimer = 300000 //milliseconds
|
val respawnTimer = 300000 //milliseconds
|
||||||
tplayer.Die
|
tplayer.Die
|
||||||
deadState = DeadState.Dead
|
deadState = DeadState.Dead
|
||||||
|
timeDL = 0
|
||||||
|
timeSurge = 0
|
||||||
sendResponse(PlanetsideAttributeMessage(player_guid, 0, 0))
|
sendResponse(PlanetsideAttributeMessage(player_guid, 0, 0))
|
||||||
sendResponse(PlanetsideAttributeMessage(player_guid, 2, 0))
|
sendResponse(PlanetsideAttributeMessage(player_guid, 2, 0))
|
||||||
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(player_guid, 0, 0))
|
avatarService ! AvatarServiceMessage(continent.Id, AvatarAction.PlanetsideAttribute(player_guid, 0, 0))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue