Jump to content

Snapping Walls


Atrik
 Share

Recommended Posts

This mod allow snapping walls to any buildings (or entities like mineral deposits), increasing drastically their potential utility by making sure to leave no gaps, and/or speed at which you can place them.

snappingwalls-min(2).thumb.png.dc2d5754d55c61b9db87b423e21d1e22.png
Walls.. That snaps... :thumbup:


I did my best for the behavior to be simple and intuitive, but there are still a couple compromises that were done. Also there are vanilla flaws with wall placements that I couldn't address.

  • Compatible mod (can be enabled in MP)
  • Works with other mods I tested that modify inputs (autociv, customtrainer, moderngui)

 

 

SnappingWalls.zip

Edited by Atrik
  • Like 7
  • Thanks 1
  • Haha 1
Link to comment
Share on other sites

Updated :

  • Significant performance improvement (First version was bad, this one fix it but also improve wall placement performance impacts in general)
     
  • Now other towers can be used as a starting or end point for wall placement instead of wall towers.
    This doesn't prevent you from walling easily around them : you can also snap walls and palisades to their edges! (The threshold distance makes it so easy to choose between the two you won't even be bothered).


    hanswallsnapdemo-min.thumb.png.d7a5f2827a93d679dc6770974bb491f7.pngiberwallsnapdemo-min.thumb.png.7496732b6f997ca9d5009cf553648dae.png
  • Like 2
Link to comment
Share on other sites

4 minutes ago, Perzival12 said:

What if you add the ability to snap walls to a fortress' towers? Then fortresses would be more realistic, more useful to build, and take up less space.

Wish I could, however this would either be very complicated, or needs to be as a incompatible mod setting some references point in fort templates or something. I wanted this mod to be compatible. :laugh:

Link to comment
Share on other sites

On 16/10/2025 at 6:52 AM, Atrik said:

Updated :

  • Significant performance improvement (First version was bad, this one fix it but also improve wall placement performance impacts in general)
     
  • Now other towers can be used as a starting or end point for wall placement instead of wall towers.
    This doesn't prevent you from walling easily around them : you can also snap walls and palisades to their edges! (The threshold distance makes it so easy to choose between the two you won't even be bothered).


    hanswallsnapdemo-min.thumb.png.d7a5f2827a93d679dc6770974bb491f7.pngiberwallsnapdemo-min.thumb.png.7496732b6f997ca9d5009cf553648dae.png

Why aren't you making this a pull request?

  • Like 3
Link to comment
Share on other sites

1 hour ago, wowgetoffyourcellphone said:

Why aren't you making this a pull request?

Unlikely to be accepted as a PR.
It lengthen the code by a bit; and is probably not how one would go about to implement all of the different features I've added, without the constraint of trying to make it into a compatible mod..

Link to comment
Share on other sites

19 hours ago, Atrik said:

Unlikely to be accepted as a PR.
It lengthen the code by a bit; and is probably not how one would go about to implement all of the different features I've added, without the constraint of trying to make it into a compatible mod..

I took a quick look at the code, correct me if I'm wrong, but for a PR it looks like you could directly move most of the logic to the GuiInterface.prototype.SetWallPlacementPreview method. I don't think length would be an issue since you largely rewrote the logic of that method anyway, which is itself already quite long. And I don't think anyone would mind having a bit more code for more desired behaviour. Also, that would make it even more performant because you wouldn't have to compute the entire entity state for each snap candidate and could pull values like the position from the simulation directly, which is a lot quicker. What do you think? I believe a lot of people (including me) would love to see this added to the main game.

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...