Introduced HaloParachute

Implemented HaloParachute
This commit is contained in:
Bjanski 2016-04-13 20:25:26 +02:00
parent c1eb50ed51
commit 99ae0791de
7 changed files with 219 additions and 0 deletions

View File

@ -0,0 +1,28 @@
/*
CfgFunctions.cpp
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
class HaloParachute
{
file = "ExHP\Functions";
class ejectPlayer {};
class pullParachute {};
class showEject {};
class showParachute {};
class customize {file = "ExAd\HaloParachute\postInit.sqf"; postInit = 1;};
};

View File

@ -0,0 +1,35 @@
/*
fn_ejectPayer.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
private ["_vehicleObj", "_push", "_vecDir"];
_vehicleObj = vehicle player;
if (_vehicleObj == player) exitWith {false};
moveOut player;
_push = if (_vehicleObj isKindOf "Plane") then {
player setDir getDir _vehicleObj;
((vectorUp _vehicleObj) vectorMultiply 40)
} else {
_vecDir = (getPosASL player) vectorDiff (getPosASL _vehicleObj);
(_vecDir vectorMultiply (5 / vectorMagnitude _vecDir))
};
player setVelocity ((velocity player) vectorAdd _push);
true

View File

@ -0,0 +1,36 @@
/*
fn_pullParachute.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
private ["_parachuteObject"];
waitUntil {sleep 0.1; {player distance _x < 10 max (sizeOf typeOf _x)} count (player nearEntities ["Helicopter_Base_F", 20]) == 0};
if (!alive player || vehicle player != player) exitWith {};
_parachuteObject = createVehicle ["Steerable_Parachute_F", getPosATL player, [], 0, "CAN_COLLIDE"];
_parachuteObject setDir getDir player;
_parachuteObject disableCollisionWith player;
player action ["GetinDriver", _parachuteObject];
player switchmove "";
player switchmove "HaloFreeFall_non";
player setVelocity [(sin (getDir player)) * 50, (cos (getDir player)) * 50, -5];
ExileJobParachuteFix = [0.25, ExileClient_object_player_parachuteFix, [], true] call ExileClient_system_thread_addtask;
true

View File

@ -0,0 +1,27 @@
/*
fn_showEject.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
if(vehicle player == player)exitWith{false};
_condition = false;
if((getPos player) select 2 > ExAd_ACTION_EJECT_HEIGHT)then{
_role = assignedVehicleRole player;
_condition = if(count _role > 0)then{if(_role select 0 == "cargo")then{false}else{true}}else{true}
};
_condition

View File

@ -0,0 +1,34 @@
/*
fn_showParachute.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
if(vehicle player != player)exitWith{false};
_condition = false;
if((getPos player) select 2 > ExAd_ACTION_PARACHUTE_HEIGHT)then{
_states = [
"ladderriflestatic",
"ladderrifledownloop",
"ladderrifleuploop",
"laddercivilstatic",
"laddercivildownloop",
"ladderciviluploop"
];
_condition = !((animationState player) in _states);
};
_condition

View File

@ -0,0 +1,22 @@
/*
customize.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
ExAd_ACTION_PARACHUTE_HEIGHT = 10;
ExAd_ACTION_EJECT_HEIGHT = 100;

View File

@ -0,0 +1,37 @@
/*
postInit.sqf
Copyright 2016 Jan Babor
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
execVM "ExAdClient\HaloParachute\customize.sqf";
[] spawn {
while {true} do {
waitUntil{!isNil "ExileClientLoadedIn"};
UISleep 0.1;
waitUntil{ExileClientLoadedIn};
UISleep 0.1;
waitUntil{alive player};
ExAd_ACTION_PARACHUTE = player addaction ["<t color='#E48A36'><img image='\a3\ui_f\data\gui\cfg\CommunicationMenu\supplydrop_ca.paa' /> Open Parachute!</t>", "call ExAd_fnc_pullParachute", [], 6, true, true, "", "call ExAd_fnc_showParachute"];
ExAd_ACTION_EJECT = player addaction ["<t color='#E48A36'><img image='\a3\ui_f\data\gui\cfg\CommunicationMenu\supplydrop_ca.paa' /> Halo Jump</t>", "call ExAd_fnc_ejectPlayer", [], 6, false, true, "", "call ExAd_fnc_showEject;"];
waitUntil{!alive player};
player removeAction ExAd_ACTION_PARACHUTE;
player removeAction ExAd_ACTION_EJECT;
}
};