33// @id fanfields@heistergand
44// @name Fan Fields 2
55// @category Layer
6- // @version 2.7.7.20260201
6+ // @version 2.7.8.20260218
77// @description Calculate how to link the portals to create the largest tidy set of nested fields. Enable from the layer chooser.
88// @downloadURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/heistergand/fanfields.user.js
99// @updateURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/heistergand/fanfields.meta.js
@@ -26,14 +26,21 @@ function wrapper(plugin_info) {
2626 // ensure plugin framework is there, even if iitc is not yet loaded
2727 if ( typeof window . plugin !== 'function' ) window . plugin = function ( ) { } ;
2828 plugin_info . buildName = 'main' ;
29- plugin_info . dateTimeVersion = '2026-02-01-142842 ' ;
29+ plugin_info . dateTimeVersion = '2026-02-18-000942 ' ;
3030 plugin_info . pluginId = 'fanfields' ;
3131
3232 /* global L, $, dialog, map, portals, links, plugin, formatDistance -- eslint*/
3333 /* exported setup, changelog -- eslint */
3434
3535 var arcname = ( window . PLAYER && window . PLAYER . team === 'ENLIGHTENED' ) ? 'Arc' : '***' ;
36- var changelog = [ {
36+ var changelog = [
37+ {
38+ version : '2.7.8' ,
39+ changes : [
40+ 'NEW: Respect Intel now supports filtering which factions\' links are treated as blockers (Issue #104).'
41+ ] ,
42+ } ,
43+ {
3744 version : '2.7.7' ,
3845 changes : [
3946 'IMPROVE portal sequence editor usage for mobile' ,
@@ -600,8 +607,9 @@ function wrapper(plugin_info) {
600607 'In outbounding mode you can set how many SBUL you plan to use (0–4) to calculate the outgoing link capacity.</p>' +
601608
602609 '<p><b>Avoid blockers</b><br>' +
603- 'If you need to plan around links/fields you cannot or do not want to destroy, use <i>Respect Intel</i>. ' +
604- 'When enabled, the plan avoids crosslinks with currently visible intel links/fields.</p>' +
610+ 'If you need to plan around links you cannot or do not want to destroy, use <i>Respect Intel</i>. ' +
611+ 'Choose which factions\' links are treated as blockers (NONE / ALL / ENL / RES / ENL & MAC / RES & MAC / MAC). ' +
612+ 'The plan avoids crossing those currently visible intel links.</p>' +
605613
606614 '<p><b>Order & route planning</b><br>' +
607615 'Switch between <i>Clockwise</i> and <i>Counterclockwise</i> order to find an easier route or squeeze out extra fields. ' +
@@ -1286,20 +1294,94 @@ function wrapper(plugin_info) {
12861294
12871295 // ghi#23 end (3)
12881296
1297+ thisplugin . respectIntelLinksModeENUM = {
1298+ NONE : 0 ,
1299+ ALL : 1 ,
1300+ ENL : 2 ,
1301+ RES : 3 ,
1302+ ENL_AND_MAC : 4 ,
1303+ RES_AND_MAC : 5 ,
1304+ MAC : 6
1305+ } ;
1306+
1307+ // Issue #104: Filter which visible intel links should block the plan.
1308+ // NONE: ignore all intel links
1309+ // ALL: treat all visible links as blockers (RES+ENL+MAC)
1310+ // ENL/RES/MAC: only that faction blocks
1311+ // ENL_AND_MAC / RES_AND_MAC: block those teams
1312+ thisplugin . respectIntelLinksMode = thisplugin . respectIntelLinksModeENUM . NONE ;
1313+
1314+ thisplugin . isRespectingIntel = function ( ) {
1315+ return thisplugin . respectIntelLinksMode !== thisplugin . respectIntelLinksModeENUM . NONE ;
1316+ } ;
1317+
1318+ thisplugin . getRespectIntelTeams = function ( ) {
1319+ switch ( thisplugin . respectIntelLinksMode ) {
1320+ case thisplugin . respectIntelLinksModeENUM . ALL :
1321+ return [ window . TEAM_RES , window . TEAM_ENL , window . TEAM_MAC ] ;
1322+
1323+ case thisplugin . respectIntelLinksModeENUM . ENL :
1324+ return [ window . TEAM_ENL ] ;
1325+
1326+ case thisplugin . respectIntelLinksModeENUM . RES :
1327+ return [ window . TEAM_RES ] ;
1328+
1329+ case thisplugin . respectIntelLinksModeENUM . MAC :
1330+ return [ window . TEAM_MAC ] ;
1331+
1332+ case thisplugin . respectIntelLinksModeENUM . ENL_AND_MAC :
1333+ return [ window . TEAM_ENL , window . TEAM_MAC ] ;
1334+
1335+ case thisplugin . respectIntelLinksModeENUM . RES_AND_MAC :
1336+ return [ window . TEAM_RES , window . TEAM_MAC ] ;
1337+
1338+ case thisplugin . respectIntelLinksModeENUM . NONE :
1339+ default :
1340+ return [ ] ;
1341+ }
1342+ } ;
1343+
1344+ thisplugin . getRespectIntelLabel = function ( ) {
1345+ switch ( thisplugin . respectIntelLinksMode ) {
1346+ case thisplugin . respectIntelLinksModeENUM . ALL :
1347+ return 'ALL' ;
1348+
1349+ case thisplugin . respectIntelLinksModeENUM . ENL :
1350+ return 'ENL' ;
1351+
1352+ case thisplugin . respectIntelLinksModeENUM . RES :
1353+ return 'RES' ;
1354+
1355+ case thisplugin . respectIntelLinksModeENUM . MAC :
1356+ return 'MAC' ;
12891357
1290- thisplugin . respectCurrentLinks = false ;
1358+ case thisplugin . respectIntelLinksModeENUM . ENL_AND_MAC :
1359+ return 'E&M' ;
1360+
1361+ case thisplugin . respectIntelLinksModeENUM . RES_AND_MAC :
1362+ return 'R&M' ;
1363+
1364+ case thisplugin . respectIntelLinksModeENUM . NONE :
1365+ default :
1366+ return 'NONE' ;
1367+ }
1368+ } ;
1369+
1370+ thisplugin . updateRespectIntelButton = function ( ) {
1371+ $ ( '#plugin_fanfields2_respectbtn' )
1372+ . html ( 'Respect Intel: ' + thisplugin . getRespectIntelLabel ( ) ) ;
1373+ } ;
1374+
1375+ // Backwards-compatible name: now cycles through the available modes.
12911376 thisplugin . toggleRespectCurrentLinks = function ( ) {
1292- thisplugin . respectCurrentLinks = ! thisplugin . respectCurrentLinks ;
1293- if ( thisplugin . respectCurrentLinks ) {
1294- $ ( '#plugin_fanfields2_respectbtn' )
1295- . html ( 'Respect Intel: ON' ) ;
1296- } else {
1297- $ ( '#plugin_fanfields2_respectbtn' )
1298- . html ( 'Respect Intel: OFF' ) ;
1377+ thisplugin . respectIntelLinksMode ++ ;
1378+ if ( thisplugin . respectIntelLinksMode > thisplugin . respectIntelLinksModeENUM . MAC ) {
1379+ thisplugin . respectIntelLinksMode = thisplugin . respectIntelLinksModeENUM . NONE ;
12991380 }
1381+
1382+ thisplugin . updateRespectIntelButton ( ) ;
13001383 thisplugin . delayedUpdateLayer ( 0.2 ) ;
13011384 } ;
1302-
13031385 thisplugin . indicateLinkDirection = true ;
13041386 thisplugin . toggleLinkDirIndicator = function ( ) {
13051387 thisplugin . indicateLinkDirection = ! thisplugin . indicateLinkDirection ;
@@ -2305,7 +2387,8 @@ function wrapper(plugin_info) {
23052387 var lls = link . getLatLngs ( ) ;
23062388 var line = {
23072389 a : { } ,
2308- b : { }
2390+ b : { } ,
2391+ team : link . options . team
23092392 } ;
23102393 var a = lls [ 0 ] ,
23112394 b = lls [ 1 ] ;
@@ -2318,8 +2401,12 @@ function wrapper(plugin_info) {
23182401 // Cache intel links as a flat array once (used repeatedly in candidate loop)
23192402 var maplinksAll = null ;
23202403 // var emptyMaplinks = [];
2321- if ( thisplugin . respectCurrentLinks ) {
2322- maplinksAll = Object . values ( thisplugin . intelLinks ) ;
2404+ if ( thisplugin . isRespectingIntel ( ) ) {
2405+ var allowedTeams = thisplugin . getRespectIntelTeams ( ) ;
2406+ maplinksAll = Object . values ( thisplugin . intelLinks )
2407+ . filter ( function ( l ) {
2408+ return allowedTeams . indexOf ( l . team ) !== - 1 ;
2409+ } ) ;
23232410 }
23242411
23252412 // filter layers into array that only contains GeodesicPolygon
@@ -2714,7 +2801,7 @@ function wrapper(plugin_info) {
27142801 maplinks = maplinksAll ;
27152802
27162803 // "Respect Intel" stuff
2717- if ( thisplugin . respectCurrentLinks ) {
2804+ if ( thisplugin . isRespectingIntel ( ) ) {
27182805 for ( i in maplinks ) {
27192806 if ( this . intersects ( possibleline , maplinks [ i ] ) ) {
27202807 intersection ++ ;
@@ -2755,7 +2842,7 @@ function wrapper(plugin_info) {
27552842 //console.log("FANPOINTS: " + pa + " - "+pb+" bearing: " + bearing + "° " + this.bearingWord(bearing));
27562843 // Check if Link is a jetlink and add second field
27572844 var thirds = [ ] ;
2758- if ( thisplugin . respectCurrentLinks ) {
2845+ if ( thisplugin . isRespectingIntel ( ) ) {
27592846 if ( possibleline . counts ) {
27602847 // thirds = this.getThirds(donelinks.concat(maplinks), possibleline.a, possibleline.b);
27612848 thirds = thisplugin . getThirds2 ( donelinks , maplinks , possibleline . a , possibleline . b ) ;
@@ -3021,7 +3108,7 @@ function wrapper(plugin_info) {
30213108
30223109 // Respect Intel
30233110 var buttonRespect =
3024- '<a class="plugin_fanfields2_btn" id="plugin_fanfields2_respectbtn" onclick="window.plugin.fanfields.toggleRespectCurrentLinks();" title="Question Conflict Data">Respect Intel: OFF </a> ' ;
3111+ '<a class="plugin_fanfields2_btn" id="plugin_fanfields2_respectbtn" onclick="window.plugin.fanfields.toggleRespectCurrentLinks();" title="Question Conflict Data">Respect Intel: NONE </a> ' ;
30253112
30263113 // Show link dir
30273114 var buttonLinkDirectionIndicator =
@@ -3101,6 +3188,8 @@ function wrapper(plugin_info) {
31013188 $ ( '#fanfields2' )
31023189 . append ( fanfields_buttons ) ;
31033190
3191+ thisplugin . updateRespectIntelButton ( ) ;
3192+
31043193 // window.pluginCreateHook('pluginBkmrksEdit');
31053194
31063195 // window.addHook('pluginBkmrksEdit', function (e) {
0 commit comments