Page 1 of 1

[1.10.15] Road curves/diagonal

Posted: 17 Dec 2021, 18:09
by Hadestia
Retiati_21-12-18_00.19.23.png
If you're wondering how ingame country road switched its curve to diagonal, here we will tackle it.

If you are not familiar with road plugin, it's better to understand first how to make a road plugin here:
viewtopic.php?f=41&t=2964

In order to make the road frame switches from curve to diagonal first we need to provide a frame for the regular road (curved/edged) and for diagonal road frames:
REGULAR FRAME
REGULAR FRAME
regular.png (6.17 KiB) Viewed 5336 times
DIAGONAL FRAME
DIAGONAL FRAME
diagonal.png (7.08 KiB) Viewed 5336 times
We're done with our frame, Now let's make a json for our roads. All we need to do is provide 2 road objects for our road, the first one if for our diagonal and the other is for the regular road. We need to initialize diagonal road first before regular to avoid missing error so our json may look like:

Code: Select all    Reset

[ //ROAD TEMPLATE { "id":"$diagonal_road_template00", "type":"template", "level":1, "traffic lights":[ {"bmp":"trafficlights.png","w":32,"count":4} ], "price":20, "monthly price":1, "title":"diagonal test", "text":"Road for diagonal road test." }, //DIAGONAL ROAD { "hidden":true, //optional if we want to hide this "level":2, "id":"$diagonal_road_diagonal00", "template":"$diagonal_road_template00", "type":"road", "draw ground":true, "speed":3, "frames":[ {"bmp":"diagonal.png","w":32,"count":16} ], "allow diagonal":true //[important] this will make car frames switch from regular to diagonal on curves }, //REGULAR ROAD { "id":"$diagonal_road00", "template":"$diagonal_road_template00", "type":"road", "speed":2, "frames":[ {"bmp":"regular.png","w":32,"count":16} ], "diagonal road":"$diagonal_road_diagonal00", //[important] with this attribute we can call the diagonal frames of this road by its id, this is for if users building this road using the diagonal marker "meta":{ "tags":{ "tool":{ "marker":"pipe" } } } // A meta for road marker when building diagonal } ]
JSON checker
Check
This feature also work for 2 width roads but, we need to click the "1" road tool first on order to show the marker and build the diagonal.

Here's the zip file of the road as experiment:
Diagonal Road Test.zip
(11.67 KiB) Downloaded 627 times

Re: [1.10.15] Road curves/diagonal

Posted: 10 Jun 2022, 07:54
by imajoke
Speaking of, are diagonal bridges and tunnels planned to be implemented for the diagonal country road? Whether ingame or as it's own plugin

Re: [1.10.15] Road curves/diagonal

Posted: 10 Jun 2022, 11:03
by Player_no_Zero
imajoke wrote:
10 Jun 2022, 07:54
Speaking of, are diagonal bridges and tunnels planned to be implemented for the diagonal country road? Whether ingame or as it's own plugin
Diagonal tunnels don't make really much sense to make. Because I cannot even see it, so why bother.

Re: [1.10.15] Road curves/diagonal

Posted: 11 Sep 2022, 11:34
by PixelDubs
Thanks mate, your a life saver, I remember a year ago creating my Diagonal Road Without Sidewalks plugin, I literally had to get help from Kingtut101