Added a noclip movement type to forceWalk

This commit is contained in:
ceikry
2021-07-22 11:20:52 -05:00
parent a275ea6251
commit 063f7c3fe8
+6 -1
View File
@@ -11,6 +11,7 @@ import core.game.node.`object`.SceneryBuilder
import core.game.node.entity.Entity import core.game.node.entity.Entity
import core.game.node.entity.combat.ImpactHandler import core.game.node.entity.combat.ImpactHandler
import core.game.node.entity.impl.Animator import core.game.node.entity.impl.Animator
import core.game.node.entity.impl.ForceMovement
import core.game.node.entity.impl.Projectile import core.game.node.entity.impl.Projectile
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
@@ -736,10 +737,14 @@ object ContentAPI {
* Force an entity to walk to a given destination. * Force an entity to walk to a given destination.
* @param entity the entity to forcewalk * @param entity the entity to forcewalk
* @param dest the Location object to walk to * @param dest the Location object to walk to
* @param type the type of pathfinder to use. "smart" for the SMART pathfinder, anything else for DUMB. * @param type the type of pathfinder to use. "smart" for the SMART pathfinder, "clip" for the noclip pathfinder, anything else for DUMB.
*/ */
@JvmStatic @JvmStatic
fun forceWalk(entity: Entity, dest: Location, type: String){ fun forceWalk(entity: Entity, dest: Location, type: String){
if(type == "clip"){
ForceMovement(entity, dest, 1, 1).run()
return
}
val pathfinder = when(type){ val pathfinder = when(type){
"smart" -> Pathfinder.SMART "smart" -> Pathfinder.SMART
else -> Pathfinder.DUMB else -> Pathfinder.DUMB