forked from KoffeinFlummi/AGM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
commy2
committed
Nov 8, 2014
1 parent
34be078
commit d6a8f84
Showing
10 changed files
with
147 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// PATCH CONFIG | ||
class CfgPatches { | ||
class AGM_SafeMode { | ||
units[] = {}; | ||
weapons[] = {}; | ||
requiredVersion = 0.60; | ||
requiredAddons[] = {AGM_Core}; | ||
version = "0.94.1"; | ||
versionStr = "0.94.1"; | ||
versionAr[] = {0,94,1}; | ||
author[] = {"commy2"}; | ||
authorUrl = "https://github.com/commy2/"; | ||
}; | ||
}; | ||
|
||
class CfgFunctions { | ||
class AGM_SafeMode { | ||
class AGM_SafeMode { | ||
file = "AGM_SafeMode\functions"; | ||
class firstMode; | ||
class lockSafety; | ||
class unlockSafety; | ||
}; | ||
}; | ||
}; | ||
|
||
class AGM_Core_Default_Keys { | ||
class safeWeapon { | ||
displayName = "$STR_AGM_SafeMode_SafeMode"; | ||
condition = "[_player] call AGM_Core_fnc_canUseWeapon"; | ||
statement = "[_player, currentWeapon _player] call AGM_SafeMode_fnc_lockSafety"; | ||
exceptions[] = {"AGM_Interaction_isNotEscorting"}; | ||
key = 41; | ||
shift = 0; | ||
control = 1; | ||
alt = 0; | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// by commy2 | ||
|
||
private ["_weapon", "_mode"]; | ||
|
||
_weapon = _this select 0; | ||
|
||
_mode = getArray (configFile >> "CfgWeapons" >> _weapon >> "modes") select 0; | ||
|
||
[_mode, _weapon] select (_mode == "this") |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// by commy2 | ||
|
||
private ["_unit", "_weapon", "_safedWeapons"]; | ||
|
||
_unit = _this select 0; | ||
_weapon = _this select 1; | ||
|
||
_safedWeapons = _unit getVariable ["AGM_SafeMode_safedWeapons", []]; | ||
|
||
if (_weapon in _safedWeapons) exitWith { | ||
_this call AGM_SafeMode_fnc_unlockSafety; | ||
}; | ||
|
||
_safedWeapons pushBack _weapon; | ||
|
||
_unit setVariable ["AGM_SafeMode_safedWeapons", _safedWeapons]; | ||
|
||
if (_unit getVariable ["AGM_SafeWeaponActionIDs", [-1, -1]] select 0 == -1) then { | ||
private ["_condition", "_statement", "_actionIDs"]; | ||
|
||
_condition = { | ||
_this select 1 == vehicle (_this select 1) | ||
&& {currentMuzzle (_this select 1) in ((_this select 1) getVariable ["AGM_SafeMode_safedWeapons", []])} | ||
}; | ||
|
||
_statement = { | ||
[_this select 1, currentWeapon (_this select 1)] call AGM_SafeMode_fnc_unlockSafety; | ||
}; | ||
|
||
_actionIDs = [ | ||
[_unit, "DefaultAction", _condition, {}] call AGM_Core_fnc_addActionEventHandler, | ||
[_unit, "nextWeapon", {true}, _statement] call AGM_Core_fnc_addActionEventHandler | ||
]; | ||
|
||
_unit setVariable ["AGM_SafeWeaponActionIDs", _actionIDs]; | ||
}; | ||
|
||
_unit selectWeapon _weapon; | ||
|
||
playSound "AGM_Sound_Click"; |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// by commy2 | ||
|
||
private ["_unit", "_weapon", "_safedWeapons"]; | ||
|
||
_unit = _this select 0; | ||
_weapon = _this select 1; | ||
|
||
_safedWeapons = _unit getVariable ["AGM_SafeMode_safedWeapons", []]; | ||
|
||
if (_weapon in _safedWeapons) then { | ||
_safedWeapons = _safedWeapons - [_weapon]; | ||
|
||
_unit setVariable ["AGM_SafeMode_safedWeapons", _safedWeapons]; | ||
|
||
if (count _safedWeapons == 0) then { | ||
private "_actionIDs"; | ||
|
||
_actionIDs = _unit getVariable ["AGM_SafeWeaponActionIDs", [-1, -1]]; | ||
//_unit removeAction _actionID; | ||
[_unit, "DefaultAction", _actionIDs select 0] call AGM_Core_fnc_removeActionEventHandler; | ||
[_unit, "nextWeapon", _actionIDs select 1] call AGM_Core_fnc_removeActionEventHandler; | ||
_unit setVariable ["AGM_SafeWeaponActionIDs", [-1, -1]]; | ||
}; | ||
}; | ||
|
||
_unit selectWeapon _weapon; | ||
|
||
playSound "AGM_Sound_Click"; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project name="AGM"> | ||
<Package name="SafeMode"> | ||
<Key ID="STR_AGM_SafeMode_SafeMode"> | ||
<English>Safe Mode</English> | ||
<German>Waffe sichern</German> | ||
</Key> | ||
</Package> | ||
</Project> |
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