Skip to content

Instantly share code, notes, and snippets.

@pennyworth12345
Last active June 13, 2016 06:16
Show Gist options
  • Save pennyworth12345/f6e6150d0db2715314eebf2b58db7dac to your computer and use it in GitHub Desktop.
Save pennyworth12345/f6e6150d0db2715314eebf2b58db7dac to your computer and use it in GitHub Desktop.
//+ icons for all surfaces within a grid of _size of the player, spaced out at a distance of _spacing
//only showing names of surfaces within 5 meters of player to avoid clutter
availableColors = [
[1,1,1,1],
[0,0,0,1],
[1,0,0,1],
[0,1,0,1],
[0,0,1,1],
[1,1,0,1],
[1,0,1,1],
[0,1,1,1],
[1,0.5,0,1],
[1,0,0.5,1],
[0.5,1,0,1],
[0,1,0.5,1],
[0.5,0,1,1],
[0,0.5,1,1]
];
surfacesUsed = [];
surfaceIcons = addMissionEventHandler ["Draw3D", {
_spacing = 1;
_size = 15;
for "_i" from (_size * -1) to _size step _spacing do {
for "_j" from (_size * -1) to _size step _spacing do {
_pos = player modelToWorldVisual [_i, _j];
_pos set [2, getTerrainHeightASL _pos];
_pos = ASLToAGL _pos;
_surface = surfaceType _pos;
_surfaceIndex = surfacesUsed find _surface;
if(_surfaceIndex isEqualTo -1) then {
_surfaceIndex = count surfacesUsed;
surfacesUsed pushBackUnique _surface;
};
_dist = player distance _pos;
_color = availableColors select _surfaceIndex;
_color set [3, -abs(_dist * (1/_size)) + 1];
if(_dist <= 5) then {
drawIcon3D ["\a3\ui_f\data\gui\cfg\cursors\add_gs.paa", _color, _pos, 0.75, 0.75, 0, _surface];
} else {
drawIcon3D ["\a3\ui_f\data\gui\cfg\cursors\add_gs.paa", _color, _pos, 0.75, 0.75, 0];
};
};
};
}];
//removed with
removeMissionEventHandler ["Draw3D", surfaceIcons];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment