diff --git a/TO_MERGE/agm/Respawn/config.cpp b/TO_MERGE/agm/Respawn/config.cpp deleted file mode 100644 index a959cc34f7..0000000000 --- a/TO_MERGE/agm/Respawn/config.cpp +++ /dev/null @@ -1,281 +0,0 @@ -class CfgPatches { - class AGM_Respawn { - units[] = {}; - weapons[] = {"AGM_Rallypoint_West", "AGM_Rallypoint_East", "AGM_Rallypoint_Independent", "AGM_RallypointExit_West", "AGM_RallypointExit_East", "AGM_RallypointExit_Independent"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; - author[] = {"bux578", "commy2"}; - authorUrl = "https://github.com/bux578/"; - }; -}; - -class CfgFunctions { - class AGM_Respawn { - class AGM_Respawn { - file = "AGM_Respawn\functions"; - class canMoveRallypoint; - class getAllGear; - class handleKilled; - class handleRespawn; - class initRallypoint; - class module; - class moduleFriendlyFire; - class moduleRallypoint; - class moveRallypoint; - class removeBody; - class removeDisconnectedPlayer; - class restoreGear; - class showFriendlyFireMessage; - class teleportToRallypoint; - }; - }; -}; - -class Extended_Killed_EventHandlers { - class CAManBase { - class AGM_Respawn_HandleGear { - killed = "_this call AGM_Respawn_fnc_handleKilled"; - }; - }; -}; -class Extended_Respawn_EventHandlers { - class CAManBase { - class AGM_Respawn_HandleGear { - respawn = "_this call AGM_Respawn_fnc_handleRespawn"; - }; - }; -}; - -class CfgAddons { - class AGM_Respawn_Rallypoints { - list[] = {"AGM_Rallypoint_West", "AGM_Rallypoint_East", "AGM_Rallypoint_Independent", "AGM_RallypointExit_West", "AGM_RallypointExit_East", "AGM_RallypointExit_Independent"}; - }; -}; - -class CfgVehicleClasses { - class AGM_Respawn_Rallypoints { - displayName = "AGM Respawn"; - }; -}; - -class CfgVehicles { - class Module_F; - class AGM_ModuleRespawn: Module_F { - author = "$STR_AGM_Core_AGMTeam"; - category = "AGM"; - displayName = "Respawn System"; - function = "AGM_Respawn_fnc_module"; - scope = 2; - isGlobal = 1; - icon = "\AGM_Respawn\UI\Icon_Module_Respawn_ca.paa"; - class Arguments { - class SavePreDeathGear { - displayName = "Save Gear?"; - description = "Respawn with the gear a soldier had just before his death?"; - typeName = "BOOL"; - class values { - class Yes { name = "Yes"; value = 1;}; - class No { default = 1; name = "No"; value = 0; }; - }; - }; - class RemoveDeadBodiesDisonncected { - displayName = "Remove bodies?"; - description = "Remove player bodies after disconnect?"; - typeName = "BOOL"; - class values { - class Yes { default = 1; name = "Yes"; value = 1;}; - class No { name = "No"; value = 0; }; - }; - }; - /*class BodyRemoveTimer { - displayName = "Time to remove bodies."; - description = "The amount of time (in seconds) after that a unit's body gets removed. Default: 90"; - typeName = "NUMBER"; - defaultValue = 90; - };*/ - }; - }; - - class AGM_ModuleFriendlyFire: Module_F { - author = "$STR_AGM_Core_AGMTeam"; - category = "AGM"; - displayName = "Friendly Fire Messages"; - function = "AGM_Respawn_fnc_moduleFriendlyFire"; - scope = 2; - isGlobal = 1; - icon = "\AGM_Respawn\UI\Icon_Module_FriendlyFire_ca.paa"; - class Arguments { - }; - }; - - class AGM_ModuleRallypoint: Module_F { - author = "$STR_AGM_Core_AGMTeam"; - category = "AGM"; - displayName = "Rallypoint System"; - function = "AGM_Respawn_fnc_moduleRallypoint"; - scope = 2; - isGlobal = 1; - icon = "\AGM_Respawn\UI\Icon_Module_Rallypoint_ca.paa"; - class Arguments { - }; - }; - - // rallypoints - class FlagCarrier; - class Flag_NATO_F: FlagCarrier { - class AGM_Actions; - }; - - class Flag_CSAT_F: FlagCarrier { - class AGM_Actions; - }; - - class Flag_AAF_F: FlagCarrier { - class AGM_Actions; - }; - - // static - class AGM_Rallypoint_West: Flag_NATO_F { - author = "$STR_AGM_Core_AGMTeam"; - displayName = "Rallypoint West Base"; - vehicleClass = "AGM_Respawn_Rallypoints"; - - class EventHandlers { - init = "(_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call AGM_Respawn_fnc_initRallypoint"; - }; - class AGM_Actions: AGM_Actions { - class AGM_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = "side group _player == west"; - statement = "[_player, side group _player, false] call AGM_Respawn_fnc_teleportToRallypoint;"; - showDisabled = 1; - priority = 1; - }; - }; - }; - - class AGM_Rallypoint_East: Flag_CSAT_F { - author = "$STR_AGM_Core_AGMTeam"; - displayName = "Rallypoint East Base"; - vehicleClass = "AGM_Respawn_Rallypoints"; - - class EventHandlers { - init = "(_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call AGM_Respawn_fnc_initRallypoint"; - }; - class AGM_Actions: AGM_Actions { - class AGM_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = "side group _player == east"; - statement = "[_player, side group _player, false] call AGM_Respawn_fnc_teleportToRallypoint;"; - showDisabled = 1; - priority = 1; - }; - }; - }; - - class AGM_Rallypoint_Independent: Flag_AAF_F { - author = "$STR_AGM_Core_AGMTeam"; - displayName = "Rallypoint Independent Base"; - vehicleClass = "AGM_Respawn_Rallypoints"; - - class EventHandlers { - init = "(_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call AGM_Respawn_fnc_initRallypoint"; - }; - class AGM_Actions: AGM_Actions { - class AGM_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = "side group _player == independent"; - statement = "[_player, side group _player, false] call AGM_Respawn_fnc_teleportToRallypoint;"; - showDisabled = 1; - priority = 1; - }; - }; - }; - - // moveable - class AGM_RallypointExit_West: Flag_NATO_F { - author = "$STR_AGM_Core_AGMTeam"; - displayName = "Rallypoint West"; - vehicleClass = "AGM_Respawn_Rallypoints"; - - class EventHandlers { - init = "(_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call AGM_Respawn_fnc_initRallypoint"; - }; - class AGM_Actions: AGM_Actions { - class AGM_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = "side group _player == west"; - statement = "[_player, side group _player, true] call AGM_Respawn_fnc_teleportToRallypoint;"; - showDisabled = 1; - priority = 1; - }; - }; - }; - - class AGM_RallypointExit_East: Flag_CSAT_F { - author = "$STR_AGM_Core_AGMTeam"; - displayName = "Rallypoint East"; - vehicleClass = "AGM_Respawn_Rallypoints"; - - class EventHandlers { - init = "(_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call AGM_Respawn_fnc_initRallypoint"; - }; - class AGM_Actions: AGM_Actions { - class AGM_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = "side group _player == east"; - statement = "[_player, side group _player, true] call AGM_Respawn_fnc_teleportToRallypoint;"; - showDisabled = 1; - priority = 1; - }; - }; - }; - - class AGM_RallypointExit_Independent: Flag_AAF_F { - author = "$STR_AGM_Core_AGMTeam"; - displayName = "Rallypoint Independent"; - vehicleClass = "AGM_Respawn_Rallypoints"; - - class EventHandlers { - init = "(_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call AGM_Respawn_fnc_initRallypoint"; - }; - class AGM_Actions: AGM_Actions { - class AGM_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = "side group _player == independent"; - statement = "[_player, side group _player, true] call AGM_Respawn_fnc_teleportToRallypoint;"; - showDisabled = 1; - priority = 1; - }; - }; - }; - - // team leader - class Man; - class CAManBase: Man { - class AGM_SelfActions { - class AGM_MoveRallypoint { - displayName = "Move Rallypoint"; - condition = "[_player, side group _player] call AGM_Respawn_fnc_canMoveRallypoint"; - statement = "[_player, side group _player] call AGM_Respawn_fnc_moveRallypoint"; - showDisabled = 0; - priority = -0.5; - }; - }; - }; -}; - -class AGM_Parameters_Boolean { - // Boolean Parameters (0/1) - AGM_Respawn_SavePreDeathGear = 0; - AGM_Respawn_RemoveDeadBodiesDisonncected = 1; -}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_canMoveRallypoint.sqf b/TO_MERGE/agm/Respawn/functions/fn_canMoveRallypoint.sqf deleted file mode 100644 index a0e0e2ab4b..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_canMoveRallypoint.sqf +++ /dev/null @@ -1,14 +0,0 @@ -// by commy2 - -private ["_unit", "_side"]; - -_unit = _this select 0; -_side = _this select 1; - -_unit getVariable ["AGM_canMoveRallypoint", false] -&& {!isNull ([ - objNull, - missionNamespace getVariable ["AGM_Rallypoint_West", objNull], - missionNamespace getVariable ["AGM_Rallypoint_East", objNull], - missionNamespace getVariable ["AGM_Rallypoint_Independent", objNull] -] select ([west, east, independent] find _side) + 1)} diff --git a/TO_MERGE/agm/Respawn/functions/fn_getAllGear.sqf b/TO_MERGE/agm/Respawn/functions/fn_getAllGear.sqf deleted file mode 100644 index 5368dbdd35..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_getAllGear.sqf +++ /dev/null @@ -1,40 +0,0 @@ -/* -Author: bux578 - -Description: -Returns an array containing all items of a given unit - -Arguments: -A player object - -Return value: -An array containing all inventory items -*/ - -private ["_unit", "_allGear"]; - -_unit = _this select 0; - -_allGear = [ - (headgear _unit), - (goggles _unit), - (uniform _unit), - (uniformItems _unit), - (vest _unit), - (vestItems _unit), - (backpack _unit), - (backpackItems _unit), - (primaryWeapon _unit), - (primaryWeaponItems _unit), - (primaryWeaponMagazine _unit), - (secondaryWeapon _unit), - (secondaryWeaponItems _unit), - (secondaryWeaponMagazine _unit), - (handgunWeapon _unit), - (handgunItems _unit), - (handgunMagazine _unit), - (assignedItems _unit), - (binocular _unit) -]; - -_allGear diff --git a/TO_MERGE/agm/Respawn/functions/fn_handleKilled.sqf b/TO_MERGE/agm/Respawn/functions/fn_handleKilled.sqf deleted file mode 100644 index 48fb056ebe..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_handleKilled.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - Name: AGM_Respawn_fnc_handleKilled - - Author(s): - bux578 - - Description: - Handles the XEH Killed event - - Parameters: - 0: OBJECT - Killed unit - 1: OBJECT - Attacker - - Returns: - VOID -*/ - -private ["_killedUnit"]; - -_killedUnit = _this select 0; - -// Saves the gear when the player is killed -AGM_Respawn_unitGear = []; - -if (AGM_Respawn_SavePreDeathGear) then { - AGM_Respawn_unitGear = [_killedUnit] call AGM_Respawn_fnc_getAllGear; -}; - -if (missionNamespace getVariable ["AGM_showFriendlyFireMessage", false]) then { - [_this, "AGM_Respawn_fnc_showFriendlyFireMessage", 2] call AGM_Core_fnc_execRemoteFnc; -}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_initRallypoint.sqf b/TO_MERGE/agm/Respawn/functions/fn_initRallypoint.sqf deleted file mode 100644 index ae84a02605..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_initRallypoint.sqf +++ /dev/null @@ -1,17 +0,0 @@ -// by commy2 - -private ["_rallypoint", "_name"]; - -_rallypoint = _this select 0; - -if (!local _rallypoint) exitWith {}; - -_name = typeOf _rallypoint; - -if (isNil _name) then { - missionNamespace setVariable [_name, _rallypoint]; - publicVariable _name; -} else { - deleteVehicle _rallypoint; - diag_log text "[AGM] Respawn: ERROR Multiple Rallypoints of same type."; -}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_module.sqf b/TO_MERGE/agm/Respawn/functions/fn_module.sqf deleted file mode 100644 index c407da505b..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_module.sqf +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: KoffeinFlummi, bux578, CAA-Picard, commy2 - * - * Initializes the respawn module. - * - * Arguments: - * Whatever the module provides. (I dunno.) - * - * Return Value: - * None - */ -if !(isServer) exitWith {}; - -_logic = _this select 0; -_activated = _this select 2; - -if !(_activated) exitWith {}; - -AGM_Respawn_Module = true; - -[_logic, "AGM_Respawn_SavePreDeathGear", "SavePreDeathGear"] call AGM_Core_fnc_readBooleanParameterFromModule; -[_logic, "AGM_Respawn_RemoveDeadBodiesDisonncected", "RemoveDeadBodiesDisonncected"] call AGM_Core_fnc_readBooleanParameterFromModule; - -if (isServer) then { - if (AGM_Respawn_RemoveDeadBodiesDisonncected) then { - _fnc_deleteDisconnected = { - _this spawn { - _unit = _this select 0; - - sleep 4; - - if (!alive _unit) then { - deleteVehicle _unit; - }; - }; - false - }; - - addMissionEventHandler ["HandleDisconnect", _fnc_deleteDisconnected]; - }; -}; - -diag_log text "[AGM]: Respawn Module Initialized."; diff --git a/TO_MERGE/agm/Respawn/functions/fn_moduleFriendlyFire.sqf b/TO_MERGE/agm/Respawn/functions/fn_moduleFriendlyFire.sqf deleted file mode 100644 index 3dc6fb302f..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_moduleFriendlyFire.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: commy2 - * - * Initializes the Friendly Fire Messages module. - * - * Arguments: - * Whatever the module provides. (I dunno.) - * - * Return Value: - * None - */ - -_this spawn { - _logic = _this select 0; - _units = _this select 1; - _activated = _this select 2; - - if !(_activated) exitWith {}; - - if (isServer) then { - _varName = "AGM_showFriendlyFireMessage"; - - missionNamespace setVariable [_varName, true]; - publicVariable _varName; - }; - - diag_log text "[AGM]: Friendly Fire Messages Module Initialized."; -}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_moduleRallypoint.sqf b/TO_MERGE/agm/Respawn/functions/fn_moduleRallypoint.sqf deleted file mode 100644 index 33efac1953..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_moduleRallypoint.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Author: commy2 - * - * Initializes the Rallypoint module. - * - * Arguments: - * Whatever the module provides. (I dunno.) - * - * Return Value: - * None - */ - -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; - -if !(_activated) exitWith {}; - -//_mode = parseNumber (_logic getVariable "Action"); - -{ - _x setVariable ["AGM_canMoveRallypoint", true]; -} forEach _units; - -diag_log text "[AGM]: Rallypoint Module Initialized."; diff --git a/TO_MERGE/agm/Respawn/functions/fn_moveRallypoint.sqf b/TO_MERGE/agm/Respawn/functions/fn_moveRallypoint.sqf deleted file mode 100644 index 68d197844c..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_moveRallypoint.sqf +++ /dev/null @@ -1,35 +0,0 @@ -// by commy2 - -_this spawn { - _unit = _this select 0; - _side = _this select 1; - - _rallypoint = [ - objNull, - missionNamespace getVariable ["AGM_RallypointExit_West", objNull], - missionNamespace getVariable ["AGM_RallypointExit_East", objNull], - missionNamespace getVariable ["AGM_RallypointExit_Independent", objNull] - ] select ([west, east, independent] find _side) + 1; - - if (isNull _rallypoint) exitWith {}; - - _position = getPosATL _unit; - _position = _position findEmptyPosition [0, 2, typeOf _rallypoint]; - if (count _position == 0) then {_position = getPosATL _unit}; - - _position set [2, 0]; - - ["Deploy in 5 seconds ..."] call AGM_Core_fnc_displayTextStructured; - - sleep 5; - _rallypoint setPosATL _position; - _unit reveal _rallypoint; - - /* - _marker = format ["AGM_RallyPoint_%1", _side]; - _marker setMarkerPos _position; - _marker setMarkerTextLocal format ["%1:%2", [date select 3, 2, 0] call CBA_fnc_FORMATNumber, [date select 4, 2, 0] call CBA_fnc_FORMATNumber]; - */ - - ["Rallypoint deployed"] call AGM_Core_fnc_displayTextStructured; -}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_removeBody.sqf b/TO_MERGE/agm/Respawn/functions/fn_removeBody.sqf deleted file mode 100644 index 063b39abec..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_removeBody.sqf +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Author: bux578 - * - * removes the body - * - * Arguments: - * The body - * - * Return Value: - * None - */ - -private ["_body", "_forceRemove", "_bodyRemoveTimer"]; - -_body = _this select 0; -_forceRemove = _this select 1; - -_bodyRemoveTimer = AGM_Respawn_BodyRemoveTimer max 0; - -// could be used for SpecOps missions. -if (_forceRemove) then { - _bodyRemoveTimer = 2; -}; - -[_body, _bodyRemoveTimer] spawn { - sleep (_this select 1); - // hideBody takes ~20s till body is fully underground - // a better hideBody would make this more aesthetic - deleteVehicle (_this select 0); -}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_removeDisconnectedPlayer.sqf b/TO_MERGE/agm/Respawn/functions/fn_removeDisconnectedPlayer.sqf deleted file mode 100644 index a3fbbc737e..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_removeDisconnectedPlayer.sqf +++ /dev/null @@ -1,15 +0,0 @@ -// by commy2 - -private ["_forceRemove", "_body"]; - -_forceRemove = _this select 0; - -{ - if (getPlayerUID _x == _uid) exitWith { - _body = _x; - }; -} forEach playableUnits; - -if (!isNil "_body" && {!alive _body}) then { - [_body, _forceRemove] call AGM_Respawn_fnc_removeBody; -}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_showFriendlyFireMessage.sqf b/TO_MERGE/agm/Respawn/functions/fn_showFriendlyFireMessage.sqf deleted file mode 100644 index e505d2cfff..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_showFriendlyFireMessage.sqf +++ /dev/null @@ -1,12 +0,0 @@ -// by commy2 - -private ["_unit", "_killer"]; - -_unit = _this select 0; -_killer = _this select 1; - -if (_unit != _killer && side group _unit in [side group AGM_player, civilian] && {side group _killer == side group AGM_player}) then { - systemChat format ["%1 was killed by %2", [_unit] call AGM_Core_fnc_getName, [_killer] call AGM_Core_fnc_getName]; - - [_unit, "killedByFriendly", [_unit, _killer]] call AGM_Core_fnc_callCustomEventHandlers; -}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_teleportToRallypoint.sqf b/TO_MERGE/agm/Respawn/functions/fn_teleportToRallypoint.sqf deleted file mode 100644 index 387039479e..0000000000 --- a/TO_MERGE/agm/Respawn/functions/fn_teleportToRallypoint.sqf +++ /dev/null @@ -1,27 +0,0 @@ -// by commy2 - -private ["_unit", "_side", "_toBase", "_rallypoint"]; - -_unit = _this select 0; -_side = _this select 1; -_toBase = _this select 2; - -_rallypoint = ([ - [ - objNull, - missionNamespace getVariable ["AGM_RallypointExit_West", objNull], - missionNamespace getVariable ["AGM_RallypointExit_East", objNull], - missionNamespace getVariable ["AGM_RallypointExit_Independent", objNull] - ], - [ - objNull, - missionNamespace getVariable ["AGM_Rallypoint_West", objNull], - missionNamespace getVariable ["AGM_Rallypoint_East", objNull], - missionNamespace getVariable ["AGM_Rallypoint_Independent", objNull] - ] -] select _toBase) select ([west, east, independent] find _side) + 1; - -if (isNull _rallypoint) exitWith {}; - -_unit setPosASL (getPosASL _rallypoint); -[["Teleported to Rallypoint", "Teleported to Base"] select _toBase] call AGM_Core_fnc_displayTextStructured; diff --git a/addons/respawn/CfgAddons.hpp b/addons/respawn/CfgAddons.hpp new file mode 100644 index 0000000000..2793ac09da --- /dev/null +++ b/addons/respawn/CfgAddons.hpp @@ -0,0 +1,5 @@ +class CfgAddons { + class GVAR(Rallypoints) { + list[] = { "ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_RallypointExit_West", "ACE_RallypointExit_East", "ACE_RallypointExit_Independent" }; + }; +}; diff --git a/addons/respawn/CfgEventHandlers.hpp b/addons/respawn/CfgEventHandlers.hpp new file mode 100644 index 0000000000..c4a50615d1 --- /dev/null +++ b/addons/respawn/CfgEventHandlers.hpp @@ -0,0 +1,20 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_Killed_EventHandlers { + class CAManBase { + class GVAR(HandleGear) { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; +class Extended_Respawn_EventHandlers { + class CAManBase { + class GVAR(HandleGear) { + respawn = QUOTE(_this call FUNC(handleRespawn)); + }; + }; +}; diff --git a/addons/respawn/CfgVehicleClasses.hpp b/addons/respawn/CfgVehicleClasses.hpp new file mode 100644 index 0000000000..8d4eeb139c --- /dev/null +++ b/addons/respawn/CfgVehicleClasses.hpp @@ -0,0 +1,5 @@ +class CfgVehicleClasses { + class GVAR(Rallypoints) { + displayName = "ACE Respawn"; + }; +}; diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp new file mode 100644 index 0000000000..7264a81aed --- /dev/null +++ b/addons/respawn/CfgVehicles.hpp @@ -0,0 +1,206 @@ +class CfgVehicles { + class Module_F; + class ACE_ModuleRespawn : Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "Respawn System"; + function = QFUNC(module); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(UI\IconSwitchUnits_ca.paa)); + class Arguments { + class SavePreDeathGear { + displayName = "Save Gear?"; + description = "Respawn with the gear a soldier had just before his death?"; + typeName = "BOOL"; + class values { + class Yes { name = "Yes"; value = 1; }; + class No { default = 1; name = "No"; value = 0; }; + }; + }; + class RemoveDeadBodiesDisonncected { + displayName = "Remove bodies?"; + description = "Remove player bodies after disconnect?"; + typeName = "BOOL"; + class values { + class Yes { default = 1; name = "Yes"; value = 1; }; + class No { name = "No"; value = 0; }; + }; + }; + }; + }; + + class ACE_ModuleFriendlyFire : Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "Friendly Fire Messages"; + function = QFUNC(moduleFriendlyFire); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(UI\Icon_Module_FriendlyFire_ca.paa)); + class Arguments { + }; + }; + + class ACE_ModuleRallypoint : Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "Rallypoint System"; + function = QFUNC(moduleRallypoint); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(UI\IconSwitchUnits_ca.paa)); + class Arguments { + }; + }; + + // rallypoints + class FlagCarrier; + class Flag_NATO_F : FlagCarrier { + class ACE_Actions; + }; + + class Flag_CSAT_F : FlagCarrier { + class ACE_Actions; + }; + + class Flag_AAF_F : FlagCarrier { + class ACE_Actions; + }; + + // static + class ACE_Rallypoint_West : Flag_NATO_F { + author = "$STR_ACE_Common_ACETeam"; + displayName = "Rallypoint West Base"; + vehicleClass = QGVAR(Rallypoints); + + class EventHandlers { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); + }; + class ACE_Actions : ACE_Actions { + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == west); + statement = QUOTE([_player, side group _player, false] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; + }; + }; + + class ACE_Rallypoint_East : Flag_CSAT_F { + author = "$STR_ACE_Common_ACETeam"; + displayName = "Rallypoint East Base"; + vehicleClass = QGVAR(Rallypoints); + + class EventHandlers { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); + }; + class ACE_Actions : ACE_Actions { + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == east); + statement = QUOTE([_player, side group _player, false] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; + }; + }; + + class ACE_Rallypoint_Independent : Flag_AAF_F { + author = "$STR_ACE_Common_ACETeam"; + displayName = "Rallypoint Independent Base"; + vehicleClass = QGVAR(Rallypoints); + + class EventHandlers { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); + }; + class ACE_Actions : ACE_Actions { + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == independent); + statement = QUOTE([_player, side group _player, false] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; + }; + }; + + // moveable + class ACE_RallypointExit_West : Flag_NATO_F { + author = "$STR_ACE_Common_ACETeam"; + displayName = "Rallypoint West"; + vehicleClass = QGVAR(Rallypoints); + + class EventHandlers { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); + }; + class ACE_Actions : ACE_Actions { + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == west); + statement = QUOTE([_player, side group _player, true] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; + }; + }; + + class ACE_RallypointExit_East : Flag_CSAT_F { + author = "$STR_ACE_Common_ACETeam"; + displayName = "Rallypoint East"; + vehicleClass = QGVAR(Rallypoints); + + class EventHandlers { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); + }; + class ACE_Actions : ACE_Actions { + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == east); + statement = QUOTE([_player, side group _player, true] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; + }; + }; + + class ACE_RallypointExit_Independent : Flag_AAF_F { + author = "$STR_ACE_Common_ACETeam"; + displayName = "Rallypoint Independent"; + vehicleClass = QGVAR(Rallypoints); + + class EventHandlers { + init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); + }; + class ACE_Actions : ACE_Actions { + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == independent); + statement = QUOTE([_player, side group _player, true] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; + }; + }; + + // team leader + class Man; + class CAManBase : Man { + class ACE_SelfActions { + class ACE_MoveRallypoint { + displayName = "Move Rallypoint"; + condition = QUOTE([_player, side group _player] call FUNC(canMoveRallypoint)); + statement = QUOTE([_player, side group _player] call FUNC(moveRallypoint)); + showDisabled = 0; + priority = -0.5; + }; + }; + }; +}; diff --git a/TO_MERGE/agm/Respawn/UI/Icon_Module_FriendlyFire_ca.paa b/addons/respawn/UI/Icon_Module_FriendlyFire_ca.paa similarity index 100% rename from TO_MERGE/agm/Respawn/UI/Icon_Module_FriendlyFire_ca.paa rename to addons/respawn/UI/Icon_Module_FriendlyFire_ca.paa diff --git a/TO_MERGE/agm/Respawn/UI/Icon_Module_Rallypoint_ca.paa b/addons/respawn/UI/Icon_Module_Rallypoint_ca.paa similarity index 100% rename from TO_MERGE/agm/Respawn/UI/Icon_Module_Rallypoint_ca.paa rename to addons/respawn/UI/Icon_Module_Rallypoint_ca.paa diff --git a/TO_MERGE/agm/Respawn/UI/Icon_Module_Respawn_ca.paa b/addons/respawn/UI/Icon_Module_Respawn_ca.paa similarity index 100% rename from TO_MERGE/agm/Respawn/UI/Icon_Module_Respawn_ca.paa rename to addons/respawn/UI/Icon_Module_Respawn_ca.paa diff --git a/addons/respawn/XEH_preInit.sqf b/addons/respawn/XEH_preInit.sqf new file mode 100644 index 0000000000..9ce46777dd --- /dev/null +++ b/addons/respawn/XEH_preInit.sqf @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +PREP(canMoveRallypoint); +PREP(getAllGear); +PREP(handleKilled); +PREP(handleRespawn); +PREP(initRallypoint); +PREP(module); +PREP(moduleFriendlyFire); +PREP(moduleRallypoint); +PREP(moveRallypoint); +PREP(removeBody); +PREP(removeDisconnectedPlayer); +PREP(restoreGear); +PREP(showFriendlyFireMessage); +PREP(teleportToRallypoint); diff --git a/addons/respawn/config.cpp b/addons/respawn/config.cpp new file mode 100644 index 0000000000..2391af350f --- /dev/null +++ b/addons/respawn/config.cpp @@ -0,0 +1,25 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = { "ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_RallypointExit_West", "ACE_RallypointExit_East", "ACE_RallypointExit_Independent" }; + requiredVersion = 0.60; + requiredAddons[] = { "ace_common" }; + version = QUOTE(VERSION); + versionStr = QUOTE(VERSION); + versionAr[] = { VERSION_AR }; + author[] = { "bux578", "commy2" }; + authorUrl = "https://github.com/bux578/"; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgAddons.hpp" +#include "CfgVehicleClasses.hpp" +#include "CfgVehicles.hpp" + +class ACE_Parameters_Boolean { + GVAR(SavePreDeathGear) = 0; + GVAR(RemoveDeadBodiesDisconnected) = 1; +}; diff --git a/addons/respawn/functions/fnc_canMoveRallypoint.sqf b/addons/respawn/functions/fnc_canMoveRallypoint.sqf new file mode 100644 index 0000000000..d5f325c067 --- /dev/null +++ b/addons/respawn/functions/fnc_canMoveRallypoint.sqf @@ -0,0 +1,33 @@ +/* + 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 +*/ + +#include "script_component.hpp" + +private ["_unit", "_side"]; + +_unit = _this select 0; +_side = _this select 1; + +// rallypoint names are defined in CfgVehicles.hpp + +_unit getVariable ["ACE_canMoveRallypoint", false] +&& {!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)} diff --git a/addons/respawn/functions/fnc_getAllGear.sqf b/addons/respawn/functions/fnc_getAllGear.sqf new file mode 100644 index 0000000000..ad9f3dbb68 --- /dev/null +++ b/addons/respawn/functions/fnc_getAllGear.sqf @@ -0,0 +1,45 @@ +/* + Name: ACE_Respawn_fnc_getAllGear + + Author(s): + bux578 + + Description: + returns an array containing all items of a given unit + + Parameters: + 0: OBJECT - unit + + Returns: + ARRAY +*/ + +#include "script_component.hpp" + +private ["_unit", "_allGear"]; + +_unit = _this select 0; + +_allGear = [ + (headgear _unit), + (goggles _unit), + (uniform _unit), + (uniformItems _unit), + (vest _unit), + (vestItems _unit), + (backpack _unit), + (backpackItems _unit), + (primaryWeapon _unit), + (primaryWeaponItems _unit), + (primaryWeaponMagazine _unit), + (secondaryWeapon _unit), + (secondaryWeaponItems _unit), + (secondaryWeaponMagazine _unit), + (handgunWeapon _unit), + (handgunItems _unit), + (handgunMagazine _unit), + (assignedItems _unit), + (binocular _unit) +]; + +_allGear diff --git a/addons/respawn/functions/fnc_handleKilled.sqf b/addons/respawn/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..e83a1f1dec --- /dev/null +++ b/addons/respawn/functions/fnc_handleKilled.sqf @@ -0,0 +1,33 @@ +/* + Name: ACE_Respawn_fnc_handleKilled + + Author(s): + bux578 + + Description: + Handles the XEH Killed event + + Parameters: + 0: OBJECT - Killed unit + 1: OBJECT - Attacker + + Returns: + VOID +*/ + +#include "script_component.hpp" + +private ["_killedUnit"]; + +_killedUnit = _this select 0; + +// Saves the gear when the player is killed +GVAR(unitGear) = []; + +if (GVAR(SavePreDeathGear)) then { + GVAR(unitGear) = [_killedUnit] call FUNC(getAllGear); +}; + +if (missionNamespace getVariable [QGVAR(showFriendlyFireMessage), false]) then { + [_this, FUNC(showFriendlyFireMessage), 2] call EFUNC(common,execRemoteFnc); +}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_handleRespawn.sqf b/addons/respawn/functions/fnc_handleRespawn.sqf similarity index 62% rename from TO_MERGE/agm/Respawn/functions/fn_handleRespawn.sqf rename to addons/respawn/functions/fnc_handleRespawn.sqf index 499bd33e8a..a9fe3293ac 100644 --- a/TO_MERGE/agm/Respawn/functions/fn_handleRespawn.sqf +++ b/addons/respawn/functions/fnc_handleRespawn.sqf @@ -1,5 +1,5 @@ /* - Name: AGM_Respawn_fnc_handleRespawn + Name: ACE_Respawn_fnc_handleRespawn Author(s): bux578 @@ -15,11 +15,13 @@ VOID */ +#include "script_component.hpp" + private ["_respawnedUnit"]; _respawnedUnit = _this select 0; // Restores the gear when the player respawns -if (AGM_Respawn_SavePreDeathGear) then { - [_respawnedUnit, AGM_Respawn_unitGear] call AGM_Respawn_fnc_restoreGear; +if (GVAR(SavePreDeathGear)) then { + [_respawnedUnit, GVAR(unitGear)] call FUNC(restoreGear); }; diff --git a/addons/respawn/functions/fnc_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf new file mode 100644 index 0000000000..cb4d55146f --- /dev/null +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -0,0 +1,33 @@ +/* + Name: ACE_Respawn_fnc_initRallypoint + + Author(s): + commy2 + + Description: + init code for rally points + + Parameters: + 0: OBJECT - rally + + Returns: + VOID +*/ + +#include "script_component.hpp" + +private ["_rallypoint", "_name"]; + +_rallypoint = _this select 0; + +if (!local _rallypoint) exitWith {}; + +_name = typeOf _rallypoint; + +if (isNil _name) then { + missionNamespace setVariable [_name, _rallypoint]; + publicVariable _name; +} else { + deleteVehicle _rallypoint; + diag_log text "[ACE] Respawn: ERROR Multiple Rallypoints of same type."; +}; diff --git a/addons/respawn/functions/fnc_module.sqf b/addons/respawn/functions/fnc_module.sqf new file mode 100644 index 0000000000..0a996d0acc --- /dev/null +++ b/addons/respawn/functions/fnc_module.sqf @@ -0,0 +1,52 @@ + /* + Name: ACE_Respawn_fnc_module + + Author(s): + KoffeinFlummi, bux578, CAA-Picard, commy2 + + Description: + initializes the respawn module + + Parameters: + 0: OBJECT - logic + 1: ARRAY - synced units + 2: BOOLEAN - activated + + Returns: + VOID +*/ + +#include "script_component.hpp" + +if !(isServer) exitWith {}; + +_logic = _this select 0; +_activated = _this select 2; + +if !(_activated) exitWith {}; + +GVAR(Module) = true; + +[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readBooleanParameterFromModule); +[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readBooleanParameterFromModule); + +if (isServer) then { + if (GVAR(RemoveDeadBodiesDisconnected)) then { + _fnc_deleteDisconnected = { + _this spawn { + _unit = _this select 0; + + sleep 4; + + if (!alive _unit) then { + deleteVehicle _unit; + }; + }; + false + }; + + addMissionEventHandler ["HandleDisconnect", _fnc_deleteDisconnected]; + }; +}; + +diag_log text "[ACE]: Respawn Module Initialized."; diff --git a/addons/respawn/functions/fnc_moduleFriendlyFire.sqf b/addons/respawn/functions/fnc_moduleFriendlyFire.sqf new file mode 100644 index 0000000000..35857b43e4 --- /dev/null +++ b/addons/respawn/functions/fnc_moduleFriendlyFire.sqf @@ -0,0 +1,36 @@ +/* + Name: ACE_Respawn_fnc_moduleFriendlyFire + + Author(s): + commy2 + + Description: + initializes the Friendly Fire Messages module + + Parameters: + 0: OBJECT - logic + 1: ARRAY - synced units + 2: BOOLEAN - activated + + Returns: + VOID +*/ + +#include "script_component.hpp" + +_this spawn { + _logic = _this select 0; + _units = _this select 1; + _activated = _this select 2; + + if !(_activated) exitWith {}; + + if (isServer) then { + _varName = QGVAR(showFriendlyFireMessage); + + missionNamespace setVariable [_varName, true]; + publicVariable _varName; + }; + + diag_log text "[ACE]: Friendly Fire Messages Module Initialized."; +}; diff --git a/addons/respawn/functions/fnc_moduleRallypoint.sqf b/addons/respawn/functions/fnc_moduleRallypoint.sqf new file mode 100644 index 0000000000..1646fa72da --- /dev/null +++ b/addons/respawn/functions/fnc_moduleRallypoint.sqf @@ -0,0 +1,31 @@ +/* + Name: ACE_Respawn_fnc_moduleRallypoint + + Author(s): + commy2 + + Description: + initializes the Rallypoint module + + Parameters: + 0: OBJECT - logic + 1: ARRAY - synced units + 2: BOOLEAN - activated + + Returns: + VOID +*/ + + #include "script_component.hpp" + +_logic = _this select 0; +_units = _this select 1; +_activated = _this select 2; + +if !(_activated) exitWith {}; + +{ + _x setVariable ["ACE_canMoveRallypoint", true]; +} forEach _units; + +diag_log text "[ACE]: Rallypoint Module Initialized."; diff --git a/addons/respawn/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf new file mode 100644 index 0000000000..dcd4810844 --- /dev/null +++ b/addons/respawn/functions/fnc_moveRallypoint.sqf @@ -0,0 +1,54 @@ +/* + 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 +*/ + +#include "script_component.hpp" + +_this spawn { + _unit = _this select 0; + _side = _this select 1; + + // rallypoint names are defined in CfgVehicles.hpp + + _rallypoint = [ + objNull, + missionNamespace getVariable ["ACE_Rallypoint_West", objNull], + missionNamespace getVariable ["ACE_RallypointExit_East", objNull], + missionNamespace getVariable ["ACE_RallypointExit_Independent", objNull] + ] select ([west, east, independent] find _side) + 1; + + if (isNull _rallypoint) exitWith {}; + + _position = getPosATL _unit; + _position = _position findEmptyPosition [0, 2, typeOf _rallypoint]; + if (count _position == 0) then {_position = getPosATL _unit}; + + _position set [2, 0]; + + [localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); + + sleep 5; + _rallypoint setPosATL _position; + _unit reveal _rallypoint; + + /* + _marker = format ["AGM_RallyPoint_%1", _side]; + _marker setMarkerPos _position; + _marker setMarkerTextLocal format ["%1:%2", [date select 3, 2, 0] call CBA_fnc_FORMATNumber, [date select 4, 2, 0] call CBA_fnc_FORMATNumber]; + */ + + [localize "STR_ACE_Respawn_Deploy"] call EFUNC(common,displayTextStructured); +}; diff --git a/addons/respawn/functions/fnc_removeBody.sqf b/addons/respawn/functions/fnc_removeBody.sqf new file mode 100644 index 0000000000..5c3ed14988 --- /dev/null +++ b/addons/respawn/functions/fnc_removeBody.sqf @@ -0,0 +1,37 @@ +/* + 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 +*/ + +#include "script_component.hpp" + +private ["_body", "_forceRemove", "_bodyRemoveTimer"]; + +_body = _this select 0; +_forceRemove = _this select 1; + +_bodyRemoveTimer = GVAR(BodyRemoveTimer) max 0; + +// could be used for SpecOps missions. +if (_forceRemove) then { + _bodyRemoveTimer = 2; +}; + +[_body, _bodyRemoveTimer] spawn { + sleep (_this select 1); + // hideBody takes ~20s till body is fully underground + // a better hideBody would make this more aesthetic + deleteVehicle (_this select 0); +}; diff --git a/addons/respawn/functions/fnc_removeDisconnectedPlayer.sqf b/addons/respawn/functions/fnc_removeDisconnectedPlayer.sqf new file mode 100644 index 0000000000..492cd990a4 --- /dev/null +++ b/addons/respawn/functions/fnc_removeDisconnectedPlayer.sqf @@ -0,0 +1,31 @@ +/* + 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"]; + +_forceRemove = _this select 0; + +{ + if (getPlayerUID _x == _uid) exitWith { + _body = _x; + }; +} forEach playableUnits; + +if (!isNil "_body" && {!alive _body}) then { + [_body, _forceRemove] call FUNC(removeBody); +}; diff --git a/TO_MERGE/agm/Respawn/functions/fn_restoreGear.sqf b/addons/respawn/functions/fnc_restoreGear.sqf similarity index 55% rename from TO_MERGE/agm/Respawn/functions/fn_restoreGear.sqf rename to addons/respawn/functions/fnc_restoreGear.sqf index f724e31af1..18afba344b 100644 --- a/TO_MERGE/agm/Respawn/functions/fn_restoreGear.sqf +++ b/addons/respawn/functions/fnc_restoreGear.sqf @@ -1,16 +1,22 @@ /* -Author: bux578 - -Description: -Restores previously saved gear - -Arguments: -A player object, an array containing all gear - -Return value: -An array containing all inventory items + Name: ACE_Respawn_fnc_removeBody + + Author(s): + bux578 + + Description: + Restores previously saved gear + + Parameters: + 0: OBJECT - unit + 1: ARRAY - Array containing all gear + + Returns: + VOID */ +#include "script_component.hpp" + private ["_unit", "_allGear", "_headgear", "_goggles", "_uniform", "_uniformitems", "_vest", "_vestitems", "_backpack", "_backpackitems", "_primaryweapon", "_primaryweaponitems", "_primaryweaponmagazine", "_handgunweapon", "_handgunweaponitems", "_handgunweaponmagazine", "_assigneditems", "_binocular"]; @@ -50,85 +56,85 @@ _binocular = _allGear select 18; // start restoring the items if (_headgear != "") then { - _unit addHeadgear _headgear; + _unit addHeadgear _headgear; }; if (_uniform != "") then { - _unit forceAddUniform _uniform; + _unit forceAddUniform _uniform; }; if (_vest != "") then { - _unit addVest _vest; + _unit addVest _vest; }; if (_goggles != "") then { - _unit addGoggles _goggles; + _unit addGoggles _goggles; }; { - _unit addItemToUniform _x; + _unit addItemToUniform _x; }forEach _uniformitems; { - _unit addItemToVest _x; + _unit addItemToVest _x; }forEach _vestitems; if(format["%1", _backpack] != "") then { - _unit addBackpack _backpack; + _unit addBackpack _backpack; - _backpa = unitBackpack _unit; - clearMagazineCargoGlobal _backpa; - clearWeaponCargoGlobal _backpa; - clearItemCargoGlobal _backpa; - { - _unit addItemToBackpack _x; - } forEach _backpackitems; + _backpa = unitBackpack _unit; + clearMagazineCargoGlobal _backpa; + clearWeaponCargoGlobal _backpa; + clearItemCargoGlobal _backpa; + { + _unit addItemToBackpack _x; + } forEach _backpackitems; }; // primaryWeapon if (_primaryweapon != "") then { - { - _unit addMagazine _x; - } forEach _primaryweaponmagazine; + { + _unit addMagazine _x; + } forEach _primaryweaponmagazine; - _unit addWeapon _primaryweapon; + _unit addWeapon _primaryweapon; - { - if (_x != "") then { - _unit addPrimaryWeaponItem _x; - }; - } forEach _primaryweaponitems; + { + if (_x != "") then { + _unit addPrimaryWeaponItem _x; + }; + } forEach _primaryweaponitems; }; // secondaryWeapon if (_secondaryweapon != "") then { - { - _unit addMagazine _x; - } forEach _secondaryweaponmagazine; + { + _unit addMagazine _x; + } forEach _secondaryweaponmagazine; - _unit addWeapon _secondaryweapon; + _unit addWeapon _secondaryweapon; - { - if (_x != "") then { - _unit addSecondaryWeaponItem _x; - }; - } forEach _secondaryweaponitems; + { + if (_x != "") then { + _unit addSecondaryWeaponItem _x; + }; + } forEach _secondaryweaponitems; }; // handgun if (_handgunweapon != "") then { - { - _unit addMagazine _x; - } forEach _handgunweaponmagazine; + { + _unit addMagazine _x; + } forEach _handgunweaponmagazine; - _unit addWeapon _handgunweapon; + _unit addWeapon _handgunweapon; - { - if (_x != "") then { - _unit addHandgunItem _x; - }; - } forEach _handgunweaponitems; + { + if (_x != "") then { + _unit addHandgunItem _x; + }; + } forEach _handgunweaponitems; }; @@ -140,6 +146,6 @@ _assignedItems = _assignedItems - [_binocular]; _unit addWeapon _binocular; if ("Laserdesignator" in assignedItems _unit) then { - _unit selectWeapon "Laserdesignator"; - if (currentMagazine _unit == "") then {_unit addMagazine "Laserbatteries";}; + _unit selectWeapon "Laserdesignator"; + if (currentMagazine _unit == "") then {_unit addMagazine "Laserbatteries";}; }; diff --git a/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf b/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf new file mode 100644 index 0000000000..f384b69284 --- /dev/null +++ b/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf @@ -0,0 +1,29 @@ +/* + 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 +*/ + +#include "script_component.hpp" + +private ["_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 { + systemChat format ["%1 was killed by %2", [_unit] call EFUNC(common,getName), [_killer] call EFUNC(common,getName)]; + + [_unit, "killedByFriendly", [_unit, _killer]] call EFUNC(common,callCustomEventHandlers); +}; diff --git a/addons/respawn/functions/fnc_teleportToRallypoint.sqf b/addons/respawn/functions/fnc_teleportToRallypoint.sqf new file mode 100644 index 0000000000..8d898441ee --- /dev/null +++ b/addons/respawn/functions/fnc_teleportToRallypoint.sqf @@ -0,0 +1,47 @@ +/* + Name: ACE_Respawn_fnc_teleportToRallypoint + + Author(s): + commy2 + + Description: + teleports a unit to a rallypoint + + Parameters: + 0: OBJECT - unit + 1: OBJECT - side + 2: BOOLEAN - teleport to base + + Returns: + VOID +*/ + +#include "script_component.hpp" + +private ["_unit", "_side", "_toBase", "_rallypoint"]; + +_unit = _this select 0; +_side = _this select 1; +_toBase = _this select 2; + +// rallypoint names are defined in CfgVehicles.hpp + +_rallypoint = ([ + [ + objNull, + missionNamespace getVariable ["ACE_RallypointExit_West", objNull], + missionNamespace getVariable ["ACE_RallypointExit_East", objNull], + missionNamespace getVariable ["ACE_RallypointExit_Independent", objNull] + ], + [ + objNull, + missionNamespace getVariable ["ACE_Rallypoint_West", objNull], + missionNamespace getVariable ["ACE_Rallypoint_East", objNull], + missionNamespace getVariable ["ACE_Rallypoint_Independent", objNull] + ] +] select _toBase) select ([west, east, independent] find _side) + 1; + +if (isNull _rallypoint) exitWith {}; + +_unit setPosASL (getPosASL _rallypoint); +[[localize "STR_ACE_Respawn_TeleportedToRallypoint", localize "STR_ACE_Respawn_TeleportedToBase"] select _toBase] call EFUNC(common,displayTextStructured); diff --git a/addons/respawn/functions/script_component.hpp b/addons/respawn/functions/script_component.hpp new file mode 100644 index 0000000000..eeb32a47bd --- /dev/null +++ b/addons/respawn/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\respawn\script_component.hpp" \ No newline at end of file diff --git a/addons/respawn/script_component.hpp b/addons/respawn/script_component.hpp new file mode 100644 index 0000000000..0ecb27b1d4 --- /dev/null +++ b/addons/respawn/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT respawn +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_RESPAWN + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_RESPAWN + #define DEBUG_SETTINGS DEBUG_SETTINGS_RESPAWN +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/respawn/stringtable.xml b/addons/respawn/stringtable.xml new file mode 100644 index 0000000000..59a9b2b31c --- /dev/null +++ b/addons/respawn/stringtable.xml @@ -0,0 +1,21 @@ + + + + + Deploy in 5 seconds ... + Wird in 5 Sekunden errichtet ... + + + Rallypoint deployed + Rallypoint errichtet + + + Teleported to Base + Zur Basis teleportiert + + + Teleported to Rallypoint + Zum Rallypoint teleportiert + + +