Localization, params

This commit is contained in:
PabstMirror 2015-08-09 01:54:44 -05:00
parent 0e17bebd23
commit 4b603ff46f
31 changed files with 234 additions and 245 deletions

View File

@ -1,32 +1,42 @@
class ACE_Settings {
class GVAR(DisplayTextOnRepair) {
displayName = CSTRING(SettingDisplayTextName);
description = CSTRING(SettingDisplayTextDesc);
typeName = "BOOL";
isClientSetable = 1;
value = 1;
displayName = "$STR_ACE_Repair_SettingDisplayTextName";
description = "$STR_ACE_Repair_SettingDisplayTextDesc";
};
class GVAR(engineerSetting_Repair) {
displayName = CSTRING(enginerSetting_Repair_name);
description = CSTRING(enginerSetting_Repair_description);
typeName = "SCALAR";
value = 1;
values[] = {"Anyone", "Engineer only", "Repair Specialist only"};
values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)};
};
class GVAR(engineerSetting_Wheel) {
displayName = CSTRING(enginerSetting_Wheel_name);
description = CSTRING(enginerSetting_Wheel_description);
typeName = "SCALAR";
value = 0;
values[] = {"Anyone", "Engineer only", "Repair Specialist only"};
};
class GVAR(consumeItem_ToolKit) {
typeName = "SCALAR";
value = 1;
values[] = {"No", "Yes"};
values[] = {CSTRING(engineerSetting_anyone), CSTRING(engineerSetting_EngineerOnly), CSTRING(engineerSetting_RepairSpecialistOnly)};
};
class GVAR(repairDamageThreshold) {
displayName = CSTRING(repairDamageThreshold_name);
description = CSTRING(repairDamageThreshold_description);
typeName = "SCALAR";
value = 0;
};
class GVAR(repairDamageThreshold_Engineer) {
displayName = CSTRING(repairDamageThreshold_Engineer_name);
description = CSTRING(repairDamageThreshold_Engineer_description);
typeName = "SCALAR";
value = 0;
};
class GVAR(consumeItem_ToolKit) {
displayName = CSTRING(consumeItem_ToolKit_name);
description = CSTRING(consumeItem_ToolKit_description);
typeName = "SCALAR";
value = 1;
values[] = {ECSTRING(common,No), ECSTRING(common,Yes)};
};
};

View File

@ -1,39 +1,39 @@
class ACE_Repair {
class Actions {
class ReplaceWheel {
displayName = CSTRING(ReplaceWheel);
displayNameProgress = CSTRING(ReplacingWheel);
class Actions {
class ReplaceWheel {
displayName = CSTRING(ReplaceWheel);
displayNameProgress = CSTRING(ReplacingWheel);
locations[] = {"All"};
requiredEngineer = 0;
repairingTime = 5;
repairingTimeSelfCoef = 1;
items[] = {};
condition = "";
itemConsumed = 0;
locations[] = {"All"};
requiredEngineer = 0;
repairingTime = 5;
repairingTimeSelfCoef = 1;
items[] = {};
condition = "";
itemConsumed = 0;
callbackSuccess = QUOTE(DFUNC(repairBasic_bandage));
callbackFailure = "";
callbackProgress = "";
callbackSuccess = QUOTE(DFUNC(repairBasic_bandage));
callbackFailure = "";
callbackProgress = "";
animationCaller = "AinvPknlMstpSlayWrflDnon_medicOther";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther";
animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
litter[] = {};
};
class RemoveWheel: ReplaceWheel {
animationCaller = "AinvPknlMstpSlayWrflDnon_medicOther";
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther";
animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
litter[] = {};
};
class RemoveWheel: ReplaceWheel {
};
class RepairEngine {
};
class RepairEngine {
};
class Tracks: ReplaceWheel {
};
class Tracks: ReplaceWheel {
};
class MiscRepair: ReplaceWheel {
displayName = ""; // let's make empty string an auto generated string
displayNameProgress = CSTRING(Repairing);
};
};
};
class MiscRepair: ReplaceWheel {
displayName = ""; // let's make empty string an auto generated string
displayNameProgress = CSTRING(Repairing);
};
};
};

View File

@ -3,7 +3,7 @@
class ACE_Actions { \
class ACE_MainActions { \
class GVAR(Repair) { \
displayName = "$STR_ACE_Repair_Repair"; \
displayName = CSTRING(Repair); \
condition = QUOTE([ARR_2(_this select 0, GVAR(engineerSetting_Repair))] call DFUNC(isEngineer)); \
statement = "'show a hint with the hitpart damage'"; \
runOnHover = 1; \
@ -20,59 +20,59 @@ class CfgVehicles {
// @todo localization for all the modules
class ACE_moduleRepairSettings: ACE_Module {
scope = 2;
displayName = "Repair Settings";
displayName = CSTRING(moduleName);
icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); //@todo
category = "ACE";
function = QUOTE(DFUNC(moduleRepairSettings));
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
author = "$STR_ACE_Common_ACETeam";
author = ECSTRING(Common,ACETeam);
class Arguments {
class engineerSetting_Repair {
displayName = "Allow Repair";
description = "Who can use the toolkit to fully repair?";
displayName = CSTRING(enginerSetting_Repair_name);
description = CSTRING(enginerSetting_Repair_description);
typeName = "NUMBER";
class values {
class anyone { name = "Anyone"; value = 0; };
class Engineer { name = "Engineers only"; value = 1; default = 1; };
class Special { name = "Repair Specialists only"; value = 2; };
class anyone { name = CSTRING(engineerSetting_anyone); value = 0; };
class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; default = 1; };
class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; };
};
};
class engineerSetting_Wheel {
displayName = "Allow Wheel";
description = "Who can remove and replace wheels?";
displayName = CSTRING(enginerSetting_Wheel_name);
description = CSTRING(enginerSetting_Wheel_description);
typeName = "NUMBER";
class values {
class anyone { name = "Anyone"; value = 0; default = 1; };
class Engineer { name = "Engineers only"; value = 1; };
class Special { name = "Repair Specialists only"; value = 2; };
class anyone { name = CSTRING(engineerSetting_anyone); value = 0; default = 1; };
class Engineer { name = CSTRING(engineerSetting_EngineerOnly); value = 1; };
class Special { name = CSTRING(engineerSetting_RepairSpecialistOnly); value = 2; };
};
};
class repairDamageThreshold {
displayName = "Repair Threshold";
description = "What is the maximum damage that can be repaired with a toolkit?";
displayName = CSTRING(repairDamageThreshold_name);
description = CSTRING(repairDamageThreshold_description);
typeName = "NUMBER";
defaultValue = 1;
};
class repairDamageThreshold_Engineer {
displayName = "Repair Threshold (Engineer)";
description = "What is the maximum damage that can be repaired by an engineer?";
displayName = CSTRING(repairDamageThreshold_Engineer_name);
description = CSTRING(repairDamageThreshold_Engineer_description);
typeName = "NUMBER";
defaultValue = 1;
};
class consumeItem_ToolKit {
displayName = "Remove toolkit on use";
description = "Should the toolkit be removed on usage?";
displayName = CSTRING(consumeItem_ToolKit_name);
description = CSTRING(consumeItem_ToolKit_description);
typeName = "NUMBER";
class values {
class keep { name = "No"; value = 0; default = 1; };
class remove { name = "Yes"; value = 1; };
class keep { name = ECSTRING(common,No); value = 0; default = 1; };
class remove { name = ECSTRING(common,Yes); value = 1; };
};
};
};
class ModuleDescription {
description = "Provides a repair system for all types of vehicles.";
description = CSTRING(moduleDescription);
sync[] = {};
};
};

View File

@ -1,19 +1,17 @@
/*
* Author: commy2
*
* Called from init eventhandler. Checks if the vehicles class already has the actions initialized. Otherwise add all available repair options.
*
* Arguments:
* 0: vehicle (Object)
* 0: vehicle <OBJECT>
*
* Return Value:
* NONE
*/
#include "script_component.hpp"
private "_vehicle";
_vehicle = _this select 0;
params ["_vehicle"];
TRACE_1("params", _vehicle);
private ["_type", "_initializedClasses"];
@ -43,8 +41,6 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1;
private ["_icon", "_selection"];
_nameRemove = format ["Remove_%1", _x];
_icon = QUOTE(PATHTOF(ui\tire_ca.paa));
_selection = _wheelHitPointSelections select (_wheelHitPoints find _x);
@ -64,7 +60,7 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1;
// replace wheel action
_name = format ["Replace_%1", _x];
_text = localize "STR_ACE_Repair_ReplaceWheel";
_text = localize LSTRING(ReplaceWheel);
_condition = {[_this select 1, _this select 0, _this select 2 select 0] call DFUNC(canReplaceWheel)};
_statement = {[_this select 1, _this select 0, _this select 2 select 0] call DFUNC(replaceWheel)};
@ -88,9 +84,9 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1;
_text = format ["STR_ACE_Repair_%1", _x];
if (isLocalized _text) then {
_text = format [localize "STR_ACE_Repair_RepairHitpoint", localize _text];
_text = format [localize LSTRING(RepairHitpoint), localize _text];
} else {
_text = format [localize "STR_ACE_Repair_RepairHitpoint", _x];
_text = format [localize LSTRING(RepairHitpoint), _x];
};
_icon = "";

View File

@ -1,23 +1,19 @@
/*
* Author: commy2
*
* Check if the unit can remove given wheel of the vehicle.
*
* Arguments:
* 0: Unit that does the repairing (Object)
* 1: vehicle to repair (Object)
* 2: Selected hitpoint (String)
* 0: Unit that does the repairing <OBJECT>
* 1: vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
*
* Return Value:
* NONE
*/
#include "script_component.hpp"
private ["_unit", "_target", "_hitPoint"];
_unit = _this select 0;
_target = _this select 1;
_hitPoint = _this select 2;
params ["_unit", "_target", "_hitPoint"];
TRACE_3("params",_unit,_target,_hitPoint);
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};

View File

@ -16,11 +16,10 @@
#include "script_component.hpp"
private ["_caller", "_target", "_hitPoint", "_className", "_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"];
_caller = _this select 0;
_target = _this select 1;
_hitPoint = _this select 2;
_className = _this select 3;
params ["_caller", "_target", "_hitPoint", "_className"];
TRACE_4("params",_caller,_target,_hitPoint,_className);
private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"];
_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
if !(isClass _config) exitwith {false}; // or go for a default?
@ -86,6 +85,6 @@ _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC
_return = call _return;
};
};
}foreach _locations;
} forEach _locations;
_return && alive _target && {_target getHitPointDamage _hitPoint > ([_unit] call FUNC(getPostRepairDamage))}
_return && alive _target && {(_target getHitPointDamage _hitPoint) > ([_target] call FUNC(getPostRepairDamage))}

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* Check if the unit can replace given wheel of the vehicle.
*
* Arguments:
@ -13,12 +12,8 @@
*/
#include "script_component.hpp"
private ["_unit", "_target", "_hitPoint", "_wheel"];
_unit = _this select 0;
_target = _this select 1;
_hitPoint = _this select 2;
_wheel = ARR_SELECT(_this,3,false);
params ["_unit", "_target", "_hitPoint", ["_wheel",false]];
TRACE_4("params",_unit,_target,_hitPoint,_wheel);
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};

View File

@ -11,12 +11,8 @@
*/
#include "script_component.hpp"
private ["_unit", "_vehicle", "_hitPoint"];
_unit = _this select 0;
_vehicle = _this select 1;
_hitPoint = _this select 2;
params ["_unit", "_vehicle", "_hitPoint"];
TRACE_3("params",_unit,_vehicle,_hitPoint);
// get current hitpoint damage
private "_hitPointDamage";
@ -38,5 +34,5 @@ _wheel setdamage _hitPointDamage;
// display text message if enabled
if (GVAR(DisplayTextOnRepair)) then {
[localize "STR_ACE_Repair_RemovedWheel"] call EFUNC(common,displayTextStructured);
[localize LSTRING(RemovedWheel)] call EFUNC(common,displayTextStructured);
};

View File

@ -1,24 +1,18 @@
/*
* Author: commy2
*
* Called by repair action / progress bar. Raise events to set the new hitpoint damage.
*
* Arguments:
* Stuff from progress bar.
* 0: Stuff from progress bar. <ARRAY>
*
* Return Value:
* NONE
*/
#include "script_component.hpp"
private ["_unit", "_vehicle", "_hitPoint", "_elapsedTime", "_totalTime"];
_unit = _this select 0 select 0;
_vehicle = _this select 0 select 1;
_hitPoint = _this select 0 select 2;
_elapsedTime = _this select 1;
_totalTime = _this select 2;
params ["_args", "_elapsedTime", "_totalTime"];
_args params ["_unit", "_vehicle", "_hitPoint"];
TRACE_5("params",_unit,_vehicle,_hitPoint,_elapsedTime,_totalTime);
// get current hitpoint damage
private "_hitPointDamage";
@ -39,9 +33,9 @@ if (GVAR(DisplayTextOnRepair)) then {
_text = format ["STR_ACE_Repair_%1", _hitPoint];
if (isLocalized _text) then {
_text = format [localize (["STR_ACE_Repair_RepairedHitPointFully", "STR_ACE_Repair_RepairedHitPointPartially"] select (_hitPointDamage > 0)), localize _text];
_text = format [localize ([LSTRING(RepairedHitPointFully), LSTRING(RepairedHitPointPartially)] select (_hitPointDamage > 0)), localize _text];
} else {
_text = localize (["STR_ACE_Repair_RepairedFully", "STR_ACE_Repair_RepairedPartially"] select (_hitPointDamage > 0));
_text = localize ([LSTRING(RepairedFully), LSTRING(RepairedPartially)] select (_hitPointDamage > 0));
};
[_text] call EFUNC(common,displayTextStructured);

View File

@ -1,22 +1,17 @@
/*
* Author: commy2
*
* Called by repair action / progress bar. Raise events to set the new hitpoint damage.
*
* Arguments:
* Stuff from progress bar.
* 0: Stuff from progress bar. <ARRAY>
*
* Return Value:
* NONE
*/
#include "script_component.hpp"
private ["_unit", "_vehicle", "_hitPoint", "_wheel"];
_unit = _this select 0;
_vehicle = _this select 1;
_hitPoint = _this select 2;
_wheel = _this select 3;
params ["_unit", "_vehicle", "_hitPoint", "_wheel"];
TRACE_4("params",_unit,_vehicle,_hitPoint,_wheel);
// get current hitpoint damage
private "_hitPointDamage";
@ -38,5 +33,5 @@ deleteVehicle _wheel;
// display text message if enabled
if (GVAR(DisplayTextOnRepair)) then {
[localize "STR_ACE_Repair_ReplacedWheel"] call EFUNC(common,displayTextStructured);
[LSTRING(ReplacedWheel)] call EFUNC(common,displayTextStructured);
};

View File

@ -1,9 +1,8 @@
// by comm2
#include "script_component.hpp"
private "_unit";
_unit = _this select 0;
params ["_unit"];
TRACE_1("params",_unit);
if ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold_Engineer)};
if ([_unit, GVAR(engineerSetting_Repair)] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold)};

View File

@ -1,19 +1,17 @@
/*
* Author: commy2
*
* Returns the wheel hitpoints and their selections.
*
* Arguments:
* 0: A vehicle (Object)
* 0: A vehicle <Object>
*
* Return Value:
* Wheel positions in model coordinates. (Array)
* Wheel positions in model coordinates. <Array>
*/
#include "script_component.hpp"
private "_vehicle";
_vehicle = _this select 0;
params ["_vehicle"];
TRACE_1("params",_vehicle);
// get the vehicles wheel config
private "_wheels";

View File

@ -12,21 +12,21 @@
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_engineer", "_items", "_return"];
_engineer = _this select 0;
_items = _this select 1;
params ["_engineer", "_items"];
TRACE_2("params",_engineer,_items);
private ["_return"];
_return = true;
{
if (typeName _x == "ARRAY" && {({[_engineer, _x] call EFUNC(common,hasItem)}count _x == 0)}) exitwith {
if (typeName _x == "ARRAY" && {({[_engineer, _x] call EFUNC(common,hasItem)} count _x == 0)}) exitwith {
_return = false;
};
if (typeName _x == "STRING" && {!([_engineer, _x] call EFUNC(common,hasItem))}) exitwith {
_return = false;
};
}foreach _items;
} forEach _items;
_return;

View File

@ -13,13 +13,13 @@
*/
#include "script_component.hpp"
private ["_unit", "_engineerN", "_class"];
params ["_unit", ["_engineerN", 1]];
TRACE_2("params",_unit,_engineerN);
_unit = _this select 0;
_engineerN = if (count _this > 1) then {_this select 1} else {1};
private ["_class"];
_class = _unit getVariable [QGVAR(engineerClass),
getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer")
];
_class >= _engineerN min GVAR(engineerSetting_Repair)
_class >= (_engineerN min GVAR(engineerSetting_Repair))

View File

@ -13,8 +13,11 @@
#include "script_component.hpp"
private ["_object","_position","_objects","_isInBuilding","_repairFacility"];
_object = _this select 0;
params ["_object"];
TRACE_1("params",_object);
private ["_position","_objects","_isInBuilding","_repairFacility"];
_position = getPosASL _object;
_isInBuilding = false;
_repairFacility = [];
@ -24,7 +27,7 @@ _objects = (lineIntersectsWith [_object modelToWorldVisual [0, 0, (_position sel
if (((typeOf _x) in _repairFacility) || (_x getVariable [QGVAR(isRepairFacility),false])) exitwith {
_isInBuilding = true;
};
}foreach _objects;
} forEach _objects;
if (!_isInBuilding) then {
_objects = position _object nearObjects 7.5;
@ -32,6 +35,6 @@ if (!_isInBuilding) then {
if (((typeOf _x) in _repairFacility) || (_x getVariable [QGVAR(isRepairFacility),false])) exitwith {
_isInBuilding = true;
};
}foreach _objects;
} forEach _objects;
};
_isInBuilding;

View File

@ -13,14 +13,16 @@
#include "script_component.hpp"
private ["_unit", "_vehicle"];
params ["_unit"];
TRACE_1("params",_unit);
private ["_nearObjects", "_return"];
_unit = _this select 0;
_nearObjects = nearestObjects [_unit, ["Air","LandVehicle"], 20];
_return = false;
{
if ([_x] call FUNC(isRepairVehicle)) exitwith {_return = true;};
}foreach _nearObjects;
} forEach _nearObjects;
_return;

View File

@ -12,8 +12,8 @@
*/
#include "script_component.hpp"
private ["_vehicle"];
_vehicle = _this select 0;
params ["_vehicle"];
TRACE_1("params",_vehicle);
if (_vehicle isKindOf "CAManBase") exitwith {false};

View File

@ -4,8 +4,6 @@
*
* Arguments:
* 0: The module logic <LOGIC>
* 1: units <ARRAY>
* 2: activated <BOOL>
*
* Return Value:
* None <NIL>
@ -14,16 +12,14 @@
*/
#include "script_component.hpp"
private ["_logic", "_units", "_activated"];
params ["_logic"];
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
if !(_activated) exitWith {};
if (!isServer) exitWith {};
[_logic, QGVAR(engineerSetting_Repair), "engineerSetting_Repair"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(engineerSetting_Wheel), "engineerSetting_Wheel"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(consumeItem_ToolKit), "consumeItem_ToolKit"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(repairDamageThreshold), "repairDamageThreshold"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(repairDamageThreshold_Engineer), "repairDamageThreshold_Engineer"] call EFUNC(common,readSettingFromModule);
diag_log text "[ACE]: Repair Module Initialized.";

View File

@ -1,19 +1,17 @@
/*
* Author: commy2
*
* Used to normalize dependant hitpoints. May overwrite some global variables that are named like hitpoints or "Total" though...
*
* Arguments:
* 0: A local vehicle with hitpoints. (Object)
* 0: A local vehicle with hitpoints. <OBJECT>
*
* Return Value:
* NONE
*/
#include "script_component.hpp"
private "_vehicle";
_vehicle = _this select 0;
params ["_vehicle"];
TRACE_1("params",_vehicle);
// can't execute all commands if the vehicle isn't local. exit here.
if !(local _vehicle) exitWith {};

View File

@ -13,11 +13,8 @@
*/
#include "script_component.hpp"
private ["_unit", "_vehicle", "_hitPoint"];
_unit = _this select 0;
_vehicle = _this select 1;
_hitPoint = _this select 2;
params ["_caller", "_vehicle", "_hitPoint"];
TRACE_3("params",_caller,_vehicle,_hitPoint);
// exit if not a valid hitpoint
if !(_hitPoint in ([_vehicle] call EFUNC(common,getHitPoints))) exitWith {};
@ -27,9 +24,9 @@ private "_time";
_time = 10;
// open the loading bar
[_time, [_unit, _vehicle, _hitPoint], {(_this select 0) call DFUNC(doRemoveWheel)}, {[localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_RemovingWheel", {(_this select 0) call DFUNC(canRemoveWheel)}, []] call EFUNC(common,progressBar);
[_time, [_caller, _vehicle, _hitPoint], {(_this select 0) call DFUNC(doRemoveWheel)}, {[localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_RemovingWheel", {(_this select 0) call DFUNC(canRemoveWheel)}, []] call EFUNC(common,progressBar);
// do animation
[_unit] call EFUNC(common,goKneeling);
[_caller] call EFUNC(common,goKneeling);
// @todo play sound

View File

@ -16,11 +16,10 @@
#include "script_component.hpp"
private ["_caller", "_target", "_hitPoint", "_className", "_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"];
_caller = _this select 0;
_target = _this select 1;
_hitPoint = _this select 2;
_className = _this select 3;
params ["_caller", "_target", "_hitPoint", "_className"];
TRACE_4("params",_calller,_target,_hitPoint,_className);
private ["_config", "_engineerRequired", "_items", "_locations", "_return", "_condition", "_vehicleStateCondition"];
_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);
if !(isClass _config) exitwith {false}; // or go for a default?
@ -86,7 +85,7 @@ _repairVeh = {([_caller] call FUNC(isNearRepairVehicle)) || ([_target] call FUNC
_return = call _return;
};
};
}foreach _locations;
} forEach _locations;
if !(_return && alive _target && {_target getHitPointDamage _hitPoint > ([_unit] call FUNC(getPostRepairDamage))}) exitwith {false};

View File

@ -13,11 +13,8 @@
*/
#include "script_component.hpp"
private ["_unit", "_vehicle", "_hitPoint"];
_unit = _this select 0;
_vehicle = _this select 1;
_hitPoint = _this select 2;
params ["_unit", "_vehicle", "_hitPoint"];
TRACE_3("params",_unit,_vehicle,_hitPoint);
// exit if not a valid hitpoint
if !(_hitPoint in ([_vehicle] call EFUNC(common,getHitPoints))) exitWith {};
@ -34,9 +31,9 @@ private "_text";
_text = format ["STR_ACE_Repair_%1", _hitPoint];
if (isLocalized _text) then {
_text = format [localize "STR_ACE_Repair_RepairingHitPoint", localize _text];
_text = format [localize LSTRING(RepairingHitPoint), localize _text];
} else {
_text = localize "STR_ACE_Repair_Repairing";
_text = localize LSTRING(Repairing);
};
// open the loading bar

View File

@ -14,17 +14,13 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_usersOfItems", "_weaponSelect"];
params ["_args"];
_args params ["_caller", "_target","_selectionName","_className","","_usersOfItems"];
TRACE_5("params",_caller,_target,_selectionName,_className,_usersOfItems);
_args = _this select 0;
_caller = _args select 0;
_target = _args select 1;
_selectionName = _args select 2;
_className = _args select 3;
_usersOfItems = _args select 5;
private ["_config","_callback", "_usersOfItems", "_weaponSelect"];
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon";
@ -43,7 +39,7 @@ if (_weaponSelect != "") then {
{
(_x select 0) addItem (_x select 1);
}foreach _usersOfItems;
} forEach _usersOfItems;
// Record specific callback
_config = (ConfigFile >> "ACE_Repair" >> "Actions" >> _className);

View File

@ -17,12 +17,11 @@
#include "script_component.hpp"
private ["_args", "_caller", "_target","_selectionName","_className","_config","_callback", "_weaponSelect"];
_args = _this select 0;
_caller = _args select 0;
_target = _args select 1;
_selectionName = _args select 2;
_className = _args select 3;
params ["_args"];
_args params ["_caller", "_target","_selectionName","_className"];
TRACE_4("params",_caller,_target,_selectionName,_className);
private ["_config","_callback", "_weaponSelect"];
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon";

View File

@ -4,20 +4,17 @@
* Start a replace wheel action and open progress bar.
*
* Arguments:
* 0: Unit that does the repairing (Object)
* 1: vehicle to repair (Object)
* 2: Selected hitpoint (String)
* 0: Unit that does the repairing <OBJECT>
* 1: vehicle to repair <OBJECT>
* 2: Selected hitpoint <STRING>
*
* Return Value:
* NONE
*/
#include "script_component.hpp"
private ["_unit", "_vehicle", "_hitPoint"];
_unit = _this select 0;
_vehicle = _this select 1;
_hitPoint = _this select 2;
params ["_unit", "_vehicle", "_hitPoint"];
TRACE_3("params",_unit,_vehicle,_hitPoint);
// exit if not a valid hitpoint
if !(_hitPoint in ([_vehicle] call EFUNC(common,getHitPoints))) exitWith {};
@ -41,7 +38,7 @@ private "_time";
_time = 10;
// open the loading bar
[_time, [_unit, _vehicle, _hitPoint, _wheel], {(_this select 0) call DFUNC(doReplaceWheel)}, {[objNull, _this select 0 select 3] call DEFUNC(common,claim); [localize "STR_ACE_Common_ActionAborted"] call EFUNC(common,displayTextStructured);}, localize "STR_ACE_Repair_ReplacingWheel", {(_this select 0) call DFUNC(canReplaceWheel)}, []] call EFUNC(common,progressBar);
[_time, [_unit, _vehicle, _hitPoint, _wheel], {(_this select 0) call DFUNC(doReplaceWheel)}, {[objNull, _this select 0 select 3] call DEFUNC(common,claim); [localize ELSTRING(common,ActionAborted)] call EFUNC(common,displayTextStructured);}, localize LSTRING(ReplacingWheel), {(_this select 0) call DFUNC(canReplaceWheel)}, []] call EFUNC(common,progressBar);
// do animation
[_unit] call EFUNC(common,goKneeling);

View File

@ -1,21 +1,18 @@
/*
* Author: commy2
*
* Sets the structural damage of a vehicle without altering the hitPoints. Requires local vehicle.
*
* Arguments:
* 0: vehicle to damage (Object)
* 1: Total damage (Number)
* 0: vehicle to damage <OBJECT>
* 1: Total damage <NUMBER>
*
* Return Value:
* NONE
*/
#include "script_component.hpp"
private ["_vehicle", "_damage"];
_vehicle = _this select 0;
_damage = _this select 1;
params ["_vehicle", "_damage"];
TRACE_2("params",_vehicle,_damage);
// can't execute all commands if the vehicle isn't local. exit here.
if !(local _vehicle) exitWith {};

View File

@ -1,6 +1,5 @@
/*
* Author: commy2
*
* Set the hitpoint damage and change the structural damage acordingly. Requires local vehicle.
*
* Arguments:
@ -13,11 +12,8 @@
*/
#include "script_component.hpp"
private ["_vehicle", "_hitPoint", "_hitPointDamage"];
_vehicle = _this select 0;
_hitPoint = _this select 1;
_hitPointDamage = _this select 2;
params ["_vehicle", "_hitPoint", "_hitPointDamage"];
TRACE_3("params",_vehicle,_hitPoint,_hitPointDamage);
// can't execute all commands if the vehicle isn't local. exit here.
if !(local _vehicle) exitWith {};

View File

@ -1,13 +1,8 @@
// by commy2
#include "script_component.hpp"
private ["_item", "_position", "_damage"];
_item = _this select 0;
_position = _this select 1;
_damage = _this select 2;
if (isNil "_damage") then {_damage = 0};
params ["_item", "_position", ["_damage", 0]];
TRACE_3("params",_item,_position,_damage);
// randomized end position
_position = _position vectorAdd [1 - random 2, 1 - random 2, 0];

View File

@ -14,9 +14,8 @@
#include "script_component.hpp"
private ["_engineer", "_item", "_return","_crew"];
_engineer = _this select 0;
_item = _this select 1;
params ["_engineer", "_item"];
TRACE_2("params",_engineer,_item);
if ([_engineer, _item] call EFUNC(common,hasItem)) exitwith {
[[_engineer, _item], QUOTE(EFUNC(common,useItem)), _engineer] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */

View File

@ -4,7 +4,7 @@
*
* Arguments:
* 0: Engineer <OBJECT>
* 2: Items <ARRAY<STRING>>
* 1: Items <ARRAY<STRING>>
*
* ReturnValue:
* <NIL>
@ -14,9 +14,10 @@
#include "script_component.hpp"
private ["_engineer", "_patient", "_items", "_itemUsedInfo", "_itemsUsedBy"];
_engineer = _this select 0;
_items = _this select 1;
params ["_engineer", "_items"];
TRACE_2("params",_engineer,_items);
private ["_itemUsedInfo", "_itemsUsedBy"];
_itemsUsedBy = [];
{
@ -25,7 +26,7 @@ _itemsUsedBy = [];
{
_itemUsedInfo = [_engineer, _x] call FUNC(useItem);
if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]};
}foreach _x;
} forEach _x;
};
// handle required item
@ -33,6 +34,6 @@ _itemsUsedBy = [];
_itemUsedInfo = [_engineer, _x] call FUNC(useItem);
if (_itemUsedInfo select 0) exitwith { _itemsUsedBy pushback [(_itemUsedInfo select 1), _x]};
};
}foreach _items;
} forEach _items;
[count _items == count _itemsUsedBy, _itemsUsedBy];

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">
@ -26,7 +26,6 @@
<Hungarian>Pótkerék</Hungarian>
<Russian>Запасное колесо</Russian>
</Key>
<Key ID="STR_ACE_Repair_ReplaceWheel">
<English>Change Wheel</English>
<German>Reifen wechseln</German>
@ -67,7 +66,6 @@
<English>Wheel removed</English>
<German>Reifen entfernt</German>
</Key>
<Key ID="STR_ACE_Repair_RepairHitpoint">
<English>Repair %1</English>
<German>Reparieren %1</German>
@ -92,14 +90,12 @@
<Hungarian>Szerelés &gt;&gt;</Hungarian>
<Russian>Ремонт &gt;&gt;</Russian>
</Key>
<Key ID="STR_ACE_Repair_SettingDisplayTextName">
<English>Display text on repair</English>
</Key>
<Key ID="STR_ACE_Repair_SettingDisplayTextDesc">
<English>Display a notification whenever you repair a vehicle</English>
</Key>
<Key ID="STR_ACE_Repair_Repairing">
<English>Repairing ...</English>
<German>Reparieren ...</German>
@ -136,7 +132,6 @@
<Hungarian>%1 megjavítva</Hungarian>
<Russian>%1 отремонтирован</Russian>
</Key>
<Key ID="STR_ACE_Repair_RepairedFully">
<English>Fully repaired part</English>
<German>Bauteil vollständig repariert</German>
@ -153,7 +148,6 @@
<English>Partially repaired %1</English>
<German>%1 teilweise repariert</German>
</Key>
<Key ID="STR_ACE_Repair_HitBody">
<English>Body</English>
<German>Karosserie</German>
@ -482,5 +476,50 @@
<Hungarian>Üveg 6</Hungarian>
<Russian>Стекло 6</Russian>
</Key>
<Key ID="STR_ACE_Repair_moduleName">
<English>Repair Settings</English>
</Key>
<Key ID="STR_ACE_Repair_moduleDescription">
<English>Provides a repair system for all types of vehicles.</English>
</Key>
<Key ID="STR_ACE_Repair_engineerSetting_anyone">
<English>Anyone</English>
</Key>
<Key ID="STR_ACE_Repair_engineerSetting_EngineerOnly">
<English>Engineer only</English>
</Key>
<Key ID="STR_ACE_Repair_engineerSetting_RepairSpecialistOnly">
<English>Repair Specialist only</English>
</Key>
<Key ID="STR_ACE_Repair_enginerSetting_Wheel_name">
<English>Allow Wheel</English>
</Key>
<Key ID="STR_ACE_Repair_enginerSetting_Wheel_description">
<English>Who can remove and replace wheels?</English>
</Key>
<Key ID="STR_ACE_Repair_enginerSetting_Repair_name">
<English>Allow Repair</English>
</Key>
<Key ID="STR_ACE_Repair_enginerSetting_Repair_description">
<English>Who can use the toolkit to fully repair?</English>
</Key>
<Key ID="STR_ACE_Repair_repairDamageThreshold_name">
<English>Repair Threshold</English>
</Key>
<Key ID="STR_ACE_Repair_repairDamageThreshold_description">
<English>What is the maximum damage that can be repaired with a toolkit?</English>
</Key>
<Key ID="STR_ACE_Repair_repairDamageThreshold_Engineer_name">
<English>Repair Threshold (Engineer)</English>
</Key>
<Key ID="STR_ACE_Repair_repairDamageThreshold_Engineer_description">
<English>What is the maximum damage that can be repaired by an engineer?</English>
</Key>
<Key ID="STR_ACE_Repair_consumeItem_ToolKit_name">
<English>Remove toolkit on use</English>
</Key>
<Key ID="STR_ACE_Repair_consumeItem_ToolKit_description">
<English>Should the toolkit be removed on usage?</English>
</Key>
</Package>
</Project>
</Project>