@@ -1188,34 +1188,81 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1188
1188
MapNode n_minus_z_plus_y = data->m_vmanip .getNodeNoEx (blockpos_nodes + v3s16 (x, y+1 , z-1 ));
1189
1189
MapNode n_plus_z_minus_y = data->m_vmanip .getNodeNoEx (blockpos_nodes + v3s16 (x, y-1 , z+1 ));
1190
1190
MapNode n_minus_z_minus_y = data->m_vmanip .getNodeNoEx (blockpos_nodes + v3s16 (x, y-1 , z-1 ));
1191
-
1191
+
1192
1192
content_t thiscontent = n.getContent ();
1193
- if (n_minus_x.getContent () == thiscontent)
1193
+ std::string groupname = " connect_to_raillike" ; // name of the group that enables connecting to raillike nodes of different kind
1194
+ bool self_connect_to_raillike = ((ItemGroupList) nodedef->get (n).groups )[groupname] != 0 ;
1195
+
1196
+ if ((nodedef->get (n_minus_x).drawtype == NDT_RAILLIKE
1197
+ && ((ItemGroupList) nodedef->get (n_minus_x).groups )[groupname] != 0
1198
+ && self_connect_to_raillike)
1199
+ || n_minus_x.getContent () == thiscontent)
1194
1200
is_rail_x[0 ] = true ;
1195
- if (n_minus_x_minus_y.getContent () == thiscontent)
1201
+
1202
+ if ((nodedef->get (n_minus_x_minus_y).drawtype == NDT_RAILLIKE
1203
+ && ((ItemGroupList) nodedef->get (n_minus_x_minus_y).groups )[groupname] != 0
1204
+ && self_connect_to_raillike)
1205
+ || n_minus_x_minus_y.getContent () == thiscontent)
1196
1206
is_rail_x_minus_y[0 ] = true ;
1197
- if (n_minus_x_plus_y.getContent () == thiscontent)
1207
+
1208
+ if ((nodedef->get (n_minus_x_plus_y).drawtype == NDT_RAILLIKE
1209
+ && ((ItemGroupList) nodedef->get (n_minus_x_plus_y).groups )[groupname] != 0
1210
+ && self_connect_to_raillike)
1211
+ || n_minus_x_plus_y.getContent () == thiscontent)
1198
1212
is_rail_x_plus_y[0 ] = true ;
1199
1213
1200
- if (n_plus_x.getContent () == thiscontent)
1214
+ if ((nodedef->get (n_plus_x).drawtype == NDT_RAILLIKE
1215
+ && ((ItemGroupList) nodedef->get (n_plus_x).groups )[groupname] != 0
1216
+ && self_connect_to_raillike)
1217
+ || n_plus_x.getContent () == thiscontent)
1201
1218
is_rail_x[1 ] = true ;
1202
- if (n_plus_x_minus_y.getContent () == thiscontent)
1219
+
1220
+ if ((nodedef->get (n_plus_x_minus_y).drawtype == NDT_RAILLIKE
1221
+ && ((ItemGroupList) nodedef->get (n_plus_x_minus_y).groups )[groupname] != 0
1222
+ && self_connect_to_raillike)
1223
+ || n_plus_x_minus_y.getContent () == thiscontent)
1203
1224
is_rail_x_minus_y[1 ] = true ;
1204
- if (n_plus_x_plus_y.getContent () == thiscontent)
1225
+
1226
+ if ((nodedef->get (n_plus_x_plus_y).drawtype == NDT_RAILLIKE
1227
+ && ((ItemGroupList) nodedef->get (n_plus_x_plus_y).groups )[groupname] != 0
1228
+ && self_connect_to_raillike)
1229
+ || n_plus_x_plus_y.getContent () == thiscontent)
1205
1230
is_rail_x_plus_y[1 ] = true ;
1206
1231
1207
- if (n_minus_z.getContent () == thiscontent)
1232
+ if ((nodedef->get (n_minus_z).drawtype == NDT_RAILLIKE
1233
+ && ((ItemGroupList) nodedef->get (n_minus_z).groups )[groupname] != 0
1234
+ && self_connect_to_raillike)
1235
+ || n_minus_z.getContent () == thiscontent)
1208
1236
is_rail_z[0 ] = true ;
1209
- if (n_minus_z_minus_y.getContent () == thiscontent)
1237
+
1238
+ if ((nodedef->get (n_minus_z_minus_y).drawtype == NDT_RAILLIKE
1239
+ && ((ItemGroupList) nodedef->get (n_minus_z_minus_y).groups )[groupname] != 0
1240
+ && self_connect_to_raillike)
1241
+ || n_minus_z_minus_y.getContent () == thiscontent)
1210
1242
is_rail_z_minus_y[0 ] = true ;
1211
- if (n_minus_z_plus_y.getContent () == thiscontent)
1243
+
1244
+ if ((nodedef->get (n_minus_z_plus_y).drawtype == NDT_RAILLIKE
1245
+ && ((ItemGroupList) nodedef->get (n_minus_z_plus_y).groups )[groupname] != 0
1246
+ && self_connect_to_raillike)
1247
+ || n_minus_z_plus_y.getContent () == thiscontent)
1212
1248
is_rail_z_plus_y[0 ] = true ;
1213
1249
1214
- if (n_plus_z.getContent () == thiscontent)
1250
+ if ((nodedef->get (n_plus_z).drawtype == NDT_RAILLIKE
1251
+ && ((ItemGroupList) nodedef->get (n_plus_z).groups )[groupname] != 0
1252
+ && self_connect_to_raillike)
1253
+ || n_plus_z.getContent () == thiscontent)
1215
1254
is_rail_z[1 ] = true ;
1216
- if (n_plus_z_minus_y.getContent () == thiscontent)
1255
+
1256
+ if ((nodedef->get (n_plus_z_minus_y).drawtype == NDT_RAILLIKE
1257
+ && ((ItemGroupList) nodedef->get (n_plus_z_minus_y).groups )[groupname] != 0
1258
+ && self_connect_to_raillike)
1259
+ || n_plus_z_minus_y.getContent () == thiscontent)
1217
1260
is_rail_z_minus_y[1 ] = true ;
1218
- if (n_plus_z_plus_y.getContent () == thiscontent)
1261
+
1262
+ if ((nodedef->get (n_plus_z_plus_y).drawtype == NDT_RAILLIKE
1263
+ && ((ItemGroupList) nodedef->get (n_plus_z_plus_y).groups )[groupname] != 0
1264
+ && self_connect_to_raillike)
1265
+ || n_plus_z_plus_y.getContent () == thiscontent)
1219
1266
is_rail_z_plus_y[1 ] = true ;
1220
1267
1221
1268
bool is_rail_x_all[] = {false , false };
@@ -1255,7 +1302,8 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
1255
1302
if (is_rail_x_all[0 ] && is_rail_x_all[1 ])
1256
1303
angle = 90 ;
1257
1304
if (is_rail_z_all[0 ] && is_rail_z_all[1 ]){
1258
- if (n_minus_z_plus_y.getContent () == thiscontent) angle = 180 ;
1305
+ if (is_rail_z_plus_y[0 ])
1306
+ angle = 180 ;
1259
1307
}
1260
1308
else if (is_rail_x_all[0 ] && is_rail_z_all[0 ])
1261
1309
angle = 270 ;
0 commit comments