Kick players from mountable amenties when owner is hacked (#293)

* Re-enable base power loss when silo capacity hits 0

* PSAM documentation

* Kick players from mountable amenities (turrets, implant terminals) when owner is hacked
This commit is contained in:
Mazo 2019-12-10 13:44:16 +00:00 committed by Fate-JH
parent 9ec97f279a
commit d168c40093
3 changed files with 16 additions and 14 deletions

View file

@ -74,12 +74,7 @@ class ResourceSiloControl(resourceSilo : ResourceSilo) extends Actor with Factio
if(resourceSilo.ChargeLevel == 0 && siloChargeBeforeChange > 0) {
// Oops, someone let the base run out of power. Shut it all down.
//todo: Make base neutral if silo hits zero NTU
//todo: temporarily disabled until warpgates can bring ANTs from sanctuary, otherwise we'd be stuck in a situation with an unpowered base and no way to get an ANT to refill it.
// zone.AvatarEvents ! AvatarServiceMessage(
// zone.Id,
// AvatarAction.PlanetsideAttribute(PlanetSideGUID(building.MapId), 48, 1)
// )
zone.AvatarEvents ! AvatarServiceMessage(zone.Id, AvatarAction.PlanetsideAttribute(building.GUID, 48, 1))
} else if (siloChargeBeforeChange == 0 && resourceSilo.ChargeLevel > 0) {
// Power restored. Reactor Online. Sensors Online. Weapons Online. All systems nominal.
//todo: Check generator is online before starting up

View file

@ -60,11 +60,11 @@ import scodec.codecs._
* `20 - Control console hacking. "The FactionName has hacked into BaseName` - also sets timer on CC and yellow base warning lights on<br>
* <ul>
* <li>65535 segments per faction in deciseconds (seconds * 10)</li>
* <li>0-65535 = Neutral 0 seconds to 1h 49m 14s</li>
* <li>65536 - 131071 - TR</li>
* <li>131072 - 196607 - NC</li>
* <li>196608 - 262143 - VS</li>
* <li>17039360 - CC Resecured</li>
* <li>0-65535 = Neutral 0 seconds to 1h 49m 14s - 0x 00 00 00 00 to 0x FF FF 00 00</li>
* <li>65536 - 131071 - TR - 0x 00 00 01 00</li>
* <li>131072 - 196607 - NC - 0x 00 00 02 00</li>
* <li>196608 - 262143 - VS - 0x 00 00 03 00</li>
* <li>17039360 - CC Resecured - 0x 00 00 04 01</li>
* </ul>
* <br>These values seem to correspond to the following data structure: Time left - 2 bytes, faction - 1 byte (1-4), isResecured - 1 byte (0-1)<br>
* `24 - Learn certifications with value :`<br>

View file

@ -1624,7 +1624,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
}
else {
continent.GUID(target_guid) match {
case Some(capture_terminal: Hackable) =>
case Some(capture_terminal: Amenity with Hackable) =>
capture_terminal.HackedBy match {
case Some(Hackable.HackInfo(_, _, hfaction, _, start, length)) =>
val hack_time_remaining_ms = TimeUnit.MILLISECONDS.convert(math.max(0, start + length - System.nanoTime), TimeUnit.NANOSECONDS)
@ -1639,6 +1639,14 @@ class WorldSessionActor extends Actor with MDCContextAware {
value = start_num + deciseconds_remaining
sendResponse(PlanetsideAttributeMessage(target_guid, 20, value))
continent.GUID(player.VehicleSeated) match {
case Some(mountable: Amenity with Mountable) =>
if(mountable.Owner.GUID == capture_terminal.Owner.GUID) {
vehicleService ! VehicleServiceMessage(continent.Id, VehicleAction.KickPassenger(player.GUID, mountable.Seats.head._1, true, mountable.GUID))
}
case _ => ;
}
case _ => log.warn("LocalResponse.HackCaptureTerminal: HackedBy not defined")
}
case _ => log.warn(s"LocalResponse.HackCaptureTerminal: Couldn't find capture terminal with GUID ${target_guid} in zone ${continent.Id}")
@ -7744,8 +7752,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
sendResponse(PlanetsideAttributeMessage(amenityId, 47, if(silo.LowNtuWarningOn) 1 else 0))
if(silo.ChargeLevel == 0) {
// temporarily disabled until warpgates can bring ANTs from sanctuary, otherwise we'd be stuck in a situation with an unpowered base and no way to get an ANT to refill it.
// sendResponse(PlanetsideAttributeMessage(PlanetSideGUID(silo.Owner.asInstanceOf[Building].ModelId), 48, 1))
sendResponse(PlanetsideAttributeMessage(silo.Owner.asInstanceOf[Building].GUID, 48, 1))
}
case _ => ;
}