#Jurgy's fake character pathfinding

1 messages · Page 1 of 1 (latest)

light stag
#

i am very curious to that pathfinding code as-is, never really dove into the depths of how transport drones does it, but having access to a mod at this barebones stage might be helpful learning material 👀

dry coyote
#

It uses the built-in pathfinding

#
    the_worker.set_command {
        type = defines.command.go_to_location,
        destination = position,
        radius = 1,
        distraction= defines.distraction.none,
        pathfind_flags = {prefer_straight_paths = true, use_cache = true, allow_paths_through_own_entities = true}
    }
#

And the worker's collision_mask is set such that it collides with almost everything except with the tiles he's walking on

#
local worker_mask =
{
  "ground-tile",
  "water-tile",
  "resource-layer",
  "doodad-layer",
  "floor-layer",
  "item-layer",
  "ghost-layer",
  "object-layer",
  --"player-layer",
  --"train-layer",
  "rail-layer",
  "transport-belt-layer"
}
raven osprey
#

I like how you can tell it's still a unit cause it moves exactly like a biter lol

dry coyote
#

yeah, I wish I could tell it to overshoot less

raven osprey
#

you can probably set the movement speed to be a little lower

#

you can also call the pathfinder directly and set the character's walking state to get to the next node, but that's way more complicated

dry coyote
#

Can you point me in the right direction for that?