Merge pull request #1348 from ScrawnyRonnie/telepad
Some checks failed
Publish Docs / docs (push) Has been cancelled
Publish Docker Image / docker (push) Has been cancelled
Test / test (push) Has been cancelled

Telepad Deployment
This commit is contained in:
Dethdeath 2026-01-09 19:12:03 +01:00 committed by GitHub
commit 07336c894f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -758,7 +758,8 @@ class PlayerControl(player: Player, avatarActor: typed.ActorRef[AvatarActor.Comm
val deployables = player.avatar.deployables
if (deployables.Valid(obj) &&
!deployables.Contains(obj) &&
Players.deployableWithinBuildLimits(player, obj)) {
Players.deployableWithinBuildLimits(player, obj) &&
routerFactionSame(obj)) {
//deployables, upon construction, may display an animation effect
tool.Definition match {
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(
target: Target,
applyDamageTo: Output