mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Code cleanup of Concertina_wire module
This commit is contained in:
parent
2b3c936e99
commit
7bdfe03c92
@ -1,4 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_wire);
|
||||
_wire addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}];
|
||||
params ["_wire"];
|
||||
_wire addEventHandler ["HandleDamage", FUNC(handleDamage)];
|
||||
|
@ -8,10 +8,9 @@
|
||||
* 1: unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -22,7 +21,7 @@ private ["_wireNoGeo", "_dir", "_pos", "_wireNoGeoPos"];
|
||||
_wireNoGeo = "ACE_ConcertinaWireNoGeo" createVehicle [0,0,0];
|
||||
{
|
||||
_wireNoGeo animate [_x, 1];
|
||||
} foreach WIRE_FAST;
|
||||
} count WIRE_FAST;
|
||||
|
||||
GVAR(placer) = _unit;
|
||||
_dir = getDir _unit;
|
||||
@ -37,8 +36,9 @@ deleteVehicle _wirecoil;
|
||||
_unit setVariable [QGVAR(wireDeployed), false];
|
||||
|
||||
GVAR(deployPFH) = [{
|
||||
EXPLODE_3_PVT(_this select 0,_wireNoGeo,_wireNoGeoPos,_unit);
|
||||
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_wireNoGeo", "_wireNoGeoPos", "_unit"];
|
||||
|
||||
private ["_range", "_posStart", "_posEnd", "_dirVect", "_dir", "_anim", "_wire"];
|
||||
_posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL);
|
||||
_posEnd = (getPosASL _unit) vectorAdd (vectorDir _unit);
|
||||
@ -46,37 +46,38 @@ GVAR(deployPFH) = [{
|
||||
_dir = _dirVect call CBA_fnc_vectDir;
|
||||
_range = vectorMagnitude _dirVect;
|
||||
_anim = 0 max (1 - (_range / 12));
|
||||
|
||||
|
||||
if (!(alive _unit) || _range >= 12 || (_unit getVariable [QGVAR(wireDeployed), false])) exitWith {
|
||||
_wire = "ACE_ConcertinaWire" createvehicle [0, 0, 0];
|
||||
{
|
||||
_wire animate [_x, _anim];
|
||||
} foreach WIRE_FAST;
|
||||
|
||||
} count WIRE_FAST;
|
||||
|
||||
[{
|
||||
EXPLODE_5_PVT(_this select 0,_wireNoGeo,_wire,_anim,_dir,_wireNoGeoPos);
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_wireNoGeo", "_wire", "_anim", "_dir", "_wireNoGeoPos"];
|
||||
if (_wire animationPhase "wire_2" == _anim) then {
|
||||
deleteVehicle _wireNoGeo;
|
||||
_wire setDir _dir;
|
||||
_wire setPosASL _wireNoGeoPos;
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 0, [_wireNoGeo, _wire, _anim, _dir, _wireNoGeoPos]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler);
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
_wireNoGeo setDir _dir;
|
||||
{
|
||||
_wireNoGeo animate [_x, _anim];
|
||||
} foreach WIRE_FAST;
|
||||
} count WIRE_FAST;
|
||||
}, 0, [_wireNoGeo, _wireNoGeoPos, _unit]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
[localize "STR_ACE_ROLLWIRE", "", ""] call EFUNC(interaction,showMouseHint);
|
||||
|
||||
|
||||
GVAR(placer) setVariable [QGVAR(Deploy),
|
||||
[GVAR(placer), "DefaultAction",
|
||||
{GVAR(deployPFH) != -1},
|
||||
|
@ -8,10 +8,9 @@
|
||||
* 1: unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -21,8 +20,7 @@ if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exit
|
||||
_this call FUNC(dismount);
|
||||
}, _this] call EFUNC(common,execNextFrame);
|
||||
};
|
||||
|
||||
PARAMS_2(_wire,_unit);
|
||||
params ["_wire", "_unit"];
|
||||
|
||||
private ["_config", "_delay"];
|
||||
_config = (configFile >> "CfgVehicles" >> typeOf _unit);
|
||||
|
@ -7,10 +7,9 @@
|
||||
* 0: wire <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
@ -18,25 +17,26 @@ PARAMS_1(_wire);
|
||||
|
||||
{
|
||||
_wire animate [_x, 1];
|
||||
} foreach WIRE_FAST;
|
||||
} count WIRE_FAST;
|
||||
|
||||
[{
|
||||
EXPLODE_1_PVT(_this select 0,_wire);
|
||||
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_wire"];
|
||||
|
||||
if (_wire animationPhase "wire_2" == 1) then {
|
||||
private ["_dir", "_pos", "_wirecoil"];
|
||||
|
||||
|
||||
_dir = getDir _wire;
|
||||
_pos = getPosASL _wire;
|
||||
|
||||
|
||||
_wirecoil = "ACE_ConcertinaWireCoil" createvehicle [0, 0, 0];
|
||||
|
||||
deleteVehicle _wire;
|
||||
|
||||
|
||||
_wirecoil setDir _dir;
|
||||
_wirecoil setPosASL _pos;
|
||||
_wirecoil setVelocity [0, 0, 0];
|
||||
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 0, [_wire]] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -11,15 +11,12 @@
|
||||
* 4: projectile <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_5(_wire,_selectionName,_damage,_source,_projectile);
|
||||
|
||||
params ["_wire", "", "_damage", "_source", ""];
|
||||
if (_damage < 0.5) exitWith { 0 };
|
||||
|
||||
if (!(isNull _source)) then {
|
||||
|
@ -8,14 +8,12 @@
|
||||
* 1: killer (vehicle) <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_wire,_killer);
|
||||
params ["_wire", "_killer"];
|
||||
|
||||
private ["_distance", "_vehicle"];
|
||||
|
||||
|
@ -7,14 +7,12 @@
|
||||
* 1: vehicle <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_2(_wire,_vehicle);
|
||||
params ["_wire", "_vehicle"];
|
||||
|
||||
private ["_type", "_mode", "_anim", "_parts", "_selectionPart", "_selection", "_pos_w", "_dir_w"];
|
||||
|
||||
@ -43,8 +41,8 @@ _dir_w = getDir _wire;
|
||||
|
||||
if (_mode == 0) then {
|
||||
private ["_x", "_y", "_found", "_wireCheckPosAr", "_no"];
|
||||
_x = _pos_w select 0;
|
||||
_y = _pos_w select 1;
|
||||
_pos_w params ["_x","_y"];
|
||||
|
||||
// Check if two Single coils are placed next to each other (i.e playes have built a big wire obstacle)
|
||||
_wireCheckPosAr = [
|
||||
[_x + (sin (_dir_w+90) * 1.5),_y + (cos (_dir_w+90) * 1.5)],
|
||||
|
Loading…
Reference in New Issue
Block a user