Merge branch 'master' into sittingFramework

This commit is contained in:
jonpas 2015-09-27 02:16:51 +02:00
commit f35b13bf29
25 changed files with 384 additions and 451 deletions

View File

@ -45,7 +45,7 @@ if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) ex
private ["_text", "_condition", "_statement", "_icon", "_action"];
_condition = {
params ["_target", "_player"];
GVAR(enable) && {locked _target < 2} && {[_player, _target, []] call EFUNC(common,canInteractWith)}
GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, []] call EFUNC(common,canInteractWith)}
};
_text = localize LSTRING(openMenu);
_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);};

View File

@ -19,14 +19,17 @@ _object = _this;
if (!local _object) exitWith {};
// save and restore hitpoints, see below why
private ["_hitPoints", "_hitPointDamages"];
private "_hitPointDamages";
_hitPointDamages = getAllHitPointsDamage _object;
_hitPoints = [_object] call FUNC(getHitpoints);
_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map);
// get correct format for objects without hitpoints
if (_hitPointDamages isEqualTo []) then {
_hitPointDamages = [[],[],[]];
};
// this prevents physx objects from floating when near other physx objects with allowDamage false
_object setDamage damage _object;
{
_object setHitPointDamage [_x, _hitPointDamages select _forEachIndex];
} forEach _hitPoints;
_object setHitIndex [_forEachIndex, _x];
} forEach (_hitPointDamages select 2);

View File

@ -21,6 +21,11 @@
#define DEFAULT_DELAY (round(random(10)+5))
// only run this after the settings are initialized
if !(EGVAR(common,settingsInitFinished)) exitWith {
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(setUnconscious), _this];
};
private ["_animState", "_originalPos", "_startingTime", "_isDead"];
params ["_unit", ["_set", true], ["_minWaitingTime", DEFAULT_DELAY], ["_force", false]];

View File

@ -1,3 +1,4 @@
class ACE_Settings {
class GVAR(SavePreDeathGear) {
value = 0;

View File

@ -1,3 +1,4 @@
class CfgAddons {
class GVAR(Rallypoints) {
list[] = {"ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_Rallypoint_West_Base", "ACE_Rallypoint_East_Base", "ACE_Rallypoint_Independent_Base"};

View File

@ -1,3 +1,4 @@
class CfgVehicleClasses {
class GVAR(Rallypoints) {
displayName = CSTRING(EditorCategory);

View File

@ -1,3 +1,4 @@
class CfgVehicles {
class ACE_Module;
class ACE_ModuleRespawn: ACE_Module {
@ -6,7 +7,7 @@ class CfgVehicles {
displayName = CSTRING(Module_DisplayName);
function = QFUNC(module);
scope = 2;
isGlobal = 1;
isGlobal = 0;
icon = QUOTE(PATHTOF(UI\Icon_Module_Respawn_ca.paa));
class Arguments {
@ -24,6 +25,7 @@ class CfgVehicles {
defaultValue = 1;
};
};
class ModuleDescription {
description = CSTRING(Module_Description);
};

View File

@ -2,4 +2,4 @@
#include "script_component.hpp"
["rallypointMoved", {_this call FUNC(updateRallypoint)}] call EFUNC(common,addEventhandler);
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers

View File

@ -13,7 +13,6 @@ PREP(moduleFriendlyFire);
PREP(moduleRallypoint);
PREP(moveRallypoint);
PREP(removeBody);
PREP(removeDisconnectedPlayer);
PREP(restoreGear);
PREP(showFriendlyFireMessage);
PREP(teleportToRallypoint);

View File

@ -1,33 +1,30 @@
/*
Name: ACE_Respawn_fnc_canMoveRallypoint
Author(s):
commy2
Description:
checks if a unit can move a rally point
Parameters:
0: OBJECT - unit
1: OBJECT - side
Returns:
BOOLEAN
*/
* Author: commy2
* Checks if a unit can move a rally point.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Side <SIDE>
*
* Return Value:
* Can move <BOOL>
*
* Example:
* [ACE_Player, side ACE_Player] call ace_respawn_fnc_canMoveRallypoint
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_side"];
params ["_unit", "_side"];
_unit = _this select 0;
_side = _this select 1;
// player has to be a rallypoint mover. group leader by default
if !(_unit getVariable ["ACE_canMoveRallypoint", false]) exitWith {false};
// rallypoint names are defined in CfgVehicles.hpp
_unit getVariable ["ACE_canMoveRallypoint", false]
&& {!isNull ([
// rallypoint of that side has to exist
!isNull ([
objNull,
missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
missionNamespace getVariable ["ACE_Rallypoint_East", objNull],
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
] select ([west, east, independent] find _side) + 1)}
] select ([west, east, independent] find _side) + 1) // return

View File

@ -1,26 +1,39 @@
// by commy2
// execute on server only!
/*
* Author: commy2
* Handle XEH Init Post on Server.
* Execution on server only.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [ACE_Player] call ace_respawn_fnc_handleInitPostServer
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
params ["_unit"];
private ["_group0", "_rallypoint"];
private ["_groupUnit", "_rallypoint", "_leaderVarName"];
_group0 = group _unit; // _group-is a reserved veriable and shouldn't be used
_groupUnit = group _unit; // _group is a reserved veriable and shouldn't be used
_rallypoint = [
objNull,
missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
missionNamespace getVariable ["ACE_Rallypoint_East", objNull],
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
] select ([west, east, independent] find side _group0) + 1;
] select ([west, east, independent] find side _groupUnit) + 1;
// exit if no moveable rallypoint is placed for that side
if (isNull _rallypoint) exitWith {};
// find leader
private "_leaderVarName";
_leaderVarName = _group0 getVariable [QGVAR(leaderVarName), ""];
_leaderVarName = _groupUnit getVariable [QGVAR(leaderVarName), ""];
// exit if group already has a playable slot assigned as rallypoint leader
if (_leaderVarName != "") exitWith {
@ -31,7 +44,7 @@ if (_leaderVarName != "") exitWith {
};
// treat group leader
_unit = leader _group0;
_unit = leader _groupUnit;
_leaderVarName = vehicleVarName _unit;
@ -47,6 +60,6 @@ if (_leaderVarName == "") then {
};
// prevent group from getting multiple leaders; use this to assign rallypoint moving ability on JIP
_group0 setVariable [QGVAR(leaderVarName), _leaderVarName];
_groupUnit setVariable [QGVAR(leaderVarName), _leaderVarName];
_unit setVariable ["ACE_canMoveRallypoint", true, true];

View File

@ -1,31 +1,30 @@
/*
Name: ACE_Respawn_fnc_handleKilled
Author(s):
bux578
Description:
Handles the XEH Killed event
Parameters:
0: OBJECT - Killed unit
1: OBJECT - Attacker
Returns:
VOID
*/
* Author: bux578
* Handles the XEH killed event.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Killer <OBJECT>
*
* Return Value:
* None
*
* Example:
* [ACE_player, bad_dude] call ace_respawn_fnc_handleKilled
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_killedUnit);
params ["_unit"];
// Saves the gear when the player! (and only him) is killed
if (ACE_player == _killedUnit) then {
if (ACE_player == _unit) then {
GVAR(unitGear) = [];
if (GVAR(SavePreDeathGear)) then {
GVAR(unitGear) = [_killedUnit] call EFUNC(common,getAllGear);
GVAR(unitGear) pushBack [currentWeapon _killedUnit, currentMuzzle _killedUnit, currentWeaponMode _killedUnit];
GVAR(unitGear) = [_unit] call EFUNC(common,getAllGear);
GVAR(unitGear) pushBack [currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit];
};
};

View File

@ -1,44 +1,28 @@
// by commy2
/*
* Author: commy2
* Handle player changed event. Updates visibility of Rallypoint markers.
*
* Arguments:
* 0: New Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [ACE_player] call ace_respawn_fnc_handlePlayerChanged
*
* Public: No
*/
#include "script_component.hpp"
private "_newUnit";
params ["_newUnit"];
_newUnit = _this select 0;
private "_side";
_side = side group _newUnit;
switch (side group _newUnit) do {
case (west): {
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
};
case (east): {
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
};
case (independent): {
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 1;
};
default {
((missionNamespace getVariable ["ACE_Rallypoint_West", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_West_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_East_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
((missionNamespace getVariable ["ACE_Rallypoint_Independent_Base", objNull]) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal 0;
};
};
((GETMVAR(ACE_Rallypoint_West, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west));
((GETMVAR(ACE_Rallypoint_West_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west));
((GETMVAR(ACE_Rallypoint_East, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east));
((GETMVAR(ACE_Rallypoint_East_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east));
((GETMVAR(ACE_Rallypoint_Independent, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent));
((GETMVAR(ACE_Rallypoint_Independent_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent));

View File

@ -1,32 +1,29 @@
/*
Name: ACE_Respawn_fnc_handleRespawn
Author(s):
bux578
Description:
Handles the XEH Respawn event
Parameters:
0: OBJECT - Respawned Unit
1: ?
Returns:
VOID
*/
* Author: bux578
* Handles the XEH Respawn event.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Corpse <OBJECT>
*
* Return Value:
* None
*
* Example:
* [ACE_Player, old_body_lying_on_floor] call ace_respawn_fnc_handleRespawn
*
* Public: No
*/
#include "script_component.hpp"
private ["_respawnedUnit"];
_respawnedUnit = _this select 0;
params ["_unit"];
// Restores the gear when the player respawns
if (GVAR(SavePreDeathGear)) then {
[_respawnedUnit, GVAR(unitGear)] call FUNC(restoreGear);
[_unit, GVAR(unitGear)] call FUNC(restoreGear);
};
// fix for setVariable public being lost on respawn for machines that JIP after the command was broadcasted
if (_respawnedUnit getVariable ["ACE_canMoveRallypoint", false]) then {
_respawnedUnit setVariable ["ACE_canMoveRallypoint", true, true];
if (_unit getVariable ["ACE_canMoveRallypoint", false]) then {
_unit setVariable ["ACE_canMoveRallypoint", true, true];
};

View File

@ -1,52 +1,51 @@
/*
Name: ACE_Respawn_fnc_initRallypoint
Author(s):
commy2
Description:
init code for rally points
Parameters:
0: OBJECT - rally
Returns:
VOID
*/
* Author: commy2
* Init code for rallypoints.
*
* Arguments:
* 0: Rallypoint Object <OBJECT>
* 1: Respawn Marker <STRING>
* 2: Side <SIDE>
*
* Return Value:
* None
*
* Example:
* [respawn_object, "", west] call ace_respawn_fnc_initRallypoint
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_rallypoint,_respawnMarker,_side);
params ["_rallypoint", "_respawnMarker", "_side"];
private "_name";
_name = typeOf _rallypoint;
// init visible marker
if (hasInterface) then {
// fix init having wrong position, vars etc.
[_rallypoint, _respawnMarker, _side, _name] spawn {
PARAMS_4(_rallypoint,_respawnMarker,_side,_name);
[{
params ["_rallypoint", "_respawnMarker", "_side", "_name"];
private ["_marker", "_type"];
private ["_marker", "_type", "_date"];
_marker = format ["ACE_Marker_%1", _name];
// exit if it already exist
// exit if marker already exist
if (_marker in allMapMarkers) exitWith {};
_marker = createMarkerLocal [_marker, getPosASL _rallypoint];
_type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == "");
_marker setMarkerTypeLocal _type;
_marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init
_marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init
private "_markerDate";
_markerDate = _rallypoint getVariable [QGVAR(markerDate), ""];
_date = _rallypoint getVariable [QGVAR(markerDate), ""];
_marker setMarkerTextLocal _markerDate;
_marker setMarkerTextLocal _date;
_rallypoint setVariable [QGVAR(marker), _marker];
};
}, [_rallypoint, _respawnMarker, _side, _name], 0.1] call EFUNC(common,waitAndExecute);
};
if (!isServer) exitWith {};
@ -62,7 +61,6 @@ if (isNil _name) then {
};
["rallypointMoved", [_rallypoint, _side]] call EFUNC(common,globalEvent);
} else {
deleteVehicle _rallypoint;
ACE_LOGERROR("Multiple Rallypoints of same type.");

View File

@ -1,26 +1,23 @@
/*
Name: ACE_Respawn_fnc_module
Author(s):
KoffeinFlummi, bux578, esteldunedain, commy2
Description:
initializes the respawn module
Parameters:
0: OBJECT - logic
1: ARRAY<OBJECT> - synced units
2: BOOLEAN - activated
Returns:
VOID
*/
/*
* Author: KoffeinFlummi, bux578, esteldunedain, commy2
* Initializes the respawn module.
*
* Arguments:
* 0: Logic <OBJECT>
* 1: Synced units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* [logic, [ACE_Player], true] call ace_respawn_fnc_module
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_logic,_units,_activated);
if !(isServer) exitWith {};
params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};
@ -29,20 +26,18 @@ GVAR(Module) = true;
[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readSettingFromModule);
if (isServer) then {
if (GVAR(RemoveDeadBodiesDisconnected)) then {
addMissionEventHandler ["HandleDisconnect", {
[{
PARAMS_1(_unit);
if (isServer && {GVAR(RemoveDeadBodiesDisconnected)}) then {
addMissionEventHandler ["HandleDisconnect", {
[{
params ["_unit"];
if (!alive _unit) then {
deleteVehicle _unit;
};
},
_this, 4, 1] call EFUNC(common,waitAndExecute);
false
}];
};
if (!alive _unit) then {
deleteVehicle _unit;
};
},
_this, 4] call EFUNC(common,waitAndExecute);
false
}];
};
ACE_LOGINFO("Respawn Module Initialized.");

View File

@ -1,32 +1,33 @@
/*
Name: ACE_Respawn_fnc_moduleFriendlyFire
Author(s):
commy2
Description:
initializes the Friendly Fire Messages module
Parameters:
0: OBJECT - logic
1: ARRAY<OBJECT> - synced units
2: BOOLEAN - activated
Returns:
VOID
*/
* Author: commy2
* Initializes the friendly fire module.
*
* Arguments:
* 0: Logic <OBJECT>
* 1: Synced units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* [logic, [ACE_Player], true] call ace_respawn_fnc_moduleFriendlyFire
*
* Public: No
*/
#include "script_component.hpp"
_this spawn {
PARAMS_3(_logic,_units,_activated);
params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};
if !(_activated) exitWith {};
if (isServer) then {
// this is done for JIP compatibility
if (isServer) then {
[{
missionNamespace setVariable [QGVAR(showFriendlyFireMessage), true];
publicVariable QGVAR(showFriendlyFireMessage);
};
ACE_LOGINFO("Friendly Fire Messages Module Initialized.");
},
[], 0.1] call EFUNC(common,waitAndExecute);
};
ACE_LOGINFO("Friendly Fire Messages Module Initialized.");

View File

@ -1,29 +1,29 @@
/*
Name: ACE_Respawn_fnc_moduleRallypoint
Author(s):
commy2
Description:
initializes the Rallypoint module
Parameters:
0: OBJECT - logic
1: ARRAY<OBJECT> - synced units
2: BOOLEAN - activated
Returns:
VOID
*/
* Author: commy2
* Initializes the Rallypoint module.
*
* Arguments:
* 0: Logic <OBJECT>
* 1: Synced units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None
*
* Example:
* [logic, [ACE_Player], true] call ace_respawn_fnc_moduleRallypoint
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_logic,_units,_activated);
params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};
{
_x setVariable ["ACE_canMoveRallypoint", true];
} forEach _units;
false
} count _units;
ACE_LOGINFO("Rallypoint Module Initialized.");

View File

@ -1,52 +1,47 @@
/*
Name: ACE_Respawn_fnc_moveRallypoint
Author(s):
commy2
Description:
Moves a rallypoint to the player's location
Parameters:
0: OBJECT - unit
1: OBJECT - side
Returns:
VOID
*/
* Author: commy2
* Moves a rallypoint to the players location.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Side <SIDE>
*
* Return Value:
* None
*
* Example:
* [ACE_Player, side ACE_Player] call ace_respawn_fnc_moveRallypoint
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_side);
params ["_unit", "_side"];
private ["_rallypoint", "_position"];
// rallypoint names are defined in CfgVehicles.hpp
_rallypoint = [
objNull,
missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
missionNamespace getVariable ["ACE_Rallypoint_East", objNull],
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
objNull,
missionNamespace getVariable ["ACE_Rallypoint_West", objNull],
missionNamespace getVariable ["ACE_Rallypoint_East", objNull],
missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull]
] select ([west, east, independent] find _side) + 1;
TRACE_3("moving rally",_unit, _rallypoint, (typeOf _rallypoint));
TRACE_3("moving rally",_unit,_rallypoint,typeOf _rallypoint);
if (isNull _rallypoint) exitWith {};
_position = getPosATL _unit;
_position = _position findEmptyPosition [0, 2, typeOf _rallypoint];
if (count _position == 0) then {_position = getPosATL _unit};
if (_position isEqualTo []) then {_position = getPosATL _unit};
_position set [2, 0];
[localize LSTRING(Deploy)] call EFUNC(common,displayTextStructured);
[{
_rallypoint = _this select 0;
_unit = _this select 1;
_position = _this select 2;
_rallypoint = _this select 3;
params ["_rallypoint", "_unit", "_position"];
_rallypoint setPosATL _position;
_unit reveal _rallypoint;
@ -56,5 +51,4 @@ _position set [2, 0];
["rallypointMoved", [_rallypoint, _side, _position]] call EFUNC(common,globalEvent);
[localize LSTRING(Deployed)] call EFUNC(common,displayTextStructured);
},
[_rallypoint, _unit, _position, _rallypoint], 5, 1] call EFUNC(common,waitAndExecute);
}, [_rallypoint, _unit, _position], 5] call EFUNC(common,waitAndExecute);

View File

@ -1,36 +1,27 @@
/*
Name: ACE_Respawn_fnc_removeBody
Author(s):
bux578
Description:
removes a given body
Parameters:
0: OBJECT - body
1: BOOLEAN - forceRemove // not used atm
Returns:
VOID
*/
* Author: bux578, commy2
* Removes a given body.
*
* Arguments:
* 0: Body <OBJECT>
*
* Return Value:
* None
*
* Example:
* [corpse] call ace_respawn_fnc_removeBody
*
* Public: No
*/
#include "script_component.hpp"
private ["_body", "_forceRemove", "_bodyRemoveTimer"];
params ["_body", "_forceRemove"];
_body = _this select 0;
_forceRemove = _this select 1;
_bodyRemoveTimer = GVAR(BodyRemoveTimer) max 0;
// could be used for SpecOps missions.
if (_forceRemove) then {
_bodyRemoveTimer = 2;
};
private "_bodyRemoveTimer";
_bodyRemoveTimer = [GVAR(BodyRemoveTimer) max 0, 2] select _forceRemove; // could be used for SpecOps missions.
[{
// hideBody takes ~20s till body is fully underground
// a better hideBody would make this more aesthetic
deleteVehicle _this;
}, _body, _bodyRemoveTimer, 1] call EFUNC(common,waitAndExecute);
}, _body, _bodyRemoveTimer] call EFUNC(common,waitAndExecute);

View File

@ -1,31 +0,0 @@
/*
Name: ACE_Respawn_fnc_removeDisconnectedPlayer
Author(s):
commy2
Description:
handles the disconnected event
Parameters:
0: BOOLEAN - forceRemove // not used atm
Returns:
VOID
*/
#include "script_component.hpp"
private ["_forceRemove", "_body", "_uid"];
_forceRemove = _this select 0;
{
if (getPlayerUID _x == _uid) exitWith {
_body = _x;
};
} forEach playableUnits;
if (!isNil "_body" && {!alive _body}) then {
[_body, _forceRemove] call FUNC(removeBody);
};

View File

@ -1,34 +1,22 @@
/*
Name: ACE_Respawn_fnc_restoreGear
Author(s):
bux578
Description:
Restores previously saved gear
Parameters:
0: OBJECT - unit
1: ARRAY<String, Array, ...> - Array containing all gear (result of ACE_common_fnc_getAllGear)
Returns:
VOID
*/
* Author: bux578
* Restores previously saved gear.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: All Gear based on return value of ACE_common_fnc_getAllGear <ARRAY>
*
* Return Value:
* None
*
* Example:
* [ACE_Player, stored_allGear] call ace_respawn_fnc_restoreGear
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_allGear);
private ["_unit", "_allGear", "_headgear", "_goggles",
"_uniform", "_uniformitems",
"_vest", "_vestitems",
"_backpack", "_backpackitems", "_backpa",
"_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine",
"_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine",
"_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine",
"_assigneditems", "_binocular",
"_activeWeaponAndMuzzle", "_activeWeapon", "_activeMuzzle", "_activeWeaponMode"];
params ["_unit", "_allGear"];
// remove all starting gear of a player
removeAllWeapons _unit;
@ -40,77 +28,66 @@ removeAllAssignedItems _unit;
clearAllItemsFromBackpack _unit;
removeBackpack _unit;
_headgear = _allGear select 0;
_goggles = _allGear select 1;
_uniform = _allGear select 2;
_uniformitems = _allGear select 3;
_vest = _allGear select 4;
_vestitems = _allGear select 5;
_backpack = _allGear select 6;
_backpackitems = _allGear select 7;
_primaryweapon = _allGear select 8;
_primaryweaponitems = _allGear select 9;
_primaryweaponmagazine = _allGear select 10;
_secondaryweapon = _allGear select 11;
_secondaryweaponitems = _allGear select 12;
_secondaryweaponmagazine = _allGear select 13;
_handgunweapon = _allGear select 14;
_handgunweaponitems = _allGear select 15;
_handgunweaponmagazine = _allGear select 16;
_assigneditems = _allGear select 17;
_binocular = _allGear select 18;
_activeWeaponAndMuzzle = _allGear select 19;
_allGear params [
"_headgear", "_goggles",
"_uniform", "_uniformitems",
"_vest", "_vestitems",
"_backpack", "_backpackitems",
"_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine",
"_secondaryweapon", "_secondaryweaponitems", "_secondaryweaponmagazine",
"_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine",
"_assigneditems", "_binocular",
"_activeWeaponAndMuzzle"
];
// start restoring the items
if (_headgear != "") then {
_unit addHeadgear _headgear;
};
if (_uniform != "") then {
_unit forceAddUniform _uniform;
};
if (_vest != "") then {
_unit addVest _vest;
};
if (_goggles != "") then {
_unit addGoggles _goggles;
};
if (_headgear != "") then {_unit addHeadgear _headgear};
if (_goggles != "") then {_unit addGoggles _goggles};
if (_uniform != "") then {_unit forceAddUniform _uniform};
if (_vest != "") then {_unit addVest _vest};
{
_unit addItemToUniform _x;
} forEach _uniformitems;
false
} count _uniformitems;
{
_unit addItemToVest _x;
} forEach _vestitems;
false
} count _vestitems;
private "_flagRemoveDummyBag";
_flagRemoveDummyBag = false;
if (format["%1", _backpack] != "") then {
if (format ["%1", _backpack] != "") then {
_unit addBackpack _backpack;
_backpa = unitBackpack _unit;
clearMagazineCargoGlobal _backpa;
clearWeaponCargoGlobal _backpa;
clearItemCargoGlobal _backpa;
// make sure the backpack is empty. Some bags are prefilled by config
private "_backpackObject";
_backpackObject = unitBackpack _unit;
clearMagazineCargoGlobal _backpackObject;
clearWeaponCargoGlobal _backpackObject;
clearItemCargoGlobal _backpackObject;
{
_unit addItemToBackpack _x;
} forEach _backpackitems;
false
} count _backpackitems;
_flagRemoveDummyBag = false;
} else {
// dummy backpack to ensure mags being loaded
_unit addBackpack "B_Kitbag_Base";
_unit addBackpack "Bag_Base";
_flagRemoveDummyBag = true;
};
// primaryWeapon
if ((_primaryweapon != "") && {_primaryweapon != "ACE_FakePrimaryWeapon"}) then {
{
_unit addMagazine _x;
} forEach _primaryweaponmagazine;
false
} count _primaryweaponmagazine;
_unit addWeapon _primaryweapon;
@ -118,15 +95,16 @@ if ((_primaryweapon != "") && {_primaryweapon != "ACE_FakePrimaryWeapon"}) then
if (_x != "") then {
_unit addPrimaryWeaponItem _x;
};
} forEach _primaryweaponitems;
false
} count _primaryweaponitems;
};
// secondaryWeapon
if (_secondaryweapon != "") then {
{
_unit addMagazine _x;
} forEach _secondaryweaponmagazine;
false
} count _secondaryweaponmagazine;
_unit addWeapon _secondaryweapon;
@ -134,15 +112,16 @@ if (_secondaryweapon != "") then {
if (_x != "") then {
_unit addSecondaryWeaponItem _x;
};
} forEach _secondaryweaponitems;
false
} count _secondaryweaponitems;
};
// handgun
if (_handgunweapon != "") then {
{
_unit addMagazine _x;
} forEach _handgunweaponmagazine;
false
} count _handgunweaponmagazine;
_unit addWeapon _handgunweapon;
@ -150,20 +129,19 @@ if (_handgunweapon != "") then {
if (_x != "") then {
_unit addHandgunItem _x;
};
} forEach _handgunweaponitems;
false
} count _handgunweaponitems;
};
// remove dummy bagpack
if (_flagRemoveDummyBag) then {
removeBackpack _unit;
};
_assignedItems = _assignedItems - [_binocular];
_assignedItems deleteAt (_assignedItems find _binocular);
// items
{_unit linkItem _x} forEach _assignedItems;
{_unit linkItem _x; false} count _assignedItems;
_unit addWeapon _binocular;
@ -178,24 +156,24 @@ if ("Laserdesignator" in assignedItems _unit) then {
};
// restore the last active weapon, muzzle and weaponMode
_activeWeapon = _activeWeaponAndMuzzle select 0;
_activeMuzzle = _activeWeaponAndMuzzle select 1;
_activeWeaponMode = _activeWeaponAndMuzzle select 2;
if (!(_activeMuzzle isEqualTo "") and
!(_activeMuzzle isEqualTo _activeWeapon) and
(_activeMuzzle in getArray (configfile >> "CfgWeapons" >> _activeWeapon >> "muzzles"))) then {
_activeWeaponAndMuzzle params ["_activeWeapon", "_activeMuzzle", "_activeWeaponMode"];
if (
(_activeMuzzle != "") &&
{_activeMuzzle != _activeWeapon} &&
{_activeMuzzle in getArray (configfile >> "CfgWeapons" >> _activeWeapon >> "muzzles")}
) then {
_unit selectWeapon _activeMuzzle;
} else {
if (!(_activeWeapon isEqualTo "")) then {
if (_activeWeapon != "") then {
_unit selectWeapon _activeWeapon;
};
};
if (!(currentWeapon _unit isEqualTo "")) then {
private ["_index"];
if (currentWeapon _unit != "") then {
private "_index";
_index = 0;
while {
_index < 100 && {currentWeaponMode _unit != _activeWeaponMode}
} do {

View File

@ -1,28 +1,24 @@
/*
Name: ACE_Respawn_fnc_showFriendlyFireMessages
Author(s):
commy2
Description:
shows a message in system chat of who killed who
Parameters:
0: OBJECT - unit
1: OBJECT - killer
Returns:
VOID
*/
* Author: commy2
* Shows a message in system chat of who killed whom.
*
* Arguments:
* 0: Unitn <OBJECT>
* 1: Killer <OBJECT>
*
* Return Value:
* None
*
* Example:
* [ACE_Player, killer] call ace_module_fnc_functionName
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_killer"];
params ["_unit", "_killer"];
_unit = _this select 0;
_killer = _this select 1;
if (_unit != _killer && side group _unit in [side group ACE_player, civilian] && {side group _killer == side group ACE_player}) then {
if (_unit != _killer && {side group _unit in [side group ACE_player, civilian]} && {side group _killer == side group ACE_player}) then {
systemChat format ["%1 was killed by %2", [_unit] call EFUNC(common,getName), [_killer] call EFUNC(common,getName)];
// Raise ACE globalEvent

View File

@ -1,29 +1,25 @@
/*
* Author: commy2
* teleports a unit to a rallypoint
* Teleports a unit to a rallypoint
*
* Arguments:
* 0: unit <OBJECT>
* 1: side? <OBJECT>
* 2: teleport to base <BOOLEAN>
* 0: Unit <OBJECT>
* 1: Side <SIDE>
* 2: Rallypoint name <STRING>
*
* Return Value:
* Nothing
* None
*
* Example:
* [,,] call ACE_Respawn_fnc_teleportToRallypoint;
* [ACE_player, side ACE_Player, rallypoint_name] call ace_respawn_fnc_teleportToRallypoint;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_3(_unit,_side,_rallypoint);
params ["_unit", "_side", "_rallypoint"];
private ["_toBase"];
// rallypoint names are defined in CfgVehicles.hpp
//IGNORE_PRIVATE_WARNING("_Base")
private "_toBase";
_toBase = _rallypoint find "_Base" != -1;
_rallypoint = missionNamespace getVariable [_rallypoint, objNull],
@ -31,4 +27,5 @@ _rallypoint = missionNamespace getVariable [_rallypoint, objNull],
if (isNull _rallypoint) exitWith {};
_unit setPosASL getPosASL _rallypoint;
[[localize LSTRING(TeleportedToRallypoint), localize LSTRING(TeleportedToBase)] select _toBase] call EFUNC(common,displayTextStructured);

View File

@ -1,11 +1,23 @@
// by commy2
/*
* Author: commy2
* Updates marker position and texts.
*
* Arguments:
* 0: Marker <STRING>
* 1: Side <SIDE>
* 2: Position <ARRAY>
*
* Return Value:
* None
*
* Example:
* [marker_name, side ACE_Player, getPos ACE_Player] call ace_respawn_fnc_updateRallypoint
*
* Public: No
*/
#include "script_component.hpp"
private ["_rallypoint", "_side", "_position"];
_rallypoint = _this select 0;
_side = _this select 1;
_position = _this select 2;
params ["_rallypoint", "_side", "_position"];
if (!hasInterface) exitWith {};