tweaks, carry static weapons

This commit is contained in:
commy2 2015-03-18 13:36:22 +01:00
parent ac8ff45d44
commit c23c0788f6
7 changed files with 51 additions and 4 deletions

View File

@ -18,8 +18,8 @@ private "_position";
_position = getPos _this;
// don't place the object below the ground
if (_position select 2 < 0) then {
_position set [2, 0];
if (_position select 2 < -0.1) then {
_position set [2, -0.1];
_this setPos _position;
};

View File

@ -13,6 +13,16 @@ class Extended_PostInit_EventHandlers {
};
class Extended_Init_EventHandlers {
class StaticWeapon {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class StaticMortar {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class ReammoBox_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));

View File

@ -1,5 +1,35 @@
class CfgVehicles {
// Static weapons
class LandVehicle;
class StaticWeapon: LandVehicle {
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1.2,0};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
};
//remove actions from Taru Pods
class Pod_Heli_Transport_04_base_F: StaticWeapon {
GVAR(canCarry) = 0;
GVAR(canDrag) = 0;
};
class StaticMortar;
class Mortar_01_base_F: StaticMortar {
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1.2,0};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
};
// ammo boxes
class ThingX;
class ReammoBox_F: ThingX {
XEH_ENABLED;

View File

@ -31,6 +31,12 @@ private ["_position", "_direction"];
_position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
_direction = _target getVariable [QGVAR(carryDirection), 0];
// add height offset of model
private "_offset";
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset];
// attach object
_target attachTo [_unit, _position];
_target setDir _direction;

View File

@ -27,6 +27,7 @@ _inBuilding = [_unit] call FUNC(isObjectOnObject);
_unit playAction "released";
// prevent collision damage
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
// release object

View File

@ -18,7 +18,7 @@ private ["_objectType","_actionsVarName"];
_objectType = _target;
if (typeName _target == "OBJECT") then {
_objectType = typeOf _target;
};systemChat _objectType;
};
_actionsVarName = format [QGVAR(Act_%1), _objectType];
// Exit if the action menu is already compiled for this class

View File

@ -13,7 +13,7 @@
EXPLODE_2_PVT(_this,_player,_target);
// Return true for static weapons if they have been fired once
// Return true for static weapons if they have been fired once, @todo 1.40 this work-around doesn't work anymore
if (_target isKindOf "StaticWeapon") exitWith {
(currentMagazine _target) != ""
};