[Mod] Better Fences [better_fences]
- ChimneySwift
- Member
- Posts: 320
- Joined: Fri Sep 22, 2017 06:46
- GitHub: ChimneySwift
- IRC: ChimneySwift
- In-game: ChimneySwift
- Location: 127.0.0.1
[Mod] Better Fences [better_fences]
Better Fences
A Minetest mod which solves the fence connection problem.
Recently I was building a house and was quite frustrated that my fence nodes wouldn't connect to the mossy cobblestone:
So, I submitted a PR to make fences connect to all nodes, and it was promptly closed because running fences along a cobble wall would look terrible. This made total sense, but it was still frustrating because the only 2 options (fences that connect to all nodes and fences that connect to only fences) both look terrible in some situations.
My Solution
Better fences overrides default fences and walls and replaces them with 2 fence types, one which connects to all nodes and one which only connects to other fences and walls.
Whenever you place or dig a fence, this mod will determine if the fence you just placed will connect to 2 or more adjacent fences or walls, if it will it places the fence which only connects to fences, otherwise it places the fence which connects to all nodes. Every dig and place will result in the surrounding 4 fences (if they exist) being checked and updated if necessary as well.
This behaviour results in only the fences at the end of a line of fences connecting to all nodes:
So you get the best of both worlds, ability to connect to nodes like stone, and also to not have a line of fences running along a wall look like trash:
Code License: LGPL 2.1+
Dependencies: default
Optional Dependencies: walls
GitHub
Download
A Minetest mod which solves the fence connection problem.
Recently I was building a house and was quite frustrated that my fence nodes wouldn't connect to the mossy cobblestone:
So, I submitted a PR to make fences connect to all nodes, and it was promptly closed because running fences along a cobble wall would look terrible. This made total sense, but it was still frustrating because the only 2 options (fences that connect to all nodes and fences that connect to only fences) both look terrible in some situations.
My Solution
Better fences overrides default fences and walls and replaces them with 2 fence types, one which connects to all nodes and one which only connects to other fences and walls.
Whenever you place or dig a fence, this mod will determine if the fence you just placed will connect to 2 or more adjacent fences or walls, if it will it places the fence which only connects to fences, otherwise it places the fence which connects to all nodes. Every dig and place will result in the surrounding 4 fences (if they exist) being checked and updated if necessary as well.
This behaviour results in only the fences at the end of a line of fences connecting to all nodes:
So you get the best of both worlds, ability to connect to nodes like stone, and also to not have a line of fences running along a wall look like trash:
Code License: LGPL 2.1+
Dependencies: default
Optional Dependencies: walls
GitHub
Download
A spoon is basically a tiny bowl with a stick on it
- sorcerykid
- Member
- Posts: 1841
- Joined: Fri Aug 26, 2016 15:36
- GitHub: sorcerykid
- In-game: Nemo
- Location: Illinois, USA
Re: [Mod] Better Fences [better_fences]
Finally! This should be included in the official game!
Re: [Mod] Better Fences [better_fences]
Agreed! I've been waiting for years for something like this.sorcerykid wrote:Finally! This should be included in the official game!
Hey, what can i say? I'm the bad guy.
- v-rob
- Developer
- Posts: 970
- Joined: Thu Mar 24, 2016 03:19
- GitHub: v-rob
- IRC: v-rob
- Location: Right behind you.
Re: [Mod] Better Fences [better_fences]
Nice! This is ingenious! We've always needed something like this.
- Beerholder
- Member
- Posts: 199
- Joined: Wed Aug 03, 2016 20:23
- GitHub: evrooije
- In-game: Beerholder
Re: [Mod] Better Fences [better_fences]
Something so simple (albeit 280 LoC O_o), yet so awesome! :D +1000
- ChimneySwift
- Member
- Posts: 320
- Joined: Fri Sep 22, 2017 06:46
- GitHub: ChimneySwift
- IRC: ChimneySwift
- In-game: ChimneySwift
- Location: 127.0.0.1
Re: [Mod] Better Fences [better_fences]
Thanks all!
Agreed, I didn't bother to do too much tidying up tbh... but there's a lot of duplicate code at the bottom where the nodes and stuff are registered so I intend to fix that.Beerholder wrote:Something so simple (albeit 280 LoC O_o), yet so awesome! :D +1000
A spoon is basically a tiny bowl with a stick on it
- Hume2
- Member
- Posts: 709
- Joined: Tue Jun 19, 2018 08:24
- GitHub: Hume2
- In-game: Hume2
- Location: Czech Republic
Re: [Mod] Better Fences [better_fences]
Nice mod!
There should be a way to distinguish these two fences in the inventory, for example a small overlaying icon.
There should be a way to distinguish these two fences in the inventory, for example a small overlaying icon.
If you lack the reality, go on a trip or find a job.
- ChimneySwift
- Member
- Posts: 320
- Joined: Fri Sep 22, 2017 06:46
- GitHub: ChimneySwift
- IRC: ChimneySwift
- In-game: ChimneySwift
- Location: 127.0.0.1
Re: [Mod] Better Fences [better_fences]
The mod will automatically decide which fence to place and update the surrounding ones, only one fence should come up in your inventory when you dig it and in creative inventory. It should also unregister default fences and walls.Hume2 wrote:There should be a way to distinguish these two fences in the inventory, for example a small overlaying icon.
Are you seeing multiple by chance?
A spoon is basically a tiny bowl with a stick on it
- Linuxdirk
- Member
- Posts: 3217
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: [Mod] Better Fences [better_fences]
Never a good idea. The decision might be different from what the player wants.ChimneySwift wrote:The mod will automatically decide …
- ChimneySwift
- Member
- Posts: 320
- Joined: Fri Sep 22, 2017 06:46
- GitHub: ChimneySwift
- IRC: ChimneySwift
- In-game: ChimneySwift
- Location: 127.0.0.1
Re: [Mod] Better Fences [better_fences]
Then don't install this mod and use the default fences which are even less likely to connect the way the player wants:Linuxdirk wrote:Never a good idea. The decision might be different from what the player wants.
This mod definitely fails in some circumstances, but the way it handles connections is much more realistic than default fences (IMO), and default fences also fail in those same areas.
I could make the fences separate, and it would be trivial to modify default to just have 2 different fence types (not to mention much more boring), but the ease of use gained from using an automated method like this vastly outweighs the ability to cover a couple of niche uses for fences where the mod fails. In fact the only time so far that I found a connection related problem was using fences to create a medieval-style skylight, where default fails already too, by the way.
and at least in this mod I didn't override default, because apparently that's also never a good idea.
A spoon is basically a tiny bowl with a stick on it
- Pyrollo
- Developer
- Posts: 385
- Joined: Mon Jan 08, 2018 15:14
- GitHub: pyrollo
- In-game: Naj
- Location: Paris
Re: [Mod] Better Fences [better_fences]
ChimneySwift maybe you could solve the choice issue by adding something like: punching the fence makes it switch to the other style node.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]
- sorcerykid
- Member
- Posts: 1841
- Joined: Fri Aug 26, 2016 15:36
- GitHub: sorcerykid
- In-game: Nemo
- Location: Illinois, USA
Re: [Mod] Better Fences [better_fences]
I too considered the screwdriver. But the API requires a paramtype2 of "facedir", which fence nodes do not have.
- ChimneySwift
- Member
- Posts: 320
- Joined: Fri Sep 22, 2017 06:46
- GitHub: ChimneySwift
- IRC: ChimneySwift
- In-game: ChimneySwift
- Location: 127.0.0.1
Re: [Mod] Better Fences [better_fences]
Update:
- Right click will now toggle the fence type, note that manual changes might revert if you place a fence next to the fence you manually adjusted)
- Security fixes for protector mod (woops! sorry, forgot protector checks, verified and working for both right click, dig and placement on tenplus1's protector mod this time)
- Bug fixes - nodes can only be placed in nodes which are buildable_to (like air, grass, etc, before you could override solid nodes...)
- Cody tidy up (the 62 lines for unregistering default fences and re-registering new ones was reduced from 62 lines to 14 lines. Code redundancy for re-registering walls was also removed)
A spoon is basically a tiny bowl with a stick on it
-
- Member
- Posts: 4276
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: [Mod] Better Fences [better_fences]
My xconnected mod also has fences of this type. Punching a middle fence will alternate between a post placed there and no post (bars just going through).
A list of my mods can be found here.
- pampogokiraly
- Member
- Posts: 293
- Joined: Wed Jan 08, 2020 22:21
- In-game: i_love_mesecon
Re: [Mod] Better Fences [better_fences]
I have found a little bug with your last update :/
I can craft a fence easily with only two sticks:
And it also works if i throw some wood into the crafting grid (replacing the nothing with them)
Can you fix this please? I really want to use this mod because this method is much better than the default placement :D
I can craft a fence easily with only two sticks:
Code: Select all
nothing, stick, nothing,
nothing, stick, nothing.
Can you fix this please? I really want to use this mod because this method is much better than the default placement :D
All praise the Bacon God! The one and only god in MineTest
Re: [Mod] Better Fences [better_fences]
We fixed this on our server, you can use better_fences from our repo:
https://github.com/minestead/minestead_ ... ter_fences
Also, we fixed the issue with item placement on top of the fence. Now the connection are switched when you punch the fence instead of right-click.
https://github.com/minestead/minestead_ ... ter_fences
Also, we fixed the issue with item placement on top of the fence. Now the connection are switched when you punch the fence instead of right-click.
- pampogokiraly
- Member
- Posts: 293
- Joined: Wed Jan 08, 2020 22:21
- In-game: i_love_mesecon
Re: [Mod] Better Fences [better_fences]
Sorry for asking a stupid question.
How can i download your version?
How can i download your version?
All praise the Bacon God! The one and only god in MineTest
Re: [Mod] Better Fences [better_fences]
You can download the whole repository, just go here: https://github.com/minestead/minestead_mods, then click green button 'Clone or download', then click 'Download ZIP'. Unzip the downloaded archive and copy content of the mod folder.
Who is online
Users browsing this forum: Bing [Bot] and 20 guests