Skip to content

Commit

Permalink
ajout d'un module avancé de saut en parachute
Browse files Browse the repository at this point in the history
  • Loading branch information
zgmrvn committed Jun 13, 2017
1 parent 42d159c commit bb97851
Show file tree
Hide file tree
Showing 12 changed files with 695 additions and 2 deletions.
75 changes: 75 additions & 0 deletions @corp_edition/addons/corp_edition_paradrop_advanced/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
CORP Edition addons
http://www.corp-arma.fr
*/

class CfgPatches {
class CORP_Edition_Paradrop_Advanced {
units[] = {"CORP_Module_Paradrop_Advanced"};
author = "CORP Modding Studio";
requiredVersion = 1.66;
requiredAddons[] = {"A3_Modules_F", "corp_edition_core"};
};
};

class CfgFunctions {
class CORP {
tag = "CORP";

class CORPEditionParadropAdvanced {
file = "\corp_edition_paradrop_advanced\functions";
class ParadropAdvanced_init {};
class ParadropAdvanced_uiStart {};
class ParadropAdvanced_uiStop {};
class ParadropAdvanced_server {};
class ParadropAdvanced_client {};
};
};
};

class CfgSounds {
class C130Engine {
name = "C130 Engine";
sound[] = {"\corp_edition_paradrop_advanced\data\sounds\ext_engine_low.wss", 1, 1};
titles[] = {0, ""};
};
};

class CfgVehicles {
class Logic;
class Module_F: Logic {
class AttributesBase {
class Checkbox;
};

class ModuleDescription {
class AnyStaticObject;
};
};

class CORP_Module_Paradrop_Advanced: Module_F {
scope = 2;
displayName = $STR_CORP_PARADROP_ADVANCED_DN;
icon = "\corp_edition_paradrop_advanced\icon.paa";
category = "CORP_Modules";

function = "CORP_fnc_paradropAdvanced_init";
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
isDisposable = 0;
is3DEN = 0;

class Attributes: AttributesBase {
class CustomDrop: Checkbox {
property = "CORP_Module_ParadropAdvanced_CustomDrop";
displayName = $STR_CORP_PARADROP_ADVANCED_CUSTOM_DROP_DN;
description = $STR_CORP_PARADROP_ADVANCED_CUSTOM_DROP_DESC;
typeName = "BOOL";
defaultValue = "false";
};
};
};
};

#include "ui\ui.hpp"
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
CORP Edition addons
http://www.corp-arma.fr
*/

private _c130j = param [0, objNull, [objNull]];
private _delay = param [1, 0, [0]];

sleep _delay;

// préparation de l'objet auquel le joueur sera attaché (téléporté)
private _helper = "Sign_Sphere10cm_F" createVehicleLocal [0, 0, 0];
_helper setPosASL (getPosASL _c130j);
_helper setDir (getDir _c130j);
_helper hideObject true;

// fondu de sortie
cutText ["", "BLACK OUT", 1];
1 fadeSound 0;
sleep 1;

// téléportation
player attachTo [_helper, [0, -8, 1.2]];

// fondu d'entrée
sleep 0.5;
cutText ["", "BLACK IN", 1];
1 fadeSound 1;

// on détache le joueur et supprime le helper
detach player;
deleteVehicle _helper;

// tant que le joueur est à moins de 1000 mètres de l'avion on joue le son des moteurs
_c130j spawn {
while {(player distance _this) < 1000} do {
_this say3D ["C130Engine", 400];

sleep 7.1;
};
};

// détection lorsque le joueur sors de l'avion
_c130j spawn {
_bearing = getDir _this;
waitUntil {(((getposASL player) vectorDiff (getPosASL _this)) select 2) <= 0};

player allowDamage false;

// phase d'ajustement de la vélocité pour simuler la perte de vitesse par rapport à l'avion
{
sleep (_x select 0);
player setVelocity [((sin _bearing) * (_x select 1)), ((cos _bearing) * (_x select 1)), (velocity player) select 2];
} forEach [
[0.5, 8],
[0.5, 12],
[0.5, 20],
[0.5, 30],
[0.5, 40],
[0.5, 50],
[0.5, 70],
[1.5, 70]
];

sleep 1;

player allowDamage true;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
CORP Edition addons
http://www.corp-arma.fr
*/

private _logic = param [0, objNull, [objNull]];
private _objects = param [1, [], [[]]];

//private _customDrop = _logic getVariable ["CustomDrop", false];
private _actions = [];
private _planes = [];

{
if (typeOf _x == "C130J_static_EP1") then {
_planes pushBack _x;
} else {
_actions pushBack _x;
};
} forEach _objects;

// serveur
if (isServer) then {
private _drops = [];

{
_drops pushBack [getPosATL _x, getDir _x];
deleteVehicle _x;
} forEach _planes;

_logic setVariable ["Drops", _drops, true];
};

// joueur
if (hasInterface) then {
{
_x addAction [
"<t color='#ffffff'><img image='\corp_edition_paradrop_advanced\icon.paa'/> Saut en parachute avancé</t>",
{
CORP_var_paradropAdvanced_object = _this select 0;
CORP_var_paradropAdvanced_logic = _this select 3;
createDialog "CORP_ParadropAdvancedDialog";
},
_logic,
100,
true,
false,
"",
"(player distance _target) < 5"
];
} forEach _actions;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
CORP Edition addons
http://www.corp-arma.fr
*/

private _playerPosition = param [0, [0, 0, 0], [[]], 3];
private _finalPosition = param [1, [0, 0, 0], [[]], 3];
private _bearing = param [2, 0, [0]];

// création de l'avion à proximité du joueur pour forcer la transmission des paramètres sur le réseau
private _c130j = createVehicle ["C130J_static_EP1", _playerPosition, [], 0, "CAN_COLLIDE"];
_c130j setDir _bearing;

sleep 1;

// on place l'avion à sa position définitive
_c130j setPosASL _finalPosition;

// on attend qu'il y ait des joueurs dans l'avion
waitUntil {(count (nearestObjects [_c130j, ["Man"], 50])) > 0};

// on attend qu'il n'y ait plus de joueurs dans l'avion
waitUntil {(count (nearestObjects [_c130j, ["Man"], 50])) == 0};

sleep 10;

// on supprime l'avion
deleteVehicle _c130j;
Loading

0 comments on commit bb97851

Please sign in to comment.