Repackage following plugin

This commit is contained in:
Major-
2018-08-28 19:58:13 +01:00
parent abc4dc3a76
commit 68361110d9
2 changed files with 10 additions and 10 deletions
@@ -3,13 +3,12 @@ package org.apollo.plugin.entity.following
import org.apollo.game.action.Action import org.apollo.game.action.Action
import org.apollo.game.model.Direction import org.apollo.game.model.Direction
import org.apollo.game.model.Position import org.apollo.game.model.Position
import org.apollo.game.model.entity.Mob
import org.apollo.game.model.entity.Player import org.apollo.game.model.entity.Player
import org.apollo.net.message.Message import org.apollo.net.message.Message
import org.apollo.plugin.entity.walkto.walkBehind import org.apollo.plugin.entity.pathing.walkBehind
import org.apollo.plugin.entity.walkto.walkTo import org.apollo.plugin.entity.pathing.walkTo
class FollowAction(player: Player, val target: Player) : Action<Player>(0, true, player) { class FollowAction(player: Player, private val target: Player) : Action<Player>(0, true, player) {
var lastPosition: Position? = null var lastPosition: Position? = null
companion object { companion object {
@@ -42,11 +41,10 @@ class FollowAction(player: Player, val target: Player) : Action<Player>(0, true,
val directionOffset = (Math.random() * directions.size).toInt() val directionOffset = (Math.random() * directions.size).toInt()
mob.walkTo(target.position.step(1, directions[directionOffset])) mob.walkTo(target.position.step(1, directions[directionOffset]))
return } else {
mob.walkBehind(target)
lastPosition = target.position
} }
mob.walkBehind(target)
lastPosition = target.position
} }
} }
@@ -1,10 +1,12 @@
package org.apollo.plugin.entity.following
import org.apollo.game.plugin.entity.actions.PlayerActionEvent import org.apollo.game.plugin.entity.actions.PlayerActionEvent
import org.apollo.game.plugin.entity.actions.PlayerActionType import org.apollo.game.plugin.entity.actions.PlayerActionType
import org.apollo.plugin.entity.following.FollowAction import org.apollo.plugin.entity.following.FollowAction
on_player_event { PlayerActionEvent::class } on_player_event { PlayerActionEvent::class }
.where { action == PlayerActionType.FOLLOW } .where { action == PlayerActionType.FOLLOW }
.then { .then { player ->
FollowAction.start(it, target) FollowAction.start(player, target)
terminate() terminate()
} }