mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
deploy if same faction
This commit is contained in:
parent
7cb72a8ad5
commit
9346a4a0c8
|
|
@ -758,7 +758,8 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
||||||
val deployables = player.avatar.deployables
|
val deployables = player.avatar.deployables
|
||||||
if (deployables.Valid(obj) &&
|
if (deployables.Valid(obj) &&
|
||||||
!deployables.Contains(obj) &&
|
!deployables.Contains(obj) &&
|
||||||
Players.deployableWithinBuildLimits(player, obj)) {
|
Players.deployableWithinBuildLimits(player, obj) &&
|
||||||
|
routerFactionSame(obj)) {
|
||||||
//deployables, upon construction, may display an animation effect
|
//deployables, upon construction, may display an animation effect
|
||||||
tool.Definition match {
|
tool.Definition match {
|
||||||
case GlobalDefinitions.router_telepad => () /* no special animation */
|
case GlobalDefinitions.router_telepad => () /* no special animation */
|
||||||
|
|
@ -804,6 +805,29 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Prevent a player from deploying a telepad that belongs to a Router of a different faction
|
||||||
|
*/
|
||||||
|
private def routerFactionSame(obj: Deployable): Boolean = {
|
||||||
|
obj match {
|
||||||
|
case tp: TelepadDeployable =>
|
||||||
|
val zone = player.Zone
|
||||||
|
tp.Router match {
|
||||||
|
case Some(routerGuid) =>
|
||||||
|
zone.Vehicles.find(_.GUID == routerGuid) match {
|
||||||
|
case Some(router) =>
|
||||||
|
router.Faction == player.Faction
|
||||||
|
case None =>
|
||||||
|
false
|
||||||
|
}
|
||||||
|
case None =>
|
||||||
|
false
|
||||||
|
}
|
||||||
|
case _ =>
|
||||||
|
true //not a telepad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override protected def PerformDamage(
|
override protected def PerformDamage(
|
||||||
target: Target,
|
target: Target,
|
||||||
applyDamageTo: Output
|
applyDamageTo: Output
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue