Add search nearby building zeus module

This commit is contained in:
SilentSpike 2016-05-18 21:19:52 +01:00
parent 600b71817f
commit e05f2ca637
6 changed files with 65 additions and 0 deletions

View File

@ -113,6 +113,11 @@ class CfgVehicles {
displayName = CSTRING(ModuleGroupSide_DisplayName);
curatorInfoType = QGVAR(RscGroupSide);
};
class GVAR(moduleSearchNearby): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = CSTRING(ModuleSearchNearby_DisplayName);
function = QFUNC(moduleSearchNearby);
};
class GVAR(moduleSetMedic): GVAR(moduleBase) {
curatorCanAttach = 1;
displayName = CSTRING(ModuleSetMedic_DisplayName);

View File

@ -10,6 +10,7 @@ PREP(moduleAddSpareWheel);
PREP(moduleCaptive);
PREP(moduleGlobalSetSkill);
PREP(moduleGroupSide);
PREP(moduleSearchNearby);
PREP(moduleSetMedic);
PREP(moduleSetMedicalVehicle);
PREP(moduleSetMedicalFacility);

View File

@ -2,3 +2,5 @@
// Global skill module PVs values for persistence, just listen for the PV
QGVAR(GlobalSkillAI) addPublicVariableEventHandler FUNC(moduleGlobalSetSkill);
[QGVAR(moduleSearchNearby), CBA_fnc_searchNearby] call EFUNC(common,addEventHandler);

View File

@ -5,6 +5,7 @@ class CfgPatches {
units[] = {
QGVAR(moduleGlobalSetSkill),
QGVAR(moduleGroupSide),
QGVAR(moduleSearchNearby),
QGVAR(moduleTeleportPlayers)
};
weapons[] = {};

View File

@ -0,0 +1,50 @@
/*
* Author: SilentSpike
* Commands the group the module is placed on to search the nearest building
*
* Arguments:
* 0: The module logic <OBJECT>
* 1: Synchronized units <ARRAY>
* 2: Activated <BOOL>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_logic","_units","_activated"];
if !(_activated && local _logic) exitWith {};
//Validate the module target:
private _unit = effectiveCommander (attachedTo _logic);
private _building = nearestBuilding (getPosASL _unit);
scopeName "Main";
private _fnc_errorAndClose = {
params ["_msg"];
deleteVehicle _logic;
[_msg] call EFUNC(common,displayTextStructured);
breakOut "Main";
};
switch (false) do {
case !(isNull _unit): {
[LSTRING(NothingSelected)] call _fnc_errorAndClose;
};
case (_unit isKindOf "CAManBase"): {
[LSTRING(OnlyInfantry)] call _fnc_errorAndClose;
};
case (alive _unit): {
[LSTRING(OnlyAlive)] call _fnc_errorAndClose;
};
case (_unit distance _building < 500): {
[LSTRING(BuildingTooFar)] call _fnc_errorAndClose;
};
};
//Perform the module function:
[QGVAR(moduleSearchNearby), _unit, [_unit]] call EFUNC(common,targetEvent);

View File

@ -262,6 +262,9 @@
<Russian>Без сознания (вкл./выкл.)</Russian>
<Italian>Apri Incosciente</Italian>
</Key>
<Key ID="STR_ACE_Zeus_ModuleSearchNearby_DisplayName">
<English>Search Nearby Building</English>
</Key>
<Key ID="STR_ACE_Zeus_ModuleSetMedic_DisplayName">
<English>Assign Medic</English>
<German>Sanitäter zuweisen.</German>
@ -387,6 +390,9 @@
<Key ID="STR_ACE_Zeus_OnlySpecificSide">
<English>Unit must belong to an appropriate side</English>
</Key>
<Key ID="STR_ACE_Zeus_BuildingTooFar">
<English>Nearest building is too far away</English>
</Key>
<Key ID="STR_ACE_Zeus_NothingSelected">
<English>Place on a unit</English>
<French>Rien sous le curseur</French>