Improve some Code

This commit is contained in:
jokoho48 2015-08-29 15:29:02 +02:00
parent 6796b3126d
commit 8916b70fe1
7 changed files with 28 additions and 34 deletions

View File

@ -18,7 +18,7 @@ private "_vehicle";
params ["_caller", "_target"];
if ([_target] call EFUNC(common,isAwake)) exitwith {
["displayTextStructured", [_caller], [[localize LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent);
["displayTextStructured", [_caller], [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent);
};
if ([_target] call FUNC(isBeingCarried)) then {
[_caller, _target] call EFUNC(dragging,dropObject_carry);

View File

@ -24,7 +24,7 @@ _tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
// Check if there is a tourniquet on this bodypart
if ((_tourniquets select _part) == 0) exitwith {
_output = localize LSTRING(noTourniquetOnBodyPart);
_output = LSTRING(noTourniquetOnBodyPart);
["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent);
};

View File

@ -25,11 +25,8 @@ if (!local _unit) exitwith {
date params ["", "", "", "_minute", "_hour"];
_moment = if (_minute < 10) then {
format["%1:0%2", _hour, _minute]
} else {
format["%1:%2", _hour, _minute]
};
_moment = format [ (["%1:%2", "%1:0%2"] select (_minute < 10)), _hour, _minute]
_logVarName = format[QGVAR(logFile_%1), _type];
_log = _unit getvariable [_logVarName, []];

View File

@ -22,11 +22,8 @@ params ["_caller", "_target", "_selectionName", "_className"];
if !(_target isKindOf "CAManBase") exitWith { false };
_config = if (GVAR(level)>=2) then {
(ConfigFile >> "ACE_Medical_Actions" >> "Advanced" >> _className)
} else {
(ConfigFile >> "ACE_Medical_Actions" >> "Basic" >> _className)
};
_config = (ConfigFile >> "ACE_Medical_Actions" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className);
if !(isClass _config) exitwith {false};
_medicRequired = if (isNumber (_config >> "requiredMedic")) then {

View File

@ -21,8 +21,8 @@ if (GVAR(level) < 2) exitWith {};
private ["_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"];
params ["_target", ["_show", true], ["_selectionN", 0]];
GVAR(currentSelectedSelectionN) = if (typeName _selectionN == "SCALAR") then {_selectionN} else {0};
GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull};
GVAR(currentSelectedSelectionN) = [0, _selectionN] select (IS_SCALAR(_selectionN));
GVAR(displayPatientInformationTarget) = [ObjNull, _target] select _show;
if (USE_WOUND_EVENT_SYNC) then {
[_target, ACE_player] call FUNC(requestWoundSync);

View File

@ -15,17 +15,16 @@
params ["_typeOfProjectile"];
call {
if (_typeOfProjectile isKindOf "BulletBase") exitWith {"bullet"};
if (_typeOfProjectile isKindOf "GrenadeCore") exitWith {"grenade"};
if (_typeOfProjectile isKindOf "TimeBombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "MineCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "FuelExplosion") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "ShellBase") exitWith {"shell"};
if (_typeOfProjectile isKindOf "RocketBase") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "MissileBase") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "LaserBombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "BombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "Grenade") exitWith {"grenade"};
toLower _typeOfProjectile
}
if (_typeOfProjectile isKindOf "BulletBase") exitWith {"bullet"};
if (_typeOfProjectile isKindOf "GrenadeCore") exitWith {"grenade"};
if (_typeOfProjectile isKindOf "TimeBombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "MineCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "FuelExplosion") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "ShellBase") exitWith {"shell"};
if (_typeOfProjectile isKindOf "RocketBase") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "MissileBase") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "LaserBombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "BombCore") exitWith {"explosive"};
if (_typeOfProjectile isKindOf "Grenade") exitWith {"grenade"};
toLower _typeOfProjectile

View File

@ -32,11 +32,11 @@ if !(_selection in (GVAR(SELECTIONS) + [""])) exitWith {0};
// Exit if we disable damage temporarily
if !(_unit getVariable [QGVAR(allowDamage), true]) exitWith {
_damageOld = damage _unit;
if (_selection in GVAR(SELECTIONS)) then {
_damageOld = _unit getHit _selection;
_unit getHit _selection
} else {
damage _unit
};
_damageOld;
};
// Get return damage
@ -47,9 +47,10 @@ _newDamage = _this call FUNC(handleDamage_caching);
_typeOfDamage = [_projectile] call FUNC(getTypeOfDamage);
_typeIndex = (GVAR(allAvailableDamageTypes) find _typeOfDamage);
_minLethalDamage = 0.01;
if (_typeIndex >= 0) then {
_minLethalDamage = GVAR(minLethalDamages) select _typeIndex;
_minLethalDamage = if (_typeIndex >= 0) then {
GVAR(minLethalDamages) select _typeIndex
} else {
0.01
};
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then {