Complete migration of footpath management out of this mod
parent
642cc58348
commit
8dff43a47c
33
README.md
33
README.md
|
@ -384,9 +384,6 @@ Track the given person (location and distance away) on the HUD.
|
|||
|
||||
Use without a parameter to switch it off.
|
||||
|
||||
### /people footpath_update
|
||||
Update the footpath network.
|
||||
|
||||
## Autonomy and Activation
|
||||
|
||||
People are 'autonomous' - i.e. they will continue to act even when no player
|
||||
|
@ -416,35 +413,19 @@ Ultimately it won't use this 'feature' at all.
|
|||
## Footpaths and Navigation
|
||||
|
||||
People (in particular via the 'go' action) have an in-built understanding of
|
||||
footpaths, which are laid out across the map by players, usually using cobble
|
||||
and cobble steps (but wood can also be used, e.g. for bridges). In addition,
|
||||
special areas (via the areas mod) are used to 'mark up' routes along these
|
||||
footpaths. This provides people with the ability to do sensible long-range
|
||||
navigation as a player would.
|
||||
|
||||
Path junctions are marked up by creating a 1x1x1 area above the junction
|
||||
node. They are always named `path_xxxxx`, where `xxxxx` is the unique name for
|
||||
that junction - e.g. `path_My House`.
|
||||
footpaths, which are managed via the footpath mod. This provides people with
|
||||
the ability to do sensible long-range navigation as a player would.
|
||||
|
||||
When following a footpath, preference will always be given to the direction
|
||||
currently being travelled in. The means that, for example, a cobblestone
|
||||
footpath can cross a larger area 'paved' with cobblestone (or other footpath
|
||||
materials), so long as the crossing is in a straight line.
|
||||
|
||||
Additionally, above each node leading away from the junction, a 1x1x1 area
|
||||
with the name `to_xxxxx` is used. In this case, `xxxxx` is the name of the
|
||||
path node this direction leads to - e.g. `to_Your House`.
|
||||
|
||||
Changes to the footpath network only take effect when the `/people footpath_update`
|
||||
command is used. At this point, if anything is wrong with the network, this
|
||||
will be indicated, and the previous network will remain in effect. The current
|
||||
network is saved across server restarts.
|
||||
|
||||
If you tell a person to go to a named place (e.g. {"go", name="My House"}) they
|
||||
will first look for `path_My House`, and then also find the nearest path
|
||||
junction to where they are now. They will then navigate along the path network
|
||||
from one to the other.
|
||||
will first look for a footpath junction with that name, and then also find the
|
||||
nearest junction to where they are now. They will then navigate along the path
|
||||
network from one to the other.
|
||||
|
||||
If there is no `path_My House` they will also look for just `My House`, and if
|
||||
that's found, head directly for the centre of that area.
|
||||
If there is no footpath junction with that name, they'll also look for an area
|
||||
(areas mod) and head directly for the centre of that area.
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ people.actions.go = function(state)
|
|||
|
||||
-- Look for a footpath node with the right name
|
||||
if footpath then
|
||||
local pathdestpos = footpath.get_nodepos("path_"..state.action.name)
|
||||
local pathdestpos = footpath.get_nodepos(state.action.name)
|
||||
if pathdestpos then
|
||||
|
||||
dbg.v2(state.ent.name.." selected path destination path_"..state.action.name)
|
||||
dbg.v2(state.ent.name.." selected path destination "..state.action.name)
|
||||
|
||||
-- Find the nearest footpath junction to us. We'll head to that
|
||||
-- first (as a pos) and then follow the footpath network from
|
||||
|
@ -40,7 +40,7 @@ people.actions.go = function(state)
|
|||
dbg.v2(state.ent.name.." selected path start "..pathstartnode.name.." at "..minetest.pos_to_string(pathstartnode.pos))
|
||||
state.action.pos = vector.new(pathstartnode.pos)
|
||||
state.action.pos.y = state.action.pos.y + ANTP
|
||||
state.action.footpathdest = "path_"..state.action.name
|
||||
state.action.footpathdest = state.action.name
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
@ -88,7 +88,7 @@ people.actions.go = function(state)
|
|||
-- We're at a junction
|
||||
dbg.v2(state.ent.name.." is at footpath junction "..curpathnode.name.." - looking for route to "..state.action.name)
|
||||
state.action.lastpathpos = vector.new(state.pos.x, state.pos.y - PNTP, state.pos.z)
|
||||
local nextpathdest = footpath.get_route(curpathnode.name, "path_"..state.action.name)
|
||||
local nextpathdest = footpath.get_route(curpathnode.name, state.action.name)
|
||||
if not nextpathdest then
|
||||
dbg.v1(state.ent.name.." can't find route")
|
||||
return true, false
|
||||
|
|
18
commands.lua
18
commands.lua
|
@ -55,24 +55,6 @@ subcmd.help = {
|
|||
end
|
||||
}
|
||||
|
||||
subcmd.footpath_update = {
|
||||
params = "",
|
||||
desc = "Update footpath node graph",
|
||||
exec = function(playername, args)
|
||||
|
||||
if not minetest.check_player_privs(playername, {server=true}) then
|
||||
return false, "Only admins can update the footpath node graph"
|
||||
end
|
||||
|
||||
response = footpath.make_pathnodes()
|
||||
if response then
|
||||
return false, response
|
||||
end
|
||||
return true, "Footpath node graph updated successfully"
|
||||
|
||||
end
|
||||
}
|
||||
|
||||
subcmd.create = {
|
||||
params = "<name>",
|
||||
desc = "Create a person with the given name at your current location",
|
||||
|
|
Loading…
Reference in New Issue