mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-14 16:04:41 +00:00
Cancel jacking if a vehicle is moving (#290)
* Add Medical / Adv Medical / Expert Electronics to default certs * Cancel jacking when object is moving more than a small amount
This commit is contained in:
parent
31bdf58ea4
commit
9e99dc75e3
2 changed files with 31 additions and 16 deletions
|
|
@ -21,7 +21,7 @@ object HackState extends Enumeration {
|
||||||
val
|
val
|
||||||
Unknown0,
|
Unknown0,
|
||||||
Start,
|
Start,
|
||||||
Unknown2,
|
Cancelled,
|
||||||
Ongoing,
|
Ongoing,
|
||||||
Finished,
|
Finished,
|
||||||
Unknown5,
|
Unknown5,
|
||||||
|
|
|
||||||
|
|
@ -3186,22 +3186,34 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
def HandleHackingProgress(progressType : Int, tplayer : Player, target : PlanetSideServerObject, tool_guid : PlanetSideGUID, delta : Float, completeAction : ()=>Unit, tickAction : Option[()=>Unit]) : Unit = {
|
def HandleHackingProgress(progressType : Int, tplayer : Player, target : PlanetSideServerObject, tool_guid : PlanetSideGUID, delta : Float, completeAction : ()=>Unit, tickAction : Option[()=>Unit]) : Unit = {
|
||||||
progressBarUpdate.cancel
|
progressBarUpdate.cancel
|
||||||
if(progressBarValue.isDefined) {
|
if(progressBarValue.isDefined) {
|
||||||
val progressBarVal : Float = progressBarValue.get + delta
|
val progressBarVal : Float = if (progressBarValue.get + delta > 100) { 100f } else { progressBarValue.get + delta }
|
||||||
|
|
||||||
val vis = if(progressBarVal == 0L) {
|
val vis = if(progressBarVal == 0L) {
|
||||||
//hack state for progress bar visibility
|
//hack state for progress bar visibility
|
||||||
HackState.Start
|
HackState.Start
|
||||||
}
|
}
|
||||||
else if(progressBarVal > 100L) {
|
else if(progressBarVal >= 100L) {
|
||||||
HackState.Finished
|
HackState.Finished
|
||||||
}
|
}
|
||||||
|
else if(target.Velocity.isDefined && Vector3.Distance(Vector3.Zero, target.Velocity.get) > 1f) {
|
||||||
|
// If the object is moving (more than slightly to account for things like magriders rotating, or the last velocity reported being the magrider dipping down on dismount) then cancel the hack
|
||||||
|
HackState.Cancelled
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
HackState.Ongoing
|
HackState.Ongoing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(vis == HackState.Cancelled) {
|
||||||
|
// Object moved. Cancel the hack (e.g. vehicle drove away)
|
||||||
|
sendResponse(HackMessage(progressType, target.GUID, player.GUID, 0, 0L, vis, 8L))
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sendResponse(HackMessage(progressType, target.GUID, player.GUID, progressBarVal.toInt, 0L, vis, 8L))
|
sendResponse(HackMessage(progressType, target.GUID, player.GUID, progressBarVal.toInt, 0L, vis, 8L))
|
||||||
if(progressBarVal > 100) {
|
|
||||||
|
if(progressBarVal >= 100) {
|
||||||
//done
|
//done
|
||||||
progressBarValue = None
|
progressBarValue = None
|
||||||
// sendResponse(HackMessage(0, target.GUID, player.GUID, 100, 1114636288L, HackState.Hacked, 8L))
|
|
||||||
completeAction()
|
completeAction()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -3213,6 +3225,7 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* na
|
* na
|
||||||
|
|
@ -3452,7 +3465,6 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
avatar.Certifications += ReinforcedExoSuit
|
avatar.Certifications += ReinforcedExoSuit
|
||||||
avatar.Certifications += ATV
|
avatar.Certifications += ATV
|
||||||
avatar.Certifications += Harasser
|
avatar.Certifications += Harasser
|
||||||
//
|
|
||||||
avatar.Certifications += InfiltrationSuit
|
avatar.Certifications += InfiltrationSuit
|
||||||
avatar.Certifications += Sniping
|
avatar.Certifications += Sniping
|
||||||
avatar.Certifications += AntiVehicular
|
avatar.Certifications += AntiVehicular
|
||||||
|
|
@ -3479,6 +3491,9 @@ class WorldSessionActor extends Actor with MDCContextAware {
|
||||||
avatar.Certifications += AssaultEngineering
|
avatar.Certifications += AssaultEngineering
|
||||||
avatar.Certifications += Hacking
|
avatar.Certifications += Hacking
|
||||||
avatar.Certifications += AdvancedHacking
|
avatar.Certifications += AdvancedHacking
|
||||||
|
avatar.Certifications += ElectronicsExpert
|
||||||
|
avatar.Certifications += Medical
|
||||||
|
avatar.Certifications += AdvancedMedical
|
||||||
avatar.CEP = 6000001
|
avatar.CEP = 6000001
|
||||||
this.avatar = avatar
|
this.avatar = avatar
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue