Styled Service Point

Insert this code into the initialization field of an object and designate that object as M9SD_mainCrate_RRR

Following this, position a diminutive object atop the aforementioned one. Within the initialization field of the small object, input the following code:

[this, M9SD_mainCrate_RRR] call BIS_fnc_attachToRelative;

Now put this code in the init field of the object you named M9SD_mainCrate_RRR:

Code
M9SD_mainCrate_RRR = this;  
publicVariable 'M9SD_mainCrate_RRR';  
private _faradayCage = M9SD_mainCrate_RRR;   
M9SD_fnc_addFaradayArsenalActions =   
{  
 params [['_faradayCage', objNull]];  
 if (isNull _faradayCage) exitWith {};   
 if (_faradayCage getVariable ['M9SD_hasAIOArsenalActions_serviceStation', false]) exitWith {};  
 _faradayCage setVariable ['M9SD_hasAIOArsenalActions_serviceStation', true, true];  
 if (isNil 'M9SD_AIOArsenal_JIPCount') then   
 {  
  M9SD_AIOArsenal_JIPCount = 0;  
 };  
 M9SD_AIOArsenal_JIPCount = M9SD_AIOArsenal_JIPCount + 1;  
 publicVariable 'M9SD_AIOArsenal_JIPCount';  
 private _uniqueJIP = format ['M9SD_JIP_AIOArsenalActions_%1', M9SD_AIOArsenal_JIPCount];  
 [[_faradayCage, _uniqueJIP],  
 {  
  if (!hasInterface) exitWith {};  
  waitUntil {!isNil {player} && {!isNull player}};  
  params [['_faradayCage', objNull], ['_uniqueJIP', '']];  
  if (isNull _faradayCage) exitWith {remoteExec ['', _uniqueJIP]};  
  [ 
   _faradayCage, 
   ["<t color='#FFFFFF' size='1.4'><img image='\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\repair_ca.paa'></img><t color='#ffd700' size='1.4' font='puristaBold'> Repair</t>",  
   { 
    playSound ['beep_target', true]; 
    playSound ['beep_target', false]; 
    private _soundSource = vehicle player; 
    private _range = 28 * 2; 
    private _position = getPosWorld _soundSource; 
    playSound3D ["a3\sounds_f\sfx\ui\vehicles\vehicle_repair.wss", _soundSource, false, _position, 5, 1, _range]; 
    playSound3D ["a3\sounds_f_orange\missionsfx\pastambiences\carpenter\orange_carpentershop_tools_02.wss", _soundSource, false, _position, 5, 1, _range]; 
    [vehicle player, 1] remoteExec ['setVehicleArmor']; 
    [vehicle player, 0] remoteExec ['setDamage']; 
    0 = [] spawn  
    { 
     for '_i' from 1 to 12 do  
     { 
      (format ['arsenalNotification%1', _i]) cutFadeOut 0; 
     }; 
     'arsenalNotification9' cutFadeOut 0;  
     'arsenalNotification9' cutText ["<t color='#ffd700' font='puristaMedium' shadow='2' size='1.4'>Vehicle Repaired.</t>", "PLAIN DOWN", -1, true, true]; 
     uiSleep 3.5; 
     'arsenalNotification9' cutFadeOut 0.35; 
    }; 
    playSound ['hintExpand', true]; 
    playSound ['hintExpand', false]; 
   }, nil, 7777, true, true, "", "(_this != vehicle _this)", 28] 
  ] remoteExec ['addAction', player, _faradayCage]; 
  [ 
   _faradayCage, 
   ["<t color='#FFFFFF' size='1.4'><img image='\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\rearm_ca.paa'></img><t color='#ffd700' size='1.4' font='puristaBold'> Rearm</t>",  
   { 
    playSound ['beep_target', true]; 
    playSound ['beep_target', false]; 
    [vehicle player, 1] remoteExec ['setVehicleAmmo']; 
    private _soundSource = vehicle player; 
    private _range = 28 * 2; 
    private _position = getPosWorld _soundSource; 
    playSound3D ["a3\sounds_f\weapons\Mortar\mortar_reload_01.wss", _soundSource, false, _position, 5, 1, _range]; 
    playSound3D ["a3\sounds_f\weapons\Zafir\zafir_reload.wss", _soundSource, false, _position, 5, 1, _range]; 
    0 = [] spawn  
    { 
     for '_i' from 1 to 12 do  
     { 
      (format ['arsenalNotification%1', _i]) cutFadeOut 0; 
     }; 
     'arsenalNotification10' cutFadeOut 0;  
     'arsenalNotification10' cutText ["<t color='#ffd700' font='puristaMedium' shadow='2' size='1.4'>Vehicle Rearmed.</t>", "PLAIN DOWN", -1, true, true]; 
     uiSleep 3.5; 
     'arsenalNotification10' cutFadeOut 0.35; 
    }; 
    playSound ['hintExpand', true]; 
    playSound ['hintExpand', false]; 
   }, nil, 7777, true, true, "", "(_this != vehicle _this)", 28] 
  ] remoteExec ['addAction', player, _faradayCage]; 
  [ 
   _faradayCage, 
   ["<t color='#FFFFFF' size='1.4'><img image='\A3\ui_f\data\IGUI\Cfg\simpleTasks\types\refuel_ca.paa'></img><t color='#ffd700' size='1.4' font='puristaBold'> Refuel</t>",  
   { 
    playSound ['beep_target', true]; 
    playSound ['beep_target', false]; 
    [vehicle player, 1] remoteExec ['setFuel']; 
    private _soundSource = vehicle player; 
    private _range = 28 * 2; 
    private _position = getPosWorld _soundSource; 
    playSound3D ["a3\missions_f_epa\data\sounds\fall_into_water.wss", _soundSource, false, _position, 5, 1, _range]; 
    playSound3D ["a3\missions_f_oldman\data\sound\refueling\refueling_loop.wss", _soundSource, false, _position, 5, 1, _range]; 
    playSound3D ["a3\missions_f_oldman\data\sound\refueling\refueling_start.wss", _soundSource, false, _position, 5, 1, _range]; 
    comment "playSound3D ['a3\missions_f_oldman\data\sound\refueling\refueling_end.wss', _soundSource, false, _position, 5, 1, _range];"; 
    0 = [] spawn  
    { 
     for '_i' from 1 to 12 do  
     { 
      (format ['arsenalNotification%1', _i]) cutFadeOut 0; 
     }; 
     'arsenalNotification11' cutFadeOut 0;  
     'arsenalNotification11' cutText ["<t color='#ffd700' font='puristaMedium' shadow='2' size='1.4'>Vehicle Refueled.</t>", "PLAIN DOWN", -1, true, true]; 
     uiSleep 3.5; 
     'arsenalNotification11' cutFadeOut 0.35; 
    }; 
    playSound ['hintExpand', true]; 
    playSound ['hintExpand', false]; 
   }, nil, 7777, true, true, "", "(_this != vehicle _this)", 28] 
  ] remoteExec ['addAction', player, _faradayCage]; 
 }] remoteExec ['spawn', 0, _uniqueJIP]; 
};  
comment "_faradayCage setVariable ['M9SD_hasArsenalActions', false, true];";  
[_faradayCage] call M9SD_fnc_addFaradayArsenalActions;  
M9SD_fnc_addFaradayMarkers =   
{  
 params [['_faradayCage', objNull]];  
 if (isNull _faradayCage) exitWith {};  
 if (_faradayCage getVariable ['M9SD_hasMarkers', false]) exitWith {};  
 _faradayCage setVariable ['M9SD_hasMarkers', true, true];  
 if (isNil 'M9SD_Arsenals') then   
 {  
  M9SD_Arsenals = [];  
 };  
 M9SD_Arsenals pushBackUnique _faradayCage;  
 publicVariable 'M9SD_Arsenals';   
 [M9SD_Arsenals,  
 {  
  if (!hasInterface) exitWith {};  
  waitUntil { !isNil { player } && { !isNull player } };  
  waitUntil { !isNull (findDisplay 46) };  
  if (isNil 'M9SD_Arsenals') then   
  {  
   M9SD_Arsenals = _this;  
  };  
  if (not (isNil 'M9SD_EH_drawArsenal3D')) then   
  {  
   removeMissionEventHandler ['Draw3D', M9SD_EH_drawArsenal3D];  
  };  
  M9SD_EH_drawArsenal3D = addMissionEventHandler ['Draw3D',   
  {  
   if (count M9SD_Arsenals == 0) exitWith {};  
   {  
    if (!isNull _x) then   
    {  
     if ((_x == cursorObject) or (_x == cursorTarget)) then   
     {  
      if ((_x distance (vehicle player)) <= 28) then   
      {  
       private _position = getPos _x;        
       private _offsetX = 0;  
       private _offsetY = -0.07;  
       private _drawSideArrows = false;  
       private _texture = '\A3\ui_f\data\logos\arsenal_1024_ca.paa';  
       _position set [2, (_position # 2) + 3.3];  
       private _width = 0.8;  
       private _height = 0.8;  
       private _angle = 0;  
       private _text = '';  
       private _textSize = 0.05;  
       private _font = 'PuristaSemiBold';  
       private _textAlign = 'center';  
       private _shadow = 2;  
       drawIcon3D   
       [  
        '\a3\3den\data\displays\display3den\entitymenu\arsenal_ca.paa',  
        [1,1,1,1],  
        _position,  
        _width,   
        _height,   
        _angle,  
        '',  
        _shadow,  
        _textSize,  
        _font,  
        _textAlign,  
        _drawSideArrows,  
        _offsetX,  
        _offsetY  
       ];  
       M9SD_arsenalIconText = if (player == vehicle player) then {'Service Station'} else {'Service Station'};  
       drawIcon3D   
       [  
        '',  
        [1,0.9,0,1],  
        _position,  
        _width,   
        _height,   
        _angle,  
        M9SD_arsenalIconText,  
        _shadow,  
        _textSize,  
        _font,  
        _textAlign,  
        _drawSideArrows,  
        _offsetX,  
        _offsetY  
       ];  
      };  
     };  
    };  
   } forEach M9SD_Arsenals;  
  }];  
  waitUntil {!isNull (findDisplay 12 displayCtrl 51)};  
  if (!isNil "M9SD_EH_drawArsenal2D") then   
  {  
   (findDisplay 12 displayCtrl 51) ctrlRemoveEventHandler ["Draw", M9SD_EH_drawArsenal2D];  
  };  
  M9SD_EH_drawArsenal2D = (findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["Draw",   
  {  
   if (count M9SD_Arsenals == 0) exitWith {};  
   {  
    if (!isNull _x) then   
    {  
     private _iconPath = 'a3\ui_f\data\logos\a_64_ca.paa';  
     M9SD_arsenalIconText = if ((((_this select 0) ctrlMapWorldToScreen (_x modelToWorldVisual [0,0,0])) distance2D getMousePosition) > 0.02) then {""} else {if (player == vehicle player) then {'Service Station'} else {'Service Station'}};  
     private _pos = _x modelToWorldVisual [0,0,0];  
     private _color = [1, 0.9, 0, 1];  
     _this select 0 drawIcon  
     [  
      _iconPath,  
      _color,  
      _pos,  
      20,  
      20,  
      0,  
      M9SD_arsenalIconText,  
      1,  
      0.05,  
      "PuristaBold",  
      "left"  
     ];  
     _color = [1,1,1,1];  
     _this select 0 drawIcon  
     [  
      _iconPath,  
      _color,  
      _pos,  
      20,  
      20,  
      0,  
      '',  
      1,  
      0.05,  
      "PuristaSemiBold",  
      "left"  
     ];  
    };  
   } foreach M9SD_Arsenals;  
  }];  
 }] remoteExec ['spawn', 0, 'M9SD_JIP_AIOArsenalIcons_serviceStation'];  
 comment "  
 M9SD_Arsenals = [];  
 publicVariable 'M9SD_Arsenals';  
 remoteExec ['', 'M9SD_JIP_arsenalIcons_3D'];  
 ";  
};  
[_faradayCage] call M9SD_fnc_addFaradayMarkers;  
['init',_faradayCage,[10,0,0]] call bis_fnc_3DENAttributeDoorStates;  
[_faradayCage, 1, 1] call BIS_fnc_door;  
[_faradayCage, 2, 1] call BIS_fnc_door;  
[_faradayCage, false] remoteExec ['allowDamage'];  
{  
 [_x, false] remoteExec ['allowDamage'];  
} forEach attachedObjects _faradayCage;

I want to note I did not write this code here is the original mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2760602147

Last updated