[mod] Footprints and trails [0.4] [footprints]

Post Reply
FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

[mod] Footprints and trails [0.4] [footprints]

by FaceDeer » Post

Image

This mod makes soil and soil-like nodes capable of holding temporary "footprint" impressions, and if they're walked on repeatedly turning into hard-packed trails.

It also allows players to flatten plants by walking on them.

It includes definitions for footprint-capable nodes in the "default" mod, and has an API for allowing nodes in other mods to use the same system.

API

New trampled nodes can be registered with this API:

Code: Select all

footprints.register_trample_node(trampleable_node_name, trample_def)

trample_def:
{
	trampled_node_name = , -- If this is not defined it defaults to the
	                       -- trampleable node name with "_trampled" appended.
	trampled_node_def_override = {}, -- If trampled_node_name doesn't exist a new
	                       -- node will be registered based on the definition of
	                       -- trampleable_node_name. Any properties in this table
	                       -- will be used to override properties ignored if
	                       -- trampled_node_name is a node that already exists.
	probability = 1, -- chance that stepping on this node will cause it to turn
                           -- into the trampled version (range is 0.0 to 1.0)
	trample_count = 1, -- The number of times this node needs to be stepped on
                           -- (and pass the probability check) to transition to
                           -- the trampled state
	randomize_trampled_param2 = nil, -- if true, sets param2 of trampled node to math.random(0,3)
                           -- This is used for trampled wheat, for example, to randomize the thatch's
						   -- direction.
	erodes = true,         -- sets the trampled node to erode back into the non-trampled
                           -- version over time, if erosion is enabled in this mod's settings.
                           -- Ignored if trampled_node_name is a node that already
                           -- exists, since that may already have an erosion target established.
	add_footprint_overlay = true, -- Applies the footprint texture over the +Y tile of the
                           -- trampleable node. ignored if trampled_node_name is a node that already exists
	footprint_overlay_texture = "footprints_footprint.png",
	footprint_opacity = 64, -- defaults to 64 (0 is transparent, 255 is fully opaque)
	hard_pack_node_name = nil, -- If the trampled node is walked on again this is the
                           -- node that it can get further packed down into. ignored if
                           -- trampled_node_name is a node that already exists, since
                           -- it's expected this has already been established
	hard_pack_probability = 0.9, -- The probability that walking on a trampled node
                           -- will turn it into the hard-packed node (0.0 to 1.0).
                           -- ignored if trampled_node_name is a node that already exists
	hard_pack_count = 10, -- The number of times the trampled node needs to be stepped on
                           -- (and pass the probability check) to turn to the hard packed state
}
Note that all of the parameters in trample_def have default values, so if you want you can just pass in nil and the footprints mod will create a footstep-marked version of the node and set it all up for you with no further information needed. "footprints.register_trample_node("modname:dirt")" will work.

Eroding hardpack back to soil over time

If you've defined a hard_pack_node and want to have it able to erode back to base soil, you can use this callback to manually add it to the erosion system:

Code: Select all

footprints.register_erosion(starting_node_name, restored_node_name)
Note that the source_node should be in group footprints_erodes or an error will be thrown.

Using a hoe to convert hardpack back to soil

If you've got the `farming` mod installed you can allow hardpack nodes to be restored back to soil using a hoe with the following function:

Code: Select all

footprints.register_hoe_converts(starting_node_name, restored_node_name)
Dependencies

optional depends = default, farming

Links License

Licenses: Source code MIT. Textures CC BY-SA (3.0)
  • This mod was developed by paramat from 'desire path' mod by Casimir: thread
  • Trail 0.3.1 by paramat: thread
  • Version 0.4 for Minetest 0.5 was developed by FaceDeer and renamed "footprints"
Last edited by FaceDeer on Mon Nov 30, 2020 08:03, edited 3 times in total.

u18398

Re: [mod] Footprints and trails [footprints] 0.4

by u18398 » Post

FaceDeer wrote: This mod makes soil and soil-like nodes capable of holding temporary "footprint" impressions, and if they're walked on repeatedly turning into hard-packed trails.

It also allows players to flatten plants by walking on them.
Is there any difference to this one ? :)
viewtopic.php?id=6773

Even the name is almost same and so are the footprint texture.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [mod] Footprints and trails [footprints] 0.4

by FaceDeer » Post

Yes, it's derived from that mod. I mention it in the licenses section. There are several major differences, I've pretty much rewritten the mod from the ground up.

paramat's not maintaining his version of the mod so it's not supporting the new soil types that have been added to the default game in recent versions. I fixed that. I've also added an API that allows any mod to easily add its own soil types to the "footprint system", as it were. And this mod has a more sophisticated method of determining when to hard-pack soil into a trail, it actually keeps a count of the number of times a patch of soil has been stepped on.

The API change is the main reason I went with changing the mod's name and giving it a new post, if a mod was to declare a dependency on "trails" that wouldn't necessarily get it the functions it needs.

CalebJ
Member
Posts: 407
Joined: Sat Dec 29, 2018 19:21
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ
Location: Tunnelers' Abyss

Re: [mod] Footprints and trails [footprints] 0.4

by CalebJ » Post

Yes!! A much more realistic API, good job!

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [mod] Footprints and trails [footprints] 0.4

by paramat » Post

Good to see development continue on this idea, and i agree it is best to use a new name.

u18398

Re: [mod] Footprints and trails [footprints] 0.4

by u18398 » Post

FaceDeer wrote:Yes, it's derived from that mod. I mention it in the licenses section. There are several major differences, I've pretty much rewritten the mod from the ground up.
Maybe I am the only one never reading that license parts of a mod X)
Cool that it is continued. I always liked that mod and it's idea behind it.

User avatar
Lone_Wolf
Member
Posts: 2575
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [mod] Footprints and trails [footprints] 0.4

by Lone_Wolf » Post

Awesome, any chance this could get Nodecore support?
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [mod] Footprints and trails [footprints] 0.4

by FaceDeer » Post

Sure, should be pretty easy to add. I just poked around a bit in Nodecore and it looks like you want to add footprints to the nodes in nc_terrain? Try creating a mod that depends on both nc_terrain and footprints and has the following init.lua:

Code: Select all

footprints.register_trample_node("nc_terrain:dirt")
footprints.register_trample_node("nc_terrain:dirt_with_grass")
footprints.register_trample_node("nc_terrain:gravel")
footprints.register_trample_node("nc_terrain:sand")
That should put footprints on those nodes when a player walks on them, and have them slowly erode away over time.

If you want to have the nodes capable of being trampled to hard-packed soil, you'll need to define a node for that (the "footprints:trail" node only gets defined by footprints itself if the default mod is installed) and then add trample_def parameters to some of those like so:

Code: Select all

minetest.register_node("nc_footprints:trail" {
--   node definition for hard-packed trail here
})

footprints.register_trample_node("nc_terrain:dirt", {hard_pack_node_name = "nc_footprints:trail"})
footprints.register_trample_node("nc_terrain:dirt_with_grass", {hard_pack_node_name = "nc_footprints:trail"})
footprints.register_trample_node("nc_terrain:gravel")
footprints.register_trample_node("nc_terrain:sand")
The API has a bunch of other properties you can fiddle with if you want to modify how the footprint system handles these nodes.

MasterPeak
New member
Posts: 2
Joined: Sat Sep 19, 2020 23:29
In-game: MasterPeak

Re: [mod] Footprints and trails [footprints] 0.4

by MasterPeak » Post

Hello, I am new to the forums, I find this mod very useful for survival pvp servers, however I got an error in my server. I am no lua expert but I am trying to fix it, this is it:

Code: Select all

2020-09-19 03:52:05: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'footprints' in callback env
ironment_Step(): ...ervers/survival/worldmods/footprints/init.lua:485: attempt to index local 'player_pos_previous'
 (a nil value)                                                                                                                
2020-09-19 03:52:05: ERROR[Main]: stack traceback:                                                                            
2020-09-19 03:52:05: ERROR[Main]:       ...ervers/survival/worldmods/footprints/init.lua:485: in function <...erver
s/survival/worldmods/footprints/init.lua:463>                                                                     
2020-09-19 03:52:05: ERROR[Main]:       /usr/share/games/minetest/builtin/game/register.lua:429: in function </usr/share/games
/minetest/builtin/game/register.lua:413>                                                                                      
2020-09-19 03:52:05: ERROR[Main]: stack traceback:
When this happened there was only one player online, I noticed that you left some commented out lines in the code preventing a nil value (lines 480 to 482):

Code: Select all

if player_pos_previous_map[player_name] == nil then
                                break
                        end
I uncommented them out and I am currently testing to see if the error comes up again. I think what happens is that the function for getting the player position returns a nil value for some reason (maybe slow internet connection). I will let you know what happens.

MasterPeak
New member
Posts: 2
Joined: Sat Sep 19, 2020 23:29
In-game: MasterPeak

Re: [mod] Footprints and trails [footprints] 0.4

by MasterPeak » Post

Well, it's been a month since I applied the change to the code, many players have joined the server and it has worked fine, so I guess that fixed it.

FaceDeer
Member
Posts: 506
Joined: Sat Aug 29, 2015 19:01
GitHub: FaceDeer

Re: [mod] Footprints and trails [footprints] 0.4

by FaceDeer » Post

MasterPeak wrote:
Sat Oct 24, 2020 15:23
Well, it's been a month since I applied the change to the code, many players have joined the server and it has worked fine, so I guess that fixed it.
Yeah, that was a bit boneheaded of me, sorry about that. I'll fix that in the repository. Thanks!

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [mod] Footprints and trails [0.4] [footprints]

by Grubler » Post

Have you ever noticed the possibility of blocks under a layer of snow disappearing after you may have stepped on them? I am not sure if it may be this mod doing it at the moment, but I think it may be. Just wanted to mention that as a potential issue, if that is okay.. otherwise yeah, it seems helpful and stuff.

User avatar
Ghaydn
Member
Posts: 54
Joined: Sat Sep 26, 2020 11:58
In-game: ghaydn
Location: Moscow, Russia

Re: [mod] Footprints and trails [0.4] [footprints]

by Ghaydn » Post

If you add this to init.lua at line 280 (after everything inside "if default_modpath then") then footprints will be compatible with Ethereal. Of course, it should be in added to mod.conf as an optional dependence.

Code: Select all

	-- Ethereal dirts

	if minetest.get_modpath("ethereal") then
	
		local dirts = {
			"Bamboo", "Jungle", "Grove", "Prairie", "Cold",
			"Crystal", "Mushroom", "Fiery", "Gray"
		}
		
		for n = 1, #dirts do
			
			local desc = dirts[n]
			local name = desc:lower()
			
			footprints.register_trample_node("ethereal:"..name.."_dirt", {
				trampled_node_name = "footprints:ethereal_"..name.."_dirt",
				trampled_node_def_override = {description = S(desc.." Dirt with Footprint"),},
				hard_pack_node_name = "footprints:trail",
				hard_pack_probability = HARDPACK_PROBABILITY,
				hard_pack_count = HARDPACK_COUNT,
			})
		end
	end
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?

User avatar
Ghaydn
Member
Posts: 54
Joined: Sat Sep 26, 2020 11:58
In-game: ghaydn
Location: Moscow, Russia

Re: [mod] Footprints and trails [0.4] [footprints]

by Ghaydn » Post

I've forked this mod and added some features:
1. Compatibility with Farming Redo, Ethereal, Cool Trees, MoreTrees, NodeCore (new). Didn't make it with MineClone, too complex.
2. Fixed a bug that turned dirt under trampled node into trampled node. Cleaned that part of code (there were weird things).
3. Added trampling of flowers, grass and saplings. Added options for that.
4. Added "squared probabilities" option that makes probabilities more natural.
5. Changed mechanism of trampled crops. Now young crops are weak and have a big probability to turn into flat plant, and mature crops are strong and have a small probability to be trampled. Also, now there is no difference between trampled crops, they all become one useless piece, because there are too many crops. Size of that piece depends on crop's age. Maybe should later add some api for growing plants. added api, see readme.md.

Known issues:
1. Ethereal has crystal shovel with silktouch. It digs footprinted dirts directly as they are.
2. Some mods (like TechAge) don't recognize footprinted nodes: gravel, dirt.
3. Crops can be trampled even from height, even in sneak mode. (Maybe add an option: not to leave trails(or just lower probability) when player sneaks). Added sneak coefficient that lowers probability to leave trail when player sneaks.

About NodeCore. I didn't see that it was already partially supported in this topic and added my own, more deep compability. There is no hardpacking, because I suggested that it would be not NC-style.

FaceDeer (and everyone), have a look: https://github.com/Ghaydn/footprints
Last edited by Ghaydn on Thu Aug 19, 2021 23:07, edited 1 time in total.
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [mod] Footprints and trails [0.4] [footprints]

by MisterE » Post

Thx ghaydn! I just used the ethereal compatibility code, but thats really useful to me. The fork that has just ethereal compat is here in case anyonw needs it: https://notabug.org/CenteriaSurvival/footprints
proper attribution has been given to ghaydn in license.txt and in init.lua

User avatar
Ghaydn
Member
Posts: 54
Joined: Sat Sep 26, 2020 11:58
In-game: ghaydn
Location: Moscow, Russia

Re: [mod] Footprints and trails [0.4] [footprints]

by Ghaydn » Post

I could not leave it like that, undone. So, an update:
1. Added sneak coefficient (configirable, default 0.5). If a player sneaks, then probability to trample nodes will be multiplied by this coefficient. It should be between 0 (no trails at all) and 1 (sneaking will not affect on footprints), but no one forbids to make it larger and get weird behavior. Also added possibility to make individual sneak_q for new trample nodes.
2. Added api to quickly register trampleable plants. Mainly farming crops and grass.
3. Found some bugs and fixed them.

Theoretically, you can disable all the new features and this version will work exactly as v0.4. Except for one, there is a bug that replaced ground under trampled nodes, it appeared mainly on slopes. Anyway MisterE thanks for the fork.

For now, I don't see how else I can improve this mod (except for Mineclone compatibility), so if there will be no bugs then I'll go to do something else.
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [mod] Footprints and trails [0.4] [footprints]

by Grubler » Post

Does any of that fix the issue of blocks under snow layer getting removed?

I don't really like the trampling of crops so I turned that off. I changed the look of the trail on the grass to look like the grass was worn out in a spot instead of just a full square difference, and now I am wondering if there is a way a person could do it where you have things change to textures related to things around it so that the worn out areas line up and make different patterns based on the other spots around them.

I am also thinking of maybe trying to make a way for it to have a footprint on the worn trail parts so that if you are walking on them still, it may not just turn them into something else so often.

(Maybe I can try turning off things that have to do with transforming snow related things.)

User avatar
Ghaydn
Member
Posts: 54
Joined: Sat Sep 26, 2020 11:58
In-game: ghaydn
Location: Moscow, Russia

Re: [mod] Footprints and trails [0.4] [footprints]

by Ghaydn » Post

Grubler wrote:
Sun Sep 12, 2021 17:32
Does any of that fix the issue of blocks under snow layer getting removed?
Yes, this bug was fixed.
I don't really like the trampling of crops so I turned that off.
I've added options to turn off any part of the mod. That was related to slabs, but it was most notably on thin snow, because it lies on mountain slabs.
I changed the look of the trail on the grass to look like the grass was worn out in a spot instead of just a full square difference, and now I am wondering if there is a way a person could do it where you have things change to textures related to things around it so that the worn out areas line up and make different patterns based on the other spots around them.
Screenshot please. This sounds like a good idea, but I'm still not shure that I understood you right.
I am also thinking of maybe trying to make a way for it to have a footprint on the worn trail parts so that if you are walking on them still, it may not just turn them into something else so often.
Ummm... Hardpacking?
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [mod] Footprints and trails [0.4] [footprints]

by Grubler » Post

Image

Also, is grass and stuff supposed to be removed if the block turns into a trail? Maybe I have an out-dated version.
I was thinking it may be interesting if it could keep track of the number of steps on it and change each time it was stepped on a bit, or something. Like grass gets smaller and the grass on the blocks wears off little by little, but it may be very complicated at that point.

User avatar
Ghaydn
Member
Posts: 54
Joined: Sat Sep 26, 2020 11:58
In-game: ghaydn
Location: Moscow, Russia

Re: [mod] Footprints and trails [0.4] [footprints]

by Ghaydn » Post

Grubler wrote:
Sat Sep 18, 2021 19:22
Maybe I have an out-dated version.
I didn't upload my version to the contentDB, because a) don't know how, b) I'm not the original author, c) will do it later, when I'll finish my modpack.
So, if you downloaded it from the in-game menu, then you indeed have an outdated version.
Also, is grass and stuff supposed to be removed if the block turns into a trail?
In 0.4 it was a bug, the same as snow bug. In 0.5 I've added an option: grass will get smaller and smaller every time a player walks through it, and will disappear at the end. Some grasses don't have several forms, these will disappear immediately.
change each time it was stepped on a bit, or something. Like grass gets smaller
That is very easy to do, you won't even have to change the mod's code, there's an API to do this. The only problem is that you'll have to register all these stages (times the number of dirt types) as nodes. More nodes means longer load, slower game. That is why there's hardpacking mechanism: node remembers how many steps it got and eventually turns into a hardpacked node.
screenshot
Nice looking. Anyway, I'll prefer to keep it as it is, simple, because this is the way. Well, maybe will add a function to UNregister trampled nodes, later.
Nobody understands me... — вРН БШ ЯЙЮГЮКХ?

Grubler
Member
Posts: 98
Joined: Wed Nov 06, 2019 03:01
In-game: Grubler

Re: [mod] Footprints and trails [0.4] [footprints]

by Grubler » Post

Do you think it may be possible to make it so when the footprint erodes it turns into another footprint with less opacity and then that one can erode and disappear. Like the degradation of a track. Something like that.
I also am thinking if it may be possible to make it wait a while before eroding so it may not happen so fast, and I see a part in the script about walking on plants sends them to a lower version, but not sure how to use it. All this mod stuff is so complicated...

User avatar
snoopy
Member
Posts: 263
Joined: Thu Oct 20, 2016 16:49
Location: DE, European Union

Re: [mod] Footprints and trails [0.4] [footprints]

by snoopy » Post

Thumbs up.

Has a nice appeal und would be worth a try. However, the maintenance seems to have stopped somehow.

@FaceDeer - Hope this message finds you well and woud like to ask if you have planned further development.

@Gaydn - Excellent contribution and I would highly appreciate support for the Ethereal mod.
Ghaydn wrote:
Mon Aug 02, 2021 07:02
If you add this to init.lua at line 280 (after everything inside "if default_modpath then") then footprints will be compatible with Ethereal. Of course, it should be in added to mod.conf as an optional dependence.

Code: Select all

	-- Ethereal dirts

	if minetest.get_modpath("ethereal") then
	
		local dirts = {
			"Bamboo", "Jungle", "Grove", "Prairie", "Cold",
			"Crystal", "Mushroom", "Fiery", "Gray"
		}
		
		for n = 1, #dirts do
			
			local desc = dirts[n]
			local name = desc:lower()
			
			footprints.register_trample_node("ethereal:"..name.."_dirt", {
				trampled_node_name = "footprints:ethereal_"..name.."_dirt",
				trampled_node_def_override = {description = S(desc.." Dirt with Footprint"),},
				hard_pack_node_name = "footprints:trail",
				hard_pack_probability = HARDPACK_PROBABILITY,
				hard_pack_count = HARDPACK_COUNT,
			})
		end
	end
I don't want to bother and I fully understand everybody has a life outside MT. Just asking and interested in this very nice mod for my MT 5.6.1 server.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests