Jire / Abendigo

A free as in both freedom and free beer game modding platform using Kotlin on the JVM.
GNU General Public License v3.0
57 stars 56 forks source link

BoneTriggerPlugin multiple targets #88

Open JonEhh42 opened 8 years ago

JonEhh42 commented 8 years ago

Is there a way to get the BoneTriggerPlugin to support multiple targets? Example -

val TARGET_BONE = Bones.HEAD

val TARGET_BONE = arrayOf(Bones.HEAD, Bones.NECK, Bones.UPPER_CHEST, Bones.LOWER_CHEST)
Jire commented 8 years ago
val TARGET_BONES = arrayOf(Bones.HEAD, Bones.NECK, Bones.UPPER_CHEST, Bones.LOWER_CHEST)

And surround lines 34-45 with for (targetBone in TARGET_BONES) { and end with }. Then replace val ePos = e.bonePosition(TARGET_BONE.id) with val ePos = e.bonePosition(targetBone.id)

Overall it should end up looking like this:

        for (targetBone in TARGET_BONES) {
            val ePos = e.bonePosition(targetBone.id)
            val distance = distance(myPosition, ePos)

            calculateAngle(Me(), myPosition, ePos, aim.reset())
            normalizeAngle(aim)

            val pitchDiff = abs(angle.x - aim.x)
            val yawDiff = abs(angle.y - aim.y)
            val diff = sin(toRadians(pitchDiff.toDouble())) + sin(toRadians(yawDiff.toDouble()))
            val delta = abs(diff * distance)

            if (delta <= FOV && delta < closestDelta) closestDelta = delta.toInt()
        }
JonEhh42 commented 8 years ago

It still does not shoot feet or legs. Please advise.

http://pastebin.com/raw/xwpyQmCy

bradylangdale commented 8 years ago

@jonfatino Its because they're not included in the array of bones use val TARGET_BONES = arrayOf(Bones.HEAD, Bones.NECK, Bones.UPPER_CHEST, Bones.LOWER_CHEST, Bones.LEGS, Bones.FEET)