From 68361110d9b708dc676718d5e375668755969e88 Mon Sep 17 00:00:00 2001 From: Major- Date: Tue, 28 Aug 2018 19:58:13 +0100 Subject: [PATCH] Repackage following plugin --- .../apollo/plugin/entity/following/Following.kt} | 14 ++++++-------- .../plugin/entity/following/Following.plugin.kts} | 6 ++++-- 2 files changed, 10 insertions(+), 10 deletions(-) rename game/plugin/entity/following/src/{following.kt => org/apollo/plugin/entity/following/Following.kt} (77%) rename game/plugin/entity/following/src/{following.plugin.kts => org/apollo/plugin/entity/following/Following.plugin.kts} (73%) diff --git a/game/plugin/entity/following/src/following.kt b/game/plugin/entity/following/src/org/apollo/plugin/entity/following/Following.kt similarity index 77% rename from game/plugin/entity/following/src/following.kt rename to game/plugin/entity/following/src/org/apollo/plugin/entity/following/Following.kt index e208229f..2c678c28 100644 --- a/game/plugin/entity/following/src/following.kt +++ b/game/plugin/entity/following/src/org/apollo/plugin/entity/following/Following.kt @@ -3,13 +3,12 @@ package org.apollo.plugin.entity.following import org.apollo.game.action.Action import org.apollo.game.model.Direction import org.apollo.game.model.Position -import org.apollo.game.model.entity.Mob import org.apollo.game.model.entity.Player import org.apollo.net.message.Message -import org.apollo.plugin.entity.walkto.walkBehind -import org.apollo.plugin.entity.walkto.walkTo +import org.apollo.plugin.entity.pathing.walkBehind +import org.apollo.plugin.entity.pathing.walkTo -class FollowAction(player: Player, val target: Player) : Action(0, true, player) { +class FollowAction(player: Player, private val target: Player) : Action(0, true, player) { var lastPosition: Position? = null companion object { @@ -42,11 +41,10 @@ class FollowAction(player: Player, val target: Player) : Action(0, true, val directionOffset = (Math.random() * directions.size).toInt() mob.walkTo(target.position.step(1, directions[directionOffset])) - return + } else { + mob.walkBehind(target) + lastPosition = target.position } - - mob.walkBehind(target) - lastPosition = target.position } } \ No newline at end of file diff --git a/game/plugin/entity/following/src/following.plugin.kts b/game/plugin/entity/following/src/org/apollo/plugin/entity/following/Following.plugin.kts similarity index 73% rename from game/plugin/entity/following/src/following.plugin.kts rename to game/plugin/entity/following/src/org/apollo/plugin/entity/following/Following.plugin.kts index 26e8f289..10d483ce 100644 --- a/game/plugin/entity/following/src/following.plugin.kts +++ b/game/plugin/entity/following/src/org/apollo/plugin/entity/following/Following.plugin.kts @@ -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.PlayerActionType import org.apollo.plugin.entity.following.FollowAction on_player_event { PlayerActionEvent::class } .where { action == PlayerActionType.FOLLOW } - .then { - FollowAction.start(it, target) + .then { player -> + FollowAction.start(player, target) terminate() } \ No newline at end of file