Skip to content

Commit

Permalink
Rewrote is_behind_Victim
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Oct 19, 2023
1 parent 68095c2 commit 18391a6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.willfp.libreforge.filters.impl
import com.willfp.eco.core.config.interfaces.Config
import com.willfp.libreforge.NoCompileData
import com.willfp.libreforge.angle
import com.willfp.libreforge.dot
import com.willfp.libreforge.filters.Filter
import com.willfp.libreforge.toFloat3
import com.willfp.libreforge.triggers.TriggerData
Expand All @@ -21,8 +22,7 @@ object FilterIsBehindVictim : Filter<NoCompileData, Boolean>("is_behind_victim")
val playerVector = player.location.direction.toFloat3().xz
val victimVector = victim.location.direction.toFloat3().xz

val angle = Math.toDegrees(playerVector.angle(victimVector).toDouble()).roundToInt()
val isBehind = angle in (-32..60) // Old code from Backstab from EE v8
val isBehind = playerVector.dot(victimVector) < 0
return isBehind == value
}
}

0 comments on commit 18391a6

Please sign in to comment.