Working save.

This commit is contained in:
jaynus 2015-04-07 12:11:28 -07:00
parent 6deff125ce
commit 2ea7ecdbf7
8 changed files with 46 additions and 25 deletions

View File

@ -9,3 +9,11 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_post_init)); init = QUOTE(call COMPILE_FILE(XEH_post_init));
}; };
}; };
class Extended_Init_EventHandlers {
class LaserTargetBase {
class ADDON {
init = QUOTE(_this call DFUNC(laser_init));
};
};
};

View File

@ -14,13 +14,11 @@ PREP(translateToWeaponSpace);
PREP(laser_init); PREP(laser_init);
GVAR(laser) = nil; // a single hud draws 1 laser at a time
PREP(laserTargetPFH); PREP(laserTargetPFH);
ACE_LASERS = []; ACE_LASERS = [];
ACE_DEFAULT_LASER_CODE = 1000; ACE_DEFAULT_LASER_CODE = 1001;
ACE_DEFAULT_FIRE_SELECTION = [FIREMODE_DIRECT_LOAL, ACE_DEFAULT_LASER_CODE]; ACE_DEFAULT_FIRE_SELECTION = [FIREMODE_DIRECT_LOAL, ACE_DEFAULT_LASER_CODE];
FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; FUNC(getPosASL) = {visiblePositionASL (_this select 0)};

View File

@ -16,9 +16,9 @@ REM(ACE_LASERS, objNull);
if(!(local _laserTarget)) exitWith { }; if(!(local _laserTarget)) exitWith { };
// The target is local, so its on this client // The target is local, so its on this client
if(!isDedicated) then { if(!isDedicated) then {
_laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", player, true]; _laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", ACE_player, true];
[FUNC(laserTargetPFH), 0, [_laserTarget, player]] call cba_fnc_addPerFrameHandler; //[FUNC(laserTargetPFH), 0, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler;
} else { } else {
// server side ownership of laser // server side ownership of laser
//_laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", nil, false]; //_laserTarget setVariable ["ACE_LASERTARGET_SHOOTER", nil, false];

View File

@ -6,6 +6,6 @@ PREP(laserHudDesignateOff);
PREP(unitTurretHasDesignator); PREP(unitTurretHasDesignator);
GVAR(laser) = nil; GVAR(laser) = nil;
GVAR(laserActive) = false; GVAR(active) = false;
FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; FUNC(getPosASL) = {visiblePositionASL (_this select 0)};

View File

@ -28,7 +28,7 @@ GVAR(initializedClasses) = _initializedClasses;
if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) exitWith { if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) exitWith {
// @todo: Add the state variables to the vehicle, instead of to the client // @todo: Add the state variables to the vehicle, instead of to the client
// e.g.: _vehicle setVariable [format ["%1_%2", QGVAR(laserActive), _x], false]; // e.g.: _vehicle setVariable [format ["%1_%2", QGVAR(active), _x], false];
// Add actions // Add actions
_onAction = [QGVAR(LaserOn), localize "STR_ACE_Laser_SelfDesignate_DesignatorOn", "", _onAction = [QGVAR(LaserOn), localize "STR_ACE_Laser_SelfDesignate_DesignatorOn", "",
@ -38,7 +38,7 @@ GVAR(initializedClasses) = _initializedClasses;
}, },
{ {
// Condition // Condition
!GVAR(laserActive) && {[ACE_player] call FUNC(unitTurretHasDesignator)} !GVAR(active) && {[ACE_player] call FUNC(unitTurretHasDesignator)}
}] call EFUNC(interact_menu,createAction); }] call EFUNC(interact_menu,createAction);
_offAction = [QGVAR(LaserOff), localize "STR_ACE_Laser_SelfDesignate_DesignatorOff", "", _offAction = [QGVAR(LaserOff), localize "STR_ACE_Laser_SelfDesignate_DesignatorOff", "",
@ -48,7 +48,7 @@ GVAR(initializedClasses) = _initializedClasses;
}, },
{ {
// Condition // Condition
GVAR(laserActive) && {[ACE_player] call FUNC(unitTurretHasDesignator)} GVAR(active) && {[ACE_player] call FUNC(unitTurretHasDesignator)}
}] call EFUNC(interact_menu,createAction); }] call EFUNC(interact_menu,createAction);
[_type, 1, ["ACE_SelfActions"], _onAction] call EFUNC(interact_menu,addActionToClass); [_type, 1, ["ACE_SelfActions"], _onAction] call EFUNC(interact_menu,addActionToClass);

View File

@ -1,8 +1,11 @@
#include "script_component.hpp" #include "script_component.hpp"
if( (count _this) > 2) then { if(!isNil "_this") then {
EXPLODE_3_PVT((_this select 0),_vehicle,_shooter,_laserTarget); if( (count _this) > 2) then {
_vehicle setVariable[QGVAR(currentTarget), [], true]; EXPLODE_3_PVT((_this select 0),_vehicle,_shooter,_laserTarget);
// We got the optional vehicle list, clear the parameters
_vehicle setVariable[QGVAR(currentTarget), [], true];
};
}; };
if(isNil QGVAR(laser)) exitWith { if(isNil QGVAR(laser)) exitWith {
@ -17,10 +20,9 @@ if(!isNil "_handle") then {
[_handle] call cba_fnc_removePerFrameHandler; [_handle] call cba_fnc_removePerFrameHandler;
}; };
REM(ACE_LASERS, GVAR(laser));
deleteVehicle GVAR(laser); deleteVehicle GVAR(laser);
GVAR(laser) = nil; GVAR(laser) = nil;
GVAR(laserActive) = false; GVAR(active) = false;

View File

@ -23,7 +23,16 @@ FUNC(laserHudDesignatePFH) = {
_args = _this select 0; _args = _this select 0;
_laserTarget = _args select 0; _laserTarget = _args select 0;
_shooter = _args select 1; _shooter = _args select 1;
TRACE_1("", _args);
if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(active) ) exitWith {
[_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff);
};
if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith {
[_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff);
};
if( (count _args) < 3) then { if( (count _args) < 3) then {
_args set[2, diag_tickTime + FCS_UPDATE_DELAY]; _args set[2, diag_tickTime + FCS_UPDATE_DELAY];
}; };
@ -32,15 +41,6 @@ FUNC(laserHudDesignatePFH) = {
_vehicle = vehicle _shooter; _vehicle = vehicle _shooter;
_weapon = currentWeapon _vehicle; _weapon = currentWeapon _vehicle;
TRACE_1("", _args);
if(!alive _shooter || isNull _vehicle || isNull _laserTarget || !GVAR(laserActive) ) exitWith {
[_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff);
};
if(!([ACE_player] call FUNC(unitTurretHasDesignator)) ) exitWith {
[_vehicle, _shooter, _laserTarget] call FUNC(laserHudDesignateOff);
};
// Retrieve the gunner and turret memory point information // Retrieve the gunner and turret memory point information
_gunnerInfo = [_vehicle, _weapon] call CBA_fnc_getFirer; _gunnerInfo = [_vehicle, _weapon] call CBA_fnc_getFirer;
_turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); _turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection);
@ -106,14 +106,16 @@ private "_laserTarget";
private "_handle"; private "_handle";
if(isNil QGVAR(laser)) then { if(isNil QGVAR(laser)) then {
_laserTarget = "LaserTargetW" createVehicle (getpos ACE_player); _laserTarget = "LaserTargetW" createVehicle (getpos ACE_player);
GVAR(laserActive) = true; GVAR(active) = true;
_handle = [FUNC(laserHudDesignatePFH), 0.1, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler; _handle = [FUNC(laserHudDesignatePFH), 0.1, [_laserTarget, ACE_player]] call cba_fnc_addPerFrameHandler;
_laserTarget setVariable ["ACE_PFH_HANDLE", _handle, false]; _laserTarget setVariable ["ACE_PFH_HANDLE", _handle, false];
// Clear the vehicle parameters
_vehicle setVariable[QGVAR(currentTarget), [], true];
GVAR(laser) = _laserTarget; GVAR(laser) = _laserTarget;
} else { } else {
[] call FUNC(laserHudDesignateOff); [] call FUNC(laserHudDesignateOff);

View File

@ -18,6 +18,17 @@ class CfgAmmo {
maxspeed = 1030; maxspeed = 1030;
maneuvrability = 8; maneuvrability = 8;
sideairfriction = 0.065; sideairfriction = 0.065;
ACE_maxDeflection = 0.15; // Maximum flap deflection for guidance
ACE_minDeflection = 0.005; // Minium flap deflection for guidance
ACE_incDeflection = 0.005; // The incrmeent in which deflection adjusts.
ACE_seekerTypes = [ "SALH" ]; // {"SALH", "LIDAR", "BeamRide", "SARH", "Optic", "Thermal"};
ACE_seekerAngle = 90; // Angle in front of the missile which can be searched
ACE_seekerAccuracy = 1; // seeker accuracy multiplier
ACE_seekerMaxRange = 2500; // Range from the missile which the seeker can visually search
ACE_attackProfiles = [ "LOAL-LIN", "LOAL-DIR", "LOAL-MID", "LOAL-HI"];
}; };
class ACE_Hydra70_DAGR : M_PG_AT { class ACE_Hydra70_DAGR : M_PG_AT {