remove phone and add crypto to player body.

now uses dynamic action menu for take option on dead player bodies.
This commit is contained in:
vbawol 2016-08-08 12:12:20 -05:00
parent e69e47185a
commit 4ea5404cd5
6 changed files with 18 additions and 7 deletions

View File

@ -2,8 +2,8 @@ private["_getCrypto"];
if !(isNil "EPOCH_takeCryptoLock") exitWith {};
EPOCH_takeCryptoLock = true;
if (!isNull _this) then {
if ((typeof _this) == "Land_MPS_EPOCH") then {
_getCrypto = _this getVariable["Crypto", 0];
_getCrypto = _this getVariable["Crypto", 0];
if (_getCrypto > 0) then {
[player, Epoch_personalToken, _this] remoteExec ["EPOCH_server_takeCrypto",2];
[format["You found %1 Krypto.", _getCrypto], 5] call Epoch_message;
};

View File

@ -28,6 +28,7 @@ class CfgActionMenu
dyna_isVehicle = "if (!(isNull dyna_cursorTarget) && alive dyna_cursorTarget) then {((dyna_cursorTarget isKindOf 'LandVehicle') || (dyna_cursorTarget isKindOf 'Air') || (dyna_cursorTarget isKindOf 'Ship') || (dyna_cursorTarget isKindOf 'Tank'))} else {false}";
dyna_isTrader = "if (!(isNull dyna_cursorTarget) && alive dyna_cursorTarget) then {((dyna_cursorTarget isKindOf 'Man') && (dyna_cursorTarget != player) && (!isPlayer dyna_cursorTarget) && ((dyna_cursorTarget getVariable['AI_SLOT', -1]) != -1))} else {false}";
dyna_isPlayer = "if (!(isNull dyna_cursorTarget) && alive dyna_cursorTarget) then {((dyna_cursorTarget isKindOf 'Man') && (dyna_cursorTarget != player) && (isPlayer dyna_cursorTarget))} else {false}";
dyna_isDeadPlayer = "if (!(isNull dyna_cursorTarget) && !(alive dyna_cursorTarget)) then {((dyna_cursorTarget isKindOf 'Man') && (dyna_cursorTarget != player))} else {false}";
dyna_canAcceptTrade = "if (!(isNull EPOCH_pendingP2ptradeTarget) && alive EPOCH_pendingP2ptradeTarget) then {((EPOCH_pendingP2ptradeTarget isKindOf 'Man') && (dyna_cursorTarget isEqualTo EPOCH_pendingP2ptradeTarget))} else {false}";
dyna_locked = "locked dyna_cursorTarget in [2,3]";
dyna_lockedInVehicle = "locked vehicle player in [2,3]";

View File

@ -77,6 +77,13 @@ class tra_shop
tooltip = "Shop";
};
class player_takeCrypto
{
condition = "dyna_isDeadPlayer && (dyna_cursorTarget getVariable ['Crypto',0]) > 0";
action = "dyna_cursorTarget call EPOCH_takeCrypto;";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\krypto.paa";
tooltip = "Take Krypto";
};
class player_trade
{
condition = "dyna_isPlayer";

View File

@ -45,9 +45,8 @@ _vars = _playerObj getVariable["VARS", _defaultVars];
_current_crypto = _vars select _cIndex;
if (_current_crypto > 0) then{
_veh = createVehicle["Land_MPS_EPOCH", _pos, [], 1.5, "NONE"];
diag_log format["Epoch: ADMIN: Created crypto device for %1 with %2 at %3", getPlayerUID _playerObj, _current_crypto, _pos];
_veh setVariable["Crypto", _current_crypto, true];
_playerObj setVariable["Crypto", _current_crypto, true];
diag_log format["Epoch: ADMIN: Crypto added to dead body for %1 with %2 at %3", getPlayerUID _playerObj, _current_crypto, _pos];
};
[_playerObj, _defaultVars] call EPOCH_server_savePlayer;

View File

@ -22,7 +22,8 @@ if (_player distance _object > 10) exitWith {};
_getCrypto = _object getVariable["Crypto", 0];
if (_getCrypto > 0) then {
deleteVehicle _object;
// remove crypto from object
_object setVariable["Crypto", nil, true];
// get vars array and current Crypto value
_cIndex = EPOCH_customVars find "Crypto";
@ -36,4 +37,7 @@ if (_getCrypto > 0) then {
_current_crypto remoteExec ['EPOCH_effectCrypto',_player];
_vars set[_cIndex, _current_crypto];
_player setVariable["VARS", _vars];
// debug and logging.
diag_log format["Epoch: ADMIN: %1 picked up %2 Crypto from object %3 with puid %4 at %5", getPlayerUID _player, _current_crypto, [_object, typeOf _object],_object getVariable['PUID', ''],getposATL _object];
};

View File

@ -231,7 +231,7 @@ class FSM
"" \n
"// TODO need better way allMissionObjects is not performant" \n
"if (_cleanupItems isEqualTo []) then {" \n
" _cleanupItems = allMissionObjects ""groundWeaponHolder"" + entities ""Land_MPS_EPOCH"" + entities ""WeaponHolderSimulated"";" \n
" _cleanupItems = allMissionObjects ""groundWeaponHolder"" + entities ""WeaponHolderSimulated"";" \n
"};"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/