69 lines
2.2 KiB
Plaintext
69 lines
2.2 KiB
Plaintext
/*
|
|
Author: Djeeberjr
|
|
|
|
Description:
|
|
Inits a plane to be ready to use
|
|
|
|
Parameter(s):
|
|
0: OBJECT - the main gamelogic
|
|
1: SCALAR - the hight of the plane
|
|
*/
|
|
params ["_gl","_hight"];
|
|
|
|
// Get synced objects
|
|
_trigger = ([_gl,"myPlanetNeedsMe"] call Dlib_fnc_getSyncTypeTrigger)#0;
|
|
_greenLight = ([_gl,"PortableHelipadLight_01_green_F"] call DLib_fnc_getSyncClass)#0;
|
|
_redLight = ([_gl,"PortableHelipadLight_01_red_F"] call DLib_fnc_getSyncClass)#0;
|
|
_spawn = ([_gl,"spawn"] call DLib_fnc_getSyncType)#0#0;
|
|
_plane = ([_gl,"C130J_static_EP1"] call DLib_fnc_getSyncClass)#0;
|
|
|
|
// Attach light to plane
|
|
[_greenLight,_plane] call DLIB_fnc_attachToRelative;
|
|
[_redLight,_plane] call DLIB_fnc_attachToRelative;
|
|
|
|
// Move all the stuff up into the air
|
|
_plane setPos ((getPos _plane) vectorAdd [0,0,_hight]);
|
|
_spawn setPos ((getPos _spawn) vectorAdd [0,0,_hight]);
|
|
_trigger setPos ((getPos _trigger) vectorAdd [0,0,_hight]);
|
|
|
|
// create sound source
|
|
_soundSources = [];
|
|
{
|
|
_soundSources pushBack (createSoundSource ["DLIB_pj_planeLoop", (getpos (_x#0)) vectorAdd [0,0,_hight] , [], 0]);
|
|
} forEach ([_gl,"soundSource"] call DLib_fnc_getSyncType);
|
|
|
|
// Setup trigger
|
|
_trigger setTriggerStatements ["this","
|
|
{
|
|
_x setVelocity "+ str (vectorDir _plane vectorMultiply 50) + ";
|
|
} forEach thisList;
|
|
resetCamShake;
|
|
",""];
|
|
|
|
// setup lights
|
|
_greenLight setDamage 1;
|
|
_redLight setDamage 1;
|
|
|
|
// _greenLight setObjectMaterial [0,"a3\structures_f_heli\items\airport\data\portablehelipadlight_01.rvmat"];
|
|
_redLight setObjectMaterial [0,"a3\data_f\lights\building_landinglights_green.rvmat"];
|
|
|
|
// Create light source
|
|
|
|
_lightsource = "#lightpoint" createVehicleLocal (getPos _redLight);
|
|
_lightsource setLightBrightness 0.2;
|
|
_lightsource setLightAmbient [1.0, 0.0, 0.0];
|
|
_lightsource setLightColor [1.0, 0.0, 0.0];
|
|
_lightsource lightAttachObject [_redLight, [0,0,0]];
|
|
|
|
// Save objects in gl
|
|
_gl setVariable ["DLib_pj_trigger",_trigger];
|
|
_gl setVariable ["DLib_pj_greenLight",_greenLight];
|
|
_gl setVariable ["DLib_pj_redLight",_redLight];
|
|
_gl setVariable ["DLib_pj_spawn",_spawn];
|
|
_gl setVariable ["DLib_pj_plane",_plane];
|
|
_gl setVariable ["DLib_pj_lightSource",_lightSource];
|
|
_gl setVariable ["DLib_pj_soundSource",_soundSources];
|
|
|
|
|
|
|