Name | Type | is_array | initial_value |
library IsWalkabilityOff//by Duckfarter
/* Configuration
¯¯¯¯¯¯¯¯¯¯¯¯¯ */
globals
private constant integer WALK_CHECKER = 'iWO0'
private constant integer WALK_CHECK = 'iWO1'
private constant integer WALK_CHECK_TERRAIN = 'iWO2'
private constant player WALK_PLAYER = Player(PLAYER_NEUTRAL_PASSIVE)
private constant boolean SHARED_CONTROL_WALK_PLAYER = true
endglobals
/*
IsWalkabilityOff 1.3
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Description:
¯¯¯¯¯¯¯¯¯¯¯¯
Contains two distinct functions for detecting if pathing type walkability is off that includes
destructible and building pathing
API:
¯¯¯¯
1. Used for checking if walkability is off at certain xy, including units
| function IsWalkabilityOff takes real x, real y returns boolean
2. Used for checking if walkability is off at certain cell containing xy, excluding units
| function IsTerrainWalkabilityOff takes real x, real y returns boolean
NOTE: Requires other players to have SHARED_CONTROL_WALK_PLAYER towards WALK_PLAYER to
exclude units. This is handled by the system at map init, though if overwritten it will stop
excluding units. In short, only use set aspect of alliance towards WALK_PLAYER and dont turn
off ALLIANCE_SHARED_CONTROL towards WALK_PLAYER.
How to import:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯
1. Copy units WalkCheck ID: iWO1, WalkCheckTerrain ID: iWO2 and WalkChecker ID: iWO0
2. Copy category/trigger IsWalkabilityOff 1.3
Credits:
¯¯¯¯¯¯¯¯
- Kazeon for PathingLib which this library is based on.
Link:
¯¯¯¯¯
https://www.hiveworkshop.com/threads/iswalkabilityoff-1-3.354129/
*/
globals
private unit walkChecker
endglobals
function IsWalkabilityOff takes real x, real y returns boolean
return IssueBuildOrderById(walkChecker, WALK_CHECK, x, y)
endfunction
function IsTerrainWalkabilityOff takes real x, real y returns boolean
return IssueBuildOrderById(walkChecker, WALK_CHECK_TERRAIN, x, y)
endfunction
private function SharedControlWalkPlayer takes nothing returns nothing
call SetPlayerAllianceBJ(GetEnumPlayer(), ALLIANCE_SHARED_CONTROL, true, WALK_PLAYER)
endfunction
private module Init
private static method onInit takes nothing returns nothing
call init()
endmethod
endmodule
private struct InitStruct extends array
private static method init takes nothing returns nothing
set walkChecker = CreateUnit(WALK_PLAYER, WALK_CHECKER, 0, 0, 0)
call BlzPauseUnitEx(walkChecker, true)
call ShowUnit(walkChecker, false)
if SHARED_CONTROL_WALK_PLAYER then
call ForForce(GetPlayersAll(), function SharedControlWalkPlayer)
endif
endmethod
implement Init
endstruct
endlibrary