-
Notifications
You must be signed in to change notification settings - Fork 737
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add enable setting * Optimize eden expressions Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * Add debug * Update addons/repair/functions/fnc_addRepairActions.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Fix strange indent * Optimize bool to number conversion Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Prevent run before setting is ready * Move postInit to EH * remove all transportRepair = 0 * remove requiredAddons --------- Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> Co-authored-by: LinkIsGrim <salluci.lovi@gmail.com>
- Loading branch information
1 parent
7ef9d19
commit 14e92df
Showing
17 changed files
with
127 additions
and
195 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,86 @@ | ||
#include "script_component.hpp" | ||
|
||
[QGVAR(setVehicleDamage), {_this call FUNC(setDamage)}] call CBA_fnc_addEventHandler; | ||
[QGVAR(setVehicleHitPointDamage), {_this call FUNC(setHitPointDamage)}] call CBA_fnc_addEventHandler; | ||
["CBA_settingsInitialized", { | ||
|
||
// wheels | ||
[QGVAR(setWheelHitPointDamage), { | ||
params ["_object", "_hitPoint", "_damage"]; | ||
private _damageDisabled = !isDamageAllowed _object; | ||
if !GVAR(enabled) exitWith {}; | ||
|
||
if (_damageDisabled) then { | ||
_object allowDamage true; | ||
}; | ||
[QGVAR(setVehicleDamage), {_this call FUNC(setDamage)}] call CBA_fnc_addEventHandler; | ||
[QGVAR(setVehicleHitPointDamage), {_this call FUNC(setHitPointDamage)}] call CBA_fnc_addEventHandler; | ||
[QGVAR(setWheelHitPointDamage), { | ||
params ["_object", "_hitPoint", "_damage"]; | ||
private _damageDisabled = !isDamageAllowed _object; | ||
|
||
if (_damageDisabled) then { | ||
_object allowDamage true; | ||
}; | ||
|
||
_object setHitPointDamage [_hitPoint, _damage]; | ||
|
||
if (_damageDisabled) then { | ||
_object allowDamage false; | ||
}; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
|
||
// placed in editor static objects don't trigger init | ||
{ | ||
if (local _x && {getRepairCargo _x > 0}) then { | ||
_x setRepairCargo 0; | ||
TRACE_3("setRepairCargo static",_x,typeOf _x,getRepairCargo _x); | ||
}; | ||
} forEach allMissionObjects "Static"; | ||
|
||
["All", "InitPost", { | ||
params ["_vehicle"]; | ||
if !(local _vehicle && {getRepairCargo _vehicle > 0}) exitWith {}; | ||
_vehicle setRepairCargo 0; | ||
TRACE_3("setRepairCargo vehicle",_vehicle,typeOf _vehicle,getRepairCargo _vehicle); | ||
}, true, ["Man"], true] call CBA_fnc_addClassEventHandler; | ||
|
||
["CAManBase", "InitPost", { | ||
params ["_unit"]; | ||
if !(local _unit && {_unit getUnitTrait "engineer"}) exitWith {}; | ||
_unit setUnitTrait ["engineer", false]; | ||
if (_unit getVariable ["ACE_IsEngineer", -1] isEqualTo -1) then { | ||
_unit setVariable ["ACE_IsEngineer", true, true]; | ||
}; | ||
TRACE_3("setUnitTrait",_unit,typeOf _unit,_unit getUnitTrait "engineer"); | ||
}, true, [], true] call CBA_fnc_addClassEventHandler; | ||
|
||
_object setHitPointDamage [_hitPoint, _damage]; | ||
|
||
if (_damageDisabled) then { | ||
_object allowDamage false; | ||
GVAR(allToolKits) = call (uiNamespace getVariable QGVAR(allToolKits)); | ||
|
||
["ACE_RepairItem_Base", "killed", { | ||
params ["_object"]; | ||
|
||
[{deleteVehicle _this}, _object, 5] call CBA_fnc_waitAndExecute; | ||
}, true, [], true] call CBA_fnc_addClassEventHandler; | ||
|
||
// load tracks and wheels | ||
if (isServer) then { | ||
private _fnc_addSpareItems = { | ||
if (!GVAR(addSpareParts)) exitWith {}; | ||
params ["_vehicle"]; | ||
|
||
private _spareTracks = _vehicle getVariable QGVAR(editorLoadedTracks); | ||
if (isNil "_spareTracks") then { | ||
_spareTracks = parseNumber (_vehicle isKindOf "Tank"); // must match eden attribute default | ||
}; | ||
if (_spareTracks > 0) then { | ||
[_vehicle, _spareTracks, "ACE_Track"] call FUNC(addSpareParts); | ||
}; | ||
|
||
private _spareWheels = _vehicle getVariable QGVAR(editorLoadedWheels); | ||
if (isNil "_spareWheels") then { | ||
_spareWheels = parseNumber (_vehicle isKindOf "Car"); // must match eden attribute default | ||
}; | ||
if (_spareWheels > 0) then { | ||
[_vehicle, _spareWheels, "ACE_Wheel"] call FUNC(addSpareParts); | ||
}; | ||
}; | ||
|
||
["Tank", "initPost", _fnc_addSpareItems, true, [], true] call CBA_fnc_addClassEventHandler; | ||
["Car", "initPost", _fnc_addSpareItems, true, [], true] call CBA_fnc_addClassEventHandler; | ||
}; | ||
|
||
}] call CBA_fnc_addEventHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.