don't disband when sl leaves, pause weather

This commit is contained in:
ScrawnyRonnie 2025-10-06 12:40:56 -04:00
parent d5db167c35
commit d5471e28de
2 changed files with 52 additions and 10 deletions

View file

@ -2535,7 +2535,7 @@ class ZoningOperations(
if (player.outfit_id == 0) { if (player.outfit_id == 0) {
SessionOutfitHandlers.HandleLoginOutfitCheck(player, sessionLogic) SessionOutfitHandlers.HandleLoginOutfitCheck(player, sessionLogic)
} }
//make weather happen /*make weather happen
sendResponse(WeatherMessage(List(),List( sendResponse(WeatherMessage(List(),List(
StormInfo(Vector3(0.1f, 0.15f, 0.0f), 240, 217), StormInfo(Vector3(0.1f, 0.15f, 0.0f), 240, 217),
StormInfo(Vector3(0.5f, 0.11f, 0.0f), 240, 215), StormInfo(Vector3(0.5f, 0.11f, 0.0f), 240, 215),
@ -2547,7 +2547,7 @@ class ZoningOperations(
StormInfo(Vector3(0.9f, 0.57f, 0.0f), 244, 215), StormInfo(Vector3(0.9f, 0.57f, 0.0f), 244, 215),
StormInfo(Vector3(0.9f, 0.9f, 0.0f), 243, 215), StormInfo(Vector3(0.9f, 0.9f, 0.0f), 243, 215),
StormInfo(Vector3(0.1f, 0.2f, 0.0f), 241, 215), StormInfo(Vector3(0.1f, 0.2f, 0.0f), 241, 215),
StormInfo(Vector3(0.95f, 0.2f, 0.0f), 241, 215)))) StormInfo(Vector3(0.95f, 0.2f, 0.0f), 241, 215))))*/
//begin looking for conditions to set the avatar //begin looking for conditions to set the avatar
context.system.scheduler.scheduleOnce(delay = 250 millisecond, context.self, SessionActor.SetCurrentAvatar(player, 200)) context.system.scheduler.scheduleOnce(delay = 250 millisecond, context.self, SessionActor.SetCurrentAvatar(player, 200))
} }
@ -2659,7 +2659,7 @@ class ZoningOperations(
} }
setupAvatarFunc = AvatarCreate setupAvatarFunc = AvatarCreate
SessionOutfitHandlers.HandleLoginOutfitCheck(player, sessionLogic) SessionOutfitHandlers.HandleLoginOutfitCheck(player, sessionLogic)
//make weather happen /*make weather happen
sendResponse(WeatherMessage(List(),List( sendResponse(WeatherMessage(List(),List(
StormInfo(Vector3(0.1f, 0.15f, 0.0f), 240, 217), StormInfo(Vector3(0.1f, 0.15f, 0.0f), 240, 217),
StormInfo(Vector3(0.5f, 0.11f, 0.0f), 240, 215), StormInfo(Vector3(0.5f, 0.11f, 0.0f), 240, 215),
@ -2671,7 +2671,7 @@ class ZoningOperations(
StormInfo(Vector3(0.9f, 0.57f, 0.0f), 244, 215), StormInfo(Vector3(0.9f, 0.57f, 0.0f), 244, 215),
StormInfo(Vector3(0.9f, 0.9f, 0.0f), 243, 215), StormInfo(Vector3(0.9f, 0.9f, 0.0f), 243, 215),
StormInfo(Vector3(0.1f, 0.2f, 0.0f), 241, 215), StormInfo(Vector3(0.1f, 0.2f, 0.0f), 241, 215),
StormInfo(Vector3(0.95f, 0.2f, 0.0f), 241, 215)))) StormInfo(Vector3(0.95f, 0.2f, 0.0f), 241, 215))))*/
//begin looking for conditions to set the avatar //begin looking for conditions to set the avatar
context.system.scheduler.scheduleOnce(delay = 750 millisecond, context.self, SessionActor.SetCurrentAvatar(player, 200)) context.system.scheduler.scheduleOnce(delay = 750 millisecond, context.self, SessionActor.SetCurrentAvatar(player, 200))
} }

View file

@ -8,7 +8,7 @@ import scala.collection.concurrent.TrieMap
import scala.collection.mutable import scala.collection.mutable
// //
import net.psforever.actors.session.SessionActor import net.psforever.actors.session.SessionActor
import net.psforever.objects.{LivePlayerList, Player} import net.psforever.objects.{Default, LivePlayerList, Player}
import net.psforever.objects.teamwork.{Member, Squad, SquadFeatures} import net.psforever.objects.teamwork.{Member, Squad, SquadFeatures}
import net.psforever.objects.avatar.{Avatar, Certification} import net.psforever.objects.avatar.{Avatar, Certification}
import net.psforever.objects.definition.converter.StatConverter import net.psforever.objects.definition.converter.StatConverter
@ -591,10 +591,32 @@ class SquadService extends Actor {
.collect { case leavingPlayer .collect { case leavingPlayer
if GetParticipatingSquad(leavingPlayer).contains(features) => //kicked player must be in the same squad if GetParticipatingSquad(leavingPlayer).contains(features) => //kicked player must be in the same squad
if (actingPlayer == leader) { if (actingPlayer == leader) {
if (leavingPlayer == leader || squad.Size == 2) { if (squad.Size == 2) {
//squad leader is leaving his own squad, so it will be disbanded //squad is only composed of two people, so it will be closed-out when one of them leaves
//OR squad is only composed of two people, so it will be closed-out when one of them leaves
DisbandSquad(features) DisbandSquad(features)
} else if (leavingPlayer == leader) {
//squad leader leaves; promote another member
squad.Membership.drop(1).find { _.CharId > 0 } match {
case Some(member) =>
//leader was shifted into a subordinate position and will retire from duty
SquadActionMembershipPromote(
leavingPlayer,
member.CharId,
features,
SquadServiceMessage(null, null, SquadAction.Membership(SquadRequestType.Promote, leavingPlayer, Some(member.CharId), member.Name, None)),
Default.Actor
)
import scala.concurrent.duration._
import context.dispatcher
context.system.scheduler.scheduleOnce(500.milliseconds) {
GetParticipatingSquad(leavingPlayer).foreach { updatedFeatures =>
LeaveSquad(leavingPlayer, updatedFeatures)
}
}
case _ =>
//the squad will be disbanded
DisbandSquad(features)
}
} else { } else {
//kicked by the squad leader //kicked by the squad leader
subs.Publish( subs.Publish(
@ -1093,8 +1115,28 @@ class SquadService extends Actor {
if (size > 2) { if (size > 2) {
GetLeadingSquad(charId, pSquadOpt) match { GetLeadingSquad(charId, pSquadOpt) match {
case Some(_) => case Some(_) =>
//leader of a squad; the squad will be disbanded. Same logic as when a SL uses /leave and the squad is disbanded. //leader of a squad; search for a suitable substitute leader
DisbandSquad(features) squad.Membership.drop(1).find { _.CharId > 0 } match {
case Some(member) =>
//leader was shifted into a subordinate position and will retire from duty
SquadActionMembershipPromote(
charId,
member.CharId,
features,
SquadServiceMessage(null, null, SquadAction.Membership(SquadRequestType.Promote, charId, Some(member.CharId), member.Name, None)),
Default.Actor
)
import scala.concurrent.duration._
import context.dispatcher
context.system.scheduler.scheduleOnce(500.milliseconds) {
GetParticipatingSquad(charId).foreach { updatedFeatures =>
LeaveSquad(charId, updatedFeatures)
}
}
case _ =>
//the squad will be disbanded
DisbandSquad(features)
}
case None => case None =>
//not the leader of a full squad; tell other members that we are leaving //not the leader of a full squad; tell other members that we are leaving
SquadSwitchboard.PanicLeaveSquad( SquadSwitchboard.PanicLeaveSquad(