Added missing assign modules

This commit is contained in:
Glowbal 2015-08-15 15:49:41 +02:00
parent 2be74dfdca
commit d3aa6a7f6b
10 changed files with 233 additions and 47 deletions

View File

@ -11,6 +11,7 @@ PREP(addCanInteractWithCondition);
PREP(addLineToDebugDraw);
PREP(addSetting);
PREP(addToInventory);
PREP(assignObjectsInList);
PREP(ambientBrightness);
PREP(applyForceWalkStatus);
PREP(ASLToPosition);

View File

@ -0,0 +1,50 @@
/*
* Author: Glowbal
* Loops through a string and filters out object names/variables to assign a value for given variable.
* Used by moduleAssign* within various parts of the ACE3 project.
*
* Arguments:
* 0: list <STRING>
* 1: variableName <STRING>
* 2: value <ANY>
* 3: Global <BOOL>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
private ["_splittedList", "_nilCheckPassedList"];
params ["_list", "_variable", "_setting", "_global"];
if (typeName _list == "STRING") then {
_splittedList = [_list, ","] call BIS_fnc_splitString;
_nilCheckPassedList = "";
{
_x = [_x] call FUNC(stringRemoveWhiteSpace);
if !(isnil _x) then {
if (_nilCheckPassedList == "") then {
_nilCheckPassedList = _x;
} else {
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
};
};
}foreach _splittedList;
_list = [] call compile format["[%1]",_nilCheckPassedList];
};
{
if (!isnil "_x") then {
if (typeName _x == typeName objNull) then {
if (local _x) then {
_x setvariable [_variable, _setting, _global];
};
};
};
}foreach _list;
true

View File

@ -144,6 +144,78 @@ class CfgVehicles {
sync[] = {};
};
};
class ACE_moduleAssignRepairVehicle: Module_F {
scope = 2;
displayName = CSTRING(AssignRepairVehicle_Module_DisplayName);
icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa));
category = "ACE";
function = QUOTE(DFUNC(moduleAssignRepairVehicle));
functionPriority = 10;
isGlobal = 2;
isTriggerActivated = 0;
isDisposable = 0;
author = ECSTRING(common,ACETeam);
class Arguments {
class EnableList {
displayName = CSTRING(AssignRepairVehicle_EnableList_DisplayName);
description = CSTRING(AssignRepairVehicle_EnableList_Description);
defaultValue = "";
typeName = "STRING";
};
class role {
displayName = CSTRING(AssignRepairVehicle_role_DisplayName);
description = CSTRING(AssignRepairVehicle_role_Description);
typeName = "NUMBER";
class values {
class none {
name = ECSTRING(common,No);
value = 0;
};
class isVehicle {
name = ECSTRING(common,Yes);
value = 1;
default = 1;
};
};
};
};
class ModuleDescription {
description = CSTRING(AssignRepairVehicle_Module_Description);
sync[] = {};
};
};
class ACE_moduleAssignRepairFacility: ACE_moduleAssignRepairVehicle {
displayName = CSTRING(AssignRepairFacility_Module_DisplayName);
function = QUOTE(DFUNC(moduleAssignRepairFacility));
class Arguments {
class EnableList {
displayName = CSTRING(AssignRepairFacility_EnableList_DisplayName);
description = CSTRING(AssignRepairFacility_EnableList_Description);
defaultValue = "";
typeName = "STRING";
};
class role {
displayName = CSTRING(AssignRepairFacility_role_DisplayName);
description = CSTRING(AssignRepairFacility_role_Description);
typeName = "NUMBER";
class values {
class none {
name = ECSTRING(common,No);
value = 0;
};
class isFacility {
name = ECSTRING(common,Yes);
value = 1;
default = 1;
};
};
};
};
class ModuleDescription {
description = CSTRING(AssignRepairFacility_Module_Description);
sync[] = {};
};
};
class LandVehicle;

View File

@ -25,6 +25,8 @@ PREP(isNearRepairVehicle);
PREP(isRepairVehicle);
PREP(moduleRepairSettings);
PREP(moduleAssignEngineer);
PREP(moduleAssignRepairVehicle);
PREP(moduleAssignRepairFacility);
PREP(normalizeHitPoints);
PREP(repair);
PREP(repair_failure);

View File

@ -1,12 +1,12 @@
/*
* Author: Glowbal
* Checks if a unit is in a designated engineeral facility
* Checks if a unit is in a repair facility
*
* Arguments:
* 0: The Unit <OBJECT>
*
* ReturnValue:
* Is in engineeral facility <BOOL>
* Is inside a repair facility <BOOL>
*
* Public: Yes
*/
@ -24,7 +24,7 @@ _repairFacility = [];
_objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position select 2)], _object modelToWorldVisual [0, 0, (_position select 2) +10], _object]);
{
if (((typeOf _x) in _repairFacility) || (_x getVariable [QGVAR(isRepairFacility),false])) exitwith {
if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith {
_isInBuilding = true;
};
} forEach _objects;
@ -32,7 +32,7 @@ _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position sel
if (!_isInBuilding) then {
_objects = position _object nearObjects 7.5;
{
if (((typeOf _x) in _repairFacility) || (_x getVariable [QGVAR(isRepairFacility),false])) exitwith {
if (((typeOf _x) in _repairFacility) || (_x getVariable ["ACE_isRepairFacility",0]) > 0) exitwith {
_isInBuilding = true;
};
} forEach _objects;

View File

@ -17,4 +17,4 @@ TRACE_1("params",_vehicle);
if (_vehicle isKindOf "CAManBase") exitwith {false};
((_vehicle getVariable [QGVAR(engineerClass), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(canRepair))]) > 0);
((_vehicle getVariable ["ACE_isRepairVehicle", getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(canRepair))]) > 0);

View File

@ -15,49 +15,15 @@
#include "script_component.hpp"
private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"];
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
params ["_logic"];
if (!isNull _logic) then {
private ["_list", "_setting"];
_list = _logic getvariable ["EnableList",""];
_splittedList = [_list, ","] call BIS_fnc_splitString;
_nilCheckPassedList = "";
{
_x = [_x] call EFUNC(common,stringRemoveWhiteSpace);
if !(isnil _x) then {
if (_nilCheckPassedList == "") then {
_nilCheckPassedList = _x;
} else {
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
};
};
}foreach _splittedList;
_list = "[" + _nilCheckPassedList + "]";
_parsedList = [] call compile _list;
_setting = _logic getvariable ["role",0];
_objects = synchronizedObjects _logic;
if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then {
{
if (!isnil "_x") then {
if (typeName _x == typeName objNull) then {
if (local _x) then {
_x setvariable ["ACE_IsEngineer", _setting, true];
};
};
};
}foreach _objects;
};
{
if (!isnil "_x") then {
if (typeName _x == typeName objNull) then {
if (local _x) then {
_x setvariable ["ACE_IsEngineer", _setting, true];
};
};
};
}foreach _parsedList;
[_list, "ACE_IsEngineer", _setting, true] call EFUNC(common,assignObjectsInList);
[synchronizedObjects _logic, "ACE_IsEngineer", _setting, true] call EFUNC(common,assignObjectsInList);
};
true

View File

@ -0,0 +1,29 @@
/*
* Author: Glowbal
* Assign an repair facility
*
* Arguments:
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_logic"];
if (!isNull _logic) then {
private ["_list", "_setting"];
_list = _logic getvariable ["EnableList",""];
_setting = _logic getvariable ["role",0];
[_list, "ACE_isRepairFacility", _setting, true] call EFUNC(common,assignObjectsInList);
[synchronizedObjects _logic, "ACE_isRepairFacility", _setting, true] call EFUNC(common,assignObjectsInList);
};
true

View File

@ -0,0 +1,29 @@
/*
* Author: Glowbal
* Assign an repair vehicle
*
* Arguments:
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_logic"];
if (!isNull _logic) then {
private ["_list", "_setting"];
_list = _logic getvariable ["EnableList",""];
_setting = _logic getvariable ["role",0];
[_list, "ACE_isRepairVehicle", _setting, true] call EFUNC(common,assignObjectsInList);
[synchronizedObjects _logic, "ACE_isRepairVehicle", _setting, true] call EFUNC(common,assignObjectsInList);
};
true

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-21 -->
<Project name="ACE">
<Package name="repair">
@ -598,5 +598,42 @@
<Key ID="STR_ACE_Repair_AssignEngineerRole_Module_Description">
<English>Assign one or multiple units as an engineer</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairVehicle_Module_DisplayName">
<English>Assign Repair Vehicle</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairVehicle_EnableList_DisplayName">
<English>List</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairVehicle_EnableList_Description">
<English>List of vehicles that will be classified as repair vehicle, separated by commas.</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairVehicle_role_DisplayName">
<English>Is Repair Vehicle</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairVehicle_role_Description">
<English>Is the vehicle classified as a repair vehicle?</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairVehicle_Module_Description">
<English>Assign one or multiple vehicles as a repair vehicle</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairFacility_Module_DisplayName">
<English>Assign Repair Facility</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairFacility_EnableList_DisplayName">
<English>List</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairFacility_EnableList_Description">
<English>List of objects that will be classified as repair Facility, separated by commas.</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairFacility_role_DisplayName">
<English>Is Repair Facility</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairFacility_role_Description">
<English>Is the object classified as a repair Facility?</English>
</Key>
<Key ID="STR_ACE_Repair_AssignRepairFacility_Module_Description">
<English>Assign one or multiple objects as a repair Facility</English>
</Key>
</Package>
</Project>